
All, I was trying to use the tuple in a set, and the STL complained about not having an operator&() - I think. My question is, is tuple supposed to be usable in a set? I read the STL docs: no mention of operator&() required. I tried both STLport and gcc's stl. I'm using gcc 3.2.2, and the snippet of code is real easy: ,---------------- | #include <boost/tuple/tuple.hpp> | #include <set> | | using namespace std; | | using namespace boost; | | int | main(int, char *[]) | { | typedef tuple<int, int, int> Things; | | std::set<Things> mySet; | | Things oneThing(1,2,3); | mySet.insert(oneThing); | | return 0; | } `---------------- tia, TJ -- Trey Jackson tjackson@ichips.intel.com "Nobody can give you wiser advice than yourself." -- Cicero

Things that go into sets must be less-than-able. The operators less than are in in tuple_comparison.hpp. Add that and your example works.... -t On Sep 1, 2004, at 12:52 AM, Trey Jackson wrote:
All,
I was trying to use the tuple in a set, and the STL complained about not having an operator&() - I think.
My question is, is tuple supposed to be usable in a set?
I read the STL docs: no mention of operator&() required. I tried both STLport and gcc's stl.
I'm using gcc 3.2.2, and the snippet of code is real easy:
,---------------- | #include <boost/tuple/tuple.hpp> | #include <set> | | using namespace std; | | using namespace boost; | | int | main(int, char *[]) | { | typedef tuple<int, int, int> Things; | | std::set<Things> mySet; | | Things oneThing(1,2,3); | mySet.insert(oneThing); | | return 0; | } `----------------
tia,
TJ
-- Trey Jackson tjackson@ichips.intel.com
"Nobody can give you wiser advice than yourself." -- Cicero _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Right, the documentation for the tuples http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#relational_operat... says that the operators ==, !=, <, >, etc. are deduced from the elementary operators. So, since my tuple contains just 'int', I would expect tuple to create an operator<() for me. Is this not correct? TJ
Things that go into sets must be less-than-able. The operators less than are in in tuple_comparison.hpp. Add that and your example works....
-- Trey Jackson tjackson@ichips.intel.com "Annex Canada now! We need the room, and who's going to stop us?" -- Tom Neff
participants (2)
-
Trey Jackson
-
troy d. straszheim