Boost logo

Boost Users :

Subject: [Boost-users] [Tuple] Problem with operator== and tuples
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2009-03-25 20:36:08

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<sqlite3_int64>& lhs,
        const boost::tuple<sqlite3_int64>& rhs
    ) const {
        return boost::get<0>(lhs) < boost::get<0>(rhs);

void TypeIdTests::test_rtti_vtable_text_vs_int() {
    typedef boost::tuple<sqlite3_int64> ROW;
    std::set<ROW, RowidTupleComparator> by_type_id;
        "select rowid from rtti where type_id = :1",
        make_tuple(MyFoo::id().value()), by_type_id
    std::set<ROW, RowidTupleComparator> by_type;
        "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<sqlite3_int64>' does not define this operator or
    a conversion to a type acceptable to the predefined operator // edited

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at