Ok, so I a boost::bimap declared as so:
boost::bimap<object*, position> object_list;
Where object and position are a class and a struct, respectively.
Within the current object stored in the bimap, I want to find its own entry.
I am currently trying to do so like this:
void order::do_thing() {
...
position pos = object_list.left.at(this);
...
}
I have trouble parsing the error output, but it seems like the at function of the bimap doesn't like the const-ness and/or reference-ness of this (and yes, I know this is an rvalue).
What would be the proper/suggested way to do this search?
Here is a snippet of the error:
order.cpp:117:56: required from here
/usr/include/boost/bimap/container_adaptor/associative_container_adaptor.hpp:207:56: error: no match for call to ‘(const boost::bimaps::container_adaptor::detail::key_to_base_identity<object*, object* const>) (order* const&)’
this->template functor<key_to_base>()(k)
(Edit added to address sehe's comments and to point out the problem)
Apologies if my post was in bad etiquette, I am both new to posting on SO and I was under the assumption that just dumping all of my code (just to include the custom objects and templates for this section of code is hundreds of lines) would be considered bad form, so I trimmed it down to (what I thought was) the bare minimum to still get the issue.
And just to address the test-cases link, I do write test cases. In this case I was swapping out a vector for a bimap to add in the position code, and this actually fails to compile (though I will say I was not very explicit on it being a compilation error, and not a stack trace). I'm assuming you (sehe), thought I was talking about a runtime error, because otherwise I don't see how the link was relevant.
Anyway, I was trimming out code down to the actual minimum to reproduce the error so I could post it here, and then realized the actual issue. As shown above, the bimap holds values <
object*, position>
But the class trying to insert itself into the bimap is an order class: void
order::do_thing() {
So it turned out to be a simple type error. Sorry, everyone, for asking a really dumb question. I guess that is what I get for working on projects at 3 AM.