1
爲什麼這個boost :: lambda表達式不起作用?這個boost :: lambda使用有什麼問題?
boost::function<bool (boost::uint64_t, boost::uint64_t&, unsigned int, float)> myFunct = boost::lambda::_3 < 1;
我得到了這些編譯錯誤,這可能不會有幫助,因爲它們真的很神祕。
|| In file included from /usr/include/boost/function/detail/maybe_include.hpp:33,
|| from /usr/include/boost/function/detail/function_iterate.hpp:14,
|| from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:67,
|| from /usr/include/boost/function.hpp:64,
|| from CMoteurRecherche.hpp:13,
|| from CBenchmark.hpp:4,
|| from CBenchmark.cpp:1:
|| /usr/include/boost/function/function_template.hpp: In static member function 'static R boost::detail::function::function_obj_invoker4<FunctionObj, R, T0, T1, T2, T3>::invoke(boost::detail::function::function_buffer&, T0, T1, T2, T3) [with FunctionObj = boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::explicit_return_type_action<bool>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::relational_action<boost::lambda::less_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<4> >, const int, 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, 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 = bool, T0 = long unsigned int, T1 = uint64_t&, T2 = unsigned int, T3 = float]':
/usr/include/boost/function/function_template.hpp|904| instantiated from 'void boost::function4<R, T1, T2, T3, T4>::assign_to(Functor) [with Functor = boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::explicit_return_type_action<bool>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::relational_action<boost::lambda::less_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<4> >, const int, 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, 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 = bool, T0 = long unsigned int, T1 = uint64_t&, T2 = uns
|| igned int, T3 = float]'
/usr/include/boost/function/function_template.hpp|720| instantiated from 'boost::function4<R, T1, T2, T3, T4>::function4(Functor, typename boost::enable_if_c<boost::type_traits::ice_not::value, int>::type) [with Functor = boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::explicit_return_type_action<bool>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::relational_action<boost::lambda::less_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<4> >, const int, 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, 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::nul
|| l_type> > >, R = bool, T0 = long unsigned int, T1 = uint64_t&, T2 = unsigned int, T3 = float]'
/usr/include/boost/function/function_template.hpp|1040| instantiated from 'boost::function<R(T0, T1, T2, T3)>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not::value, int>::type) [with Functor = boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::explicit_return_type_action<bool>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::relational_action<boost::lambda::less_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<4> >, const int, 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, 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 = bool, T0 = uint64_t, T1 = uint64_t&, T2 = unsigned int, T3 = float]'
/usr/include/boost/function/function_template.hpp|1081| instantiated from 'typename boost::enable_if_c<boost::type_traits::ice_not::value, boost::function<R(T0, T1, T2, T3)>&>::type boost::function<R(T0, T1, T2, T3)>::operator=(Functor) [with Functor = boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::explicit_return_type_action<bool>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::relational_action<boost::lambda::less_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<4> >, const int, 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, 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 = bool, T0 = uint64_t, T1 = uint64_t&, T2 = unsigned int, T3 = float]'
/home/mathmoi/MatMoi/CBenchmark.cpp|85| instantiated from here
/usr/include/boost/function/function_template.hpp|131| error: no match for call to '(boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::explicit_return_type_action<bool>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::relational_action<boost::lambda::less_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<4> >, const int, 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, 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> > >) (long unsigned int&, long unsigned int&, unsigned int&, float&)'
/usr/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::explicit_return_type_action<bool>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::relational_action<boost::lambda::less_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<4> >, const int, 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, 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> >]
我很高興我不用C++編碼:) – Skilldrick 2010-01-14 14:01:35