ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You'd better use

std::queue http://www.cplusplus.com/reference/queue/queue/

or std::list http://www.cplusplus.com/reference/list/list/ with push_front() and pop_back()

The problem with std::vector in this use case is that it will have to relocate your entire data every time you call insert( name_vector.begin(),element) in order for keeping its memory layout. This might be computationally expensive! For std::vector you can only efficiently insert / remove objects at the end of the vector.