...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::reference_wrapper — Contains a reference to an object of type `T`.
// In header: <boost/core/ref.hpp> template<typename T> class reference_wrapper { public: // types typedef T type; // construct/copy/destruct explicit reference_wrapper(T &); reference_wrapper(T &&); // public member functions operator T &() const; T & get() const; T * get_pointer() const; };
`reference_wrapper` is primarily used to "feed" references to function templates (algorithms) that take their parameter by value. It provides an implicit conversion to `T&`, which usually allows the function templates to work on references unmodified.