|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-10-15 10:39:23
On Tuesday 15 October 2002 11:31 am, Neal D. Becker wrote:
> I noticed the new ref.hpp. The description sounds like just what I
> need. I want to pass a function object to std::generate by reference.
>
> I made a small test, but it doesn't work. Am I doing something wrong,
> or is ref.hpp not the solution to my problem?
ref.hpp was supposed to be the solution to your problem, but it isn't yet.
It's more like a cue to other function object libraries (Bind, Lambda,
Function) to keep a reference. You can use:
std::generate_n (ostream_iterator<int> (cout, " "), 10,
boost::bind<int>(boost::ref(c)));
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk