Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.lamba compile errror....
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-29 15:26:55


AMDG

Joost Kraaijeveld wrote:
> I want to sort a Matrix of Vectors according to their difference in
> length to some arbitrary Vector. e.g:
>
> template< typename T>
> struct MatrixVector : std::vector< T >
> {
> ...
> double length() const;
> MatrixVector<T> difference(const MatrixVector< T>& rhs) const;
> ...
> }
>
> <snip>
> std::sort( matrix.begin(),
> matrix.end(),
> boost::lambda::bind(&Vector::difference, boost::lambda::_1, observation).length()
> <
> boost::lambda::bind(&Vector::difference, boost::lambda::_2, observation).length()
> );
>

You have to use bind for length exactly like you used bind for
difference.

In Christ,
Steven Watanabe


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