
While on the subject of vectors, can one do derivatives, like curl, divergence of a vector field, etc., & vector cross-product, etc., as in Blitz++? I ask since there's a relationship between multi_array & blitz++ according to http://www.boost.org/doc/libs/1_48_0/libs/multi_array/doc/user.html Todd Veldhuizen wrote Blitz++, which inspired some aspects of this design. In addition, he supplied feedback on the design and implementation of the library. On Dec 29, 2011, at 3:48 AM, Ion Gaztañaga wrote:
El 28/12/2011 9:30, Prasanth Madhavan escribió:
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
vecAllocator;typedef vector vec;typedef std::pair ValueType;typedef allocator ShmemAllocator;typedef multimap 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
(i, myvec));}for(int i = 0; i< 6; ++i){ for(int j = 0; j<6; j++) mymap->insert(std::pair (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? You should use anonymous allocation:
http://www.boost.org/doc/libs/1_48_0/doc/html/interprocess/managed_memory_se...
best,
Ion _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users