The instance class is used for forwarding the instance of an object to invoke a property or method. More...
#include <instance.h>
Public Member Functions | |
instance () noexcept | |
Creates an invalid instance object. | |
instance (const instance &other) noexcept | |
Copy constructor for an instance. | |
instance (const variant &var) noexcept | |
Creates an instance object from a variant object. | |
template<typename T , typename Tp = decay_instance_t<T>> | |
instance (T &data) noexcept | |
Creates an instance object from type T . | |
type | get_derived_type () const noexcept |
Returns the most derived type of the hold instance. | |
type | get_type () const noexcept |
Returns the type of the internally hold instance. | |
instance | get_wrapped_instance () const noexcept |
Returns an instance object for the wrapped instance. | |
bool | is_valid () const noexcept |
Returns true when the instance class contains a reference to an object. | |
operator bool () const noexcept | |
Returns true when the instance class contains a reference to an object. | |
template<typename Target_Type > | |
Target_Type * | try_convert () const noexcept |
This function will try to convert the underlying instance to the given type Target_Type* . | |
Detailed Description
Constructor & Destructor Documentation
◆ instance() [1/4]
|
noexcept |
Creates an invalid instance object.
Use this constructor, when you need to invoke a property or method where no instance is required.
◆ instance() [2/4]
Creates an instance object from a variant object.
◆ instance() [3/4]
◆ instance() [4/4]
|
noexcept |
Creates an instance object from type T
.
- Remarks
- Internally, the instance class will hold a reference to the address of the given object
data
.
Member Function Documentation
◆ get_derived_type()
|
noexcept |
Returns the most derived type of the hold instance.
See following example code:
◆ get_type()
|
noexcept |
◆ get_wrapped_instance()
|
noexcept |
Returns an instance object for the wrapped instance.
See following example code:
- Remarks
- When the current instance is not a wrapper type, an invalid instance will be returned.
- Returns
- An instance object from the wrapped type.
◆ is_valid()
|
noexcept |
Returns true when the instance class contains a reference to an object.
Otherwise false.
- Returns
- True when a reference is stored, otherwise false.
◆ operator bool()
|
explicitnoexcept |
Returns true when the instance class contains a reference to an object.
Otherwise false.
- Returns
- True when a reference is stored, otherwise false.
◆ try_convert()
|
noexcept |
This function will try to convert the underlying instance to the given type Target_Type*
.
When the conversion succeeds, a valid pointer will be returned. Otherwise a nullptr.
- Returns
- A pointer to the instance of
Target_Type
, when the conversion succeeds, otherwise a nullptr.
The documentation for this class was generated from the following file:
Generated on Fri Jan 26 2024 00:00:00 for rttr - 0.9.7 by doxygen.