Boost logo

Boost Users :

From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-07-18 13:20:18


This little piece of code,

#include <algorithm>
#include <functional>

template <typename InputIterator, typename Predicate>
  inline bool if_all( InputIterator first, InputIterator last, Predicate
predicate )
{
  return std :: find_if( first, last, std :: not1( predicate ) ) == last;
}

#include <vector>
#include "boost/lambda/lambda.hpp"

int main( )
{
  using namespace boost :: lambda;
  std :: vector<int> v;
  if_all( v.begin( ), v.end( ), _1 == 3 );
  return 0;
}

Gives a compiler error, which I think tells me that my lambda expression, _1
== 3
does not provide the argument_type typedef. I thought lambda expressions
were
careful to to do this. What am I doing wrong?

Thanks, Rob.

-- 
ACCU - Professionalism in programming - http://www.accu.org


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