|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-12-14 19:58:38
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] ===================================================
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk