Loading...
Searching...
No Matches
treepath.hh
Go to the documentation of this file.
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=8 sw=2 sts=2:
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
#ifndef DUNE_COMMON_TYPETREE_TREEPATH_HH
#define DUNE_COMMON_TYPETREE_TREEPATH_HH
#include <cstddef>
#include <cassert>
#include <type_traits>
#include <dune/common/documentation.hh>
#include <dune/common/typetraits.hh>
#include <dune/common/indices.hh>
#include <dune/common/hybridmultiindex.hh>
namespace Dune::TypeTree {
template<typename... T>
using TreePath = Dune::HybridMultiIndex<T...>;
template<typename... T>
requires (((std::is_integral_v<T> or Dune::IsIntegralConstant<T>::value) && ...))
[[nodiscard]] constexpr auto treePath(const T&... t)
{
return HybridMultiIndex(t...);
}
// Pull in the free utility function for HybridMultiIndex/TreePath
// We cannot add forwarding functions of the same name here, since this
// leads to ambiguous overloads.
// Unfortunately doxygen ignores documentation for using statements.
using Dune::back;
using Dune::front;
using Dune::push_back;
using Dune::push_front;
using Dune::accumulate_back;
using Dune::accumulate_front;
using Dune::join;
using Dune::reverse;
using Dune::pop_front;
using Dune::pop_back;
inline namespace Literals {
template <char... digits>
constexpr auto operator""_tp()
{
using namespace Dune::Indices::Literals;
return treePath(operator""_ic<digits...>());
}
} // end namespace Literals
} //namespace Dune::TypeTree
#endif // DUNE_TYPETREE_TREEPATH_HH
typetraits.hh
Traits for type conversions and type information.
indices.hh
hybridmultiindex.hh
documentation.hh
Documentation related stuff.
Dune::TypeTree::TreePath
Dune::HybridMultiIndex< T... > TreePath
A type for representing tree paths that supports both compile time and run time indices.
Definition treepath.hh:43
Dune::TypeTree::treePath
constexpr auto treePath(const T &... t)
Constructs a new TreePath from the given indices.
Definition treepath.hh:55
Dune::HybridMultiIndex
HybridMultiIndex(I... i) -> HybridMultiIndex< decltype(Impl::castToHybridSizeT(i))... >
Dune::join
constexpr auto join(const HybridMultiIndex< Head... > &head, const Other &... tail)
Join two hybrid multi-indices into one.
Definition hybridmultiindex.hh:355
Dune::reverse
constexpr auto reverse(const HybridMultiIndex< T... > &tp)
Reverses the order of the elements in the multi-index.
Definition hybridmultiindex.hh:361
Dune::pop_back
constexpr auto pop_back(const HybridMultiIndex< T... > &tp)
Removes last index on a HybridMultiIndex.
Definition hybridmultiindex.hh:387
Dune::pop_front
constexpr auto pop_front(const HybridMultiIndex< T... > &tp)
Removes first index on a HybridMultiIndex.
Definition hybridmultiindex.hh:374
Dune::accumulate_back
constexpr auto accumulate_back(const HybridMultiIndex< T... > &tp, I i)
Hybrid utility that accumulates to the back of a multi-index.
Definition hybridmultiindex.hh:328
Dune::back
constexpr auto back(const HybridMultiIndex< T... > &tp) -> decltype(tp.back())
Returns a copy of the last element of the HybridMultiIndex.
Definition hybridmultiindex.hh:225
Dune::push_front
constexpr HybridMultiIndex< std::size_t, T... > push_front(const HybridMultiIndex< T... > &tp, std::size_t i)
Prepends a run time index to a HybridMultiIndex.
Definition hybridmultiindex.hh:284
Dune::accumulate_front
constexpr auto accumulate_front(const HybridMultiIndex< T... > &tp, I i)
Hybrid utility that accumulates to the front of a multi-index.
Definition hybridmultiindex.hh:348
Dune::push_back
constexpr HybridMultiIndex< T..., std::size_t > push_back(const HybridMultiIndex< T... > &tp, std::size_t i)
Appends a run time index to a HybridMultiIndex.
Definition hybridmultiindex.hh:249
Dune::front
constexpr auto front(const HybridMultiIndex< T... > &tp) -> decltype(tp.front())
Returns a copy of the first element of the HybridMultiIndex.
Definition hybridmultiindex.hh:238
Dune::Indices::Literals
Definition indices.hh:131
Dune::TypeTree
Definition childaccess.hh:23
Dune::TypeTree::Literals
Definition treepath.hh:75
Dune::HybridMultiIndex
A hybrid multi-index class that supports both compile time and run time indices.
Definition hybridmultiindex.hh:81
Dune::IsIntegralConstant
Check if T is an std::integral_constant<I, i>.
Definition typetraits.hh:384