Boost logo

Boost Users :

From: Jens Theisen (jens-theisen-tmp01_at_[hidden])
Date: 2006-08-21 16:54:48


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 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