AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
aui::no_escape< T > Struct Template Reference

Does not allow escaping, allowing to accept lvalue ref, rvalue ref, shared_ptr and etc without overhead. More...

#include <AUI/Traits/values.h>

Public Member Functions#

 no_escape (T &value)
 
 no_escape (T &&value)
 
 no_escape (T *value)
 
 no_escape (const _< T > &value)
 
 no_escape (const _unique< T > &value)
 
template<typename DerivedFromT, std::enable_if_t< std::is_base_of_v< T, DerivedFromT > &&!std::is_same_v< DerivedFromT, T >, bool > = true>
 no_escape (const _< DerivedFromT > &value)
 
template<typename DerivedFromT, std::enable_if_t< std::is_base_of_v< T, DerivedFromT > &&!std::is_same_v< DerivedFromT, T >, bool > = true>
 no_escape (const _unique< DerivedFromT > &value)
 
T * ptr () const noexcept
 
T * operator-> () const noexcept
 
T & operator* () const noexcept
 

Detailed Description#

template<typename T>
struct aui::no_escape< T >

Promises that the contained object wouldn't be copied/moved/referenced outside of the function where the no_escape came to; thus does not take responsibility of deleting the object. This allows to accept any kind of lifetimes: lvalue and rvalue references, pointers, unique_ptr and shared_ptr without ref counter modification.

Intended to use in function arguments.

Accepts lvalue ref, rvalue ref, ptr and shared_ptr. Does not accepts null.

Template Parameters
Tundecorated type
Examples
examples/7guis/cells/src/Tokens.cpp, and examples/7guis/cells/src/Tokens.h.