You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice, if for every msg a constructor would be generated, that takes all msg members as arguments.
There would be some positive effects from this:
Compile time check if msg was modified
Makes it harder to 'forget' to initialize a member
Enforces RVO
Implementation considerations
Would slightly raise compile times
Default constructors must stay for compability
The text was updated successfully, but these errors were encountered:
FYI, see this old discussion on the topic: #749
The purpose was different though.
In that case, we wanted to avoid to pay the cost for a default initialization.
The solution we discussed in that case was based on the use of aggregate initialization with designated initializers, which requires C++ 20 (currently ROS uses C++ 17).
@clalancette My college had a good point to add to the discussion: Using constructors with arguments is 'The C++ way' of initializing objects. Not supporting it is kind of odd.
I do not have any objections for this feature. I do not quite follow the discussion during today's PMC meeting, what could be the downside of this feature?
Feature request
Feature description
It would be nice, if for every msg a constructor would be generated, that takes all msg members as arguments.
There would be some positive effects from this:
Implementation considerations
Would slightly raise compile times
Default constructors must stay for compability
The text was updated successfully, but these errors were encountered: