I'm trying to compare two tuple instances of the same type (indirectly
by doing an == on std::set's of them), but this doesn't compile for
me. The Tuple doc seems to indicate comparisons are supported. What am
I missing? Thanks, --DD
struct RowidTupleComparator {
bool operator()(
const boost::tuple& lhs,
const boost::tuple& rhs
) const {
return boost::get<0>(lhs) < boost::get<0>(rhs);
}
};
void TypeIdTests::test_rtti_vtable_text_vs_int() {
typedef boost::tuple ROW;
std::set by_type_id;
get_rows(
"select rowid from rtti where type_id = :1",
make_tuple(MyFoo::id().value()), by_type_id
);
std::set by_type;
get_rows(
"select rowid from rtti where type = :1",
make_tuple(MyFoo::id().name().string()), by_type
);
CPPUNIT_ASSERT_EQUAL(by_type_id.size(), by_type.size());
CPPUNIT_ASSERT(by_type_id == by_type); // <<< doesn't compile
}
c:\program files\microsoft visual studio 8\vc\include\utility(60) :
see declaration of 'std::operator =='
c:\program files\microsoft visual studio 8\vc\include\xutility(2621) :
error C2676: binary '==' :
'const boost::tuples::tuple' does not define this operator or
a conversion to a type acceptable to the predefined operator // edited