Q: Boost interprocess vector, creating multiple vector pointers I want to insert a shared vector into a shared map using the following code:
managed_shared_memory segment(create_only ,"MySharedMemory" ,65536);

typedef allocator<int, managed_shared_memory::segment_manager> vecAllocator;
typedef vector<int, vecAllocator> vec;
typedef std::pair<int, vec* > ValueType;
typedef allocator<ValueType, managed_shared_memory::segment_manager> ShmemAllocator;
typedef multimap<int, vec*, std::less<int>, ShmemAllocator> MyMap;

ShmemAllocator alloc_inst (segment.get_segment_manager());
vecAllocator vectorallocator (segment.get_segment_manager());


MyMap *mymap = segment.construct<MyMap>("MyMap")(std::less<int>(),alloc_inst);
vec *myvec = segment.construct<vec>("myvec")(vectorallocator);
vec *myvec1 = segment.construct<vec>("myvec1")(vectorallocator);

myvec->push_back(10);
myvec->push_back(9);
myvec->push_back(8);
myvec1->push_back(987);
myvec1->push_back(123);
myvec1->push_back(456);


for(int i = 0; i < 6; ++i){
    for(int j = 0; j<6; j++)
        mymap->insert(std::pair<int, vec*>(i, myvec));
}
for(int i = 0; i < 6; ++i){
    for(int j = 0; j<6; j++)
        mymap->insert(std::pair<int, vec*>(i, myvec1));
}

the code works.. but what i want to do is construct a vector without a name. that is do something like this 
vec *myvec = segment.construct<vec>(vectorallocator);
vec *myvec1 = segment.construct<vec>(vectorallocator);

so that if i put it inside a loop and there is no problem with naming them differently every loop. Is there a way to do so?
Or atleast is there an automatic way to name them differently every loop?

A: since i dont need the name of the vector, here is what i did.
unsigned int seconds;
srand ( time(NULL) );
seconds = rand() % 1000000;
std::stringstream buf;
buf << seconds;
vec *myvec = segment.construct<vec>((buf.str()).c_str())(vectorallocator);

and i can now have lots of vec* without having to consider for the name.. :)
this is just a trivial answer.

A: Well my previous answer was STUPID.. so here is the correct answer
We have to use anonymous instance to get what i want. It is done using
vec *myvec = segment.construct<vec>(anonymous_instance)(vectorallocator);

it is explained here 
    http://www.boost.org/doc/libs/1_48_0/doc/html/interprocess/managed_memory_segments.html#interprocess.managed_memory_segments.managed_memory_segment_features.anonymous 
It also explains some other good features.
