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

Meta constructor object. More...

#include <meta.hpp>

Public Types

using size_type = typename internal::ctor_node::size_type
 Unsigned integer type.
 

Public Member Functions

 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::propprop (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...
 

Friends

template<typename >
class factory
 A meta factory is allowed to create meta objects.
 

Detailed Description

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.

Member Function Documentation

◆ arg()

meta::type meta::ctor::arg ( size_type  index) const
inlinenoexcept

Returns the meta type of the i-th argument of a meta constructor.

Parameters
indexThe 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
ArgsTypes of arguments to use to construct the instance.
Parameters
argsParameters 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
otherThe 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()

meta::type meta::ctor::parent ( ) const
inlinenoexcept

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
OpType of the function object to invoke.
Parameters
opA 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
KeyType of key to use to search for a property.
Parameters
keyThe 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()

size_type meta::ctor::size ( ) const
inlinenoexcept

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: