meta  1.4.9
Public Member Functions | Friends | List of all members
meta::handle Class Reference

Meta handle object. More...

#include <meta.hpp>

Public Member Functions

 handle () noexcept
 Default constructor.
 
 handle (any &any) noexcept
 Constructs a meta handle from a meta any object. More...
 
template<typename Type , typename = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Type>>, handle>>>
 handle (Type &obj) noexcept
 Constructs a meta handle from a given instance. More...
 
meta::type type () const noexcept
 Returns the meta type of the underlying object. More...
 
const void * data () const noexcept
 Returns an opaque pointer to the contained instance. More...
 
void * data () noexcept
 Returns an opaque pointer to the contained instance. More...
 
 operator bool () const noexcept
 Returns false if a handle is empty, true otherwise. More...
 

Friends

class any
 A meta any is allowed to inherit from a meta handle.
 

Detailed Description

Meta handle object.

A meta handle is an opaque pointer to an instance of any type.

A handle doesn't perform copies and isn't responsible for the contained object. It doesn't prolong the lifetime of the pointed instance. Users are responsible for ensuring that the target object remains alive for the entire interval of use of the handle.

Definition at line 675 of file meta.hpp.

Constructor & Destructor Documentation

◆ handle() [1/2]

meta::handle::handle ( any any)
inlinenoexcept

Constructs a meta handle from a meta any object.

Parameters
anyA reference to an object to use to initialize the handle.

Definition at line 690 of file meta.hpp.

◆ handle() [2/2]

template<typename Type , typename = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Type>>, handle>>>
meta::handle::handle ( Type &  obj)
inlinenoexcept

Constructs a meta handle from a given instance.

Template Parameters
TypeType of object to use to initialize the handle.
Parameters
objA reference to an object to use to initialize the handle.

Definition at line 701 of file meta.hpp.

Member Function Documentation

◆ data() [1/2]

const void* meta::handle::data ( ) const
inlinenoexcept

Returns an opaque pointer to the contained instance.

Returns
An opaque pointer the contained instance, if any.

Definition at line 716 of file meta.hpp.

◆ data() [2/2]

void* meta::handle::data ( )
inlinenoexcept

Returns an opaque pointer to the contained instance.

Returns
An opaque pointer the contained instance, if any.

Definition at line 721 of file meta.hpp.

◆ operator bool()

meta::handle::operator bool ( ) const
inlineexplicitnoexcept

Returns false if a handle is empty, true otherwise.

Returns
False if the handle is empty, true otherwise.

Definition at line 729 of file meta.hpp.

◆ type()

meta::type meta::handle::type ( ) const
inlinenoexcept

Returns the meta type of the underlying object.

Returns
The meta type of the underlying object, if any.

Definition at line 1955 of file meta.hpp.


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