$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
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