|
Boost Users : |
From: Kevin Heifner (heifner_k_at_[hidden])
Date: 2005-11-26 00:31:49
Sumanth,
Comparison operators are defined in tuple_comparison.hpp
Sumanth J.V wrote:
> #include "boost/tuple/tuple_io.hpp"
// add this line
#include "boost/tuple/tuple_comparison.hpp"
> #include <vector>
> #include <algorithm>
>
> typedef boost::tuple<unsigned long int, unsigned long int, double,
> unsigned long int> Task;
> typedef std::vector<Task> TaskSet;
>
// remove these
// bool operator<(const Task& a, const Task& b) {
// return boost::get<1>(a) < boost::get<1>(b);
// }
>
> int main(int argc, char** argv) {
> TaskSet ts;
>
> ts.push_back( boost::make_tuple(0, 0, 0, 0) );
> ts.push_back( boost::make_tuple(3, 3, 3, 3) );
> ts.push_back( boost::make_tuple(2, 2, 2, 2) );
>
> std::sort(ts.begin(), ts.end());
>
> return 0;
> }
KevinH
-- Kevin Heifner heifner @ ociweb.com http://heifner.blogspot.com Object Computing, Inc. (OCI) www.ociweb.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net