uTL
micro Template library
utl::meta Namespace Reference

Namespaces

 apply_impl
 
 at_impl
 
 back_impl
 
 cat_impl
 
 count_if_impl
 
 detail
 
 filter_impl
 
 find_if_impl
 
 fold_impl
 
 front_impl
 
 pop_back_impl
 
 pop_front_impl
 
 replace_if_impl
 
 rev_fold_impl
 
 reverse_impl
 
 seek_if_impl
 
 transform_impl
 
 transform_lazy_impl
 

Classes

struct  bind_back
 
struct  bind_front
 
struct  identity
 
struct  nat_
 
struct  nil_
 
struct  not_same_as
 
struct  quote
 
struct  quote_i
 Wrap a template F taking literal constants of type T into an Invokable. More...
 
struct  same_
 
struct  same_< _Tp, _Tp >
 
struct  same_as
 
struct  typelist
 
struct  wrap
 
struct  wrap_i
 Wrap a template F taking literal constants of type T into an Invokable. More...
 

Typedefs

template<typename... >
using void_ = void
 void_ type alias More...
 
template<typename... >
using void_t = void
 void_t type alias More...
 
template<typename Tp >
using eval = typename Tp::type
 Type alias for Tp::type. Used to evaluate/extract return type of metafunctions. More...
 
using Npos = size_< index_t(-1)>
 The last position we can express for indexing. More...
 
template<bool B>
using not_c = bool_<!B >
 Negate the bool constant parameter. More...
 
template<typename _Tp >
using not_ = not_c< _Tp::type::value >
 not More...
 
template<typename List >
using size = size_< List::size()>
 
template<typename List >
using empty = bool_< List::empty()>
 
template<typename T1 , typename T2 >
using pair = typelist< T1, T2 >
 
template<typename List , typename... Ts>
using push_front = eval< apply< bind_front< quote< typelist >, Ts... >, List > >
 
template<typename List , typename... Ts>
using push_back = eval< apply< bind_back< quote< typelist >, Ts... >, List > >
 
template<typename List , typename Pred >
using all_of = if_< empty< List >, false_, empty< filter< List, compose< quote< not_ >, Pred > > > >
 
template<typename List , typename Pred >
using any_of = not_< empty< filter< List, Pred > > >
 
template<typename List , typename Pred >
using none_of = empty< filter< List, Pred > >
 
template<typename _T1 , typename _T2 , typename _Ret = _T1>
using use_if_same_t = enable_if_t< same_< _T1, _T2 >::value, _Ret >
 If same type resolves to _Ret, else SFINAE. More...
 
template<typename _T1 , typename _T2 , typename _Ret = _T1>
using use_if_not_same_t = enable_if_t< !same_< _T1, _T2 >::value, _Ret >
 If not same type resolves to _Ret, else SFINAE. More...
 
template<typename T1 , typename... Ts>
using use_if_any_t = enable_if_t< or_< T1, Ts... >::value, T1 >
 If any type (_T1 or _T2) type resolves to _Ret, else to SFINAE. More...
 
template<typename T1 , typename... Ts>
using use_if_all_t = enable_if_t< and_< T1, Ts... >::value, T1 >
 If both type (_T1 and _T2) type resolves to _Ret, else to SFINAE. More...
 
template<typename Tp , Tp v>
using integral_ = std::integral_constant< Tp, v >
 
template<bool v>
using bool_ = integral_< bool, v >
 bool_ type: integral constant wrapper for bool More...
 
using true_ = bool_< true >
 The type used as a compile-time boolean with true value. More...
 
using false_ = bool_< false >
 The type used as a compile-time boolean with false value. More...
 
template<int8_t v>
using int8_ = integral_< int8_t, v >
 int8_ type: integral constant wrapper for int8_t More...
 
template<uint8_t v>
using uint8_ = integral_< uint8_t, v >
 uint8_ type: integral constant wrapper for uint8_t More...
 
template<int16_t v>
using int16_ = integral_< int16_t, v >
 int16_ type: integral constant wrapper for int16_t More...
 
template<uint16_t v>
using uint16_ = integral_< uint16_t, v >
 uint16_ type: integral constant wrapper for uint16_t More...
 
template<int32_t v>
using int32_ = integral_< int32_t, v >
 int32_ type: integral constant wrapper for int32_t More...
 
template<uint32_t v>
using uint32_ = integral_< uint32_t, v >
 uint32_ type: integral constant wrapper for uint32_t More...
 
template<char v>
using char_ = integral_< char, v >
 char_ type: integral constant wrapper for char More...
 
template<int v>
using int_ = integral_< int, v >
 int_ type: integral constant wrapper for int More...
 
template<long v>
using long_ = integral_< long, v >
 long_ type: integral constant wrapper for long More...
 
template<index_t v>
using index_ = integral_< index_t, v >
 index_ type: integral constant wrapper for index_t a.k.a std::size_t More...
 
template<size_t v>
using size_ = integral_< size_t, v >
 size_ type: integral constant wrapper for size_t a.k.a std::size_t More...
 
template<typename Tp >
using sizeof_ = size_< sizeof(Tp)>
 
