On Sun, Dec 11, 2011, at 12:22 AM, Klaim - Joël Lamotte wrote:
Hi,
On Sat, Dec 10, 2011 at 17:22, Tim Burgess <[1]tim@raisedbar.net>
wrote:
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 myMap;
AFAIK uuid is copyable as it's a POD.
Correct, boost::uuids::uuid is copyable, it is a POD.
It can be used as the key in an std::map. I have created a
simple test for this and checked it into trunk
([2]http://svn.boost.org/svn/boost/trunk/libs/uuid/test/test_uuid
_in_map.cpp). It passes. I have also attached the file.
I'm not sure where the problem is with your code. Could you
provide a more complete example?
However, I don't know about this problem but I remember having
failed to make uuid a key of map (I don't remember the reason).
If that can help you, I'm using a workaround to allow this : I
convert the uuid to std::string (using the generator function)
and use it in my whole application to allow finding by uuid from
maps. That's obviously more expensive but it works fine.
Joël Lamotte
Regards,
Andy.
References
1. mailto:tim@raisedbar.net
2. http://svn.boost.org/svn/boost/trunk/libs/uuid/test/test_uuid_in_map.cpp