qb
2.0.0.0
C++17 Actor Framework
|
Advanced type traits and metaprogramming utilities for the QB Framework. More...
#include <string_view>
#include <type_traits>
#include <utility>
#include <valarray>
Go to the source code of this file.
Classes | |
struct | qb::crtp< T > |
Base class for implementing the Curiously Recurring Template Pattern (CRTP). More... | |
struct | qb::detail::has_const_iterator< T > |
Type trait to detect whether T has a const_iterator type. More... | |
struct | qb::detail::has_begin_end< T > |
Type trait to detect whether T has begin() and end() methods. More... | |
struct | qb::detail::is_mappish_impl< T, U > |
Internal implementation to detect map-like types. More... | |
struct | qb::detail::is_mappish_impl< T, std::void_t< typename T::key_type, typename T::mapped_type, decltype(std::declval< T & >()[std::declval< const typename T::key_type & >()])> > |
Specialization for types that have key_type, mapped_type, and operator[]. More... | |
struct | qb::is_container< T > |
Type trait to check if a type T is a container. More... | |
struct | qb::is_container< T[N]> |
Specialization for array types, which are containers. More... | |
struct | qb::is_container< char[N]> |
Specialization for character arrays, which are not considered containers. More... | |
struct | qb::is_container< std::valarray< T > > |
Specialization for std::valarray, which is a container. More... | |
struct | qb::is_container< std::pair< T1, T2 > > |
Specialization for std::pair, which is a container. More... | |
struct | qb::is_container< std::tuple< Args... > > |
Specialization for std::tuple, which is a container. More... | |
struct | qb::remove_reference_if< T, cond > |
Conditionally removes a reference from type T if cond is true. More... | |
struct | qb::remove_reference_if< T, true > |
Specialization that actually removes the reference. More... | |
struct | qb::is_mappish< T > |
Type trait to check if a type T is map-like. More... | |
struct | qb::is_pair<... > |
Type trait to check if a type is a std::pair. More... | |
struct | qb::is_pair< std::pair< T, U > > |
Specialization for std::pair, which returns true. More... | |
struct | qb::is_inserter< T, U > |
Type trait to check if a type T is an inserter iterator (e.g., std::back_inserter). More... | |
struct | qb::is_inserter< T, typename std::enable_if<!std::is_void< typename T::container_type >::value >::type > |
Specialization for types that have a container_type. More... | |
struct | qb::iterator_type< Iter, T > |
Type trait to extract the value_type from an iterator Iter. More... | |
struct | qb::iterator_type< Iter, typename std::enable_if< is_inserter< Iter >::value >::type > |
Specialization for inserter iterators. More... | |
struct | qb::is_terator< Iter, T > |
Type trait to check if a type Iter is an iterator. More... | |
struct | qb::is_terator< Iter, typename std::enable_if< is_inserter< Iter >::value >::type > |
Specialization for inserter iterators. More... | |
struct | qb::is_terator< Iter, typename std::enable_if<!std::is_void< typename std::iterator_traits< Iter >::value_type >::value >::type > |
Specialization for standard iterators. More... | |
struct | qb::is_map_iterator< T > |
Type trait to check if an iterator T points to map elements (i.e., std::pair). More... | |
struct | qb::has_push_back< T, typename > |
Type trait to check if a type T has a push_back(T::value_type) member function. More... | |
struct | qb::has_push_back< T, typename std::enable_if< std::is_void< decltype(std::declval< T >().push_back(std::declval< typename T::value_type >()))>::value >::type > |
Specialization for types with a valid push_back method. More... | |
struct | qb::has_insert< T, typename > |
Type trait to check if a type T has an insert(T::const_iterator, T::value_type) member function. More... | |
struct | qb::has_insert< T, typename std::enable_if< std::is_same< decltype(std::declval< T >().insert(std::declval< typename T::const_iterator >(), std::declval< typename T::value_type >())), typename T::iterator >::value >::type > |
Specialization for types with a valid insert method. More... | |
struct | qb::is_sequence_container< T > |
Type trait to check if type T is a sequence container. More... | |
struct | qb::is_associative_container< T > |
Type trait to check if type T is an associative container. More... | |
struct | qb::nth_type< num, T, Y... > |
Recursive case for nth_type template. More... | |
struct | qb::nth_type< 0, T, Y... > |
Base case for nth_type template. More... | |
struct | qb::indexes_tuple< Indexes > |
Represents a compile-time tuple of size_t indexes. More... | |
struct | qb::index_builder< num, indexes_tuple< Indexes... > > |
Recursive case for index_builder. More... | |
struct | qb::index_builder< 0, indexes_tuple< Indexes... > > |
Base case for index_builder. More... | |
struct | qb::expand |
Utility for forcing parameter pack expansion in certain contexts. More... | |
struct | ambiguate< Args > |
Helper class to force ambiguity of class members. More... | |
struct | got_type< A, typename > |
Type trait to check if a type exists. More... | |
struct | got_type< A > |
Specialization that indicates the type exists. More... | |
struct | sig_check< T, T > |
Helper for signature checking. More... | |
struct | has_member< Alias, AmbiguitySeed > |
Type trait to check if a type has a specific member. More... |
Macros | |
#define | CREATE_MEMBER_CHECK(member) |
Macro to create a type trait to check for any member with a given name. | |
#define | CREATE_MEMBER_VAR_CHECK(var_name) |
Macro to create a type trait to check for a member variable with given name. | |
#define | CREATE_MEMBER_CLASS_CHECK(class_name) |
Macro to create a type trait to check for a member class with given name. | |
#define | CREATE_MEMBER_UNION_CHECK(union_name) |
Macro to create a type trait to check for a member union with given name. | |
#define | CREATE_MEMBER_ENUM_CHECK(enum_name) |
Macro to create a type trait to check for a member enum with given name. | |
#define | CREATE_MEMBER_FUNC_CHECK(func) |
Macro to create a type trait to check for a member function with given name. | |
#define | CREATE_MEMBER_CHECKS(member) |
Macro to create all member check variants for a single member name. | |
#define | GENERATE_HAS_METHOD(method) |
Macro to generate a type trait to check for a method with a specific signature. | |
#define | GENERATE_HAS_MEMBER(member) |
Macro to generate a type trait to check for a member of any kind. | |
#define | GENERATE_HAS_MEMBER_TYPE(Type) |
Macro to generate a type trait to check for a member type. |
Typedefs | |
template<typename...> | |
using | qb::Void = void |
Helper alias to void for SFINAE purposes. |
Functions | |
template<typename T> | |
std::remove_reference_t< T > && | mv (T &&t) noexcept |
Alias for std::move with a concise syntax. | |
template<typename T> | |
T && | fwd (std::remove_reference_t< T > &t) noexcept |
Alias for std::forward with a concise syntax (lvalue overload). | |
template<typename T> | |
T && | fwd (std::remove_reference_t< T > &&t) noexcept |
Alias for std::forward with a concise syntax (rvalue overload). | |
CREATE_MEMBER_CHECKS (is_alive) | |
CREATE_MEMBER_CHECKS (is_broadcast) | |
CREATE_MEMBER_CHECKS (is_valid) | |
CREATE_MEMBER_CHECKS (disconnect) |
Advanced type traits and metaprogramming utilities for the QB Framework.
This file extends the standard library's <type_traits> with additional type traits and metaprogramming utilities. These are used for compile-time introspection and template metaprogramming, enabling features such as:
These utilities are primarily for internal framework use but can also be leveraged by application code for advanced template programming.
#define CREATE_MEMBER_CHECK | ( | member | ) |
Macro to create a type trait to check for any member with a given name.
Creates has_member_[member] trait that can detect variables, functions, classes, unions, or enums.
member | Name of the member to check for |
#define CREATE_MEMBER_VAR_CHECK | ( | var_name | ) |
Macro to create a type trait to check for a member variable with given name.
Creates has_member_var_[var_name] trait.
var_name | Name of the variable to check for |
#define CREATE_MEMBER_CLASS_CHECK | ( | class_name | ) |
Macro to create a type trait to check for a member class with given name.
Creates has_member_class_[class_name] trait.
class_name | Name of the class to check for |
#define CREATE_MEMBER_UNION_CHECK | ( | union_name | ) |
Macro to create a type trait to check for a member union with given name.
Creates has_member_union_[union_name] trait.
union_name | Name of the union to check for |
#define CREATE_MEMBER_ENUM_CHECK | ( | enum_name | ) |
Macro to create a type trait to check for a member enum with given name.
Creates has_member_enum_[enum_name] trait.
enum_name | Name of the enum to check for |
#define CREATE_MEMBER_FUNC_CHECK | ( | func | ) |
Macro to create a type trait to check for a member function with given name.
Creates has_member_func_[func] trait that identifies functions specifically (not variables, classes, unions, or enums).
func | Name of the function to check for |
#define CREATE_MEMBER_CHECKS | ( | member | ) |
Macro to create all member check variants for a single member name.
Creates checks for any member type, variables, classes, unions, enums, and functions.
member | Name of the member to check for |
#define GENERATE_HAS_METHOD | ( | method | ) |
Macro to generate a type trait to check for a method with a specific signature.
Creates has_method_[method] trait that checks if a type has a method with the given name and matches the specified signature (return type and parameters).
method | Name of the method to check for |
#define GENERATE_HAS_MEMBER | ( | member | ) |
Macro to generate a type trait to check for a member of any kind.
Creates has_member_[member] trait using a different technique that avoids ambiguity issues in some contexts.
member | Name of the member to check for |
#define GENERATE_HAS_MEMBER_TYPE | ( | Type | ) |
Macro to generate a type trait to check for a member type.
Creates has_member_type_[Type] trait that checks if a type has a nested type definition with the given name.
Type | Name of the type to check for |