Boost logo

Boost Users :

From: Meryl Silverburgh (silverburgh.meryl_at_[hidden])
Date: 2007-02-24 15:52:30


Hi,

I have code which uses Boost lambda in a template like this:

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'


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net