Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
std::reference_wrapper< T > Class Template Reference

wraps a reference in a copyable and assignable object More...

Inheritance diagram for std::reference_wrapper< T >:
Inheritance graph

Public Types

using type = T
 Wrapped type.
 

Public Member Functions

 reference_wrapper (T &&)=delete
 Cannot be constructed from an rvalue reference.
 
 reference_wrapper (T &to_wrap) noexcept
 Construct a reference_wrapper around a given input. Wrapped object must have an lvalue reference address and not be the same type of reference_wrapper.
 
auto get () const noexcept -> T &
 Access the stored reference.
 
 operator T& () const noexcept
 Access the stored reference.
 
template<class... Args, arene::base::constraints< enable_if_t< arene::base::is_invocable_v< T &, Args... > > > = nullptr>
auto operator() (Args &&... args) const noexcept(arene::base::is_nothrow_invocable_v< T &, Args... >) -> arene::base::invoke_result_t< T &, Args... >
 Calls the stored function with given args. Only available if the stored type is callable.
 

Detailed Description

template<typename T>
class std::reference_wrapper< T >

wraps a reference in a copyable and assignable object

Forward declare reference wrapper for use in is_reference_wrapper.hpp This will avoid a circular dependency.

Template Parameters
TType of the reference
Tvalue type of the reference

Member Typedef Documentation

◆ type

template<typename T>
using std::reference_wrapper< T >::type = T

Wrapped type.

Constructor & Destructor Documentation

◆ reference_wrapper() [1/2]

template<typename T>
std::reference_wrapper< T >::reference_wrapper ( T & to_wrap)
inlinenoexcept

Construct a reference_wrapper around a given input. Wrapped object must have an lvalue reference address and not be the same type of reference_wrapper.

Template Parameters
UType of passed object or function to wrap
Parameters
to_wrapor function to wrap

◆ reference_wrapper() [2/2]

template<typename T>
std::reference_wrapper< T >::reference_wrapper ( T && )
delete

Cannot be constructed from an rvalue reference.

Member Function Documentation

◆ get()

template<typename T>
auto std::reference_wrapper< T >::get ( ) const -> T&
inlinenoexcept

Access the stored reference.

Returns
The reference wrapped by this instance

◆ operator T&()

template<typename T>
std::reference_wrapper< T >::operator T& ( ) const
inlinenoexcept

Access the stored reference.

Returns
The reference wrapped by this instance

◆ operator()()

template<typename T>
template<class... Args, arene::base::constraints< enable_if_t< arene::base::is_invocable_v< T &, Args... > > > = nullptr>
auto std::reference_wrapper< T >::operator() ( Args &&... args) const -> arene::base::invoke_result_t<T&, Args...>
inlinenoexcept

Calls the stored function with given args. Only available if the stored type is callable.

Parameters
argsArguments to forward to the stored function
Returns
The result of invoking the wrapped function

The documentation for this class was generated from the following file: