How am I misusing boost::lambda::bind?

I hope the sheer size of this post doesn't scare those who can help me away :( Depending on how I use the code at the bottom of this post, things either work or they blow up with varying error messages deep within the boost libraries. The very last function in the code below is the last consistent "source" of the errors. As best as I understand it, that line is correct. I'm scratching my head on how to diagnose what's going wrong. The simplest error I got seemed to complain about const qualifiers that seem to have been added internally to boost::lambda::bind. I'm not sure which error message to pick out from other error scenarios (such as 3 input parameters (types T0, T1, and T2)). This error had R0=void, and no input arguments (T0, T1, etc...). The code at the bottom of this post compiles with R0=void and T0=int. actions.hpp:87: error: no matching function for call to ‘boost::lambda::function_adaptor< GTPInternalResponse (*)( boost::function0<void, std::allocator<boost::function_base> >*, GTPCommand)> ::apply( GTPInternalResponse (* const&)( boost::function0<void, std::allocator<boost::function_base> >*, GTPCommand), boost::function0<void, std::allocator<boost::function_base> >* const&)’ As clarification for understanding the code: GTPInternalResponse can be thought of a string and GTPCommand as a tokenized string. The extract<>() function consumes some string tokens and returns a value of the specified type (T0,T1,T2,T3, etc...) The only big impact on this code externally (besides the calls to GTPFunctionObjectN) is #define's for GTP_PARAM_COUNT and GTP_PARAM_COUNT_PLUS_ONE. GTP_PARAM_COUNT_PLUS_ONE == GTP_PARAM_COUNT. The useful range for GTP_PARAM_COUNT is between 0 and 3 (inclusive).
#include <boost/preprocessor/enum_params.hpp> // expands for 0 ... N-1 #include <boost/preprocessor/repetition/enum_shifted_params.hpp> // expands for 1 ... N-1
#if GTP_PARAM_COUNT == 0 # define GTP_OPTIONAL_COMMA #else # define GTP_OPTIONAL_COMMA , #endif
// GTP_PARMS expands to " typename T0, typename T1, typename T2" if GTP_PARAM_COUNT is 3 #define GTP_TEMPLATE_PARAMS BOOST_PP_ENUM_PARAMS(GTP_PARAM_COUNT, typename T)
// expands to "typename R0 , typename T0, typename T1, typename T2" if GTP_PARAM_COUNT is 3 #define GTP_FULL_TEMPLATE_PARAMS typename R0 GTP_OPTIONAL_COMMA GTP_TEMPLATE_PARAMS
// GTP_PARAM expands to " T3 a3" if INDEX is 3 #define GTP_PARAM(UNKNOWN1,INDEX,UNKNOWN2) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I)
// GTP_PARAMS expands to " T0 a0, T1 a1, T2 a2" if GTP_PARAM_COUNT is 3 #define GTP_PARAMS BOOST_PP_ENUM(GTP_PARAM_COUNT,GTP_PARAM,BOOST_PP_EMPTY)
// GTP_PARAM_TYPES expands to " T0, T1, T2" if GTP_PARAM_COUNT is 3 #define GTP_PARAM_TYPES BOOST_PP_ENUM_PARAMS(GTP_PARAM_COUNT, T)
// expands to "R0 , T0, T1, T2" if GTP_PARAM_COUNT is 3 #define GTP_FULL_PARAM_TYPES R0 GTP_OPTIONAL_COMMA GTP_PARAM_TYPES
// GTP_PARAM_NAMES expands to " a0, a1, a2" if GTP_PARAM_COUNT is 3 #define GTP_PARAM_NAMES BOOST_PP_ENUM_PARAMS(GTP_PARAM_COUNT, a)
// expands to "boost::function3 < R0 , T0, T1, T2 >" when GTP_PARAM_COUNT is 3 #define GTP_BOOST_FUNCTION BOOST_PP_CAT(boost::function,GTP_PARAM_COUNT) < GTP_FULL_PARAM_TYPES >
// expands to "boost::function3 < void , T0, T1, T2 >" when GTP_PARAM_COUNT is 3 #define GTP_BOOST_FUNCTION_VOID BOOST_PP_CAT(boost::function,GTP_PARAM_COUNT) < void GTP_OPTIONAL_COMMA GTP_PARAM_TYPES >
// expands to type_wrapper3 when GTP_PARAM_COUNT is 3 #define GTP_TYPE_WRAPPER BOOST_PP_CAT(type_wrapper,GTP_PARAM_COUNT)
////////////////////////////////////////////////////////////// // gtp_detail::type_wrapper for converting all input arguments namespace gtp_detail{
template < GTP_FULL_TEMPLATE_PARAMS > struct GTP_TYPE_WRAPPER{ static GTPInternalResponse wrap(GTP_BOOST_FUNCTION *(callback_function), GTPCommand cmd){ unsigned int position = 0; /// \bug Must figure out how to auto generate this repetative body #if GTP_PARAM_COUNT >= 1 assert(position < cmd.GetArgumentCount()); T0 a0 = extract<T0>(cmd, position); #endif #if GTP_PARAM_COUNT >= 2 assert(position < cmd.GetArgumentCount()); T1 a1 = extract<T1>(cmd,position); #endif #if GTP_PARAM_COUNT >= 3 assert(position < cmd.GetArgumentCount()); T2 a2 = extract<T2>(cmd,position); #endif assert(position == cmd.GetArgumentCount()); return converter<R0, GTPInternalResponse>( (*callback_function)(GTP_PARAM_NAMES) ); } };
template < GTP_TEMPLATE_PARAMS > struct GTP_TYPE_WRAPPER < void GTP_OPTIONAL_COMMA GTP_PARAM_TYPES >{ static GTPInternalResponse wrap(GTP_BOOST_FUNCTION_VOID *(callback_function), GTPCommand cmd){ unsigned int position = 0; /// \bug Must figure out how to auto generate this repetative body #if GTP_PARAM_COUNT >= 1 assert(position < cmd.GetArgumentCount()); T0 a0 = extract<T0>(cmd, position); #endif #if GTP_PARAM_COUNT >= 2 assert(position < cmd.GetArgumentCount()); T1 a1 = extract<T1>(cmd,position); #endif #if GTP_PARAM_COUNT >= 3 assert(position < cmd.GetArgumentCount()); T2 a2 = extract<T2>(cmd,position); #endif assert(position == cmd.GetArgumentCount()); (*callback_function)(GTP_PARAM_NAMES); return GTPInternalResponse(); } };
};
/////////////////////////////////////////////////////// // GTPCommandCallBack accepting a boost function object
// expands to GTPFunctionObject3 when GTP_PARAM_COUNT is 3 #define GTP_COMMAND_CALLBACK BOOST_PP_CAT(GTPCommandCallBack,GTP_PARAM_COUNT)
// expands to " boost::lambda::_1, boost::lambda::_2, boost::lambda::_3" if GTP_PARAM_COUNT is 3 #define GTP_LAMBDA_PARAMS BOOST_PP_ENUM_SHIFTED_PARAMS(GTP_PARAM_COUNT_PLUS_ONE, boost::lambda::_)
template< GTP_FULL_TEMPLATE_PARAMS > inline GTPFunctionObject* GTP_COMMAND_CALLBACK(GTP_BOOST_FUNCTION *callback_function){ return new GTPFunctionObject(boost::lambda::bind((>p_detail::GTP_TYPE_WRAPPER<GTP_FULL_PARAM_TYPES>::wrap), callback_function GTP_OPTIONAL_COMMA GTP_LAMBDA_PARAMS)); }

I've tried to create a simpler version of my problem. The code below also does not compile. The full compiler output is at the bottom of this message.
#include <boost/function.hpp> #include <boost/lambda/bind.hpp>
namespace gtp_detail{ template<typename input_t, typename output_t> output_t converter(input_t x){ output_t y; return y; } };
typedef boost::function1<double, double> GTPFunctionObject;
namespace gtp_detail{
template<typename R0, typename T0> struct type_wrapper1{ static double wrap(boost::function1<R0,T0>* callback_function, double cmd){ unsigned int position = 0; T0 a0; return converter<R0, std::string>((*callback_function)(a0)); } };
template<typename T0> struct type_wrapper1<void,T0>{ static double wrap(boost::function1<void,T0>* callback_function, double cmd){ unsigned int position; T0 a0; (*callback_function)(a0); }; };
};
template<typename R0, typename T0> GTPFunctionObject* GTPCommandCallBack1(boost::function1<R0,T0> *callback_function){ return new GTPFunctionObject(boost::lambda::bind((gtp_detail::type_wrapper1<R0,T0>::wrap),boost::lambda::_1)); }
int main(int argc, char** argv){ boost::function1<void,int> *f1a = new boost::function1<void,int>(); GTPCommandCallBack1(f1a); }
/home/jhouse/boost_1_33_1/boost/tuple/detail/tuple_basic.hpp: In constructor ‘boost::tuples::cons<HT, TT>::cons(T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&, T10&) [with T1 = double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double)const, T2 = const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, T3 = const boost::tuples::null_type, T4 = const boost::tuples::null_type, T5 = const boost::tuples::null_type, T6 = const boost::tuples::null_type, T7 = const boost::tuples::null_type, T8 = const boost::tuples::null_type, T9 = const boost::tuples::null_type, T10 = const boost::tuples::null_type, HT = double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), TT = boost::tuples::cons<const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type>]’: /home/jhouse/boost_1_33_1/boost/tuple/detail/tuple_basic.hpp:546: instantiated from ‘boost::tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::tuple(typename boost::tuples::access_traits<T0>::parameter_type, typename boost::tuples::access_traits<TT>::parameter_type) [with T0 = double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), T1 = const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, T2 = boost::tuples::null_type, T3 = boost::tuples::null_type, T4 = boost::tuples::null_type, T5 = boost::tuples::null_type, T6 = boost::tuples::null_type, T7 = boost::tuples::null_type, T8 = boost::tuples::null_type, T9 = boost::tuples::null_type]’ /home/jhouse/boost_1_33_1/boost/lambda/detail/bind_functions.hpp:220: instantiated from ‘const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<2, boost::lambda::function_action<2, boost::lambda::detail::unspecified> >, typename boost::lambda::detail::bind_tuple_mapper<const Arg1, const Arg2, 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::bind(const Arg1&, const Arg2&) [with Arg1 = double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), Arg2 = boost::lambda::lambda_functor<boost::lambda::placeholder<1> >]’ test.cpp:39: instantiated from ‘GTPFunctionObject* GTPCommandCallBack1(boost::function1<R0, T0, std::allocator<boost::function_base> >*) [with R0 = void, T0 = int]’ test.cpp:44: instantiated from here /home/jhouse/boost_1_33_1/boost/tuple/detail/tuple_basic.hpp:360: error: no matching function for call to ‘boost::tuples::detail::non_storeable_type<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double)>::non_storeable_type(double (&)(boost::function1<void, int, std::allocator<boost::function_base> >*, double)const)’ /home/jhouse/boost_1_33_1/boost/tuple/detail/tuple_basic.hpp:305: note: candidates are: boost::tuples::detail::non_storeable_type<T>::non_storeable_type() [with T = double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double)] /home/jhouse/boost_1_33_1/boost/tuple/detail/tuple_basic.hpp:304: note: boost::tuples::detail::non_storeable_type<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double)>::non_storeable_type(const boost::tuples::detail::non_storeable_type<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double)>&) /home/jhouse/boost_1_33_1/boost/lambda/detail/select_functions.hpp: In static member function ‘static RET boost::lambda::detail::r_select<RET>::go(Any&, A&, B&, C&, Env&) [with Any = double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double)const, A = double, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type, RET = double (&)(boost::function1<void, int, std::allocator<boost::function_base> >*, double)]’: /home/jhouse/boost_1_33_1/boost/lambda/detail/lambda_functor_base.hpp:408: instantiated from ‘RET boost::lambda::lambda_functor_base<boost::lambda::action<2, Act>, Args>::call(A&, B&, C&, Env&) const [with RET = double, A = double, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type, Act = boost::lambda::function_action<2, boost::lambda::detail::unspecified>, Args = boost::tuples::tuple<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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>]’ /home/jhouse/boost_1_33_1/boost/lambda/detail/lambda_functors.hpp:148: instantiated from ‘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 = double, T = boost::lambda::lambda_functor_base<boost::lambda::action<2, boost::lambda::function_action<2, boost::lambda::detail::unspecified> >, boost::tuples::tuple<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> >]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:119: instantiated from ‘static R boost::detail::function::function_obj_invoker1<FunctionObj, R, T0>::invoke(boost::detail::function::any_pointer, T0) [with FunctionObj = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:479: instantiated from ‘void boost::function1<R, T0, Allocator>::assign_to(FunctionObj, boost::detail::function::function_obj_tag) [with FunctionObj = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double, Allocator = std::allocator<boost::function_base>]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:430: instantiated from ‘void boost::function1<R, T0, Allocator>::assign_to(Functor) [with Functor = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double, Allocator = std::allocator<boost::function_base>]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:294: instantiated from ‘boost::function1<R, T0, Allocator>::function1(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double, Allocator = std::allocator<boost::function_base>]’ test.cpp:39: instantiated from ‘GTPFunctionObject* GTPCommandCallBack1(boost::function1<R0, T0, std::allocator<boost::function_base> >*) [with R0 = void, T0 = int]’ test.cpp:44: instantiated from here /home/jhouse/boost_1_33_1/boost/lambda/detail/select_functions.hpp:55: error: invalid initialization of reference of type ‘double (&)(boost::function1<void, int, std::allocator<boost::function_base> >*, double)’ from expression of type ‘double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double)const’ /home/jhouse/boost_1_33_1/boost/lambda/detail/actions.hpp: In static member function ‘static RET boost::lambda::function_action<2, T>::apply(A1&, A2&) [with RET = double, A1 = double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), A2 = double, T = boost::lambda::detail::unspecified]’: /home/jhouse/boost_1_33_1/boost/lambda/detail/lambda_functor_base.hpp:408: instantiated from ‘RET boost::lambda::lambda_functor_base<boost::lambda::action<2, Act>, Args>::call(A&, B&, C&, Env&) const [with RET = double, A = double, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type, Act = boost::lambda::function_action<2, boost::lambda::detail::unspecified>, Args = boost::tuples::tuple<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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>]’ /home/jhouse/boost_1_33_1/boost/lambda/detail/lambda_functors.hpp:148: instantiated from ‘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 = double, T = boost::lambda::lambda_functor_base<boost::lambda::action<2, boost::lambda::function_action<2, boost::lambda::detail::unspecified> >, boost::tuples::tuple<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> >]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:119: instantiated from ‘static R boost::detail::function::function_obj_invoker1<FunctionObj, R, T0>::invoke(boost::detail::function::any_pointer, T0) [with FunctionObj = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:479: instantiated from ‘void boost::function1<R, T0, Allocator>::assign_to(FunctionObj, boost::detail::function::function_obj_tag) [with FunctionObj = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double, Allocator = std::allocator<boost::function_base>]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:430: instantiated from ‘void boost::function1<R, T0, Allocator>::assign_to(Functor) [with Functor = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double, Allocator = std::allocator<boost::function_base>]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:294: instantiated from ‘boost::function1<R, T0, Allocator>::function1(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double, Allocator = std::allocator<boost::function_base>]’ test.cpp:39: instantiated from ‘GTPFunctionObject* GTPCommandCallBack1(boost::function1<R0, T0, std::allocator<boost::function_base> >*) [with R0 = void, T0 = int]’ test.cpp:44: instantiated from here /home/jhouse/boost_1_33_1/boost/lambda/detail/actions.hpp:87: error: no matching function for call to ‘boost::lambda::function_adaptor<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double)>::apply(double (&)(boost::function1<void, int, std::allocator<boost::function_base> >*, double), double&)’ /home/jhouse/boost_1_33_1/boost/tuple/detail/tuple_basic.hpp: In static member function ‘static RET boost::tuples::detail::get_class<0>::get(const boost::tuples::cons<HT, TT>&) [with RET = double (&)(boost::function1<void, int, std::allocator<boost::function_base> >*, double)const, HT = double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), TT = boost::tuples::cons<const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type>]’: /home/jhouse/boost_1_33_1/boost/tuple/detail/tuple_basic.hpp:292: instantiated from ‘typename boost::tuples::access_traits<typename boost::tuples::element<N, boost::tuples::cons<HT, TT>
::type>::const_type boost::tuples::get(const boost::tuples::cons<HT, TT>&) [with int N = 0, HT = double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), TT = boost::tuples::cons<const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type>]’ /home/jhouse/boost_1_33_1/boost/lambda/detail/lambda_functor_base.hpp:408: instantiated from ‘RET boost::lambda::lambda_functor_base<boost::lambda::action<2, Act>, Args>::call(A&, B&, C&, Env&) const [with RET = double, A = double, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type, Act = boost::lambda::function_action<2, boost::lambda::detail::unspecified>, Args = boost::tuples::tuple<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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>]’ /home/jhouse/boost_1_33_1/boost/lambda/detail/lambda_functors.hpp:148: instantiated from ‘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 = double, T = boost::lambda::lambda_functor_base<boost::lambda::action<2, boost::lambda::function_action<2, boost::lambda::detail::unspecified> >, boost::tuples::tuple<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> >]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:119: instantiated from ‘static R boost::detail::function::function_obj_invoker1<FunctionObj, R, T0>::invoke(boost::detail::function::any_pointer, T0) [with FunctionObj = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:479: instantiated from ‘void boost::function1<R, T0, Allocator>::assign_to(FunctionObj, boost::detail::function::function_obj_tag) [with FunctionObj = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double, Allocator = std::allocator<boost::function_base>]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:430: instantiated from ‘void boost::function1<R, T0, Allocator>::assign_to(Functor) [with Functor = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double, Allocator = std::allocator<boost::function_base>]’ /home/jhouse/boost_1_33_1/boost/function/function_template.hpp:294: instantiated from ‘boost::function1<R, T0, Allocator>::function1(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = 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<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double), 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> > >, R = double, T0 = double, Allocator = std::allocator<boost::function_base>]’ test.cpp:39: instantiated from ‘GTPFunctionObject* GTPCommandCallBack1(boost::function1<R0, T0, std::allocator<boost::function_base> >*) [with R0 = void, T0 = int]’ test.cpp:44: instantiated from here /home/jhouse/boost_1_33_1/boost/tuple/detail/tuple_basic.hpp:121: error: invalid initialization of reference of type ‘double (&)(boost::function1<void, int, std::allocator<boost::function_base> >*, double)const’ from expression of type ‘const boost::tuples::detail::non_storeable_type<double ()(boost::function1<void, int, std::allocator<boost::function_base> >*, double)>’

Jason House wrote:
template<typename T0> struct type_wrapper1<void,T0>{ static double wrap(boost::function1<void,T0>* callback_function, double cmd){ unsigned int position; T0 a0; (*callback_function)(a0); }; };
};
template<typename R0, typename T0> GTPFunctionObject* GTPCommandCallBack1(boost::function1<R0,T0> *callback_function){ return new GTPFunctionObject(boost::lambda::bind((gtp_detail::type_wrapper1<R0,T0>::wrap),boost::lambda::_1));
I've no idea what are you trying to do here, but wrap takes two arguments, and you only pass one. Probably a missing "callback_function," before the _1. Why are you allocating the function1 on the heap? Once you put it into lambda::bind it would be hard to not leak it. :-)

hi! I want to cross compile boost for an ARM processor. For a pxa 270. but when i try to cross compile boost with arm-linux-g++ , it dosen't work ... a proble with jam... everyone can help me? Thank you BEST REGARDS Rémi __________________________________________________ Do You Yahoo!? En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités http://mail.yahoo.fr Yahoo! Mail
participants (3)
-
Jason House
-
Peter Dimov
-
remi