19 #ifndef GEOSX_DATAREPOSITORY_REFERENCEWRAPPER_HPP_ 20 #define GEOSX_DATAREPOSITORY_REFERENCEWRAPPER_HPP_ 23 #include <type_traits> 47 template<
typename T >
90 source.m_ref =
nullptr;
100 m_ref = source.m_ref;
115 template<
typename T_RHS,
typename U=T >
117 typename std::enable_if< !std::is_const< U >::value,
ReferenceWrapper & >::type
133 *m_ref = std::move( source );
140 inline operator T & ()
148 inline operator T
const & ()
const 157 inline void set( T & source )
166 inline void set( T * source )
184 inline T
const &
get()
const 220 template<
typename INDEX_TYPE,
typename U = T >
221 inline decltype( std::declval< U >()[1] )
222 operator[]( INDEX_TYPE
const i )
233 template<
typename INDEX_TYPE,
typename U = T >
234 inline decltype( std::declval< U const >()[1] )
235 operator[]( INDEX_TYPE
const i )
const 248 template<
typename ... ARGS >
249 inline typename std::result_of< T & (ARGS&&...) >::type
252 return m_ref->operator()( std::forward< ARGS >(args)... );
261 template<
typename ... ARGS >
262 inline typename std::result_of< T
const&(ARGS&&...) >::type
265 return m_ref->operator()( std::forward< ARGS >(args)... );
ReferenceWrapper(T &source) noexcept
Constructor that sets m_ref to address of input.
std::result_of< T const &(ARGS &&...) >::type operator()(ARGS &&... args) const
A pass thru parenthesis operator which calls underlying T::operator().
~ReferenceWrapper()=default
Default destructor.
bool isValid() const
Check if reference is initialized.
ReferenceWrapper(ReferenceWrapper const &source)
Copy constructor copies the source m_ref to the new m_ref.
T const * getPtr() const
Const accessor for m_ref.
ReferenceWrapper & operator=(ReferenceWrapper const &source)
Copy assignment operator.
ReferenceWrapper(ReferenceWrapper &&source)
Move constructor copies the source m_ref to the new m_ref.
ReferenceWrapper & operator=(T &&source)
Move assignment operator.
std::enable_if< !std::is_const< U >::value, ReferenceWrapper &>::type operator=(T_RHS const &rhs)
Assignment operator.
ReferenceWrapper()
Default constructor sets m_ref to nullptr.
std::result_of< T &(ARGS &&...) >::type operator()(ARGS &&... args)
A pass thru parenthesis operator which calls underlying T::operator().