Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-12-14 20:12:24


I also note the following, which I think is out-of-date, since it doesn't
apply when the function is held by reference:

Copying efficiency
Copying function object wrappers requires allocating member for a copy of
the function object target. The default allocator may be replaced with a
faster custom allocator if the cost of this cloning becomes prohibitive.

----- Original Message -----
From: "David Abrahams" <david.abrahams_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, December 14, 2001 7:58 PM
Subject: [boost] Function documentation omission?

> At my request, Doug Gregor very kindly (and elegantly!) implemented
> reference semantics for boost::function. Now the docs say:
>
> ---
> References to Functions
> In some cases it is expensive (or semantically incorrect) to have
> Boost.Function clone a function object. In such cases, it is possible to
> request that Boost.Function keep only a reference to the actual function
> object. This is done using the ref and cref functions to wrap a reference
to
> a function object:
> stateful_type a_function_object;
> boost::function<int, int> f;
> f = ref(a_function_object);
>
> boost::function<int, int> f2(f);
>
> Here, f will not make a copy of a_function_object, nor will f2 when it is
> targeted to f's reference to a_function_object. Additionally, when using
> references to function objects, Boost.Function will not throw exceptions
> during assignment.
> ---
>
> The reason for my request, however was that I wanted to avoid exceptions
> during construction. Is that already implemented, or not?
>
> The message at: http://groups.yahoo.com/group/boost/message/21065
> seems to indicate that it is.
>
> -Dave
>
> ===================================================
> David Abrahams, C++ library designer for hire
> resume: http://users.rcn.com/abrahams/resume.html
>
> C++ Booster (http://www.boost.org)
> email: david.abrahams_at_[hidden]
> ===================================================
>
>
> Info: http://www.boost.org Send unsubscribe requests to:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk