Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
metaprogramming.hh
Go to the documentation of this file.
1
5#ifndef UTOPIA_CORE_COMPILETIME_ALGOS_HH
6#define UTOPIA_CORE_COMPILETIME_ALGOS_HH
7#include "type_traits.hh"
8
9namespace Utopia {
10// namespace for implementing tuple for each
11namespace _Metaprogramming_helpers {
19template<template<typename...> class Metafunc, typename Tuplelike, typename X>
21
31template<template<typename...> class Metafunc,
32 typename Tuplelike,
33 std::size_t... idxs>
35{
36 // application of metafunction
37 using type = typename Metafunc<
38 typename std::tuple_element_t<idxs, Tuplelike>...>::type;
39};
40
41} // namespace _Metaprogramming_helpers
42
43namespace Utils {
44
45
54template<template<typename...> class Metafunc, typename Tuplelike>
55struct apply
56{
57
60 std::decay_t<Tuplelike>,
61 std::make_index_sequence<std::tuple_size_v<std::decay_t<Tuplelike>>>>::type;
62};
63
72template<template<typename...> class Metafunc, typename Tuplelike>
74
75
76} // namespace Utils
77} // namespace Utopia
78#endif
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
typename apply< Metafunc, Tuplelike >::type apply_t
Alias for apply for applying a metafunction to a tuple.
Definition metaprogramming.hh:73
Definition agent.hh:11
Definition parallel.hh:235
typename Metafunc< typename std::tuple_element_t< idxs, Tuplelike >... >::type type
Definition metaprogramming.hh:38
Prototype for apply_impl.
Definition metaprogramming.hh:20
Apply the metafunction 'Metafunc' to a tuplelike type 'Tuplelike'.
Definition metaprogramming.hh:56
typename _Metaprogramming_helpers::apply_impl< Metafunc, std::decay_t< Tuplelike >, std::make_index_sequence< std::tuple_size_v< std::decay_t< Tuplelike > > > >::type type
Definition metaprogramming.hh:61