Boost logo

Boost Users :

From: Jeffrey Holle (jeffreyholle_at_[hidden])
Date: 2007-08-29 23:04:26


In experimenting with boost::multi_index, I find that std::distance does
not work properly multi_index iterators.

My multi_index as a single ordered index for now, and I've tried:
   C cs;
   Index& index = cs.get<0>();
   ... populate cs
   Index::iterator iter=index.find(7);
   cout << "distance is \"" << distance(cs.begin(),iter) << "\"" << endl;
   cout << "distance is \"" << distance(index.begin(),iter) << "\"" endl;

Both outputs print that the distance is 0, and should be 7.
Note both output lines compile and I've also tried using operator- and
operator+ with the iterators and found that they don't exist (as expected).

Is there a work around for this?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net