template<typename Tp >
using alignof_ = size_< alignof(Tp)>
 
template<class Tp , Tp... Ints>
using integer_sequence = std::integer_sequence< Tp, Ints... >
 
template<typename Tp , Tp Num>
using make_integer_sequence = std::make_integer_sequence< Tp, Num >
 
template<index_t... Idx>
using index_sequence = integer_sequence< index_t, Idx... >
 Alias template index_sequence. More...
 
template<index_t Num>
using make_index_sequence = make_integer_sequence< index_t, Num >
 Alias template make_index_sequence. More...
 
template<typename... Types>
using index_sequence_for = make_index_sequence< sizeof...(Types)>
 Alias template index_sequence_for. More...
 
meta::invoke

A meta-programming invoke() analogous. A meta::invocable shall contain a nested template type named apply which is bind to actual invocable meta-function.

  • We can use wrap<> or even better quote<> in order to wrap a metafunction to a type (metafunction class)
  • We can pass these wrapped types to other metafunctions
  • We can invoke<> the inner apply from a wrapped metafunction class.
template<typename _Tp >
using identity_t = eval< identity< _Tp > >
 identity type alias More...
 
template<typename Fn , typename... Args>
using invoke = typename Fn::template apply< Args... >
 
template<typename Fn , typename... Args>
using invoke_t = eval< invoke< Fn, Args... > >
 
template<template< typename... > class F, typename... T>
using is_applicable_t = eval< detail::is_applicable_< F, T... > >
 check if we can instantiate F with parameters T More...
 
template<typename Q , typename... T>
using is_applicable_qt = eval< detail::is_applicable_q_< Q, T... > >
 check if we can invoke Q with parameters T More...
 
template<typename T , template< T... > class F, T... Is>
using is_applicable_it = eval< detail::is_applicable_i_< T, F, Is... > >
 check if we can instantiate F with parameters Is of type T More...
 
template<template< class... > class F, class... Ts>
using defer = if_< detail::is_applicable_< F, Ts... >, detail::defer_< F, Ts... >, nil_ >
 defer alias template for F<Ts...> More...
 
template<typename T , template< T... > class F, T... Is>
using defer_i = if_< detail::is_applicable_i_< T, F, Is... >, detail::defer_i_< T, F, Is... >, nil_ >
 defer_i alias template for F<T, Is...> More...
 
template<typename... Fns>
using compose = detail::compose_< Fns... >
 
template<template< typename... > class... Fns>
using compose_f = detail::compose_f_< Fns... >
 
template<typename... _Ts>
using or_ = eval< detail::_or_< _Ts... > >
 
template<typename... _Ts>
using and_ = eval< detail::_and_< _Ts... > >
 
template<typename _T1 , typename _T2 >
using not_same_ = not_< eval< same_< _T1, _T2 > >>
 
template<typename _Tp >
using negate = integral_< decltype(-_Tp()), -_Tp()>
 Negation. More...
 
template<typename _Tp1 , typename _Tp2 >
using add = integral_< decltype(_Tp1()+_Tp2()), _Tp1()+_Tp2() >
 Addition. More...
 
template<typename _Tp1 , typename _Tp2 >
using mult = integral_< decltype(_Tp2() *_Tp2()), _Tp1() *_Tp2() >
 Multiplication. More...
 
template<typename _Tp1 , typename _Tp2 >
using divide = integral_< decltype(_Tp2()/_Tp2()), _Tp1()/_Tp2() >
 Division. More...
 
template<typename _Tp1 , typename _Tp2 >
using modulo = integral_< decltype(_Tp1() % _Tp2()), _Tp1() % _Tp2() >
 Modulo. More...
 
template<typename _Tp1 , typename _Tp2 >
using sub = add< _Tp1, negate< _Tp2 > >
 Substruction. More...
 
template<typename _Tp >
using inc = add< _Tp, int_< 1 > >
 Increase. More...
 
template<typename _Tp >
using dec = add< _Tp, int_<-1 > >
 decrease More...
 
template<typename _Tp1 , typename _Tp2 >
using comp_eq = bool_< _Tp1()==_Tp2()>
 
template<typename _Tp1 , typename _Tp2 >
using comp_lt = bool_<(_Tp1()< _Tp2())>
 
template<typename _Tp1 , typename _Tp2 >
using comp_ne = not_< comp_eq< _Tp1, _Tp2 > >
 Not equal. More...
 
template<typename _Tp1 , typename _Tp2 >
using comp_gt = comp_lt< _Tp2, _Tp1 >
 Greater than. More...
 
template<typename _Tp1 , typename _Tp2 >
using comp_le = not_< comp_lt< _Tp2, _Tp1 > >
 Less or equal. More...
 
template<typename _Tp1 , typename _Tp2 >
using comp_ge = not_< comp_lt< _Tp1, _Tp2 > >
 Greater or equal. More...
 
template<typename _T >
using bitnot_ = integral_< typename _T::value_type,(typename _T::value_type)(~_T())>
 
template<typename _Tp1 , typename _Tp2 >
using bitand_ = integral_< decltype(_Tp1() &_Tp2()), _Tp1() &_Tp2()>
 
template<typename _Tp1 , typename _Tp2 >
using bitor_ = integral_< decltype(_Tp1()|_Tp2()), _Tp1()|_Tp2()>
 
template<typename _Tp1 , typename _Tp2 >
using bitxor_ = integral_< decltype(_Tp1() ^ _Tp2()), _Tp1() ^ _Tp2()>
 
template<typename _Tp , typename shift >
using shift_left = integral_< typename _Tp::value_type,(typename _Tp::value_type)(_Tp()<< shift())>
 
template<typename _Tp , typename shift >
using shift_right = integral_< typename _Tp::value_type,(typename _Tp::value_type)(_Tp() > > shift())>
 
template<bool B, typename... Args>
using if_c = eval< detail::if_c_< B, Args... > >
 Select one type or another depending on a compile-time Boolean. More...
 
template<typename If , typename... Args>
using if_ = if_c< If::type::value, Args... >
 Select one type or another depending on a compile-time Boolean type. More...
 
template<typename T1 , typename ... >
using first_of = T1
 Select the first type of a type sequence. More...
 
template<typename T1 , typename T2 , typename ... >
using second_of = T2
 Select the second type of a type sequence. More...
 
template<bool If>
using when = eval< detail::when_< If > >
 Well formed only if If is true. More...
 
template<bool If, typename _Tp = void>
using enable_if = std::enable_if< If, _Tp >
 enable_if, imported from stl More...
 
template<bool If, typename _Tp = void>
using enable_if_t = eval< enable_if< If, _Tp > >
 alias template for enable_if More...
 
template<size_t N, typename ... Ts>
using repeat_c = typename typelist< Ts... >::template times< N >
 
template<typename N , typename ... Ts>
using repeat = repeat_c< N::type::value, Ts... >
 
template<typename Fn , typename Seq >
using apply = apply_impl::apply_< Fn, Seq >
 
template<typename Fn , typename Seq >
using apply_t = eval< apply< Fn, Seq > >
 
template<typename List , index_t N>
using at_c = eval< at_impl::at_< List, N > >
 
template<typename List , typename N >
using at = at_c< List, N::type::value >
 
template<typename List >
using front = eval< front_impl::front_< List > >
 
template<typename List >
using back = eval< back_impl::back_< List > >
 
template<typename... Lists>
using cat = eval< cat_impl::cat_< Lists... > >
 
template<typename List , typename V , typename Fn >
using fold = eval< fold_impl::fold_< List, V, Fn > >
 
template<typename List , typename V , typename Fn >
using accumulate = fold< List, V, Fn >
 accumulate is an stl name for fold More...
 
template<typename List , typename V , typename Fn >
using rev_fold = eval< rev_fold_impl::rev_fold_< List, V, Fn > >
 
template<typename List >
using reverse = eval< reverse_impl::reverse_< List > >
 
template<typename List >
using pop_front = eval< pop_front_impl::pop_front_< List > >
 
template<typename List >
using pop_back = eval< pop_back_impl::pop_back_< List > >
 
template<typename... Args>
using transform = eval< transform_impl::transform_< typelist< Args... > > >
 
template<typename... Args>
using transform_lazy = eval< transform_lazy_impl::transform_lazy_< typelist< Args... > > >
 
template<typename List , typename Pred >
using find_if = eval< find_if_impl::find_if_< List, Pred, 0 > >
 
template<typename List , typename T >
using find = find_if< List, same_as< T > >
 
template<typename List , typename Pred >
using seek_if = eval< seek_if_impl::seek_if_< List, Pred, 0 > >
 
template<typename List , typename T >
using seek = seek_if< List, same_as< T > >
 
template<typename List , typename Pred >
using count_if = eval< count_if_impl::count_if_< List, Pred, 0 > >
 
template<typename List , typename T >
using count = count_if< List, same_as< T > >
 
template<typename List , typename Pred >
using filter = eval< filter_impl::filter_< List, Pred, typelist<> > >
 
template<typename List , typename Pred , typename T >
using replace_if = eval< replace_if_impl::replace_if_< List, Pred, T, typelist<> > >
 
template<typename List , typename T , typename U >
using replace = eval< replace_if< List, same_as< T >, U > >
 
template<template< typename... > class Op, typename... Args>
using is_detected = typename detail::detector< nat_, void, Op, Args... >::detected
 
template<template< typename... > class Op, typename... Args>
using detected_t = eval< detail::detector< nat_, void, Op, Args... > >
 
template<typename Default , template< typename... > class Op, typename... Args>
using detected_or_t = eval< detail::detected_or< Default, Op, Args... > >
 
template<typename Expected , template< typename... > class Op, typename... Args>
using is_detected_exact = eval< same_< Expected, detected_t< Op, Args... > > >
 
template<typename To , template< typename... > class Op, typename... Args>
using is_detected_convertible = eval< std::is_convertible< detected_t< Op, Args... >, To > >
 
template<template< typename... > class Op, typename... Args>
constexpr bool is_detected_v = is_detected<Op, Args...>::value
 Detection predicate. More...
 
template<typename Expected , template< typename... > class Op, typename... Args>
constexpr bool is_detected_exact_v = is_detected_exact< Expected, Op, Args...>::value
 evaluates to true if evaluation of Op<Args...> is Expected and to false if not More...
 
template<typename To , template< typename... > class Op, typename... Args>
constexpr bool is_detected_convertible_v
 

Typedef Documentation

◆ accumulate

template<typename List , typename V , typename Fn >
using utl::meta::accumulate = typedef fold<List, V, Fn>

accumulate is an stl name for fold

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 387 of file typelist.h.

◆ add

template<typename _Tp1 , typename _Tp2 >
using utl::meta::add = typedef integral_< decltype(_Tp1() + _Tp2()), _Tp1() + _Tp2() >

Addition.

Definition at line 144 of file operations.h.

◆ alignof_

template<typename Tp >
using utl::meta::alignof_ = typedef size_<alignof(Tp)>

Computes the alignment required for any instance of the type Tp. Complexity $ O(1) $.

Definition at line 120 of file integral.h.

◆ all_of

template<typename List , typename Pred >
using utl::meta::all_of = typedef if_ < empty <List>, false_, empty < filter <List, compose<quote<not_>, Pred> > > >

Returns true_ if Pred returns true_ for all the elements in the List or if the List is empty and false_ otherwise.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 861 of file typelist.h.

◆ any_of

template<typename List , typename Pred >
using utl::meta::any_of = typedef not_< empty<filter <List, Pred> > >

Returns true_ if Pred returns true_ for any of the elements in the List and false_ otherwise.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 868 of file typelist.h.

◆ apply

template<typename Fn , typename Seq >
using utl::meta::apply = typedef apply_impl::apply_<Fn, Seq>

Apply the Invocable Fn using the types in the type Seq as arguments.

Note
This is the opposed operation of typelist<Ts...>

If Seq == typelist<> then Unpack typelist and apply to Fn It Seq == integer_sequence<> then Unpack and use the integral_c<> of each integer

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h, and W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 197 of file typelist.h.

◆ apply_t

template<typename Fn , typename Seq >
using utl::meta::apply_t = typedef eval <apply<Fn, Seq> >

◆ at

template<typename List , typename N >
using utl::meta::at = typedef at_c<List, N::type::value>

Return the N th element in the meta::typelist List.

Complexity $ O(N) $.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 253 of file typelist.h.

◆ at_c

template<typename List , index_t N>
using utl::meta::at_c = typedef eval< at_impl::at_<List, N> >

Return the N th element in the meta::typelist List.

Complexity $ O(logN) $.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 245 of file typelist.h.

◆ back

template<typename List >
using utl::meta::back = typedef eval< back_impl::back_<List> >

Return the last element in meta::typelist List. Complexity $ O(N) $.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 296 of file typelist.h.

◆ bitand_

template<typename _Tp1 , typename _Tp2 >
using utl::meta::bitand_ = typedef integral_<decltype(_Tp1() & _Tp2()), _Tp1() & _Tp2()>
Returns
bitwise and (&) operation of its arguments

Definition at line 208 of file operations.h.

◆ bitnot_

template<typename _T >
using utl::meta::bitnot_ = typedef integral_<typename _T::value_type, (typename _T::value_type)(~_T())>

Bitwise operations requires IntegralConstant(_Tp)

Returns
bitwise not (~) operation of its argument.

Definition at line 205 of file operations.h.

◆ bitor_

template<typename _Tp1 , typename _Tp2 >
using utl::meta::bitor_ = typedef integral_<decltype(_Tp1() | _Tp2()), _Tp1() | _Tp2()>
Returns
bitwise or (|) operation of its arguments.

Definition at line 211 of file operations.h.

◆ bitxor_

template<typename _Tp1 , typename _Tp2 >
using utl::meta::bitxor_ = typedef integral_<decltype(_Tp1() ^ _Tp2()), _Tp1() ^ _Tp2()>
Returns
bitwise xor (^) operation of its arguments.

Definition at line 215 of file operations.h.

◆ bool_

template<bool v>
using utl::meta::bool_ = typedef integral_<bool, v>

bool_ type: integral constant wrapper for bool

Wrappers for basic types

Definition at line 66 of file integral.h.

◆ cat

template<typename... Lists>
using utl::meta::cat = typedef eval< cat_impl::cat_<Lists...> >

Transformation that concatenates several lists into a single typelist. The parameters must all be instantiations of meta::typelist. Complexity: $ O(N) $ where $ N $ is the number of lists passed to the algorithm.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 338 of file typelist.h.

◆ char_

template<char v>
using utl::meta::char_ = typedef integral_<char, v>

char_ type: integral constant wrapper for char

Definition at line 94 of file integral.h.

◆ comp_eq

template<typename _Tp1 , typename _Tp2 >
using utl::meta::comp_eq = typedef bool_<_Tp1() == _Tp2()>

Comparison operations requires IntegralConstant(_Tp)

Returns
a true-valued Integral Constant if _Tp1 and _Tp2 are equal.

Definition at line 184 of file operations.h.

◆ comp_ge

template<typename _Tp1 , typename _Tp2 >
using utl::meta::comp_ge = typedef not_<comp_lt<_Tp1, _Tp2> >

