Boost logo

Boost Users :

From: David Greene (greened_at_[hidden])
Date: 2006-01-10 17:11:54

Is it possible to bind template functions? If so, what's the
syntax? I'm having trouble with this test:

#include <boost/lambda/bind.hpp>
#include <boost/numeric/interval.hpp>

#include <vector>
#include <cassert>

typedef boost::numeric::interval<int> range;

std::vector<range> ranges;

int main(void)
   using boost::lambda::bind;
   using boost::lambda::_1;

   int range_base = 0;
   int range_limit = 9;

   for(int i = 0; i < 10; ++i) {
      ranges.push_back(range(range_base, range_limit));
      range_base += 10;
      range_limit += 10;

   std::vector<range>::iterator i =
      std::find_if(ranges.begin(), ranges.end(),
                   bind(&boost::numeric::template in<range>, 5, _1));
// bind(&boost::numeric::in<range>, 5, _1));
// bind(&boost::numeric::in, 5, _1));

   assert(i == ranges.begin());


None of the commented options works, either. I wouldn't expect the last
one to work. They all fail with the same error trace: In function `int main()': error: no matching function for call to `bind(<unknown type>,
   int, const
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >&)'

Any ideas?


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