|
Boost Users : |
From: Martin Fisher (mnfisher_at_[hidden])
Date: 2007-11-28 05:13:33
I'm trying to use boost::bind - and I'm probably doing something very
obviously wrong, but code blindness has set in.
A simple example:
I have
class X {
public:
void t(int a, int b) { cout << a * b << endl; }
};
then in main...
vector<int> v; // filled with some ints
for_each(v.begin(), v.end(), boost::bind(&X::t, _1, 4)); // or _1, 4
But this doesn't compile - using Borland Turbo C++ (or Visual C++)
Elsewhere in my code I use
for_each(istream_iterator<string>(f),
istream_iterator<string>(), boost::bind(Inserter<T>(), boost::ref(m), _1));
Which works just fine...
I'm sure it's something strikingly obvious - but as far as I can see I'm
doing much the same as in the docs ?
Thanks for any comments.
Martin
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