Commit 36146f55 authored by Carsten Gräser's avatar Carsten Gräser

Implement HybridTreePath::back() and HybridTreePath::element()

`HybridTreePath::element()` is implemented in two versions,
one for a static and one for dynamic index argument. Adding
those methods makes `HybridTreePath` more compatible with
`DynamicTreePath`.
parent 9c77fca0
Pipeline #8569 passed with stage
in 12 minutes and 41 seconds
......@@ -357,6 +357,30 @@ namespace Dune {
return sizeof...(T);
}
//! Get the last index value.
template<std::size_t i>
auto element(Dune::index_constant<i> pos = {}) const
{
return std::get<i>(_data);
}
//! Get the index value at position pos.
std::size_t element(std::size_t pos) const
{
std::size_t entry = 0;
Dune::Hybrid::forEach(enumerate(), [&] (auto i) {
if (i==pos)
entry = element(i);
});
return entry;
}
//! Get the last index value.
auto back() const
{
return std::get<sizeof...(T)-1>(_data);
}
#ifndef DOXYGEN
// I can't be bothered to make all the external accessors friends of HybridTreePath,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment