
Hi, I'm new to using boost and have hit a problem using UUID. I have a set of classes that have UUID variables to provide unique identifiers. I wish to achieve two things: 1 - Allow objects to reference each other based on their UUID values (imagine the usual databasing student/teacher/course models); 2 - Maintain std::map collections of objects of the same class. Initially, I made the mistake of creating a class instance containing my UUID then inserting it into a map: Std::map <boost::uuid::uid, myClass> myMap; The index of the entry was set as follows: Std::pair <boost::uuids::uuid, myClass> myPair; myPair = std::make_pair( myClassInstance.UUIDField, myClassInstance); myMap.insert( myPair); All look-ups within the map based on the UUID then fail, as adding the object to the map is essentially a copy operation and UUID is non-copyable, so new unique identifiers were generated. I then tried: Std::map <boost::uuids::uuid *, myClass*> myMap; I thought that this should work as the actual UUID value would only ever be held in a single instance of myClass and the relationships between objects could be maintained by following the pointers. Unfortunately, look-ups using this scheme also fail and I can't see where I'm going wrong. Can anybody advise, please? Best wishes. Tim Burgess Raised Bar Ltd Phone: +44 (0)1827 719822 Don't forget to vote for improved access to music and music technology at http://www.raisedbar.net/petition.htm -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Cromwell Enage Sent: 10 December 2011 05:42 To: boost-users@lists.boost.org Subject: [Boost-users] [boost-users][container] associative placement insertion Hi, all! I'm wondering how placement insertion works for pair-associative Boost.Container types. For example, given: //[ex_code struct DÂ { D(char,char) {} // Insert Boost.Move awareness here... }; boost::container::map<int,D> my_map; //] Will my_map.emplace(0, 't', 'p') call D('t', 'p') and move the object into the map? Will Boost.Unordered work the same way? TIA! Cromwell D. Enage _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users