Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Lambda and Tupl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 44676 of 47977
Post > Topic >>

Lambda and Tuple question

by Jerzie.Klenchier@[EMAIL PROTECTED] Apr 11, 2008 at 02:30 PM

Hi all,

I'm having some difficulty in getting the following piece of code to
compile:

#include <iostream>
#include <deque>
#include <algorithm>
#include <boost/tuple/tuple.hpp>
#include <boost/lambda/lambda.hpp>

int main(void)
{
    typedef boost::tuples::tuple<unsigned int, double> my_tuple_type;
    std::deque<my_tuple_type> my_list;

    std::sort(my_list.begin(),my_list.end(),
             (boost::lambda::_1).get<0>() <
             (boost::lambda::_2).get<0>());

   return 0;

}

my understanding of the lambda place-holders was that they represent
the value_type of the iterators in the above example. A simpler
example as below seems to work, just wondering why the above doesn't.

{
    std::vector<int> v_list;
    std::sort(v_list.begin(),v_list.end(),
              boost::lambda::_1 < boost::lambda::_2);

}

Jerzie
 




 5 Posts in Topic:
Lambda and Tuple question
Jerzie.Klenchier@[EMAIL P  2008-04-11 14:30:21 
Re: Lambda and Tuple question
Kai-Uwe Bux <jkherciue  2008-04-12 01:32:59 
Re: Lambda and Tuple question
=?ISO-8859-1?Q?Marcel_M=F  2008-04-12 08:33:45 
Re: Lambda and Tuple question
brian tyler <brian.tyl  2008-04-12 06:29:53 
Re: Lambda and Tuple question
pjb@[EMAIL PROTECTED] (P  2008-04-14 09:34:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 8:42:46 CDT 2008.