From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-15 00:28:33
Any syntax you propose is fine with me, as long as I can provide a function
interface that the user doesn't have to think about. In particular, the user
shouldn't have to write "ref". If it could be done with a template function
that wraps the object up in a ref and passes off a function<...> to the
function that does the work, I'm happy.
----- Original Message -----
From: "Douglas Gregor" <gregod_at_[hidden]>
> I see now what you mean. You want the function library to essentially hold
> reference/pointer to the function object you pass in and not ever make a
> of it.
> If this were to be an addition to the function library, would you have a
> preferred form? The only form I can think of would be to reuse the "ref"
> function used by bind, so one would have:
> void foo(boost::function<...> func);
> template<typename F>
> void bar(F f)
> foo(ref(f)); // boost::function won't allocate any memory or copy f
> > > An alternative that would work right now would be to use a custom
> > allocator.
> > How would that help?
> Well, it can solve the stateless function object problem, but not the
> you're facing.
> I'd be willing to support the abovementioned syntax.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk