6#ifndef DUNE_COMMON_TYPETREE_CHILDACCESS_HH
7#define DUNE_COMMON_TYPETREE_CHILDACCESS_HH
54 template<
typename Node,
typename...
Indices>
57 if constexpr (
sizeof...(Indices) == 0)
58 return std::forward<Node>(node);
63 static_assert(I0::value < std::decay_t<Node>::degree(),
"Child index out of range");
65 assert(std::size_t(
treePath.front()) < node.degree() &&
"Child index out of range");
66 if constexpr (
sizeof...(Indices) == 1)
96 template<
typename Node,
typename...
Indices>
112 template<
typename Node, std::size_t... indices>
128 template<
typename Node, std::size_t... indices>
139 template<
typename Node,
typename TreePath>
140 using ChildForTreePath = std::decay_t<decltype(child(std::declval<Node>(), std::declval<TreePath>()))>;
147 static constexpr auto childTypes()
153 }, std::make_index_sequence<N::degree()>{});
171 using Children =
typename decltype(Impl::childTypes<N>())
::type;
Traits for type conversions and type information.
decltype(auto) constexpr unpackIntegerSequence(F &&f, std::integer_sequence< I, i... > sequence)
Unpack an std::integer_sequence<I,i...> to std::integral_constant<I,i>...
Definition indices.hh:124
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition indices.hh:29
decltype(auto) child(Node &&node, TreePath< Indices... > treePath)
Extracts the child of a node given by a TreePath object.
Definition childaccess.hh:55
typename Impl::ChildTraits< Node, indices... >::type Child
Template alias for the type of a child node given by a list of child indices.
Definition childaccess.hh:129
std::decay_t< decltype(child(std::declval< Node >(), std::declval< TreePath >()))> ChildForTreePath
Template alias for the type of a child node given by a TreePath type.
Definition childaccess.hh:140
Dune::HybridMultiIndex< T... > TreePath
A type for representing tree paths that supports both compile time and run time indices.
Definition treepath.hh:43
constexpr auto treePath(const T &... t)
Constructs a new TreePath from the given indices.
Definition treepath.hh:55
Namespace with predefined compile time indices for the range [0,19].
Definition indices.hh:50
Definition childaccess.hh:23
constexpr auto pop_front(const HybridMultiIndex< T... > &tp)
Removes first index on a HybridMultiIndex.
Definition hybridmultiindex.hh:374
A hybrid multi-index class that supports both compile time and run time indices.
Definition hybridmultiindex.hh:81
A type that refers to another type.
Definition typelist.hh:33
Check if T is an std::integral_constant<I, i>.
Definition typetraits.hh:384
Model of an inner node of a typetree with compile time known degree and child access via index_consta...
Definition nodeconcepts.hh:41