Greater or equal.

Definition at line 195 of file operations.h.

◆ comp_gt

template<typename _Tp1 , typename _Tp2 >
using utl::meta::comp_gt = typedef comp_lt <_Tp2, _Tp1>

Greater than.

Definition at line 191 of file operations.h.

◆ comp_le

template<typename _Tp1 , typename _Tp2 >
using utl::meta::comp_le = typedef not_<comp_lt<_Tp2, _Tp1> >

Less or equal.

Definition at line 193 of file operations.h.

◆ comp_lt

template<typename _Tp1 , typename _Tp2 >
using utl::meta::comp_lt = typedef bool_<(_Tp1() < _Tp2())>
Returns
a true-valued Integral Constant if _Tp1 is less than _Tp2.

Definition at line 186 of file operations.h.

◆ comp_ne

template<typename _Tp1 , typename _Tp2 >
using utl::meta::comp_ne = typedef not_<comp_eq<_Tp1, _Tp2> >

Not equal.

Definition at line 189 of file operations.h.

◆ compose

template<typename... Fns>
using utl::meta::compose = typedef detail::compose_<Fns...>

◆ compose_f

template<template< typename... > class... Fns>
using utl::meta::compose_f = typedef detail::compose_f_<Fns...>

◆ count

template<typename List , typename T >
using utl::meta::count = typedef count_if<List, same_as<T> >

Count all occurrences of type T int List

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 761 of file typelist.h.

◆ count_if

template<typename List , typename Pred >
using utl::meta::count_if = typedef eval< count_if_impl::count_if_<List, Pred, 0> >

Count all Items on the List for which the predicate Pred returns true_ when eval<invoke<Pred, Item>>

Complexity $ O(N) $

Parameters
ListA typelist
PredA Unary invocable predicate
Returns
The total count of occurrences as an integral constant of size_t
Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 755 of file typelist.h.

◆ dec

template<typename _Tp >
using utl::meta::dec = typedef add<_Tp, int_<-1> >

decrease

Definition at line 173 of file operations.h.

◆ defer

template<template< class... > class F, class... Ts>
using utl::meta::defer = typedef if_< detail::is_applicable_<F, Ts...>, detail::defer_<F, Ts...>, nil_ >

defer alias template for F<Ts...>

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h.

Definition at line 213 of file invoke.h.

◆ defer_i

template<typename T , template< T... > class F, T... Is>
using utl::meta::defer_i = typedef if_ < detail::is_applicable_i_<T, F, Is...>, detail::defer_i_<T, F, Is...>, nil_ >

defer_i alias template for F<T, Is...>

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h.

Definition at line 221 of file invoke.h.

◆ detected_or_t

template<typename Default , template< typename... > class Op, typename... Args>
using utl::meta::detected_or_t = typedef eval < detail::detected_or<Default, Op, Args...> >

◆ detected_t

template<template< typename... > class Op, typename... Args>
using utl::meta::detected_t = typedef eval < detail::detector<nat_, void, Op, Args...> >

◆ divide

template<typename _Tp1 , typename _Tp2 >
using utl::meta::divide = typedef integral_< decltype(_Tp2() / _Tp2()), _Tp1() / _Tp2() >

Division.

Definition at line 156 of file operations.h.

◆ empty

template<typename List >
using utl::meta::empty = typedef bool_<List::empty()>

An Boolean constant wrapper that returns if the typelist is empty

Complexity $ O(1) $.

Parameters
ListA typelist
Returns
Empty or not
Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 140 of file typelist.h.

◆ enable_if

template<bool If, typename _Tp = void>
using utl::meta::enable_if = typedef std::enable_if<If, _Tp>

enable_if, imported from stl

enable_if

Definition at line 60 of file sfinae.h.

◆ enable_if_t

template<bool If, typename _Tp = void>
using utl::meta::enable_if_t = typedef eval< enable_if<If, _Tp> >

alias template for enable_if

Definition at line 63 of file sfinae.h.

◆ eval

template<typename Tp >
using utl::meta::eval = typedef typename Tp::type

Type alias for Tp::type. Used to evaluate/extract return type of metafunctions.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/detection.h, W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h, and W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 49 of file integral.h.

◆ false_

◆ filter

template<typename List , typename Pred >
using utl::meta::filter = typedef eval< filter_impl::filter_<List, Pred, typelist<> > >

Return a new typelist with elements, the elements of List that satisfy the invocable Pred such that eval<invoke<Pred, Item>> is true_

Complexity $ O(N) $

Parameters
ListThe input typelist
PredA unary invocable predicate
Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 800 of file typelist.h.

◆ find

template<typename List , typename T >
using utl::meta::find = typedef find_if<List, same_as<T> >

Search for the first occurrence of type T on a List

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 663 of file typelist.h.

◆ find_if

template<typename List , typename Pred >
using utl::meta::find_if = typedef eval< find_if_impl::find_if_<List, Pred, 0> >

Search for the first Item on the List for which the predicate Pred returns true_ when eval<invoke<Pred, Item>>

Complexity $ O(N) $

