On 8/9/07, chun ping wang wrote:
sorry, my bad.
you should use std::pair country_kv;
replace countries_t in the lambda code with country_kv;
this should work.
This doesn't compile either:
int main()
{
typedef std::map countries_t;
countries_t countries;
countries[0] = 5;
countries[1] = 3;
countries[2] = 1;
typedef vector countries1_t;
countries1_t countries1;
for (countries_t::const_iterator i = countries.begin(); i !=
countries.end(); i++)
countries1.push_back(i);
typedef std::pair country_kv;
sort(countries1.begin(), countries1.end(),
bll::bind(&country_kv::second, _1) < bll::bind(&country_kv::second,
_2));
return 0;
}
------ Build started: Project: Lambda Test, Configuration: Debug Win32 ------
Compiling...
Lambda Test.cpp
c:\vc\misc\include\boost\lambda\detail\actions.hpp(87) : error C2665:
'boost::lambda::function_adaptor<Func>::apply' : none of the 8
overloads could convert all the argument types
with
[
Func=int std::pair::*
]
c:\vc\misc\include\boost\lambda\detail\function_adaptors.hpp(117):
could be 'RET boost::lambda::function_adaptor<Func>::apply<RET>(T
std::pair<_Ty1,_Ty2>::* ,Object &)'
with
[
RET=int &,
Func=int std::pair::* ,
T=int,
_Ty1=int,
_Ty2=int,
Object=std::pair
]
c:\vc\misc\include\boost\lambda\detail\function_adaptors.hpp(121):
or 'RET boost::lambda::function_adaptor<Func>::apply<RET>(T
std::pair<_Ty1,_Ty2>::* ,const Object &)'
with
[
RET=int &,
Func=int std::pair::* ,
T=int,
_Ty1=int,
_Ty2=int,
Object=std::pair
]
c:\vc\misc\include\boost\lambda\detail\function_adaptors.hpp(125):
or 'RET boost::lambda::function_adaptor<Func>::apply<RET>(T
std::pair<_Ty1,_Ty2>::* ,volatile Object &)'
with
[
RET=int &,
Func=int std::pair::* ,
T=int,
_Ty1=int,
_Ty2=int,
Object=std::pair
]
c:\vc\misc\include\boost\lambda\detail\function_adaptors.hpp(129):
or 'RET boost::lambda::function_adaptor<Func>::apply<RET>(T
std::pair<_Ty1,_Ty2>::* ,volatile const Object &)'
with
[
RET=int &,
Func=int std::pair::* ,
T=int,
_Ty1=int,
_Ty2=int,
Object=std::pair
]
c:\vc\misc\include\boost\lambda\detail\function_adaptors.hpp(133):
or 'RET boost::lambda::function_adaptor<Func>::apply<RET>(T
std::pair<_Ty1,_Ty2>::* ,Object *)'
with
[
RET=int &,
Func=int std::pair::* ,
T=int,
_Ty1=int,
_Ty2=int,
Object=std::pair
]
c:\vc\misc\include\boost\lambda\detail\function_adaptors.hpp(137):
or 'RET boost::lambda::function_adaptor<Func>::apply<RET>(T
std::pair<_Ty1,_Ty2>::* ,const Object *)'
with
[
RET=int &,
Func=int std::pair::* ,
T=int,
_Ty1=int,
_Ty2=int,
Object=std::pair
]
c:\vc\misc\include\boost\lambda\detail\function_adaptors.hpp(141):
or 'RET boost::lambda::function_adaptor<Func>::apply<RET>(T
std::pair<_Ty1,_Ty2>::* ,volatile Object *)'
with
[
RET=int &,
Func=int std::pair::* ,
T=int,
_Ty1=int,
_Ty2=int,
Object=std::pair
]
c:\vc\misc\include\boost\lambda\detail\function_adaptors.hpp(145):
or 'RET boost::lambda::function_adaptor<Func>::apply<RET>(T
std::pair<_Ty1,_Ty2>::* ,volatile const Object *)'
with
[
RET=int &,
Func=int std::pair::* ,
T=int,
_Ty1=int,
_Ty2=int,
Object=std::pair
]
while trying to match the argument list '(rt0 ,
std::_Tree<_Traits>::const_iterator)'
with
[
_Traits=std::_Tmap_traits>,false>
]
c:\vc\misc\include\boost\lambda\detail\lambda_functor_base.hpp(408)
: see reference to function template instantiation 'RET
boost::lambda::function_action<I>::apply::const_iterator>(A1 &,A2 &)' being compiled
with
[
RET=int &,
I=2,
U=rt0,
_Traits=std::_Tmap_traits>,false>,
A1=rt0,
A2=std::_Tree>,false>>::const_iterator
]
c:\vc\misc\include\boost\lambda\detail\select_functions.hpp(30)
: see reference to function template instantiation 'RET
boost::lambda::lambda_functor_base::call(A
&,B &,C &,Env &) const' being compiled
with
[
RET=int &,
Act=boost::lambda::action<2,boost::lambda::function_action<2>>,
Args=boost::tuples::tuple::* const
,const boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type>,
A=std::_Tree>,false>>::const_iterator,
B=std::_Tree>,false>>::const_iterator,
C=const boost::tuples::null_type,
Env=const boost::tuples::null_type
]
c:\vc\misc\include\boost\lambda\detail\operator_lambda_func_base.hpp(218)
: see reference to function template instantiation 'int
&boost::lambda::detail::select,A,B,C,Env>(const
boost::lambda::lambda_functor<T> &,A &,B &,C &,Env &)' being compiled
with
[
Act=boost::lambda::action<2,boost::lambda::function_action<2>>,
Args=boost::tuples::tuple::* const
,const boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type>,
A=std::_Tree>,false>>::const_iterator,
B=std::_Tree>,false>>::const_iterator,
C=const boost::tuples::null_type,
Env=const boost::tuples::null_type,
T=boost::lambda::lambda_functor_base>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type>>
]
c:\vc\misc\include\boost\lambda\detail\lambda_functors.hpp(156)
: see reference to function template instantiation 'RET
boost::lambda::lambda_functor_base::call(A &,B &,C
&,Env &) const' being compiled
with
[
RET=bool,
Act=boost::lambda::relational_actionboost::lambda::less_action,
Args=boost::tuples::tuple>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type>>>,boost::lambda::lambda_functor>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::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>,
A=std::_Tree>,false>>::const_iterator,
B=std::_Tree>,false>>::const_iterator,
C=const boost::tuples::null_type,
Env=const boost::tuples::null_type
]
c:\program files\microsoft visual studio
8\vc\include\algorithm(3181) : see reference to function template
instantiation 'bool boost::lambda::lambda_functor<T>::operator
()::const_iterator,std::_Tree<_Traits>::const_iterator>(A
&,B &) const' being compiled
with
[
T=boost::lambda::lambda_functor_baseboost::lambda::less_action,boost::tuples::tuple>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type>>>,boost::lambda::lambda_functor>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::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>>,
_Traits=std::_Tmap_traits>,false>,
A=std::_Tree>,false>>::const_iterator,
B=std::_Tree>,false>>::const_iterator
]
c:\program files\microsoft visual studio
8\vc\include\algorithm(3237) : see reference to function template
instantiation 'std::pair<_Ty1,_Ty2>
std::_Unguarded_partition<_RanIt,_Pr>(_RanIt,_RanIt,_Pr)' being
compiled
with
[
_Ty1=std::_Vector_iterator>,false>>::const_iterator,std::allocator>,false>>::const_iterator>>,
_Ty2=std::_Vector_iterator>,false>>::const_iterator,std::allocator>,false>>::const_iterator>>,
_RanIt=std::_Vector_iterator>,false>>::const_iterator,std::allocator>,false>>::const_iterator>>,
_Pr=boost::lambda::lambda_functorboost::lambda::less_action,boost::tuples::tuple>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type>>>,boost::lambda::lambda_functor>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::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:\program files\microsoft visual studio
8\vc\include\algorithm(3261) : see reference to function template
instantiation 'void std::_Sort,__w64
int,_Pr>(_RanIt,_RanIt,_Diff,_Pr)' being compiled
with
[
_Ty=std::_Tree>,false>>::const_iterator,
_Alloc=std::allocator>,false>>::const_iterator>,
_Pr=boost::lambda::lambda_functorboost::lambda::less_action,boost::tuples::tuple>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type>>>,boost::lambda::lambda_functor>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::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>>>,
_RanIt=std::_Vector_iterator>,false>>::const_iterator,std::allocator>,false>>::const_iterator>>,
_Diff=__w64 int
]
c:\vc\temp\lambda test\lambda test.cpp(27) : see reference to
function template instantiation 'void
std::sort,boost::lambda::lambda_functor<T>>(_RanIt,_RanIt,_Pr)'
being compiled
with
[
_Ty=std::_Tree>,false>>::const_iterator,
_Alloc=std::allocator>,false>>::const_iterator>,
T=boost::lambda::lambda_functor_baseboost::lambda::less_action,boost::tuples::tuple>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type>>>,boost::lambda::lambda_functor>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::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>>,
_RanIt=std::_Vector_iterator>,false>>::const_iterator,std::allocator>,false>>::const_iterator>>,
_Pr=boost::lambda::lambda_functorboost::lambda::less_action,boost::tuples::tuple>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type>>>,boost::lambda::lambda_functor>,boost::tuples::tuple::* const ,const
boost::lambda::lambda_functor>,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::type,boost::lambda::detail::bind_traitsboost::tuples::null_type::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>>>
]
Lambda Test - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========