Subject: [Boost-bugs] [Boost C++ Libraries] #10510: boost::uuids::uuid comparison error when used as key in std::map
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-17 11:37:03
#10510: boost::uuids::uuid comparison error when used as key in std::map
------------------------------+-------------------------
Reporter: cosmin.szanto@⦠| Owner: atompkins
Type: Bugs | Status: new
Milestone: To Be Determined | Component: uuid
Version: Boost 1.56.0 | Severity: Showstopper
Keywords: |
------------------------------+-------------------------
When using two almost equal uuids (e.g. the last character differs), ''a''
as a key of a std::map and ''b'' as parameter for the '''find''' function,
the function will return that elements ''b'' is found in the map.
A simple test to reproduce the bug:
{{{#!c++
#include <map>
#include <iostream>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/string_generator.hpp>
int main() {
boost::uuids::string_generator gen;
boost::uuids::uuid a =
gen(std::string("145cfc95-8050-455a-8382-44ca57c1483b"));
boost::uuids::uuid b =
gen(std::string("145cfc95-8050-455a-8382-44ca57c1483c"));
std::map<boost::uuids::uuid, int> elements;
// Adding element 'a'
elements.insert(std::make_pair(a, 1));
// Element 'b' is found although is not added.
std::cout << ((elements.find(b) != elements.end()) ? "Found." : "Not
found.") << std::endl;
return 0;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10510> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC