restinio::utils::metaprogramming Namespace Reference

## Namespaces

namespace | impl

## Classes

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

## Typedefs

template<typename... Ts>
using | void_t = typename make_void< Ts... >::type
template<typename... L>
using | head_of_t = typename impl::head_of< L... >::type
| Metafunction to get the first item from a list of types. More...
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. More...
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. More...
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. More...
template<template< class... > class Transform_F, typename From >
using | transform_t = typename impl::transform< Transform_F, From, type_list<> >::type
| Applies a specified meta-function to every item from a specified type-list and return a new type-list. More...

## 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. More...

## Typedef Documentation

## head_of_t

template<typename... L>

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

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

Usage example:

using T = restinio::utils::metaprogramming::head_of_t<int, float, double>;
static_assert(std::is_same_v<T, int>, "T isn't int");
restinio::utils::metaprogramming::head_of_t
typename impl::head_of< L... >::type head_of_t
Metafunction to get the first item from a list of types.
Definition: metaprogramming.hpp:91

Since
  v.0.6.1

Definition at line 91 of file metaprogramming.hpp.

## put_front_t

template<typename T , typename Rest >

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

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

Usage example:

using namespace restinio::utils::metaprogramming;
using T = put_front_t<int, type_list<float, double>>;
static_assert(std::is_same_v<T, typelist<int, float, double> >, "!Ok");
restinio::utils::metaprogramming
Definition: metaprogramming.hpp:24
restinio::utils::metaprogramming::put_front_t
typename impl::put_front< T, Rest >::type put_front_t
Metafunction to insert a type to the front of a type_list.
Definition: metaprogramming.hpp:165

Since
  v.0.6.1

Definition at line 165 of file metaprogramming.hpp.

## rename_t

template<typename From , template< class... > class To>

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

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

Usage example:

using namespace restinio::utils::metaprogramming;
using T = rename_t<typelist<int, float, double>, std::tuple>;
static_assert(std::is_same_v<T, std::tuble<int, float, double>>, "!Ok");
restinio::utils::metaprogramming::rename_t
typename impl::rename< From, To >::type rename_t
Allows to pass all template arguments from one type to another.
Definition: metaprogramming.hpp:203

Since
  v.0.6.1

Definition at line 203 of file metaprogramming.hpp.

## tail_of_t

template<typename... L>

using restinio::utils::metaprogramming::tail_of_t = typedef 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:

using T = restinio::utils::metaprogramming::tail_of_t<int, float, double>;
static_assert(std::is_same_v<T,
restinio::utils::metaprogramming::typelist<float, double> >, "!Ok");
restinio::utils::metaprogramming::tail_of_t
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.
Definition: metaprogramming.hpp:129

Since
  v.0.6.1

Definition at line 129 of file metaprogramming.hpp.

## transform_t

template<template< class... > class Transform_F, typename From >

using restinio::utils::metaprogramming::transform_t = typedef typename impl::transform< Transform_F, From, type_list<> >::type

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

Usage example:

using namespace restinio::utils::metaprogramming;
using T = transform_t<std::decay, type_list<int, char &, const long &>>;
static_assert(std::is_same<T, type_list<int, char, long>>::value, "!Ok");
restinio::utils::metaprogramming::transform_t
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...
Definition: metaprogramming.hpp:263

Since
  v.0.6.6

Definition at line 259 of file metaprogramming.hpp.

## void_t

template<typename... Ts>

using restinio::utils::metaprogramming::void_t = typedef typename make_void<Ts...>::type

Definition at line 28 of file metaprogramming.hpp.

## Variable Documentation

## all_of_v

template<template< class... > class Predicate, typename... List>

constexpr 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:

using namespace restinio::utils::metaprogramming;
static_assert(all_of_v<std::is_integral, int, long, unsigned short>, "!Ok");

Since v.0.6.6 can be used with type_list:

using namespace restinio::utils::metaprogramming;
static_assert(all_of_v<std::is_integral,
transform_t<std::decay, type_list<int &, long &, unsigned short&>>>, "!Ok");
restinio::utils::metaprogramming::all_of_v
constexpr bool all_of_v
Applies the predicate to all types from the list and return true only if all types satisty that predi...
Definition: metaprogramming.hpp:325

Since
  v.0.6.1

Definition at line 325 of file metaprogramming.hpp.