Meta function object.
More...
#include <meta.hpp>
|
using | size_type = typename internal::func_node::size_type |
| Unsigned integer type.
|
|
|
| func () noexcept |
| Default constructor.
|
|
meta::type | parent () const noexcept |
| Returns the meta type to which a meta function belongs. More...
|
|
size_type | size () const noexcept |
| Returns the number of arguments accepted by a meta function. More...
|
|
bool | is_const () const noexcept |
| Indicates whether a given meta function is constant or not. More...
|
|
bool | is_static () const noexcept |
| Indicates whether a given meta function is static or not. More...
|
|
meta::type | ret () const noexcept |
| Returns the meta type of the return type of a meta function. More...
|
|
meta::type | arg (size_type index) const noexcept |
| Returns the meta type of the i-th argument of a meta function. More...
|
|
template<typename... Args> |
any | invoke (handle handle, Args &&... args) const |
| Invokes the underlying function, 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 function. 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 func &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 function object.
A meta function is an opaque container for a member function associated with a given type.
Definition at line 1363 of file meta.hpp.
◆ arg()
Returns the meta type of the i-th argument of a meta function.
- 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 function, if any.
Definition at line 2015 of file meta.hpp.
◆ invoke()
template<typename... Args>
any meta::func::invoke |
( |
handle |
handle, |
|
|
Args &&... |
args |
|
) |
| const |
|
inline |
Invokes the underlying function, if possible.
To invoke a meta function, the types of the parameters must coincide exactly with those required by the underlying function. Otherwise, an empty and then invalid container is returned.
It must be possible to cast the instance to the parent type of the meta function. Otherwise, invoking the underlying function results in an undefined behavior.
- Template Parameters
-
Args | Types of arguments to use to invoke the function. |
- Parameters
-
handle | An opaque pointer to an instance of the underlying type. |
args | Parameters to use to invoke the function. |
- Returns
- A meta any containing the returned value, if any.
Definition at line 1443 of file meta.hpp.
◆ is_const()
bool meta::func::is_const |
( |
| ) |
const |
|
inlinenoexcept |
Indicates whether a given meta function is constant or not.
- Returns
- True if the meta function is constant, false otherwise.
Definition at line 1398 of file meta.hpp.
◆ is_static()
bool meta::func::is_static |
( |
| ) |
const |
|
inlinenoexcept |
Indicates whether a given meta function is static or not.
A static meta function is such that it can be invoked using a null pointer as an instance.
- Returns
- True if the meta function is static, false otherwise.
Definition at line 1410 of file meta.hpp.
◆ operator bool()
meta::func::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 1488 of file meta.hpp.
◆ operator==()
bool meta::func::operator== |
( |
const func & |
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 1498 of file meta.hpp.
◆ parent()
Returns the meta type to which a meta function belongs.
- Returns
- The meta type to which the meta function belongs.
Definition at line 2005 of file meta.hpp.
◆ prop() [1/2]
template<typename Op >
std::enable_if_t<std::is_invocable_v<Op, meta::prop>, void> meta::func::prop |
( |
Op |
op | ) |
const |
|
inlinenoexcept |
Iterates all the properties assigned to a meta function.
- Template Parameters
-
Op | Type of the function object to invoke. |
- Parameters
-
op | A valid function object. |
Definition at line 1462 of file meta.hpp.
◆ prop() [2/2]
template<typename Key >
std::enable_if_t<!std::is_invocable_v<Key, meta::prop>, meta::prop> meta::func::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 1476 of file meta.hpp.
◆ ret()
Returns the meta type of the return type of a meta function.
- Returns
- The meta type of the return type of the meta function.
Definition at line 2010 of file meta.hpp.
◆ size()
Returns the number of arguments accepted by a meta function.
- Returns
- The number of arguments accepted by the meta function.
Definition at line 1390 of file meta.hpp.
The documentation for this class was generated from the following file: