
Hello Newsgroup, in the following code the call bind (&boost::tuple<int, double>::get<0>, _1) does not compile whereas an analogous call with a non-template parameter compiles fine. What am I doing wrong? I'm using boost 1.33.1 and Visual Studio 7.1 Thanks in advance, Christian #include <vector> #include <algorithm> #include <string> #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> #include <boost/tuple/tuple.hpp> class SearchForMe { std::string a_; public: std::string getA () {return a_;} }; int main(int argc, char* argv[]) { using namespace std; using namespace boost::lambda; vector<SearchForMe> foo; // compiles fine find_if (foo.begin (), foo.end (), bind (&SearchForMe::getA, _1) == "apple"); vector< boost::tuple<int, double> > bar; // does not compile find_if (bar.begin (), bar.end (), bind (&boost::tuple<int, double>::get<0>, _1) == 15); return 0; } The error messages are: Compiling... boost_lambda.cpp d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2784: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda::function_action<2,Result>>,detail::bind_tuple_mapper<const Arg1,const Arg2>::type>> boost::lambda::bind(const Arg1 &,const Arg2 &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(232) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2784: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda::function_action<2,Result>>,detail::bind_tuple_mapper<const Arg1,const Arg2>::type>> boost::lambda::bind(const Arg1 &,const Arg2 &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(232) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2784: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<Arity,Act>,detail::bind_tuple_mapper<const Arg1,const Arg2>::type>> boost::lambda::bind(const Arg1 &,const Arg2 &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' with [ Arity=2, Act=boost::lambda::function_action<2> ] d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(212) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2784: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<Arity,Act>,detail::bind_tuple_mapper<const Arg1,const Arg2>::type>> boost::lambda::bind(const Arg1 &,const Arg2 &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' with [ Arity=2, Act=boost::lambda::function_action<2> ] d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(212) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2784: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<Arity,Act>,detail::bind_tuple_mapper<const Arg1,const Arg2>::type>> boost::lambda::bind(const Arg1 &,const Arg2 &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' with [ Arity=2, Act=boost::lambda::function_action<2> ] d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(212) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2784: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda::function_action<2,Result>>,detail::bind_tuple_mapper<Result(__cdecl &)(Par1),const Arg2>::type>> boost::lambda::bind(Result (__cdecl &)(Par1),const Arg2 &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(190) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2784: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda::function_action<2,Result>>,detail::bind_tuple_mapper<Result(__cdecl &)(Par1),const Arg2>::type>> boost::lambda::bind(Result (__cdecl &)(Par1),const Arg2 &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(190) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2784: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<2,boost::lambda::function_action<2,Result>>,detail::bind_tuple_mapper<Result(__cdecl &)(Par1),const Arg2>::type>> boost::lambda::bind(Result (__cdecl &)(Par1),const Arg2 &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type' d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(190) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2780: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<1,boost::lambda::function_action<1,Result>>,detail::bind_tuple_mapper<const Arg1>::type>> boost::lambda::bind(const Arg1 &)' : expects 1 arguments - 2 provided d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(91) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2780: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<Arity,Act>,detail::bind_tuple_mapper<const Arg1>::type>> boost::lambda::bind(const Arg1 &)' : expects 1 arguments - 2 provided with [ Arity=1, Act=boost::lambda::function_action<1> ] d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(71) : see declaration of 'boost::lambda::bind' d:\home\roe\c++_tests\boost_lambda\boost_lambda\boost_lambda\boost_lambda.cpp(31) : error C2780: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<1,boost::lambda::function_action<1,Result>>,detail::bind_tuple_mapper<Result(__cdecl &)(void)>::type>> boost::lambda::bind(Result (__cdecl &)(void))' : expects 1 arguments - 2 provided d:\home\roe\boost_1_33_1\boost\lambda\detail\bind_functions.hpp(49) : see declaration of 'boost::lambda::bind'