Parameters
ListA typelist
PredA Unary invocable predicate
Returns
An integral constant of index_t with the location of the first match, or Npos otherwise.
Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 657 of file typelist.h.

◆ fold

template<typename List , typename V , typename Fn >
using utl::meta::fold = typedef eval<fold_impl::fold_<List, V, Fn> >

◆ front

template<typename List >
using utl::meta::front = typedef eval< front_impl::front_<List> >

Return the first element in meta::typelist List. Complexity $ O(1) $.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 274 of file typelist.h.

◆ identity_t

template<typename _Tp >
using utl::meta::identity_t = typedef eval<identity<_Tp> >

identity type alias

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h.

Definition at line 68 of file invoke.h.

◆ inc

template<typename _Tp >
using utl::meta::inc = typedef add<_Tp, int_<1> >

Increase.

Definition at line 169 of file operations.h.

◆ index_

template<index_t v>
using utl::meta::index_ = typedef integral_<index_t, v>

index_ type: integral constant wrapper for index_t a.k.a std::size_t

Definition at line 106 of file integral.h.

◆ index_sequence

template<index_t... Idx>
using utl::meta::index_sequence = typedef integer_sequence<index_t, Idx...>

Alias template index_sequence.

Definition at line 136 of file integral.h.

◆ index_sequence_for

template<typename... Types>
using utl::meta::index_sequence_for = typedef make_index_sequence<sizeof...(Types)>

Alias template index_sequence_for.

Definition at line 144 of file integral.h.

◆ int16_

template<int16_t v>
using utl::meta::int16_ = typedef integral_<int16_t, v>

int16_ type: integral constant wrapper for int16_t

Definition at line 80 of file integral.h.

◆ int32_

template<int32_t v>
using utl::meta::int32_ = typedef integral_<int32_t, v>

int32_ type: integral constant wrapper for int32_t

Definition at line 87 of file integral.h.

◆ int8_

template<int8_t v>
using utl::meta::int8_ = typedef integral_<int8_t, v>

int8_ type: integral constant wrapper for int8_t

Definition at line 73 of file integral.h.

◆ int_

template<int v>
using utl::meta::int_ = typedef integral_<int, v>

int_ type: integral constant wrapper for int

Definition at line 98 of file integral.h.

◆ integer_sequence

template<class Tp , Tp... Ints>
using utl::meta::integer_sequence = typedef std::integer_sequence<Tp, Ints...>

integer sequence

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 129 of file integral.h.

◆ integral_

template<typename Tp , Tp v>
using utl::meta::integral_ = typedef std::integral_constant<Tp, v>

integral_ Integral Constant is a holder class for a compile-time value of an integral type. Every Integral Constant is also a null-ary Metafunction, returning itself. An integral constant object is implicitly convertible to the corresponding run-time value of the wrapped integral type

Definition at line 58 of file integral.h.

◆ invoke

template<typename Fn , typename... Args>
using utl::meta::invoke = typedef typename Fn::template apply<Args...>

invoke, invoke_t

Invoke the nested apply meta-function from Fn with the arguments Args.

Note
This is an analogous to the std::invoke()
Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h, and W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 81 of file invoke.h.

◆ invoke_t

template<typename Fn , typename... Args>
using utl::meta::invoke_t = typedef eval< invoke <Fn, Args...> >

Evaluate the invocation of the nested apply metafunction from Fn with the arguments Args.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h.

Definition at line 88 of file invoke.h.

◆ is_applicable_it

template<typename T , template< T... > class F, T... Is>
using utl::meta::is_applicable_it = typedef eval< detail::is_applicable_i_<T, F, Is...> >

check if we can instantiate F with parameters Is of type T

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h.

Definition at line 174 of file invoke.h.

◆ is_applicable_qt

template<typename Q , typename... T>
using utl::meta::is_applicable_qt = typedef eval < detail::is_applicable_q_ <Q, T...> >

check if we can invoke Q with parameters T

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h.

Definition at line 168 of file invoke.h.

◆ is_applicable_t

template<template< typename... > class F, typename... T>
using utl::meta::is_applicable_t = typedef eval< detail::is_applicable_<F, T...> >

check if we can instantiate F with parameters T

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h.

Definition at line 163 of file invoke.h.

◆ is_detected

template<template< typename... > class Op, typename... Args>
using utl::meta::is_detected = typedef typename detail::detector<nat_, void, Op, Args...>::detected

◆ is_detected_convertible

template<typename To , template< typename... > class Op, typename... Args>
using utl::meta::is_detected_convertible = typedef eval < std::is_convertible< detected_t<Op, Args...>, To > >

◆ is_detected_exact

template<typename Expected , template< typename... > class Op, typename... Args>
using utl::meta::is_detected_exact = typedef eval < same_<Expected, detected_t<Op, Args...> > >

◆ long_

template<long v>
using utl::meta::long_ = typedef integral_<long, v>

long_ type: integral constant wrapper for long

Definition at line 102 of file integral.h.

◆ make_index_sequence

template<index_t Num>
using utl::meta::make_index_sequence = typedef make_integer_sequence <index_t, Num>

Alias template make_index_sequence.

