capydi
Loading...
Searching...
No Matches
Pack.hpp
Go to the documentation of this file.
1
15
16#ifndef PACK_HPP_
17#define PACK_HPP_
18
19#include <tuple>
20
21namespace capy::meta
22{
23
44template<typename UnitType>
45struct Unit {
46 using InnerType = UnitType;
47};
48
49template<typename Unit_>
50using unit_inner_type_t = typename Unit_::InnerType;
51
69template<typename... Types>
70struct Pack {};
71
72template<typename Pack_>
73constexpr std::size_t pack_size_v = []<typename... Types>(Pack<Types...>&&) {
74 return sizeof...(Types);
75}(Pack_{});
76
77template<typename Pack_>
78constexpr bool pack_is_empty_v = pack_size_v<Pack_> == 0;
79
93template<auto Value>
94struct ValueUnit {};
95
105template<typename ValueUnit_>
107
109template<auto Value>
111{
112 static constexpr auto value = Value;
113};
114
116template<typename ValueUnit_>
117static constexpr auto unwrap_value_unit_v = UnwrapValueUnit<ValueUnit_>::value;
118
128template<
129 template<typename> typename
130>
132
135
152template<typename Pack_, template<typename...> typename Template>
154
156template<template<typename...> typename Template, typename... Elements>
157struct RebindPack<Pack<Elements...>, Template>
158{
159 using type = Template<Elements...>;
160};
161
163template<typename Pack_, template<typename...> typename Template>
165
166}
167
168#endif // !PACK_HPP_
Definition Rebind.hpp:7
typename RebindPack< Pack_, Template >::type rebind_pack_t
Convenience alias for RebindPack.
Definition Pack.hpp:164
Pack<> EmptyPack
The empty type pack; useful as a base case for recursive operations.
Definition Pack.hpp:134
typename Unit_::InnerType unit_inner_type_t
Definition Pack.hpp:50
constexpr std::size_t pack_size_v
Definition Pack.hpp:73
constexpr bool pack_is_empty_v
Definition Pack.hpp:78
A compile-time heterogeneous type list.
Definition Pack.hpp:70
Template< Elements... > type
Definition Pack.hpp:159
Type trait that repackages a Pack's elements into a different template.
Definition Pack.hpp:153
A tag for template template parameters representing unary predicates.
Definition Pack.hpp:131
A zero-cost wrapper for forwarding compile-time type information.
Definition Pack.hpp:45
UnitType InnerType
Definition Pack.hpp:46
static constexpr auto value
Definition Pack.hpp:112
Type trait that extracts a value from a ValueUnit.
Definition Pack.hpp:106
A wrapper for non-type template parameter values.
Definition Pack.hpp:94