#3529 closed Bugs (invalid)
boost::interprocess::map can't find() elements which exist in the map
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Boost 1.41.0 | Component: | interprocess |
| Version: | Boost 1.40.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
I have prepared a relatively small C++ program to demonstrate the problem: I create an empty segment and a map within, put there few elements and then try to list the whole map and to find specific items. Some items are perfectly visible when iterting over the map, but can't be found via find().
If I put some traces into operator< (), I can see that only few comparsions are made (less then expected) when searching for a "missing" key
Attachments (2)
Change History (4)
by , 13 years ago
| Attachment: | testmap.cc added |
|---|
comment:1 by , 13 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
Your comparison operator is not quite right. It should be
bool operator<(const RouteKey& _o) const {
return (this->tv_sec < _o.tv_sec ||
(this->tv_sec == _o.tv_sec && (this->tv_usec < _o.tv_usec ||
(this->tv_usec == _o.tv_usec && this->pid < _o.pid))
));
}
(warning untested)
comment:2 by , 13 years ago
| Component: | None → interprocess |
|---|
Note:
See TracTickets
for help on using tickets.

the test C++ program