# Revision history [back]

### Are c++ message types and their members Plain Old Data?

In the c++ api, I would like to do the following operations on (custom) message type MyMsg:

• assignment: my_msg = other_msg;
• copy-construction: MyMsg my_msg(other_msg);
• swapping: std::swap(msg1, msg2);

Are all of these safe? By the fact that the ROS' own generated code for messages sometimes puts messages in std::vectors, I'm thinking they are, but I wanted to make sure.

### Are c++ How safe is it to directly modify message types and their members Plain Old Data?member vectors in c++?

In the c++ api, I would like to do the following operations on (custom) have a custom message type MyMsg:class A that contains vectors (of other message classes, but I think that's immaterial).

• assignment: my_msg = other_msg;
• copy-construction: MyMsg my_msg(other_msg);
• swapping: std::swap(msg1, msg2);

Is it safe to mess around with the vectors directly, by resizing them, inserting things into them, etc?

Are all of these safe? By the fact My concern is that the ROS' own generated code for messages sometimes puts messages in std::vectors, I'm thinking they are, but A's header might contain some metadata about A's vector, which becomes out-of-date when I wanted to make sure.modify A's vector.

-- Matt

 3 retagged

### How safe is it to directly modify message member vectors in c++?

I have a custom message class A that contains vectors (of other message classes, but I think that's immaterial).

Is it safe to mess around with the vectors directly, by resizing them, inserting things into them, etc?

My concern is that A's header might contain some metadata about A's vector, which becomes out-of-date when I modify A's vector.

-- Matt

 4 retagged

### How safe is it to directly modify message member vectors in c++?

I have a custom message class A that contains vectors (of other message classes, but I think that's immaterial).

Is it safe to mess around with the vectors directly, by resizing them, inserting things into them, etc?

My concern is that A's header might contain some metadata about A's vector, which becomes out-of-date when I modify A's vector.

-- Matt

 5 retagged

### How safe is it to directly modify message member vectors in c++?

I have a custom message class A that contains vectors (of other message classes, but I think that's immaterial).

Is it safe to mess around with the vectors directly, by resizing them, inserting things into them, etc?

My concern is that A's header might contain some metadata about A's vector, which becomes out-of-date when I modify A's vector.

-- Matt