
On Thu, Feb 3, 2011 at 2:56 PM, Rytuto
Hello everyone,
Hi, sorry I did not see your email sooner.
I have just started to use boost via boost::bimap. I have a problem when using iterators to build a new bimap.
typedef boost::bimap< set_of
>, multiset_of > // because at one position, I can have many objects .... is that right ? > PosMap;
This is exactly the other way around. Your object are unique while the x positions can be the same, so you need a relation between a multiset of doubles (that can hold duplicated values) and a set of your objects.
// Here is my problem : PosMap m(posX.left.lower_bound(x-R), posX.left.lower_bound(x+R));
What is wrong with this piece of code ... ?
You can not use view iterators directly in the bimap set view. If you really want to do this, you could write: PosMap m ; m.left.insert(posX.left.lower_bound(x-R), posX.left.lower_bound(x+R)); Anyways, I will recomend that if it is possible, you work directly with the range of iterators to avoid all this copying. Read this section of the docs, there is a range function that is really nice for your use case: http://tinyurl.com/bimap-range
Here is the output from the compiler :
(snip error message)
This is strange, this error does not seems to correspond with the code you posted above. And there are typos in your code that do not allow to directly try your snippet. If you want others to help you faster, I recommend that you try to isolate as much as possible your problem. Cheers, Matias