N
Noah Roberts
I am trying to keep a vector of tuples sorted based on the first member
and so for my insert function I am calling std::lower_bound with a bound
comparator like the following:
std::lower_bound(sit, eit, t, boost::bind(tuple_t::get<0>(), _1) <
boost::bind(tuple_t::get<0>(), _2));
The problem is that get<> is overloaded via const. There are the two
definitions:
const T& get<int I>() const;
T& get<int I>();
The compiler complains that my specification is ambiguous
I'm pretty sure that the const version is the correct one but I don't
know how to specify that in my attempt to bind this function. I've
tried some variations of the following theme and gotten nowhere. As I
suspect, it's a syntax error:
std::lower_bound(sit, eit, t, boost::bind(tuple_t::get<0>() const, _1) <
boost::bind(tuple_t::get<0>() const, _2));
I also tried another typedef:
typedef tuple_t const tuple_ct;
std::lower_bound(sit, eit, t, boost::bind(tuple_ct::get<0>() const, _1)
< boost::bind(tuple_ct::get<0>() const, _2));
I still get an ambiguous call error!
and so for my insert function I am calling std::lower_bound with a bound
comparator like the following:
std::lower_bound(sit, eit, t, boost::bind(tuple_t::get<0>(), _1) <
boost::bind(tuple_t::get<0>(), _2));
The problem is that get<> is overloaded via const. There are the two
definitions:
const T& get<int I>() const;
T& get<int I>();
The compiler complains that my specification is ambiguous
I'm pretty sure that the const version is the correct one but I don't
know how to specify that in my attempt to bind this function. I've
tried some variations of the following theme and gotten nowhere. As I
suspect, it's a syntax error:
std::lower_bound(sit, eit, t, boost::bind(tuple_t::get<0>() const, _1) <
boost::bind(tuple_t::get<0>() const, _2));
I also tried another typedef:
typedef tuple_t const tuple_ct;
std::lower_bound(sit, eit, t, boost::bind(tuple_ct::get<0>() const, _1)
< boost::bind(tuple_ct::get<0>() const, _2));
I still get an ambiguous call error!