Class template reference_wrapper
boost::reference_wrapper —
Contains a reference to an object of type
T
.
Synopsis
Description
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.
reference_wrapper
construct/copy/destruct
-
explicit reference_wrapper(T& t);
Effects: |
Constructs a
reference_wrapper
object that stores a reference to
t . |
Throws: |
Does not throw. |
reference_wrapper
access
-
operator T&() const;
Returns: |
The stored reference. |
Throws: |
Does not throw. |
-
T& get() const;
Returns: |
The stored reference. |
Throws: |
Does not throw. |
-
T* get_pointer() const;
Returns: |
A pointer to the object referenced by the stored reference. |
Throws: |
Does not throw. |
reference_wrapper
constructors
-
reference_wrapper<T> ref(T& t);
-
reference_wrapper<T const> cref(T const& t);