S
silverburgh.meryl
I have code which uses Boost lambda in a template like this:
using namespace boost::lambda;
template<class T>
bool lessThanXY( T& src, T& dest ) {
return (src.getY() < dest.getY());
}
template<class T1, class T2>
void sortXY(T1& list) {
::sort( list.begin(), list.end(), bind:lessThanXY<T2>, *(_1),
*(_2) ) );
}
But when I instantiate the template like this, I get the following
compile error:
class Rect;
typedef list<Rect*> RectList;
void sortXYRectList(RectList& rl) {
sortXYWithThreshold<RectList, Rect>(rl);
}
/usr/include/boost/lambda/detail/lambda_traits.hpp:389: error:
ignoring 'const' qualifiers added to function type 'bool ()(Rect&,
Rect&)const'
gmake[5]: *** [RectUtils.o] Error 1
Can you please tell me how to fix my problem ? I did not use 'const'
anywhere in my template, why I get this error:
error: ignoring 'const' qualifiers added to function type 'bool
()(Rect&, Rect&)const'
using namespace boost::lambda;
template<class T>
bool lessThanXY( T& src, T& dest ) {
return (src.getY() < dest.getY());
}
template<class T1, class T2>
void sortXY(T1& list) {
::sort( list.begin(), list.end(), bind:lessThanXY<T2>, *(_1),
*(_2) ) );
}
But when I instantiate the template like this, I get the following
compile error:
class Rect;
typedef list<Rect*> RectList;
void sortXYRectList(RectList& rl) {
sortXYWithThreshold<RectList, Rect>(rl);
}
/usr/include/boost/lambda/detail/lambda_traits.hpp:389: error:
ignoring 'const' qualifiers added to function type 'bool ()(Rect&,
Rect&)const'
gmake[5]: *** [RectUtils.o] Error 1
Can you please tell me how to fix my problem ? I did not use 'const'
anywhere in my template, why I get this error:
error: ignoring 'const' qualifiers added to function type 'bool
()(Rect&, Rect&)const'