
8 Nov
2004
8 Nov
'04
3:15 p.m.
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?
7522
Age (days ago)
7522
Last active (days ago)
0 comments
1 participants
participants (1)
-
Neal D. Becker