RESTinio
Loading...
Searching...
No Matches
restinio::utils::metaprogramming Namespace Reference

Namespaces

namespace  impl

Classes

struct  type_list
 The basic building block: a type for representation of a type list. More...

Typedefs

template<typename... Ts>
using void_t = std::void_t<Ts...>
template<typename... L>
using head_of_t = typename impl::head_of<L...>::type
 Metafunction to get the first item from a list of types.
template<typename... L>
using tail_of_t = typename impl::tail_of<L...>::type
 Metafunction to get the tail of a list of types in a form of type_list.
template<typename T, typename Rest>
using put_front_t = typename impl::put_front<T, Rest>::type
 Metafunction to insert a type to the front of a type_list.
template<typename From, template< class... > class To>
using rename_t = typename impl::rename<From, To>::type
 Allows to pass all template arguments from one type to another.
template<template< class... > class Transform_F, typename From>
using transform_t
 Applies a specified meta-function to every item from a specified type-list and return a new type-list.

Variables

template<template< class... > class Predicate, typename... List>
constexpr bool all_of_v = impl::all_of<Predicate, List...>::value
 Applies the predicate to all types from the list and return true only if all types satisty that predicate.

Typedef Documentation

◆ head_of_t

template<typename... L>
using restinio::utils::metaprogramming::head_of_t = typename impl::head_of<L...>::type

Metafunction to get the first item from a list of types.

Usage example:

static_assert(std::is_same_v<T, int>, "T isn't int");
typename impl::head_of< L... >::type head_of_t
Metafunction to get the first item from a list of types.
Since
v.0.6.1

Definition at line 89 of file metaprogramming.hpp.

◆ put_front_t

template<typename T, typename Rest>
using restinio::utils::metaprogramming::put_front_t = typename impl::put_front<T, Rest>::type

Metafunction to insert a type to the front of a type_list.

Usage example:

static_assert(std::is_same_v<T, typelist<int, float, double> >, "!Ok");
typename impl::put_front< T, Rest >::type put_front_t
Metafunction to insert a type to the front of a type_list.
Since
v.0.6.1

Definition at line 163 of file metaprogramming.hpp.

◆ rename_t

template<typename From, template< class... > class To>
using restinio::utils::metaprogramming::rename_t = typename impl::rename<From, To>::type

Allows to pass all template arguments from one type to another.

Usage example:

static_assert(std::is_same_v<T, std::tuble<int, float, double>>, "!Ok");
typename impl::rename< From, To >::type rename_t
Allows to pass all template arguments from one type to another.
Since
v.0.6.1

Definition at line 201 of file metaprogramming.hpp.

◆ tail_of_t

template<typename... L>
using restinio::utils::metaprogramming::tail_of_t = typename impl::tail_of<L...>::type

Metafunction to get the tail of a list of types in a form of type_list.

Returns all types expect the first one. If input list of types contains just one type then type_list<> is returned.

Usage example:

static_assert(std::is_same_v<T,
restinio::utils::metaprogramming::typelist<float, double> >, "!Ok");
typename impl::tail_of< L... >::type tail_of_t
Metafunction to get the tail of a list of types in a form of type_list.
Since
v.0.6.1

Definition at line 127 of file metaprogramming.hpp.

◆ transform_t

template<template< class... > class Transform_F, typename From>
using restinio::utils::metaprogramming::transform_t
Initial value:

Applies a specified meta-function to every item from a specified type-list and return a new type-list.

Usage example:

static_assert(std::is_same<T, type_list<int, char, long>>::value, "!Ok");
typename impl::transform< Transform_F, From, type_list<> >::type transform_t
Applies a specified meta-function to every item from a specified type-list and return a new type-list...
Since
v.0.6.6

Definition at line 257 of file metaprogramming.hpp.

◆ void_t

template<typename... Ts>
using restinio::utils::metaprogramming::void_t = std::void_t<Ts...>

Definition at line 26 of file metaprogramming.hpp.

Variable Documentation

◆ all_of_v

template<template< class... > class Predicate, typename... List>
bool restinio::utils::metaprogramming::all_of_v = impl::all_of<Predicate, List...>::value
constexpr

Applies the predicate to all types from the list and return true only if all types satisty that predicate.

Usage example:

constexpr bool all_of_v
Applies the predicate to all types from the list and return true only if all types satisty that predi...

Since v.0.6.6 can be used with type_list:

Since
v.0.6.1

Definition at line 323 of file metaprogramming.hpp.