Graphle 1.0.0
A C++20 header-only graph library
Loading...
Searching...
No Matches
type_list.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <common.hpp>
4#include <meta/concepts.hpp>
5
6
7namespace graphle::meta {
9 template <typename... Ts> struct type_list {
10 constexpr static inline std::size_t size = sizeof...(Ts);
11 constexpr static inline bool empty = size == 0;
12
13
14 template <template <typename... X> typename F> using map = type_list<F<Ts>...>;
15 template <template <typename... X> typename F> using to = type_list<F<Ts...>>;
16
17
19 template <typename F> constexpr static decltype(auto) apply(F&& fn) {
20 return fn.template operator()<Ts...>();
21 }
22
23
25 template <typename F> constexpr static inline void foreach(F&& fn) {
26 (fn.template operator()<Ts>(), ...);
27 }
28 };
29
30
32 template <typename L> concept list_of_types = is_template_v<type_list, L>;
33}
static constexpr bool empty
Definition: type_list.hpp:11
static constexpr decltype(auto) apply(F &&fn)
Definition: type_list.hpp:19
static constexpr std::size_t size
Definition: type_list.hpp:10