Definition at line 140 of file integral.h.

◆ make_integer_sequence

template<typename Tp , Tp Num>
using utl::meta::make_integer_sequence = typedef std::make_integer_sequence<Tp, Num>

Definition at line 132 of file integral.h.

◆ modulo

template<typename _Tp1 , typename _Tp2 >
using utl::meta::modulo = typedef integral_< decltype(_Tp1() % _Tp2()), _Tp1() % _Tp2() >

Modulo.

Definition at line 162 of file operations.h.

◆ mult

template<typename _Tp1 , typename _Tp2 >
using utl::meta::mult = typedef integral_< decltype(_Tp2() * _Tp2()), _Tp1() * _Tp2() >

Multiplication.

Definition at line 150 of file operations.h.

◆ negate

template<typename _Tp >
using utl::meta::negate = typedef integral_<decltype(-_Tp()), -_Tp()>

Negation.

Math operations requires IntegralConstant(_Tp)

Definition at line 138 of file operations.h.

◆ none_of

template<typename List , typename Pred >
using utl::meta::none_of = typedef empty< filter <List, Pred> >

Returns true_ if Pred returns false_ for all the elements in the List or if the List is empty and false otherwise.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 875 of file typelist.h.

◆ Npos

using utl::meta::Npos = typedef size_<index_t(-1)>

The last position we can express for indexing.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 124 of file integral.h.

◆ pair

template<typename T1 , typename T2 >
using utl::meta::pair = typedef typelist<T1, T2>

pair A special typelist with only 2 Types

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 145 of file typelist.h.

◆ pop_back

template<typename List >
using utl::meta::pop_back = typedef eval < pop_back_impl::pop_back_<List> >

Return a new typelist by removing the last element from the List. Complexity $ O(N) $.

Note
This operation, in addition from other push/pop operations, is heavy(2 reverse operations).
Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 526 of file typelist.h.

◆ pop_front

template<typename List >
using utl::meta::pop_front = typedef eval< pop_front_impl::pop_front_<List> >

Return a new typelist by removing the first element from the front of List. Complexity $ O(1) $

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 502 of file typelist.h.

◆ push_back

template<typename List , typename... Ts>
using utl::meta::push_back = typedef eval< apply < bind_back<quote<typelist>, Ts...>, List > >

Return a new typelist by adding the elements Ts to the back of List. Complexity $ O(1) $

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 461 of file typelist.h.

◆ push_front

template<typename List , typename... Ts>
using utl::meta::push_front = typedef eval< apply < bind_front<quote<typelist>, Ts...>, List > >

Return a new typelist by adding the elements Ts to the front of List. Complexity $ O(1) $

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 450 of file typelist.h.

◆ repeat

template<typename N , typename ... Ts>
using utl::meta::repeat = typedef repeat_c<N::type::value, Ts...>

A wrapper to typelist<>::times<> utility for integral_c argument N

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 161 of file typelist.h.

◆ repeat_c

template<size_t N, typename ... Ts>
using utl::meta::repeat_c = typedef typename typelist<Ts...>::template times<N>

repeat

A wrapper to typelist<>::times<> utility for integer argument N

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 155 of file typelist.h.

◆ replace

template<typename List , typename T , typename U >
using utl::meta::replace = typedef eval < replace_if <List, same_as<T>, U> >

Alias wrapper that returns a new typelist where all instances of type T have been replaced with U.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 848 of file typelist.h.

◆ replace_if

template<typename List , typename Pred , typename T >
using utl::meta::replace_if = typedef eval< replace_if_impl::replace_if_<List, Pred, T, typelist<> > >

Return a new typelist where all the instances for which the invocation ofPred returns true_, are replaced with T

Complexity $ O(N) $

Parameters
ListThe input typelist
PredA unary invocable predicate
TThe new type to replace the item of the List, when eval<invoke<Pred, Item>> returns true_
Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 841 of file typelist.h.

◆ rev_fold

template<typename List , typename V , typename Fn >
using utl::meta::rev_fold = typedef eval< rev_fold_impl::rev_fold_<List, V, Fn> >

◆ reverse

template<typename List >
using utl::meta::reverse = typedef eval< reverse_impl::reverse_<List> >

Return a new typelist by reversing the elements in the list List. Complexity $ O(N) $

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 479 of file typelist.h.

◆ seek

template<typename List , typename T >
using utl::meta::seek = typedef seek_if <List, same_as<T> >

Search for the first Item on the List of type T and return the rest of the List starting from that position as new typelist

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 711 of file typelist.h.

◆ seek_if

template<typename List , typename Pred >
using utl::meta::seek_if = typedef eval< seek_if_impl::seek_if_<List, Pred, 0> >

Search for the first Item on the List for which the predicate Pred returns true_ when eval<invoke<Pred, Item>> and return the rest of the List starting from that position as new typelist

Complexity $ O(N) $

Parameters
ListA typelist
PredA Unary invocable predicate
Returns
An integral constant with the location of the first match, on Npos otherwise
Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 705 of file typelist.h.

◆ shift_left

