Ardour  9.0-pre0-582-g084a23a80d
Stack< T > Struct Template Reference

#include <Userdata.h>

Static Public Member Functions

static void push (lua_State *L, T const &t)
 
static std::conditional_t< passByValueNotEnum, T const &, T > get (lua_State *L, int index)
 

Static Private Attributes

static constexpr bool passByContainer = TypeTraits::isContainer<T>::value
 
static constexpr bool passByValueNotEnum = !passByContainer && !std::is_enum_v<T>
 
static constexpr bool passByValueEnum = !passByContainer && std::is_enum_v<T>
 

Detailed Description

template<class T>
struct Stack< T >

Lua stack conversions for class objects passed by value.

Definition at line 617 of file Userdata.h.

Member Function Documentation

◆ get()

template<class T >
static std::conditional_t<passByValueNotEnum, T const&, T> Stack< T >::get ( lua_State L,
int  index 
)
inlinestatic

Definition at line 667 of file Userdata.h.

◆ push()

template<class T >
static void Stack< T >::push ( lua_State L,
T const &  t 
)
inlinestatic

Definition at line 646 of file Userdata.h.

Member Data Documentation

◆ passByContainer

template<class T >
constexpr bool Stack< T >::passByContainer = TypeTraits::isContainer<T>::value
staticconstexprprivate

Pass by container.

The container controls the object lifetime. Typically this will be a lifetime shared by C++ and Lua using a reference count. Because of type erasure, containers like std::shared_ptr will not work. Containers must either be of the intrusive variety, or in the style of the RefCountedPtr type provided by LuaBridge (that uses a global hash table).

Definition at line 631 of file Userdata.h.

◆ passByValueEnum

template<class T >
constexpr bool Stack< T >::passByValueEnum = !passByContainer && std::is_enum_v<T>
staticconstexprprivate

Definition at line 642 of file Userdata.h.

◆ passByValueNotEnum

template<class T >
constexpr bool Stack< T >::passByValueNotEnum = !passByContainer && !std::is_enum_v<T>
staticconstexprprivate

Pass by value.

Lifetime is managed by Lua. A C++ function which accesses a pointer or reference to an object outside the activation record in which it was retrieved may result in undefined behavior if Lua garbage collected it.

Definition at line 641 of file Userdata.h.


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