Meta constructor object.
More...
#include <meta.hpp>
|
using | size_type = typename internal::ctor_node::size_type |
| Unsigned integer type.
|
|
|
| ctor () noexcept |
| Default constructor.
|
|
meta::type | parent () const noexcept |
| Returns the meta type to which a meta constructor belongs. More...
|
|
size_type | size () const noexcept |
| Returns the number of arguments accepted by a meta constructor. More...
|
|
meta::type | arg (size_type index) const noexcept |
| Returns the meta type of the i-th argument of a meta constructor. More...
|
|
template<typename... Args> |
any | invoke (Args &&... args) const |
| Creates an instance of the underlying type, if possible. More...
|
|
template<typename Op > |
std::enable_if_t< std::is_invocable_v< Op, meta::prop >, void > | prop (Op op) const noexcept |
| Iterates all the properties assigned to a meta constructor. More...
|
|
template<typename Key > |
std::enable_if_t<!std::is_invocable_v< Key, meta::prop >, meta::prop > | prop (Key &&key) const noexcept |
| Returns the property associated with a given key. More...
|
|
| operator bool () const noexcept |
| Returns true if a meta object is valid, false otherwise. More...
|
|
bool | operator== (const ctor &other) const noexcept |
| Checks if two meta objects refer to the same node. More...
|
|
|
template<typename > |
class | factory |
| A meta factory is allowed to create meta objects.
|
|
Meta constructor object.
A meta constructor is an opaque container for a function to be used to construct instances of a given type.
Definition at line 976 of file meta.hpp.
◆ arg()
Returns the meta type of the i-th argument of a meta constructor.
- Parameters
-
index | The index of the argument of which to return the meta type. |
- Returns
- The meta type of the i-th argument of a meta constructor, if any.
Definition at line 1985 of file meta.hpp.
◆ invoke()
template<typename... Args>
any meta::ctor::invoke |
( |
Args &&... |
args | ) |
const |
|
inline |
Creates an instance of the underlying type, if possible.
To create a valid instance, the types of the parameters must coincide exactly with those required by the underlying meta constructor. Otherwise, an empty and then invalid container is returned.
- Template Parameters
-
Args | Types of arguments to use to construct the instance. |
- Parameters
-
args | Parameters to use to construct the instance. |
- Returns
- A meta any containing the new instance, if any.
Definition at line 1026 of file meta.hpp.
◆ operator bool()
meta::ctor::operator bool |
( |
| ) |
const |
|
inlineexplicitnoexcept |
Returns true if a meta object is valid, false otherwise.
- Returns
- True if the meta object is valid, false otherwise.
Definition at line 1070 of file meta.hpp.
◆ operator==()
bool meta::ctor::operator== |
( |
const ctor & |
other | ) |
const |
|
inlinenoexcept |
Checks if two meta objects refer to the same node.
- Parameters
-
other | The meta object with which to compare. |
- Returns
- True if the two meta objects refer to the same node, false otherwise.
Definition at line 1080 of file meta.hpp.
◆ parent()
Returns the meta type to which a meta constructor belongs.
- Returns
- The meta type to which the meta constructor belongs.
Definition at line 1980 of file meta.hpp.
◆ prop() [1/2]
template<typename Op >
std::enable_if_t<std::is_invocable_v<Op, meta::prop>, void> meta::ctor::prop |
( |
Op |
op | ) |
const |
|
inlinenoexcept |
Iterates all the properties assigned to a meta constructor.
- Template Parameters
-
Op | Type of the function object to invoke. |
- Parameters
-
op | A valid function object. |
Definition at line 1044 of file meta.hpp.
◆ prop() [2/2]
template<typename Key >
std::enable_if_t<!std::is_invocable_v<Key, meta::prop>, meta::prop> meta::ctor::prop |
( |
Key && |
key | ) |
const |
|
inlinenoexcept |
Returns the property associated with a given key.
- Template Parameters
-
Key | Type of key to use to search for a property. |
- Parameters
-
key | The key to use to search for a property. |
- Returns
- The property associated with the given key, if any.
Definition at line 1058 of file meta.hpp.
◆ size()
Returns the number of arguments accepted by a meta constructor.
- Returns
- The number of arguments accepted by the meta constructor.
Definition at line 1003 of file meta.hpp.
The documentation for this class was generated from the following file: