4#ifndef DUNE_TYPETREE_FIXEDCAPACITYSTACK_HH
5#define DUNE_TYPETREE_FIXEDCAPACITYSTACK_HH
19 class FixedCapacityStackView
27 Impl(T* data, std::size_t capacity)
35 const std::size_t _capacity;
38 FixedCapacityStackView(Impl& impl)
44 std::size_t size()
const
49 std::size_t capacity()
const
51 return _impl._capacity;
56 return _impl._size == 0;
61 return _impl._size == _impl._capacity;
67 _impl._data[_impl._size++] = t;
79 return _impl._data[_impl._size-1];
85 return _impl._data[_impl._size-1];
91 return _impl._data[0];
94 const T&
front()
const
97 return _impl._data[0];
100 T& operator[](std::size_t k)
102 assert(k < _impl._size);
103 return _impl._data[k];
106 const T& operator[](std::size_t k)
const
108 assert(k < _impl._size);
109 return _impl._data[k];
118 template<
typename T, std::
size_t capacity>
119 class FixedCapacityStack
120 :
private std::array<T,capacity>
121 ,
private FixedCapacityStackView<T>::Impl
122 ,
public FixedCapacityStackView<T>
125 typedef FixedCapacityStackView<T> view_base;
131 using view_base::size;
132 using view_base::operator[];
135 : FixedCapacityStackView<T>::Impl(&(static_cast<
std::array<T,capacity>&>(*this)[0]),capacity)
136 , FixedCapacityStackView<T>(static_cast<typename FixedCapacityStackView<T>::Impl&>(*this))
142 FixedCapacityStack& operator=(
const FixedCapacityStack&);
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:278
constexpr auto back(const HybridTreePath< T... > &tp) -> decltype(treePathEntry< sizeof...(T) -1 >(tp))
Returns a copy of the last element of the HybridTreePath.
Definition: treepath.hh:254
constexpr auto front(const HybridTreePath< T... > &tp) -> decltype(treePathEntry< 0 >(tp))
Returns a copy of the first element of the HybridTreePath.
Definition: treepath.hh:267
Dune namespace.
Definition: alignedallocator.hh:11