siplasplas
A library for C++ reflection and introspection
|
Type-erasure utilities. More...
Modules | |
storage | |
Provides different storage backends for cpp::SimpleAny class. | |
Concepts | |
Family of concepts defining possible features of types. | |
Features | |
Generic implementation of type features. | |
Classes | |
class | cpp::Any< Storage, FunctionsStorage, FunctionArgsStorage, AttributesStorage > |
Implements a type-erased object container with support for dynamic method and attribute invokation. More... | |
class | cpp::AnyArg |
Represents a type erased function call argument. More... | |
class | cpp::typeerasure::Field< Storage, ObjectArgStorage > |
Stores a type erased member object pointer. More... | |
class | cpp::typeerasure::Function< Storage, ArgsStorage, ReturnStorage > |
Stores a type-erased callable of any signature and kind. More... | |
class | cpp::SimpleAny< Storage > |
Implements a type-erased value container with minimal value semantics requirements. More... | |
class | cpp::typeerasure::TypeInfo |
Contains minimal information to execute the value semantics operations of a type. More... | |
Typedefs | |
using | cpp::Any8 = Any< DeadPoolStorage< 8 >> |
An Any with 8 byte deadpool storage. | |
using | cpp::Any16 = Any< DeadPoolStorage< 16 >> |
An Any with 16 byte deadpool storage. | |
using | cpp::Any32 = Any< DeadPoolStorage< 32 >> |
An Any with 32 byte deadpool storage. | |
using | cpp::Any64 = Any< DeadPoolStorage< 64 >> |
An Any with 64 byte deadpool storage. | |
using | cpp::ConstReferenceAny = Any< ConstNonOwningStorage, DeadPoolStorage< 32 >> |
A non-owning Any that (const) references an existing object. | |
using | cpp::ReferenceAny = Any< NonOwningStorage, DeadPoolStorage< 32 >> |
A non-owning Any that references an existing object. | |
using | cpp::typeerasure::Field8 = Field< DeadPoolStorage< 8 >> |
A field with 8 byte fixed-size storage. | |
using | cpp::typeerasure::Field16 = Field< DeadPoolStorage< 16 >> |
A field with 16 byte fixed-size storage. | |
using | cpp::typeerasure::Field32 = Field< DeadPoolStorage< 32 >> |
A field with 32 byte fixed-size storage. | |
using | cpp::typeerasure::Field64 = Field< DeadPoolStorage< 64 >> |
A field with 64 byte fixed-size storage. | |
using | cpp::typeerasure::Function8 = Function< DeadPoolStorage< 8 >> |
A Function with 8 byte fixed-size storage. | |
using | cpp::typeerasure::Function16 = Function< DeadPoolStorage< 16 >> |
A Function with 16 byte fixed-size storage. | |
using | cpp::typeerasure::Function32 = Function< DeadPoolStorage< 32 >> |
A Function with 32 byte fixed-size storage. | |
using | cpp::typeerasure::Function64 = Function< DeadPoolStorage< 64 >> |
A Function with 64 byte fixed-size storage. | |
using | cpp::SimpleAny8 = SimpleAny< DeadPoolStorage< 8 >> |
A SimpleAny with 8 byte dead pool storage. | |
using | cpp::SimpleAny16 = SimpleAny< DeadPoolStorage< 16 >> |
A SimpleAny with 16 byte dead pool storage. | |
using | cpp::SimpleAny32 = SimpleAny< DeadPoolStorage< 32 >> |
A SimpleAny with 32 byte dead pool storage. | |
using | cpp::SimpleAny64 = SimpleAny< DeadPoolStorage< 64 >> |
A SimpleAny with 64 byte dead pool storage. | |
using | cpp::ConstReferenceSimpleAny = SimpleAny< ConstNonOwningStorage > |
A non-owning SimpleAny that (const) references an existing object. | |
using | cpp::ReferenceSimpleAny = SimpleAny< NonOwningStorage > |
A non-owning SimpleAny that references an existing object. | |
Enumerations | |
enum | cpp::typeerasure::detail::ValueSemanticsOperation : std::size_t { COPY_CONSTRUCT, MOVE_CONSTRUCT, COPY_ASSIGN, MOVE_ASSIGN, DESTROY } |
Represents a value semantics operation. See valueSemanticsOperation() | |
Functions | |
template<typename Callable , typename... Storages> | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable, const ::cpp::SimpleAny< Storages > &...args) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename Callable , typename... Storages> | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable,::cpp::SimpleAny< Storages > &...args) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename Callable , typename... Storages> | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable,::cpp::SimpleAny< Storages > &&...args) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename Callable , typename Storage > | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable, const std::vector<::cpp::SimpleAny< Storage >> &args) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename Callable , typename Storage > | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable, std::vector<::cpp::SimpleAny< Storage >> &args) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename Callable , typename Storage > | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable, std::vector<::cpp::SimpleAny< Storage >> &&args) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename Callable > | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable, const std::vector<::cpp::AnyArg > &args) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename Callable > | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable, std::vector<::cpp::AnyArg > &args) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename Callable > | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable, std::vector<::cpp::AnyArg > &&args) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename Callable , typename Iterator , typename = typename std::iterator_traits<Iterator>::value_type> | |
decltype(auto) | cpp::typeerasure::invoke (Callable &&callable, Iterator argsBegin) |
Invokes a callable object with the given type-erased arguments. More... | |
template<typename T > | |
ValueSemanticsOperationFunction | cpp::typeerasure::detail::valueSemanticsOperation (ValueSemanticsOperation operation) |
Implements a type-erased interface for the value semantics features of a type T. More... | |
Type-erasure utilities.
This module provides classes and methods to manipulate type-erased objects:
cpp::SimpleAny
: Type-erased value container with customizable storagecpp::typeerasure::Function
: Type-erased callable with customizable storagecpp::Any
: Type-erased value container with a customizable object-like interface at runtime.cpp::typeerasure::invoke()
: Generic callable invocation with type-erased arguments decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
const ::cpp::SimpleAny< Storages > &... | args | ||
) |
Invokes a callable object with the given type-erased arguments.
callable | Callable entity to be invoked |
args | Invocation arguments. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
::cpp::SimpleAny< Storages > &... | args | ||
) |
Invokes a callable object with the given type-erased arguments.
callable | Callable entity to be invoked |
args | Invocation arguments. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
::cpp::SimpleAny< Storages > &&... | args | ||
) |
Invokes a callable object with the given type-erased arguments.
callable | Callable entity to be invoked |
args | Invocation arguments. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
const std::vector<::cpp::SimpleAny< Storage >> & | args | ||
) |
Invokes a callable object with the given type-erased arguments.
callable | Callable entity to be invoked |
args | Invocation arguments. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
std::vector<::cpp::SimpleAny< Storage >> & | args | ||
) |
Invokes a callable object with the given type-erased arguments.
callable | Callable entity to be invoked |
args | Invocation arguments. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
std::vector<::cpp::SimpleAny< Storage >> && | args | ||
) |
Invokes a callable object with the given type-erased arguments.
callable | Callable entity to be invoked |
args | Invocation arguments. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
const std::vector<::cpp::AnyArg > & | args | ||
) |
Invokes a callable object with the given type-erased arguments.
This overload using cpp::AnyArg objects ensures that reference parameters of the callable get references to the original non-type-erased arguments
callable | Callable entity to be invoked |
args | Invocation arguments. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
std::vector<::cpp::AnyArg > & | args | ||
) |
Invokes a callable object with the given type-erased arguments.
This overload using cpp::AnyArg objects ensures that reference parameters of the callable get references to the original non-type-erased arguments
callable | Callable entity to be invoked |
args | Invocation arguments. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
std::vector<::cpp::AnyArg > && | args | ||
) |
Invokes a callable object with the given type-erased arguments.
This overload using cpp::AnyArg objects ensures that reference parameters of the callable get references to the original non-type-erased arguments
callable | Callable entity to be invoked |
args | Invocation arguments. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
decltype(auto) cpp::typeerasure::invoke | ( | Callable && | callable, |
Iterator | argsBegin | ||
) |
Invokes a callable object with the given type-erased arguments.
This overload takes an iterator to a sequence of type-erased arguments.
Iterator | Must follow the RandomAccessIterator concept |
callable | Callable entity to be invoked |
argsBegin | Iterator pointing to the beginning of the args sequence. If callable is a pointer to member function, the first argument is interpreted as the caller object |
See cpp::invoke() for detailed behavior
ValueSemanticsOperationFunction cpp::typeerasure::detail::valueSemanticsOperation | ( | ValueSemanticsOperation | operation | ) |
Implements a type-erased interface for the value semantics features of a type T.
The function returns a function pointer with a type erased signature that gives access to the specified value semantics feature. See ValueSemanticsOperation.
operation | The operation needed |
void(*)(void*, const void*)
function pointer that implements the required operation