The instance class is used for forwarding the instance of an object to invoke a property or method.
More...
#include <instance.h>
The instance class is used for forwarding the instance of an object to invoke a property or method.
rttr::instance::instance |
( |
| ) |
|
|
noexcept |
Creates an invalid instance object.
Use this constructor, when you need to invoke a property or method where no instance is required.
rttr::instance::instance |
( |
const variant & |
var | ) |
|
|
noexcept |
Creates an instance object from a variant object.
rttr::instance::instance |
( |
const instance & |
other | ) |
|
|
noexcept |
Copy constructor for an instance.
template<typename T , typename Tp = decay_instance_t<T>>
rttr::instance::instance |
( |
T & |
data | ) |
|
|
noexcept |
Creates an instance object from type T
.
type rttr::instance::get_derived_type |
( |
| ) |
const |
|
noexcept |
Returns the most derived type of the hold instance.
See following example code:
derived d;
base& b = d;
obj.get_type() == type::get<base>();
obj.get_derived_type() == type::get<derived>();
type rttr::instance::get_type |
( |
| ) |
const |
|
noexcept |
Returns the type of the internally hold instance.
- Returns
- Type object of stored reference.
instance rttr::instance::get_wrapped_instance |
( |
| ) |
const |
|
noexcept |
Returns an instance object for the wrapped instance.
See following example code:
std::shared_ptr<foo> f;
obj.get_type() == type::get<std::shared_ptr<foo>>();
obj.get_wrapped_instance().get_type() == type::get<foo>();
- Returns
- An instance object from the wrapped type.
bool rttr::instance::is_valid |
( |
| ) |
const |
|
noexcept |
Returns true when the instance class contains a reference to an object.
Otherwise false.
- Returns
- True when a reference is stored, otherwise false.
rttr::instance::operator bool |
( |
| ) |
const |
|
explicitnoexcept |
Returns true when the instance class contains a reference to an object.
Otherwise false.
- Returns
- True when a reference is stored, otherwise false.
template<typename Target_Type >
Target_Type* rttr::instance::try_convert |
( |
| ) |
const |
|
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: