|
Boost Users : |
From: Nelis Franken (nfranken_at_[hidden])
Date: 2006-08-22 05:48:14
Thanks Jens! That works great...
-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Jens Theisen
Sent: 21 August 2006 10:55 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Problem binding a predicate to random_shuffle()
Nelis Franken wrote:
> Any ideas anyone?
The problem is that the temporary object returned by boost::bind doesn't
bind to the non-const reference random_shuffle accepts.
I'm not sure if there is a nicer solution to using boost::function, as
the return type of boost::bind is unspecified.
#include <boost/function.hpp>
void myShuffle() {
boost::function< int (int) > rand
= boost::bind(&Foo::customRand, this, _1);
random_shuffle(dataVector.begin(), dataVector.end(), rand);
}
Jens
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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