20 #ifndef GEOS_DATAREPOSITORY_REFERENCEWRAPPER_HPP_
21 #define GEOS_DATAREPOSITORY_REFERENCEWRAPPER_HPP_
24 #include <type_traits>
48 template<
typename T >
91 source.m_ref =
nullptr;
101 m_ref = source.m_ref;
116 template<
typename T_RHS,
typename U=T >
118 typename std::enable_if< !std::is_const< U >::value,
ReferenceWrapper & >::type
134 *m_ref = std::move( source );
141 inline operator T & ()
149 inline operator T
const & ()
const
158 inline void set( T & source )
167 inline void set( T * source )
185 inline T
const &
get()
const
221 template<
typename INDEX_TYPE,
typename U = T >
222 inline decltype( std::declval< U >()[1] )
223 operator[]( INDEX_TYPE const i )
234 template<
typename INDEX_TYPE,
typename U = T >
235 inline decltype( std::declval< U const >()[1] )
236 operator[]( INDEX_TYPE const i )
const
249 template<
typename ... ARGS >
250 inline typename std::result_of< T & (ARGS&&...) >::type
253 return m_ref->operator()( std::forward< ARGS >(args)... );
262 template<
typename ... ARGS >
263 inline typename std::result_of< T
const&(ARGS&&...) >::type
266 return m_ref->operator()( std::forward< ARGS >(args)... );
T const * getPtr() const
Const accessor for m_ref.
std::enable_if< !std::is_const< U >::value, ReferenceWrapper & >::type operator=(T_RHS const &rhs)
Assignment operator.
ReferenceWrapper(ReferenceWrapper &&source)
Move constructor copies the source m_ref to the new m_ref.
bool isValid() const
Check if reference is initialized.
std::result_of< T &(ARGS &&...) >::type operator()(ARGS &&... args)
A pass thru parenthesis operator which calls underlying T::operator().
ReferenceWrapper & operator=(ReferenceWrapper const &source)
Copy assignment operator.
std::result_of< T const &(ARGS &&...) >::type operator()(ARGS &&... args) const
A pass thru parenthesis operator which calls underlying T::operator().
void set(T &source)
Set the address that m_ref points to.
~ReferenceWrapper()=default
Default destructor.
T & get()
Accessor for m_ref.
ReferenceWrapper(T &source) noexcept
Constructor that sets m_ref to address of input.
T const & get() const
Const accessor for m_ref.
void set(T *source)
Set the address that m_ref points to.
ReferenceWrapper & operator=(T &&source)
Move assignment operator.
ReferenceWrapper()
Default constructor sets m_ref to nullptr.
ReferenceWrapper(ReferenceWrapper const &source)
Copy constructor copies the source m_ref to the new m_ref.