21#ifndef HEDGEHOG_META_FUNCTIONS_H 
   22#define HEDGEHOG_META_FUNCTIONS_H 
   33#ifndef DOXYGEN_SHOULD_SKIP_THIS 
   37namespace abstraction {
 
   42class ReceiverAbstraction;
 
   47class SenderAbstraction;
 
   61template<
typename Ts, 
typename T>
 
   67template<
typename... Vs, 
typename T>
 
   70  using Type = std::tuple<T, Vs...>;
 
   74template<
typename Ts, 
typename T>
 
   80template<
typename Types, 
typename Indices>
 
   86template<
typename Types, 
size_t... Indices>
 
   87struct SplitInput<Types, std::index_sequence<Indices...>> {
 
   89  using Type = std::tuple<std::tuple_element_t<Indices, Types>...>;
 
   93template<
typename Types, 
typename Indices>
 
  100template<
typename Types, 
size_t delta, 
typename Indices>
 
  107template<
typename Types, 
size_t delta, 
size_t... Indices>
 
  108struct SplitOutput<Types, delta, std::index_sequence<Indices...>> {
 
  110  using Type = std::tuple<std::tuple_element_t<delta + Indices, Types>...>;
 
  114template<
typename Types, 
size_t delta, 
typename Indices>
 
  120template<
size_t delimiter, 
typename ... Types>
 
  122  static_assert(delimiter != 0, 
"The delimiter should not be 0.");
 
  123  static_assert(delimiter < 
sizeof...(Types), 
"The delimiter should be inferior to the number of types.");
 
  131                                           std::make_integer_sequence<
size_t, 
sizeof...(Types) - delimiter>>;
 
  137template<
typename T, 
typename Tuple>
 
  143struct HasType<T, std::tuple<>> : std::false_type {};
 
  149template<
typename T, 
typename Front, 
typename... 
Ts>
 
  155template<
typename T, 
typename... 
Ts>
 
  156struct HasType<T, std::tuple<T, Ts...>> : std::true_type {};
 
  163template<
typename T1, 
typename T2, 
size_t Index, 
size_t Size>
 
  170template<
typename T1, 
typename T2, 
size_t Size>
 
  181template<
typename T1, 
typename T2, 
size_t Index, 
size_t Size>
 
  184  using type = std::conditional_t<
 
  193template<
typename T1, 
typename T2>
 
  201template<
size_t delta, 
typename ... Types>
 
  205template<
size_t delta, 
typename ... Types>
 
  209template<
class Tuple1, 
class Tuple2>
 
  215template<
class T, 
class ...Ts>
 
  221template<
class T, 
class Tuple>
 
  229  std::string_view name, prefix, suffix;
 
  231  name = __PRETTY_FUNCTION__;
 
  232  prefix = 
"auto hh::tool::typeToStr() [T = ";
 
  234#elif defined(__GNUC__) 
  235  name = __PRETTY_FUNCTION__;
 
  236  prefix = 
"constexpr auto hh::tool::typeToStrView() [with T = ";
 
  238#elif defined(_MSC_VER) 
  240    prefix = 
"auto __cdecl typeToStr<";
 
  243  name.remove_prefix(prefix.size());
 
  244  name.remove_suffix(suffix.size());
 
  253constexpr auto typeToStr() { 
return std::string(typeToStrView<T>()); }
 
typename internals::Intersect< Tuple1, Tuple2 >::type Intersect_t
Helper getting the intersection of types between two type tuples.
constexpr auto typeToStrView()
Create a string_view containing the type name.
constexpr auto typeToStr()
Create a string containing the type name.
constexpr bool isContainedInTuple_v
Helper testing if a type is in a tuple of types.
typename internals::Splitter< delta, Types... >::Inputs Inputs
Helper getting the input types from a list of template types (variadic)
typename internals::Splitter< delta, Types... >::Outputs Outputs
Helper getting the output types from a list of template types (variadic)
constexpr bool isContainedIn_v
Helper testing if a type T is in variadic Ts.
typename SplitInput< Types, Indices >::Type SplitInput_t
Helper getting the input types in a tuple.
typename PushFront< Ts, T >::Type PushFront_t
Helper creating a tuple from a tuple Ts in wish we have added on front the type T.
typename SplitOutput< Types, delta, Indices >::Type SplitOutput_t
Helper to output types of a tuple.
Base definition of PushFront accepting a tuple as template parameter and the element to add.
std::tuple< T, Vs... > Type
Accessor of the tuple type consisting of the type T followed by the Vs...
Base definition of SplitInput splitting a tuple of type to get the input types.
std::tuple< std::tuple_element_t< Indices, Types >... > Type
Type accessor.
Base definition of SplitOutput_t splitting a tuple of type to get the output types.
std::tuple< std::tuple_element_t< delta+Indices, Types >... > Type
Type accessor.
Metafunction splitting a variadic to input and output types at a specific delimiter.
internals::SplitOutput_t< std::tuple< Types... >, delimiter, std::make_integer_sequence< size_t, sizeof...(Types) - delimiter > > Outputs
Type accessor of the output types.
internals::SplitInput_t< std::tuple< Types... >, std::make_integer_sequence< size_t, delimiter > > Inputs
Type accessor of the input types.
Base definition of HasType testing if a type T is in tuple Tuple.
Base definition of the implementation of the Intersect metafunction.
std::conditional_t< internals::HasType< std::tuple_element_t< Index, T1 >, T2 >::value, internals::PushFront_t< typename IntersectImpl< T1, T2, Index+1, Size >::type, std::tuple_element_t< Index, T1 > >, typename IntersectImpl< T1, T2, Index+1, Size >::type > type
Accessor to the type of the tuple representing the intersection between two tuples.
std::tuple<> type
Returning an empty tuple when arriving at the end of T1.
Intersect metafunction creating a tuple of types that are in T1 and T2.
typename IntersectImpl< T1, T2, 0, std::tuple_size_v< T1 > >::type type
Accessor to the type of the tuple of types that are in T1 and T2.