OOLua  2.0.1
C++ and Lua binding
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Shared Pointer

Enable and configure library support for a shared pointer type. More...


 Default: Disabled More...
 Default: MSC: <memory> other compilers: <tr1/memory> More...
 Default: std::tr1::shared_ptr More...
 Default: std::tr1::const_pointer_cast More...
 Default: Disabled More...

Detailed Description

Enable and configure library support for a shared pointer type.

Requirements for the shared pointer type.

Defaults for the configuration options in this category only apply when shared pointer support is enabled.

Macro Definition Documentation


Default: Disabled

When compiled with support for a shared pointer type (OOLUA_USE_SHARED_PTR) and in a situation that requires the allocation of a proxy type, then how the situation is handled depends upon this configuration value and possibly Shared Tags defined for the proxy. The resulting pointer can either be a 'Raw' pointer or a 'Shared' pointer that retains shared ownership . Allocation of a proxy occurs for functions and operators that return a non-integral on the C stack and constructors.

Configuration value Has Shared tag Has No_shared tag Pointer type
Disabled No X Raw
Disabled Yes X Shared
Enabled X No Shared
Enabled X Yes Raw
See Also

Default: std::tr1::const_pointer_cast

Templated function which casts away constness for the shared pointer type.


Default: MSC: <memory> other compilers: <tr1/memory>

Header file for the shared pointer type, library code will include the header using :


Default: std::tr1::shared_ptr

The templated shared pointer type.


Default: Disabled

Configuration option to enable or disable the support of a shared pointer type for OOLua proxies.

When enabled the library supports:

  • pushing a shared pointer to the stack
  • pulling a shared pointer from the stack(only defined when it is a shared pointer)
  • pulling a raw pointer from a stack that contains a shared pointer(It is up to the user of the library to ensure the type will not be garbage collected)
  • functions that return a shared pointer
  • functions that return a shared pointer and have the OOLUA::maybe_null trait
  • functions that take a shared pointer as a parameter
  • decaying of a shared pointer to a raw pointer for functions parameters(The raw pointer is defined to be valid for the duration of the call)
    The OOLUA::Shared and OOLUA::No_shared tags maybe ignored, as they are dependent on the value of OOLUA_NEW_POINTER_DEFAULT_IS_SHARED_TYPE