
23 Oct
2006
23 Oct
'06
8:26 p.m.
"Sebastian Weber" <sebastian.weber@physik.tu-darmstadt.de> wrote
I'm about to explore the power of boost::bind, but I am still a beginner. Maybe the question is rather stupid, but the following code does not compile and I do not understand why:
typedef std::vector<std::size_t> data_t;
data_t dataVec;
... populate dataVec ...
std::size_t shiftIndex = 3;
boost::function<std::size_t& (std::size_t)> shiftedData = boost::bind(&data_t::at, &dataVec, _1 - shiftIndex);
The following should work: boost::function<std::size_t& (std::size_t)> shiftedData = boost::bind(&data_t::at, &dataVec, boost::bind(std::minus<size_t>(), _1, shiftIndex)); HTH, Arkadiy