ValPack.hpp

A set of values that can be manipulated at compile time (good for metaprogramming)

Any built-in type can be added to ValPack to be manipulated at compile time.

Typedefs

template<auto START, auto END, auto STEP = 1>
using ValPackRange = typename internal::vp_range<(START >= END), START, END, STEP>::type

Generate a ValPack with a specified range of values.

template<auto COUNT>
using ValPackCount = ValPackRange<0, COUNT, 1>

Generate a count from 0 to COUNT-1 (so a total of COUNT values)

template<auto... Ts>
struct ValPack
#include <ValPack.hpp>
template<auto V1, auto... Vs>
struct ValPack<V1, Vs...>
#include <ValPack.hpp>

ValPack with at least one value.

Public Types

using this_t = ValPack<V1, Vs...>
using pop = ValPack<Vs...>
template<auto V>
using push = ValPack<V, V1, Vs...>

Add a value to the front of an ValPack.

template<auto V>
using push_back = ValPack<V1, Vs..., V>

Add a value to the back of an ValPack.

template<auto V, auto X>
using push_if_not = typename internal::vp_push_if_not<V, X, this_t>::result

Push V onto front of an ValPack if it does not equal X.

template<auto V, auto X>
using push_back_if_not = typename internal::vp_push_if_not<V, X, this_t>::back

Push V onto back of an ValPack if it does not equal X.

template<auto V>
using pop_val = typename internal::vp_loop<this_t, ValPack<>, false, 2>::template pop_val<V>

Remove the first time value V appears from an ValPack.

template<auto V>
using remove = typename internal::vp_loop<this_t, ValPack<>, false, 3>::template remove<V>

Remove the all appearances of value V from an ValPack.

template<typename T>
using append = typename internal::vp_concat<this_t, T>::result

Append one whole ValPack to the end of another.

template<template<int...> class TEMPLATE>
using apply = TEMPLATE<V1, Vs...>

Apply to a specified template with ValPack as template arguments.

Public Static Functions

template<typename T>
static inline constexpr bool Has(T val)

&#8212;=== Member Functions ===&#8212;

Return wheter an ValPack contains the value V.

template<typename T>
static inline constexpr size_t Count(T val)

Count the number of occurances of value V in ValPack.

template<typename T>
static inline constexpr int GetID(T val)

Determine the position at which V appears in ValPack.

static inline constexpr size_t GetSize()

Function to retrieve number of elements in ValPack.

static inline constexpr bool IsEmpty()

Determine if there are NO value in an ValPack.

static inline constexpr bool IsUnique()

Determine if all values in ValPack are different from each other.

static inline constexpr auto Sum()

Add up all values in an ValPack.

static inline constexpr auto Product()

Multiply together all value in an ValPack.

template<typename T>
static inline constexpr auto Min(T cap)

Find the smallest value in an ValPack, to a maximum of cap.

static inline constexpr auto Min()

Find the overall smallest value in an ValPack.

template<typename T>
static inline constexpr auto Max(T floor)

Find the maximum value in an ValPack, to a minimum of floor.

static inline constexpr auto Max()

Find the overall maximum value in an ValPack.

static inline constexpr bool IsSorted()

Determine if the pack is sorted.

template<typename T>
static inline constexpr auto ApplyIndex(T &&container)

Use each value in an ValPack as an index and return results as a tuple.

static inline std::string ToString()

Convert all values from an ValPack into a string, treating each as a char.

static inline void PrintVals(std::ostream &os = std::cout)

Print all values in an ValPack into a stream.

Public Static Attributes

static constexpr auto first = V1

First value in ValPack.

static constexpr size_t SIZE = 1 + sizeof...(Vs)

Number of values in ValPack.

template<>
struct ValPack<>
#include <ValPack.hpp>

Public Types

using this_t = ValPack<>
template<auto V>
using push = ValPack<V>
template<auto V>
using push_back = ValPack<V>
template<auto V, auto X>
using push_if_not = typename internal::vp_push_if_not<V, X, ValPack<>>::result
template<auto V, auto X>
using push_back_if_not = typename internal::vp_push_if_not<V, X, ValPack<>>::back
template<auto V>
using pop_val = ValPack<>
template<auto V>
using remove = ValPack<>
template<typename T>
using append = T

Public Static Functions

template<typename T>
static inline constexpr bool Has(T)
template<typename T>
static inline constexpr size_t Count(T)
template<typename T>
static inline constexpr int GetID(T)
static inline constexpr size_t GetSize()
static inline constexpr bool IsEmpty()
static inline constexpr bool IsUnique()
static inline constexpr double Sum()
static inline constexpr double Product()
template<typename T>
static inline constexpr auto Min(T cap)
template<typename T>
static inline constexpr auto Max(T floor)
static inline constexpr bool IsSorted()
static inline std::string ToString()
static inline void PrintVals(std::ostream& = std::cout)

Public Static Attributes

static constexpr size_t SIZE = 0
namespace pack

Typedefs

template<typename T>
using reverse = typename internal::vp_reverse<T>::result
template<typename T>
using uniq = typename internal::vp_uniq<T>::result
template<typename T>
using sort = typename internal::vp_sort<T>::result
template<typename T>
using Rsort = reverse<sort<T>>
template<typename T>
using Usort = uniq<sort<T>>
template<typename T>
using RUsort = reverse<Usort<T>>