|
Boost : |
From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-11-08 10:15:47
This must be a common question.
I want to use std::transform with a function object that is expensive to
copy, so I want to pass by reference. I tried to use boost::ref for this,
but this simple test doesn't work:
struct Op {
int operator() (int x) { return 1 + x;}
Op() {}
private:
Op (const Op&);
};
int main() {
vector<int> x (4);
vector<int> y (4);
Op o;
std::transform (x.begin(), x.end(), y.begin(), boost::ref(o));
}
Any suggestion?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk