The Sparta Modeling Framework
Loading...
Searching...
No Matches
MetaStructs.hpp File Reference

Contains a collection implementation of various compile-time metaprogramming and Type-Detection APIs useful for Template Metaprogramming. More...

#include <vector>
#include <array>
#include <functional>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <forward_list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <type_traits>
#include "sparta/utils/Enum.hpp"

Go to the source code of this file.

Classes

struct  MetaStruct::matches_any< T >
 This templated struct takes a target type and another parameter pack of types and returns a nested boolean value of true, if the target type matches any one of the types in the parameter pack. More...
 
struct  MetaStruct::matches_any< T, Head, Tail... >
 This templated struct takes a target type and another parameter pack of types and returns a nested boolean value of true, if the target type matches any one of the types in the parameter pack. More...
 
struct  MetaStruct::add_pointer< T >
 This templated struct takes a type and gives back a nested typedef of a pointer to that type. More...
 
struct  MetaStruct::add_pointer< T * >
 
struct  MetaStruct::add_pointer< const T * >
 
struct  MetaStruct::add_pointer< T *const >
 
struct  MetaStruct::add_pointer< const T *const >
 
struct  MetaStruct::is_any_pointer< typename >
 This templated struct lets us know about whether the datatype is actually an ordinary object or pointer to that object. This is specialized for a couple different signatures. More...
 
struct  MetaStruct::is_any_pointer< T * >
 
struct  MetaStruct::is_any_pointer< T *const >
 
struct  MetaStruct::is_any_pointer< const T * >
 
struct  MetaStruct::is_any_pointer< const T *const >
 
struct  MetaStruct::is_any_pointer< std::shared_ptr< T > >
 
struct  MetaStruct::is_any_pointer< std::shared_ptr< T > const >
 
struct  MetaStruct::is_any_pointer< std::shared_ptr< T > & >
 
struct  MetaStruct::is_any_pointer< std::shared_ptr< T > const & >
 
struct  MetaStruct::is_any_pointer< std::unique_ptr< T > >
 
struct  MetaStruct::is_any_pointer< std::unique_ptr< T > const >
 
struct  MetaStruct::is_any_pointer< std::unique_ptr< T > & >
 
struct  MetaStruct::is_any_pointer< std::unique_ptr< T > const & >
 
struct  MetaStruct::is_any_pointer< std::weak_ptr< T > >
 
struct  MetaStruct::is_any_pointer< std::weak_ptr< T > const >
 
struct  MetaStruct::is_any_pointer< std::weak_ptr< T > & >
 
struct  MetaStruct::is_any_pointer< std::weak_ptr< T > const & >
 
struct  MetaStruct::remove_any_pointer< T >
 Template type helper that removes any pointer. A modeler may call certain APIs with shared pointers to the actual Collectable classes, or templatize Collectables with pointers to collectable objects. To make our API have a single interface and still work when passed pointers, we will remove the pointer and then do all the decision making work, by default. It is harmless if the modeler passes a non pointer type as removing a pointer from something which is not a pointer results in itself. More...
 
struct  MetaStruct::remove_any_pointer< T * >
 
struct  MetaStruct::remove_any_pointer< T *const >
 
struct  MetaStruct::remove_any_pointer< const T * >
 
struct  MetaStruct::remove_any_pointer< const T *const >
 
struct  MetaStruct::remove_any_pointer< std::shared_ptr< T > >
 
struct  MetaStruct::remove_any_pointer< std::shared_ptr< T > const >
 
struct  MetaStruct::remove_any_pointer< std::shared_ptr< T > & >
 
struct  MetaStruct::remove_any_pointer< std::shared_ptr< T > const & >
 
struct  MetaStruct::remove_any_pointer< std::unique_ptr< T > >
 
struct  MetaStruct::remove_any_pointer< std::unique_ptr< T > const >
 
struct  MetaStruct::remove_any_pointer< std::unique_ptr< T > & >
 
struct  MetaStruct::remove_any_pointer< std::unique_ptr< T > const & >
 
struct  MetaStruct::remove_any_pointer< std::weak_ptr< T > >
 
struct  MetaStruct::remove_any_pointer< std::weak_ptr< T > const >
 
struct  MetaStruct::remove_any_pointer< std::weak_ptr< T > & >
 
struct  MetaStruct::remove_any_pointer< std::weak_ptr< T > const & >
 
struct  MetaStruct::is_stl_container< typename >
 This templated struct takes a type and tells us whether that type is a STL container. More...
 
struct  MetaStruct::is_stl_container< std::array< T, N > >
 
struct  MetaStruct::is_stl_container< std::vector< Args... > >
 
struct  MetaStruct::is_stl_container< std::deque< Args... > >
 
struct  MetaStruct::is_stl_container< std::list< Args... > >
 
struct  MetaStruct::is_stl_container< std::forward_list< Args... > >
 
struct  MetaStruct::is_stl_container< std::set< Args... > >
 
struct  MetaStruct::is_stl_container< std::multiset< Args... > >
 
struct  MetaStruct::is_stl_container< std::map< Args... > >
 
struct  MetaStruct::is_stl_container< std::multimap< Args... > >
 
struct  MetaStruct::is_stl_container< std::unordered_set< Args... > >
 
struct  MetaStruct::is_stl_container< std::unordered_multiset< Args... > >
 
struct  MetaStruct::is_stl_container< std::unordered_map< Args... > >
 
struct  MetaStruct::is_stl_container< std::unordered_multimap< Args... > >
 
struct  MetaStruct::is_stl_container< std::stack< Args... > >
 
struct  MetaStruct::is_stl_container< std::queue< Args... > >
 
struct  MetaStruct::is_stl_container< std::priority_queue< Args... > >
 
struct  MetaStruct::is_stl< T >
 
struct  MetaStruct::parameter_pack_length< Args >
 This Variadic templated struct contains a nested value which stores the length of any parameter pack it gets templatized on. More...
 
struct  MetaStruct::peek_last_type< Head, Tail... >
 
struct  MetaStruct::peek_last_type< Tail >
 
struct  MetaStruct::last_index_type< size_t,... >
 This Variadic templated struct helps us know about the type of the very last or tail item in a parameter pack. It works by peeling of one parameter at a time from the pack and when it hits the last item, it specializes the struct by typedefing the template parameter T in its namespace. More...
 
struct  MetaStruct::last_index_type< 0, T >
 Base case when we have just the last item of the parameter pack. More...
 
struct  MetaStruct::last_index_type< N, T, Args... >
 Recursive case when we recursively peel off items from the front of the pack until we hit the last item. More...
 
struct  MetaStruct::sequence_generator<... >
 This Variadic templated struct basically works much like std::integer_sequence. It represents a compile-time sequence of integers. This is used as a parameter to the Collection function template and helps in type deduction, unpacking and transforming our tuple of random parameters back into a variadic template. More...
 
struct  MetaStruct::generate_sequence< N, S >
 This is the generic template. More...
 
struct  MetaStruct::generate_sequence< 0, S... >
 This is the specialization which kicks in when the first template parameter is 0. More...
 
struct  MetaStruct::return_type< T >
 This templated struct lets us know about the return type from any random function pointer. This is specialized for a couple different signatures. More...
 
struct  MetaStruct::return_type< std::function< R(Ts...)> >
 
struct  MetaStruct::return_type< std::function< R(Ts...)> const >
 
struct  MetaStruct::return_type< std::function< R(Ts...)> T::* >
 
struct  MetaStruct::return_type< std::function< R(Ts...)> const T::* >
 
struct  MetaStruct::return_type< std::function< R(Ts...)> T::*const & >
 
struct  MetaStruct::return_type< std::function< R(Ts...)> const T::*const >
 
struct  MetaStruct::return_type< R(*)(Ts...)>
 
struct  MetaStruct::return_type< R &(*)(Ts...)>
 
struct  MetaStruct::return_type< R(T::*)() const >
 
struct  MetaStruct::return_type< R &(T::*)() const >
 
struct  MetaStruct::return_type< std::shared_ptr< R >(T::*)() const >
 
struct  MetaStruct::return_type< std::shared_ptr< R > &(T::*)() const >
 
struct  MetaStruct::return_type< R(T::*const)() const >
 
struct  MetaStruct::return_type< R &(T::*const)() const >
 
struct  MetaStruct::return_type< std::shared_ptr< R >(T::*const)() const >
 
struct  MetaStruct::return_type< std::shared_ptr< R > &(T::*const)() const >
 
struct  MetaStruct::return_type< R(T::*const &)() const >
 
struct  MetaStruct::return_type< R &(T::*const &)() const >
 
struct  MetaStruct::return_type< std::shared_ptr< R >(T::*const &)() const >
 
struct  MetaStruct::return_type< std::shared_ptr< R > &(T::*const &)() const >
 
struct  MetaStruct::is_bool< typename >
 Templated struct for detecting Boolean Type. More...
 
struct  MetaStruct::is_bool< bool >
 
struct  MetaStruct::is_bool< bool & >
 
struct  MetaStruct::is_bool< bool const & >
 
struct  MetaStruct::is_bool< bool const >
 
struct  MetaStruct::is_pair< typename >
 This templated struct lets us know about whether the datatype is actually an std::pair object. This is specialized for a couple different signatures. The collection procedure for a pair object is broken down into first collecting the first member and then, the second. More...
 
struct  MetaStruct::is_pair< std::pair< T, U > >
 
struct  MetaStruct::is_pair< std::pair< T, U > & >
 
struct  MetaStruct::is_pair< std::pair< T, U > const & >
 
struct  MetaStruct::is_pair< std::pair< T, U > const >
 
struct  MetaStruct::is_string< typename >
 Templated struct for detecting String Type. More...
 
struct  MetaStruct::is_string< std::string >
 
struct  MetaStruct::is_string< std::string & >
 
struct  MetaStruct::is_string< std::string const & >
 
struct  MetaStruct::is_string< std::string const >
 
struct  MetaStruct::is_char_pointer< typename >
 Templated struct for detecting char pointer type. More...
 
struct  MetaStruct::is_char_pointer< char * >
 
struct  MetaStruct::is_char_pointer< const char * >
 
struct  MetaStruct::is_char_pointer< char *const >
 
struct  MetaStruct::is_char_pointer< const char *const >
 
struct  MetaStruct::is_sparta_enum< T >
 Detect whether template parameter is sparta::utils::Enum type. Case when it is not a sparta::utils::Enum type. More...
 
struct  MetaStruct::is_sparta_enum< sparta::utils::Enum< T > >
 Detect whether template parameter is sparta::utils::Enum type. Case when it is a sparta::utils::Enum type. More...
 

Typedefs

template<typename T >
using MetaStruct::add_pointer_t = typename add_pointer< T >::type
 Alias Template for add_pointer.
 
template<typename T >
using MetaStruct::remove_any_pointer_t = typename remove_any_pointer< T >::type
 Alias Template for remove_pointer.
 
template<typename... Args>
using MetaStruct::peek_last_type_t = typename peek_last_type< Args... >::type
 
template<std::size_t N, typename... Args>
using MetaStruct::last_index_type_t = typename last_index_type< N, Args... >::type
 Alias Template for last_index_type.
 
template<std::size_t... Args>
using MetaStruct::generate_sequence_t = typename generate_sequence< Args... >::type
 Alias Template for generate_sequence.
 
template<typename T >
using MetaStruct::return_type_t = typename return_type< T >::type
 Alias Template for return_type.
 

Detailed Description

Contains a collection implementation of various compile-time metaprogramming and Type-Detection APIs useful for Template Metaprogramming.

Definition in file MetaStructs.hpp.

Typedef Documentation

◆ add_pointer_t

template<typename T >
using MetaStruct::add_pointer_t = typedef typename add_pointer<T>::type

Alias Template for add_pointer.

Definition at line 211 of file MetaStructs.hpp.

◆ generate_sequence_t

template<std::size_t... Args>
using MetaStruct::generate_sequence_t = typedef typename generate_sequence<Args...>::type

Alias Template for generate_sequence.

Definition at line 479 of file MetaStructs.hpp.

◆ last_index_type_t

template<std::size_t N, typename... Args>
using MetaStruct::last_index_type_t = typedef typename last_index_type<N, Args...>::type

Alias Template for last_index_type.

Definition at line 448 of file MetaStructs.hpp.

◆ peek_last_type_t

template<typename... Args>
using MetaStruct::peek_last_type_t = typedef typename peek_last_type<Args...>::type

Definition at line 420 of file MetaStructs.hpp.

◆ remove_any_pointer_t

template<typename T >
using MetaStruct::remove_any_pointer_t = typedef typename remove_any_pointer<T>::type

Alias Template for remove_pointer.

Definition at line 336 of file MetaStructs.hpp.

◆ return_type_t

template<typename T >
using MetaStruct::return_type_t = typedef typename return_type<T>::type

Alias Template for return_type.

Definition at line 552 of file MetaStructs.hpp.