0

Building on CentOS 7, g++ 4.8.5-28. Language standard: C++03

Working sample: https://godbolt.org/z/ijSFrK

In the method RemoveMapping, the call to mapDb.erase(clientIter); is failing (see sample code in link for the actual code and the compile error). I am wondering if it is because of the multiple ordered indexes which are both using composite keys and key extractor methods?

Jon
  • 1,675
  • 26
  • 57
  • I may be reading it wrong but https://stackoverflow.com/questions/11558399/deleting-from-a-boost-multiindex seems to say that erase is a member of an index and not a container. Is it a duplicate? Something else to look at: https://stackoverflow.com/questions/12579000/erase-element-per-key-from-multi-index-container-with-composite-key – Jerry Jeremiah May 15 '19 at 21:47

1 Answers1

0

Rather than

mapDb.erase(clientIter);

you have to write

clientView.erase(clientIter);

Remember that each index (view) has its own iterator type, and you can't freely interchange them. As a convenience, the container itself (mapDb here) behaves like its first (#0) index, so mapDb.erase can only accept an iterator for serverView.

Joaquín M López Muñoz
  • 5,243
  • 1
  • 15
  • 20