Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Reference Wrappers.

#include <boost/tr1/functional.hpp>

or

#include <functional>

The Ref library is a small library that is useful for passing references to function templates (algorithms) that would usually take copies of their arguments. It defines the class template reference_wrapper<T>, and the two functions ref and cref that return instances of reference_wrapper<T>. Refer to Boost.Bind for more information.

namespace std {
namespace tr1 {

template <class T> class reference_wrapper;

template <class T> reference_wrapper<T> ref(T&);
template <class T> reference_wrapper<const T> cref(const T&);
template <class T> reference_wrapper<T> ref(reference_wrapper<T>);
template <class T> reference_wrapper<const T> cref(reference_wrapper<T>);

} // namespace tr1
} // namespace std

Configuration: Boost.Config should (automatically) define the macro BOOST_HAS_TR1_REFERENCE_WRAPPER if your standard library implements this part of TR1.

Standard Conformity: The Boost version of this this component does not currently support function call invocation (2.1.2.4), or derivation from std::unary_function or std::binary_function (2.1.2 paragraphs 3 and 4).

The Boost version is not implicitly convertible to T& as the TR requires.


PrevUpHomeNext