capydi
Loading...
Searching...
No Matches
/capydi/core/capymeta/include/capymeta/primitives/Pack.hpp
template<typename Dispatcher>
void initialize(Unit<Dispatcher>&& u) {
// Dispatcher type information is available at compile time,
// but no instantiation has occurred
}
initialize(Unit<MyDispatcher>{});
#ifndef PACK_HPP_
#define PACK_HPP_
#include <tuple>
namespace capy::meta
{
template<typename UnitType>
struct Unit {
using InnerType = UnitType;
};
template<typename Unit_>
using unit_inner_type_t = typename Unit_::InnerType;
template<typename... Types>
struct Pack {};
template<typename Pack_>
constexpr std::size_t pack_size_v = []<typename... Types>(Pack<Types...>&&) {
return sizeof...(Types);
}(Pack_{});
template<typename Pack_>
constexpr bool pack_is_empty_v = pack_size_v<Pack_> == 0;
template<auto Value>
struct ValueUnit {};
template<typename ValueUnit_>
struct UnwrapValueUnit;
template<auto Value>
struct UnwrapValueUnit<ValueUnit<Value>>
{
static constexpr auto value = Value;
};
template<typename ValueUnit_>
static constexpr auto unwrap_value_unit_v = UnwrapValueUnit<ValueUnit_>::value;
template<
template<typename> typename
>
struct UnaryMetaFunction {};
using EmptyPack = Pack<>;
template<typename Pack_, template<typename...> typename Template>
struct RebindPack;
template<template<typename...> typename Template, typename... Elements>
struct RebindPack<Pack<Elements...>, Template>
{
using type = Template<Elements...>;
};
template<typename Pack_, template<typename...> typename Template>
using rebind_pack_t = typename RebindPack<Pack_, Template>::type;
}
#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
UnitType InnerType
Definition Pack.hpp:46