dune-typetree 2.10
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions
Collaboration diagram for TreePath:

Namespaces

namespace  Dune::TypeTree::TreePathType
 
namespace  Dune::TypeTree::Literals
 

Classes

class  Dune::TypeTree::FixedCapacityStackView< T >
 
class  Dune::TypeTree::FixedCapacityStack< T, capacity >
 
struct  Dune::TypeTree::TreePathSize< typename >
 
struct  Dune::TypeTree::TreePathPushBack< typename, size_t >
 
struct  Dune::TypeTree::TreePathPushFront< typename, size_t >
 
struct  Dune::TypeTree::TreePathBack< typename >
 
struct  Dune::TypeTree::TreePathFront< typename >
 
struct  Dune::TypeTree::TreePathPopBack< typename,... >
 
struct  Dune::TypeTree::TreePathPopFront< typename >
 
struct  Dune::TypeTree::TreePathConcat< typename, typename >
 
class  Dune::TypeTree::HybridTreePath< T >
 A hybrid version of TreePath that supports both compile time and run time indices. More...
 
struct  Dune::TypeTree::TreePathSize< HybridTreePath< index_constant< i >... > >
 
struct  Dune::TypeTree::TreePathPushBack< HybridTreePath< index_constant< i >... >, k >
 
struct  Dune::TypeTree::TreePathPushFront< HybridTreePath< index_constant< i >... >, k >
 
struct  Dune::TypeTree::TreePathBack< HybridTreePath< index_constant< k > > >
 
struct  Dune::TypeTree::TreePathBack< HybridTreePath< index_constant< j >, index_constant< k >, index_constant< l >... > >
 
struct  Dune::TypeTree::TreePathFront< HybridTreePath< index_constant< k >, index_constant< i >... > >
 
struct  Dune::TypeTree::TreePathPopBack< HybridTreePath< index_constant< k > >, i... >
 
struct  Dune::TypeTree::TreePathPopBack< HybridTreePath< index_constant< j >, index_constant< k >, index_constant< l >... >, i... >
 
struct  Dune::TypeTree::TreePathPopFront< HybridTreePath< index_constant< k >, index_constant< i >... > >
 
struct  Dune::TypeTree::TreePathConcat< HybridTreePath< index_constant< i >... >, HybridTreePath< index_constant< k >... > >
 

Typedefs

template<std::size_t... i>
using Dune::TypeTree::StaticTreePath = HybridTreePath< Dune::index_constant< i >... >
 

Functions

template<std::size_t... i>
void Dune::TypeTree::print_tree_path (std::ostream &os)
 
template<std::size_t k, std::size_t... i>
void Dune::TypeTree::print_tree_path (std::ostream &os)
 
template<typename... T>
constexpr auto Dune::TypeTree::makeTreePath (const T... t)
 helper function to construct a new HybridTreePath from the given indices.
 
template<typename... T>
constexpr auto Dune::TypeTree::hybridTreePath (const T &... t)
 Constructs a new HybridTreePath from the given indices.
 
template<typename... T>
constexpr auto Dune::TypeTree::treePath (const T &... t)
 Constructs a new HybridTreePath from the given indices.
 
template<typename... T>
constexpr std::size_t Dune::TypeTree::treePathSize (const HybridTreePath< T... > &)
 Returns the size (number of components) of the given HybridTreePath.
 
template<std::size_t i, typename... T>
constexpr auto Dune::TypeTree::treePathEntry (const HybridTreePath< T... > &tp, index_constant< i >={}) -> typename std::decay< decltype(std::get< i >(tp._data))>::type
 Returns a copy of the i-th element of the HybridTreePath.
 
template<std::size_t i, typename... T>
constexpr std::size_t Dune::TypeTree::treePathIndex (const HybridTreePath< T... > &tp, index_constant< i >={})
 Returns the index value of the i-th element of the HybridTreePath.
 
template<typename... T>
constexpr auto Dune::TypeTree::back (const HybridTreePath< T... > &tp) -> decltype(tp.back())
 Returns a copy of the last element of the HybridTreePath.
 
template<typename... T>
constexpr auto Dune::TypeTree::front (const HybridTreePath< T... > &tp) -> decltype(tp.front())
 Returns a copy of the first element of the HybridTreePath.
 
template<typename... T>
constexpr HybridTreePath< T..., std::size_t > Dune::TypeTree::push_back (const HybridTreePath< T... > &tp, std::size_t i)
 Appends a run time index to a HybridTreePath.
 
template<std::size_t i, typename... T>
constexpr HybridTreePath< T..., index_constant< i > > Dune::TypeTree::push_back (const HybridTreePath< T... > &tp, index_constant< i > i_={})
 Appends a compile time index to a HybridTreePath.
 
template<typename... T>
constexpr HybridTreePath< std::size_t, T... > Dune::TypeTree::push_front (const HybridTreePath< T... > &tp, std::size_t element)
 Prepends a run time index to a HybridTreePath.
 
template<std::size_t i, typename... T>
constexpr HybridTreePath< index_constant< i >, T... > Dune::TypeTree::push_front (const HybridTreePath< T... > &tp, index_constant< i > _i={})
 Prepends a compile time index to a HybridTreePath.
 
template<typename I , typename... T, std::enable_if_t<(sizeof...(T) > 0), bool > = true>
constexpr auto Dune::TypeTree::accumulate_back (const HybridTreePath< T... > &tp, I i)
 Hybrid utility that accumulates to the back of a multi-index.
 
template<typename I , typename... T, std::enable_if_t<(sizeof...(T) > 0), bool > = true>
constexpr auto Dune::TypeTree::accumulate_front (const HybridTreePath< T... > &tp, I i)
 Hybrid utility that accumulates to the front of a multi-index.
 
template<class... Head, class... Other>
constexpr auto Dune::TypeTree::join (const HybridTreePath< Head... > &head, const Other &... tail)
 Join two tree paths into one.
 
template<class... T>
constexpr auto Dune::TypeTree::reverse (const HybridTreePath< T... > &tp)
 Reverses the order of the elements in the path.
 
template<class... T, std::enable_if_t<(sizeof...(T) > 0), bool > = true>
constexpr auto Dune::TypeTree::pop_front (const HybridTreePath< T... > &tp)
 Removes first index on a HybridTreePath.
 
template<class... T, std::enable_if_t<(sizeof...(T) > 0), bool > = true>
constexpr auto Dune::TypeTree::pop_back (const HybridTreePath< T... > &tp)
 Removes last index on a HybridTreePath.
 
template<class... S, class... T>
constexpr bool Dune::TypeTree::operator== (const HybridTreePath< S... > &lhs, const HybridTreePath< T... > &rhs)
 Compare two HybridTreePaths for value equality.
 
template<class S , S... lhs, class T , T... rhs>
constexpr auto Dune::TypeTree::operator== (const HybridTreePath< std::integral_constant< S, lhs >... > &, const HybridTreePath< std::integral_constant< T, rhs >... > &)
 Overload for purely static HybridTreePaths.
 
template<class... S, class... T>
constexpr auto Dune::TypeTree::operator!= (const HybridTreePath< S... > &lhs, const HybridTreePath< T... > &rhs)
 Compare two HybridTreePaths for unequality.
 
template<class S , S... lhs, class T , T... rhs>
constexpr auto Dune::TypeTree::operator!= (const HybridTreePath< std::integral_constant< S, lhs >... > &, const HybridTreePath< std::integral_constant< T, rhs >... > &)
 Compare two static HybridTreePaths for unequality.
 
template<typename... T>
std::ostream & Dune::TypeTree::operator<< (std::ostream &os, const HybridTreePath< T... > &tp)
 Dumps a HybridTreePath to a stream.
 

Detailed Description

Typedef Documentation

◆ StaticTreePath

template<std::size_t... i>
using Dune::TypeTree::StaticTreePath = typedef HybridTreePath<Dune::index_constant<i>...>

Function Documentation

◆ accumulate_back()

template<typename I , typename... T, std::enable_if_t<(sizeof...(T) > 0), bool > = true>
constexpr auto Dune::TypeTree::accumulate_back ( const HybridTreePath< T... > &  tp,
i 
)
constexpr

Hybrid utility that accumulates to the back of a multi-index.

The back of the path will be accumulated and promoted in order to hold the new index:

accumulate_back(treePath(_0,_2),_2) -> treePath(_0,_4)
accumulate_back(treePath(_0,_2), 2) -> treePath(_0, 4)
accumulate_back(treePath(_0, 2),_2) -> treePath(_0, 4)
accumulate_back(treePath(_0, 2), 2) -> treePath(_0, 4)
constexpr auto accumulate_back(const HybridTreePath< T... > &tp, I i)
Hybrid utility that accumulates to the back of a multi-index.
Definition treepath.hh:486
constexpr auto treePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition treepath.hh:326

◆ accumulate_front()

template<typename I , typename... T, std::enable_if_t<(sizeof...(T) > 0), bool > = true>
constexpr auto Dune::TypeTree::accumulate_front ( const HybridTreePath< T... > &  tp,
i 
)
constexpr

Hybrid utility that accumulates to the front of a multi-index.

The front of the path will be accumulated and promoted in order to hold the new index:

accumulate_front(treePath(_0,_2),_2) -> treePath(_2,_2)
accumulate_front(treePath(_0,_2), 2) -> treePath( 2,_2)
accumulate_front(treePath( 0,_2),_2) -> treePath( 2,_2)
accumulate_front(treePath( 0,_2), 2) -> treePath( 2,_2)
constexpr auto accumulate_front(const HybridTreePath< T... > &tp, I i)
Hybrid utility that accumulates to the front of a multi-index.
Definition treepath.hh:505

◆ back()

template<typename... T>
constexpr auto Dune::TypeTree::back ( const HybridTreePath< T... > &  tp) -> decltype(tp.back())
constexpr

Returns a copy of the last element of the HybridTreePath.

As HybridTreePath instances should not be mutated after their creation, this function returns a copy of the value. As values are either std::integral_constant or std::size_t, that's just as cheap as returning a reference.

◆ front()

template<typename... T>
constexpr auto Dune::TypeTree::front ( const HybridTreePath< T... > &  tp) -> decltype(tp.front())
constexpr

Returns a copy of the first element of the HybridTreePath.

As HybridTreePath instances should not be mutated after their creation, this function returns a copy of the value. As values are either std::integral_constant or std::size_t, that's just as cheap as returning a reference.

◆ hybridTreePath()

template<typename... T>
constexpr auto Dune::TypeTree::hybridTreePath ( const T &...  t)
constexpr

Constructs a new HybridTreePath from the given indices.

This function returns a new HybridTreePath with the given index values. It exists mainly to avoid having to manually specify the exact type of the new object.

It further ensures that the basic number type is std::size_t and casts any indices accordingly.

◆ join()

template<class... Head, class... Other>
constexpr auto Dune::TypeTree::join ( const HybridTreePath< Head... > &  head,
const Other &...  tail 
)
constexpr

Join two tree paths into one.

◆ makeTreePath()

template<typename... T>
constexpr auto Dune::TypeTree::makeTreePath ( const T...  t)
constexpr

helper function to construct a new HybridTreePath from the given indices.

This function returns a new HybridTreePath with the given index values. It is only a helper function used by treePath and hybridTreePath.

It expects that all indices use std::size_t as basic number type.

◆ operator!=() [1/2]

template<class... S, class... T>
constexpr auto Dune::TypeTree::operator!= ( const HybridTreePath< S... > &  lhs,
const HybridTreePath< T... > &  rhs 
)
constexpr

Compare two HybridTreePaths for unequality.

◆ operator!=() [2/2]

template<class S , S... lhs, class T , T... rhs>
constexpr auto Dune::TypeTree::operator!= ( const HybridTreePath< std::integral_constant< S, lhs >... > &  ,
const HybridTreePath< std::integral_constant< T, rhs >... > &   
)
constexpr

Compare two static HybridTreePaths for unequality.

◆ operator<<()

template<typename... T>
std::ostream & Dune::TypeTree::operator<< ( std::ostream &  os,
const HybridTreePath< T... > &  tp 
)

Dumps a HybridTreePath to a stream.

◆ operator==() [1/2]

template<class... S, class... T>
constexpr bool Dune::TypeTree::operator== ( const HybridTreePath< S... > &  lhs,
const HybridTreePath< T... > &  rhs 
)
constexpr

Compare two HybridTreePaths for value equality.

The function returns true if both tree paths are of the same length and all entries have the same value.

Note, it might be that the values are represented with different types. To check for same value and same type, use a combination of std::is_same and this comparison operator.

◆ operator==() [2/2]

template<class S , S... lhs, class T , T... rhs>
constexpr auto Dune::TypeTree::operator== ( const HybridTreePath< std::integral_constant< S, lhs >... > &  ,
const HybridTreePath< std::integral_constant< T, rhs >... > &   
)
constexpr

Overload for purely static HybridTreePaths.

The function returns std::true_type if the values of the passed treepaths are equal. Otherwise returns std::false_type. Note, this overload is chosen for purely static treepaths only.

◆ pop_back()

template<class... T, std::enable_if_t<(sizeof...(T) > 0), bool > = true>
constexpr auto Dune::TypeTree::pop_back ( const HybridTreePath< T... > &  tp)
constexpr

Removes last index on a HybridTreePath.

This function returns a new HybridTreePath without the last index.

◆ pop_front()

template<class... T, std::enable_if_t<(sizeof...(T) > 0), bool > = true>
constexpr auto Dune::TypeTree::pop_front ( const HybridTreePath< T... > &  tp)
constexpr

Removes first index on a HybridTreePath.

This function returns a new HybridTreePath without the first index.

◆ print_tree_path() [1/2]

template<std::size_t... i>
void Dune::TypeTree::print_tree_path ( std::ostream &  os)

◆ print_tree_path() [2/2]

template<std::size_t k, std::size_t... i>
void Dune::TypeTree::print_tree_path ( std::ostream &  os)

◆ push_back() [1/2]

template<std::size_t i, typename... T>
constexpr HybridTreePath< T..., index_constant< i > > Dune::TypeTree::push_back ( const HybridTreePath< T... > &  tp,
index_constant< i >  i_ = {} 
)
constexpr

Appends a compile time index to a HybridTreePath.

This function returns a new HybridTreePath with the compile time index i appended.

The value for the new entry can be passed either as a template parameter or as an index_constant:

auto tp = hybridTreePath(1,2,3,4);
using namespace Dune::TypeTree::Indices;
// the following two lines are equivalent
auto tp_a = push_back<1>(tp);
auto tp_b = push_back(tp,_1);
constexpr HybridTreePath< T..., std::size_t > push_back(const HybridTreePath< T... > &tp, std::size_t i)
Appends a run time index to a HybridTreePath.
Definition treepath.hh:416
constexpr auto hybridTreePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition treepath.hh:312

◆ push_back() [2/2]

template<typename... T>
constexpr HybridTreePath< T..., std::size_t > Dune::TypeTree::push_back ( const HybridTreePath< T... > &  tp,
std::size_t  i 
)
constexpr

Appends a run time index to a HybridTreePath.

This function returns a new HybridTreePath with the run time index i appended.

◆ push_front() [1/2]