template<typename _Tp , typename shift >
using utl::meta::shift_left = typedef integral_<typename _Tp::value_type, (typename _Tp::value_type)(_Tp() << shift())>
Returns
the result of bitwise shift left (<<) operation on _Tp.

Definition at line 218 of file operations.h.

◆ shift_right

template<typename _Tp , typename shift >
using utl::meta::shift_right = typedef integral_<typename _Tp::value_type, (typename _Tp::value_type)(_Tp() > > shift())>
Returns
the result of bitwise shift right (>>) operation on _Tp.

Definition at line 221 of file operations.h.

◆ size

template<typename List >
using utl::meta::size = typedef size_<List::size()>

An integral constant wrapper that is the size of the meta::typelist

Complexity $ O(1) $.

Parameters
ListA typelist
Returns
The size of the typelist
Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/typelist.h.

Definition at line 129 of file typelist.h.

◆ size_

template<size_t v>
using utl::meta::size_ = typedef integral_<size_t, v>

size_ type: integral constant wrapper for size_t a.k.a std::size_t

Definition at line 110 of file integral.h.

◆ sizeof_

template<typename Tp >
using utl::meta::sizeof_ = typedef size_<sizeof(Tp)>

Computes the size of the type Tp. Complexity $ O(1) $.

Definition at line 115 of file integral.h.

◆ sub

template<typename _Tp1 , typename _Tp2 >
using utl::meta::sub = typedef add<_Tp1, negate<_Tp2> >

Substruction.

Definition at line 165 of file operations.h.

◆ transform

template<typename... Args>
using utl::meta::transform = typedef eval< transform_impl::transform_<typelist<Args...> > >

◆ transform_lazy

template<typename... Args>
using utl::meta::transform_lazy = typedef eval< transform_lazy_impl::transform_lazy_<typelist<Args...> > >

◆ true_

using utl::meta::true_ = typedef bool_<true>

The type used as a compile-time boolean with true value.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/detection.h, and W:/Work/Software/Libraries/utl/include/utl/meta/invoke.h.

Definition at line 68 of file integral.h.

◆ uint16_

template<uint16_t v>
using utl::meta::uint16_ = typedef integral_<uint16_t, v>

uint16_ type: integral constant wrapper for uint16_t

Definition at line 83 of file integral.h.

◆ uint32_

template<uint32_t v>
using utl::meta::uint32_ = typedef integral_<uint32_t, v>

uint32_ type: integral constant wrapper for uint32_t

Definition at line 90 of file integral.h.

◆ uint8_

template<uint8_t v>
using utl::meta::uint8_ = typedef integral_<uint8_t, v>

uint8_ type: integral constant wrapper for uint8_t

Definition at line 76 of file integral.h.

◆ use_if_all_t

template<typename T1 , typename... Ts>
using utl::meta::use_if_all_t = typedef enable_if_t< and_<T1, Ts...>::value, T1 >

If both type (_T1 and _T2) type resolves to _Ret, else to SFINAE.

Definition at line 56 of file useif.h.

◆ use_if_any_t

template<typename T1 , typename... Ts>
using utl::meta::use_if_any_t = typedef enable_if_t< or_<T1, Ts...>::value, T1 >

If any type (_T1 or _T2) type resolves to _Ret, else to SFINAE.

Definition at line 50 of file useif.h.

◆ use_if_not_same_t

template<typename _T1 , typename _T2 , typename _Ret = _T1>
using utl::meta::use_if_not_same_t = typedef enable_if_t< !same_<_T1, _T2>::value, _Ret >

If not same type resolves to _Ret, else SFINAE.

Definition at line 45 of file useif.h.

◆ use_if_same_t

template<typename _T1 , typename _T2 , typename _Ret = _T1>
using utl::meta::use_if_same_t = typedef enable_if_t< same_<_T1, _T2>::value, _Ret >

If same type resolves to _Ret, else SFINAE.

Definition at line 40 of file useif.h.

◆ when

template<bool If>
using utl::meta::when = typedef eval< detail::when_<If> >

Well formed only if If is true.

Definition at line 46 of file sfinae.h.

Variable Documentation

◆ is_detected_convertible_v

template<typename To , template< typename... > class Op, typename... Args>
constexpr bool utl::meta::is_detected_convertible_v
Initial value:
=
is_detected_convertible<To, Op, Args...>::value
eval< std::is_convertible< detected_t< Op, Args... >, To > > is_detected_convertible
Definition: detection.h:231

evaluates to true if evaluation of Op<Args...> is convertible to To and to false if not

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/detection.h.

Definition at line 237 of file detection.h.

◆ is_detected_exact_v

template<typename Expected , template< typename... > class Op, typename... Args>
constexpr bool utl::meta::is_detected_exact_v = is_detected_exact< Expected, Op, Args...>::value

evaluates to true if evaluation of Op<Args...> is Expected and to false if not

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/detection.h.

Definition at line 204 of file detection.h.

◆ is_detected_v

template<template< typename... > class Op, typename... Args>
constexpr bool utl::meta::is_detected_v = is_detected<Op, Args...>::value

Detection predicate.

Examples:
W:/Work/Software/Libraries/utl/include/utl/meta/detection.h.

Definition at line 122 of file detection.h.