reference_wrapper

The reference_wrapper is a templated wrapper class that behaves as an assignable reference.

  template <class T> class reference_wrapper
  
Remarks

You can pass reference_wrapper's around, and even put them into containers.

The reference_wrapper also serves as a marker for some packages that explicitly look for it, and behave differently when they find it. For example if you send a reference_wrapper to the function make_tuple, a T& will be put in the tuple instead of a T or a reference_wrapper<T>. See see the description of tuple for more details.

The templace class reference_wrapper can also be used as a function object. It is instantiated with a function pointer or function object.

See Also

tuple, cref, ref