Boost logo

Boost Users :

From: Patrik Jonsson (patrik_at_[hidden])
Date: 2006-09-29 10:15:55


Hi,

I've used BLL off an on for a while, but right now even the most basic
bind won't work. Two of the following three binds don't work for me, and
they are basically a copy if the bind examples... At this point I'm sure
I'm doing something incredibly stupid, so can someone set me straight?

#include <iostream>
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
using namespace boost::lambda;

int g(int i) {std::cout << i<<std::endl; return i;};

int main() {
  bind(_1, 1)(g); // works
  bind(g, _1)(1); // nope
  bind(&g, _1)(1); // nope
}

This is with gcc 4.0.1 and boost 1.33.1. Thanks,

/Patrik

The errors are:

junk.cc: In function 'int main()':
junk.cc:10: error: no match for call to '(const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<2,
boost::lambda::function_action<2, int> >, boost::tuples::tuple<int
(&)(int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >) (int)'
/Users/patrik/include/boost/lambda/detail/lambda_functors.hpp:137: note:
candidates are: typename T::sig<boost::tuples::null_type>::type
boost::lambda::lambda_functor<Base>::operator()() const [with T =
boost::lambda::lambda_functor_base<boost::lambda::action<2,
boost::lambda::function_action<2, int> >, boost::tuples::tuple<int
(&)(int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> >]
/Users/patrik/include/boost/lambda/detail/lambda_functors.hpp:145:
note: typename T::sig<boost::tuples::tuple<A&,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> >::type
boost::lambda::lambda_functor<Base>::operator()(A&) const [with A = int,
T = boost::lambda::lambda_functor_base<boost::lambda::action<2,
boost::lambda::function_action<2, int> >, boost::tuples::tuple<int
(&)(int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> >]
junk.cc:11: error: no match for call to '(const
boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<2,
boost::lambda::function_action<2, boost::lambda::detail::unspecified> >,
boost::tuples::tuple<int (* const)(int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> > >) (int)'
/Users/patrik/include/boost/lambda/detail/lambda_functors.hpp:137: note:
candidates are: typename T::sig<boost::tuples::null_type>::type
boost::lambda::lambda_functor<Base>::operator()() const [with T =
boost::lambda::lambda_functor_base<boost::lambda::action<2,
boost::lambda::function_action<2, boost::lambda::detail::unspecified> >,
boost::tuples::tuple<int (* const)(int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> >]
/Users/patrik/include/boost/lambda/detail/lambda_functors.hpp:145:
note: typename T::sig<boost::tuples::tuple<A&,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> >::type
boost::lambda::lambda_functor<Base>::operator()(A&) const [with A = int,
T = boost::lambda::lambda_functor_base<boost::lambda::action<2,
boost::lambda::function_action<2, boost::lambda::detail::unspecified> >,
boost::tuples::tuple<int (* const)(int), const
boost::lambda::lambda_functor<boost::lambda::placeholder<1> >,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type> >]




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