dune-typetree 2.12-git
Loading...
Searching...
No Matches
treepath.hh
Go to the documentation of this file.
1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=8 sw=2 sts=2:
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-PDELab-exception
5
6#ifndef DUNE_TYPETREE_TREEPATH_HH
7#define DUNE_TYPETREE_TREEPATH_HH
8
9#include <cstddef>
10#include <cassert>
11#include <iostream>
12#include <type_traits>
13
17
19
20
21namespace Dune {
22 namespace TypeTree {
23
27
29
42 template<typename... T>
44
46
58 template<typename... T>
60 [[nodiscard]] constexpr auto hybridTreePath(const T&... t)
61 {
62 return HybridMultiIndex(t...);
63 }
64
65 namespace TreePathType {
67 }
68
70
79 template<typename... T>
81 [[nodiscard]] constexpr auto makeTreePath(const T... t)
82 {
83 return HybridMultiIndex(t...);
84 }
85
87 template<typename... T>
88 [[nodiscard]] constexpr std::size_t treePathSize(const HybridTreePath<T...>&)
89 {
90 return sizeof...(T);
91 }
92
94
110 template<std::size_t i, typename... T>
111 [[nodiscard]] constexpr auto treePathEntry(const HybridTreePath<T...>& tp, index_constant<i> = {})
112 {
113 return tp[index_constant<i>{}];
114 }
115
116 template<std::size_t... i>
118
120
121 } // namespace TypeTree
122} //namespace Dune
123
124
125
126#endif // DUNE_TYPETREE_TREEPATH_HH
constexpr auto treePathEntry(const HybridTreePath< T... > &tp, index_constant< i >={})
Returns a copy of the i-th element of the HybridTreePath.
Definition treepath.hh:111
constexpr std::size_t treePathSize(const HybridTreePath< T... > &)
Returns the size (number of components) of the given HybridTreePath.
Definition treepath.hh:88
constexpr auto makeTreePath(const T... t)
helper function to construct a new HybridTreePath from the given indices.
Definition treepath.hh:81
constexpr auto hybridTreePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition treepath.hh:60
Type
Definition treepath.hh:66
@ fullyStatic
Definition treepath.hh:66
@ dynamic
Definition treepath.hh:66
T reduce(T... args)