template<std::size_t i, typename... T>
constexpr HybridTreePath< index_constant< i >, T... > Dune::TypeTree::push_front ( const HybridTreePath< T... > &  tp,
index_constant< i >  _i = {} 
)
constexpr

Prepends a compile time index to a HybridTreePath.

This function returns a new HybridTreePath with the compile time index i prepended.

The value for the new entry can be passed either as a template parameter or as an index_constant:

auto tp = hybridTreePath(1,2,3,4);
using namespace Dune::TypeTree::Indices;
// the following two lines are equivalent
auto tp_a = push_front<1>(tp);
auto tp_b = push_front(tp,_1);
constexpr HybridTreePath< std::size_t, T... > push_front(const HybridTreePath< T... > &tp, std::size_t element)
Prepends a run time index to a HybridTreePath.
Definition treepath.hh:447

◆ push_front() [2/2]

template<typename... T>
constexpr HybridTreePath< std::size_t, T... > Dune::TypeTree::push_front ( const HybridTreePath< T... > &  tp,
std::size_t  element 
)
constexpr

Prepends a run time index to a HybridTreePath.

This function returns a new HybridTreePath with the run time index i prepended.

◆ reverse()

template<class... T>
constexpr auto Dune::TypeTree::reverse ( const HybridTreePath< T... > &  tp)
constexpr

Reverses the order of the elements in the path.

◆ treePath()

template<typename... T>
constexpr auto Dune::TypeTree::treePath ( const T &...  t)
constexpr

Constructs a new HybridTreePath from the given indices.

This function returns a new HybridTreePath with the given index values. It exists mainly to avoid having to manually specify the exact type of the new object.

It further ensures that the basic number type is std::size_t and casts any indices accordingly.

◆ treePathEntry()

template<std::size_t i, typename... T>
constexpr auto Dune::TypeTree::treePathEntry ( const HybridTreePath< T... > &  tp,
index_constant< i >  = {} 
) -> typename std::decay<decltype(std::get<i>(tp._data))>::type
constexpr

Returns a copy of the i-th element of the HybridTreePath.

As HybridTreePath instances should not be mutated after their creation, this function returns a copy of the value. As values are either std::integral_constant or std::size_t, that's just as cheap as returning a reference.

The index for the entry can be passed either as a template parameter or as an index_constant:

auto tp = hybridTreePath(1,2,3,4);
using namespace Dune::TypeTree::Indices;
// the following two lines are equivalent
std::cout << treePathEntry<2>(tp) << std::endl;
std::cout << treePathEntry(tp,_2) << std::endl;
constexpr auto treePathEntry(const HybridTreePath< T... > &tp, index_constant< i >={}) -> typename std::decay< decltype(std::get< i >(tp._data))>::type
Returns a copy of the i-th element of the HybridTreePath.
Definition treepath.hh:357

◆ treePathIndex()

template<std::size_t i, typename... T>
constexpr std::size_t Dune::TypeTree::treePathIndex ( const HybridTreePath< T... > &  tp,
index_constant< i >  = {} 
)
constexpr

Returns the index value of the i-th element of the HybridTreePath.

This function always returns the actual index value, irrespective of whether the entry is a compile time index or a run time index.

The index for the entry can be passed either as a template parameter or as an index_constant:

auto tp = hybridTreePath(1,2,3,4);
using namespace Dune::TypeTree::Indices;
// the following two lines are equivalent
std::cout << treePathIndex<2>(tp) << std::endl;
std::cout << treePathIndex(tp,_2) << std::endl;
constexpr std::size_t treePathIndex(const HybridTreePath< T... > &tp, index_constant< i >={})
Returns the index value of the i-th element of the HybridTreePath.
Definition treepath.hh:380

◆ treePathSize()

template<typename... T>
constexpr std::size_t Dune::TypeTree::treePathSize ( const HybridTreePath< T... > &  )
constexpr

Returns the size (number of components) of the given HybridTreePath.