$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Jaakko Jarvi (jarvi_at_[hidden])
Date: 2006-01-10 17:50:49
Hi David,
Template functions have to be explicitly instantiated if used  
together with bind.
One cannot take the address of an uninstantiated template.
The second line
   bind(&boost::numeric::in<range>, 5, _1));
seems like it should be correct, but I don't know the definition of in.
I tried a direct call to boost::numeric::in, however, and it fails:
   boost::numeric::in<range>(5, *(ranges.begin()));
test.cpp:25: error: no matching function for call to 'in(int,  
boost::numeric::interval<int,  
boost::numeric::interval_lib::policies<boost::numeric::interval_lib::rou 
nded_math<int>, boost::numeric::interval_lib::checking_strict<int> >  
 >&)'
So maybe there's something wrong in how you try to call to in?
(Or maybe I did a mistake interpreting the call, I was in a rush and  
couldn't dig very deep on this.)
  Best,
    Jaakko Järvi
On Jan 10, 2006, at 4:11 PM, David Greene wrote:
> 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());
>
>    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<boost::lambda::placeholder<1> >&)'
>
> Any ideas?
>
>                           -Dave
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://listarchives.boost.org/mailman/listinfo.cgi/boost-users