mirror of
https://github.com/usatiuk/cardboy.git
synced 2025-10-28 23:27:49 +01:00
37 lines
995 B
C++
37 lines
995 B
C++
//
|
|
// Created by Stepan Usatiuk on 27.07.2025.
|
|
//
|
|
|
|
#ifndef UTILS_HPP
|
|
#define UTILS_HPP
|
|
|
|
template <typename... Ts>
|
|
struct type_list {};
|
|
|
|
template <template <typename...> class T, typename U>
|
|
struct is_specialization_of: std::false_type {};
|
|
|
|
template <template <typename...> class T, typename... Us>
|
|
struct is_specialization_of<T, T<Us...>>: std::true_type {};
|
|
|
|
template <template <typename> class Target, typename List>
|
|
struct instantiate_all_with;
|
|
|
|
template <template <typename> class Target, template <typename...> class List, typename... Ts>
|
|
struct instantiate_all_with<Target, List<Ts...>> {
|
|
using type = std::tuple<Target<Ts>...>;
|
|
};
|
|
|
|
template <template <typename> class Func, typename List>
|
|
struct call_template_for_all;
|
|
|
|
template <template <typename> class Func, template <typename...> class List, typename... Ts>
|
|
struct call_template_for_all<Func, List<Ts...>> {
|
|
static void run() {
|
|
(Func<Ts>{}(), ...); // assumes Func<T>::operator() exists
|
|
}
|
|
};
|
|
|
|
|
|
#endif //UTILS_HPP
|