conststr 0.2.1
Loading...
Searching...
No Matches
Concepts | Typedefs | Variables
conststr::meta Namespace Reference

Some useful template meta. More...

Concepts

concept  all_same
 This concept is satisfied if all types of Ts... the same type.
 
concept  all_same_of
 This concept is satisfied if all values of Vs... has the same type.
 
concept  hashable
 This concept is satisfied if std::hash<T> has specialization.
 
concept  viewer
 This concept is satisfied if T is a view type to a constant contiguous sequence of Elem.
 

Typedefs

template<typename... Ts>
using first_t = std::tuple_element_t< 0, std::tuple< Ts... > >
 Get the first type of class template parameter pack. More...
 
template<auto... Vs>
using first_t_of = std::remove_cvref_t< std::tuple_element_t< 0, decltype(std::tuple{Vs...})> >
 Get the type of the first value of variable template parameter pack. More...
 
template<typename... Ts>
using last_t = std::tuple_element_t< sizeof...(Ts) - 1, std::tuple< Ts... > >
 Get the last type of class template parameter pack. More...
 
template<auto... Vs>
using last_t_of = std::remove_cvref_t< std::tuple_element_t< sizeof...(Vs) - 1, decltype(std::tuple{Vs...})> >
 Get the type of the last value of variable template parameter pack. More...
 

Variables

template<auto... Vs>
constexpr auto first_v = [](auto first, auto...) { return first; }(Vs...)
 Get the first value of variable template parameter pack. More...
 
template<auto... Vs>
constexpr auto last_v = (Vs, ...)
 Get the last value of variable template parameter pack. More...
 

Detailed Description

Some useful template meta.

Typedef Documentation

◆ first_t

template<typename... Ts>
using conststr::meta::first_t = typedef std::tuple_element_t<0, std::tuple<Ts...> >

Get the first type of class template parameter pack.

For example, first_t<T, U, V, W> is T.

Template Parameters
Tsthe class template parameter pack

◆ first_t_of

template<auto... Vs>
using conststr::meta::first_t_of = typedef std::remove_cvref_t<std::tuple_element_t<0, decltype(std::tuple{Vs...})> >

Get the type of the first value of variable template parameter pack.

For example, first_t_of<a, b, c, d> is decltype(a).

Template Parameters
Vsthe variable template parameter pack

◆ last_t

template<typename... Ts>
using conststr::meta::last_t = typedef std::tuple_element_t<sizeof...(Ts) - 1, std::tuple<Ts...> >

Get the last type of class template parameter pack.

For example, first_t<T, U, V, W> is W.

Template Parameters
Tsthe class template parameter pack

◆ last_t_of

template<auto... Vs>
using conststr::meta::last_t_of = typedef std::remove_cvref_t< std::tuple_element_t<sizeof...(Vs) - 1, decltype(std::tuple{Vs...})> >

Get the type of the last value of variable template parameter pack.

For example, first_t_of<a, b, c, d> is decltype(d).

Template Parameters
Vsthe variable template parameter pack

Variable Documentation

◆ first_v

template<auto... Vs>
constexpr auto conststr::meta::first_v = [](auto first, auto...) { return first; }(Vs...)
constexpr

Get the first value of variable template parameter pack.

For example, first_v<a, b, c, d> is a.

Template Parameters
Vsthe variable template parameter pack

◆ last_v

template<auto... Vs>
constexpr auto conststr::meta::last_v = (Vs, ...)
constexpr

Get the last value of variable template parameter pack.

For example, first_v<a, b, c, d> is d.

Template Parameters
Vsthe variable template parameter pack