Is it possible to bind template functions? If so, what's the
syntax? I'm having trouble with this test:
#include
#include
#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());
return(0);
}
None of the commented options works, either. I wouldn't expect the last
one to work. They all fail with the same error trace:
lambda.cc: In function `int main()':
lambda.cc:27: error: no matching function for call to `bind(<unknown type>,
int, const
boost::lambda::lambda_functor >&)'
Any ideas?
-Dave