ccutl  0.3.2
a C++ utilities library focused on flexibility and expressibility
Public Types | Public Member Functions | Static Public Attributes | List of all members
ctl::value_pack< values > Struct Template Reference

#include <ccutl.h>

Public Types

template<template< auto... > class Template, detail::value_pack::typeof_vtpl< Template > T>
using from = typename detail::value_pack::from< Template, T >::template type< values... >
 
template<template< auto... > class Template>
using to = Template< values... >
 
using types = type_pack< decltype(values)... >
 type_pack of the types of each value
 
template<std::size_t idx>
using get_type = typename types::template get< idx >
 
template<auto value>
using push_back = value_pack< values..., value >
 Represents a value_pack with value pushed to the back.
 
template<auto value>
using push_front = value_pack< value, values... >
 Represents a value_pack with value pushed to the front.
 
template<detail::value_pack::typeof_vtpl< value_pack > Other>
using concat = typename detail::value_pack::concat< Other >::template type< values... >
 

Public Member Functions

constexpr value_pack (const value_pack< values... > &)=default
 
constexpr value_pack (value_pack< values... > &&)=default
 
template<template< auto... > class Template, auto... vs>
constexpr value_pack (const Template< vs... > &) noexcept
 Placeholder constructor for deduction-guide construction.
 
template<template< auto... > class Template, auto... vs>
constexpr value_pack (Template< vs... > &&) noexcept
 Placeholder constructor for deduction-guide construction.
 
template<std::size_t idx>
 requires (idx< sizeof...(values)) static const expr get_type< idx > get
 
template<std::size_t n_removed = 1>
 requires (size >=n_removed) using pop_back
 
template<std::size_t n_removed = 1ul>
 requires (size >=n_removed) using pop_front
 
template<std::size_t begin, std::size_t end = size>
 requires (size >=0 and begin<=end and end<=size) using slice
 

Static Public Attributes

static constexpr std::size_t size = sizeof...(values)
 Represents the number of types in the pack.
 

Detailed Description

template<auto... values>
struct ctl::value_pack< values >

Provides a nontype template arg container with transformational utilities

#include "ctl/value_pack.h"
using t0 = ctl::value_pack<>; // value_pack<>
using t1 = t0::push_back<0>; // value_pack<0>
using t2 = t1::push_front<1>; // value_pack<1, 0>
using t3 = t2::concat<value_pack<2, 3>>; // value_pack<1, 0, 2, 3>
using t4 = t3::pop_back<>; // value_pack<1, 0, 2>
using t5 = t4::pop_front<2>; // value_pack<2>
using t6 = t5::to<example>; // example<2>
using t7 = t5::get<0>; // 2
//
auto sz = t5::size; // 1

Member Typedef Documentation

◆ concat

template<auto... values>
template<detail::value_pack::typeof_vtpl< value_pack > Other>
using ctl::value_pack< values >::concat = typename detail::value_pack::concat<Other>::template type<values...>

Represents a value_pack with types from the concatenation of another value_pack – <this..., other...>

Template Parameters
Other- Other value_pack to concatenate

◆ from

template<auto... values>
template<template< auto... > class Template, detail::value_pack::typeof_vtpl< Template > T>
using ctl::value_pack< values >::from = typename detail::value_pack::from<Template, T>::template type<values...>

Creates a value_pack from all template arguments in a nontype template

Template Parameters
Template- Template name
T[Template<auto...>] - Type to grab arguments from value_pack<>::from<Tpl, Tpl<1, 2, 'a'>>; // -> value_pack<1, 2, 'a'>

◆ get_type

template<auto... values>
template<std::size_t idx>
using ctl::value_pack< values >::get_type = typename types::template get<idx>

Represents the type of the value at index idx

Template Parameters
idx- Index of the value

◆ to

template<auto... values>
template<template< auto... > class Template>
using ctl::value_pack< values >::to = Template<values...>

Creates a nontype template specialization from the held values

Template Parameters
Template- Template to type_specialize

Member Function Documentation

◆ requires() [1/3]

template<auto... values>
template<std::size_t begin, std::size_t end = size>
ctl::value_pack< values >::requires ( size >=0 and begin<=end and end<=  size)

Represents a value_pack from a slice of this pack [begin, end)

Template Parameters
begin- First element index
end- Element index following last element index

◆ requires() [2/3]

template<auto... values>
template<std::size_t n_removed = 1>
ctl::value_pack< values >::requires ( size >=  n_removed)

Represents a value_pack with its last n_removed elements removed

Template Parameters
n_removed[ =1 ] - Number of elements to remove

◆ requires() [3/3]

template<auto... values>
template<std::size_t n_removed = 1ul>
ctl::value_pack< values >::requires ( size >=  n_removed)

Represents a value_pack with its first n_removed elements removed

Template Parameters
n_removed[ =1 ] - Number of elements to remove

The documentation for this struct was generated from the following file: