Cannot seem to use custom container allocators without default constructors

asked 2019-07-22 14:49:23 -0600

I cannot seem to be able to use an allocator with messages were the allocator does not have a default constructor.

There are many reasons why an allocator wont have a default constructor. The biggest one being the allocator requires some context to perform its allocations.

The reason I found for such an allocator not able to be used is because of the ros::VectorSerializercalling resize with default arguments so there is no way to pass the allocator to subobjects that require it inside a vector. (see )

Does anyone know how I could use a custom container allocator with ros messages when the allocator does not have a default constructor?

An immediate work around that I am using is to make a one off allocator that references the context from a global variable for the situation that I am dealing with.

edit retag flag offensive close merge delete