13#ifndef dealii_storage_h
14#define dealii_storage_h
50 std::is_default_constructible_v<T>,
51 "This class requires that the elements of type T are default constructible.");
67 add(
const T &element);
121 std::deque<std::unique_ptr<T>>
data;
127 std::deque<std::unique_ptr<T>>
cache;
139 : max_n_elements(max_elements)
149 auto el = std::move(
data[ind]);
152 cache.push_back(std::move(el));
165 std::unique_ptr<T> new_el;
166 if (
data.size() < max_n_elements)
172 new_el = std::make_unique<T>(element);
178 new_el = std::move(cache.back());
188 new_el = std::move(
data.back());
195 data.push_front(std::move(new_el));
237 return max_n_elements;
T & operator[](const std::size_t index)
const T & operator[](const std::size_t index) const
std::size_t max_size() const
FiniteSizeHistory(const std::size_t max_elements=0)
std::deque< std::unique_ptr< T > > cache
std::size_t max_n_elements
void add(const T &element)
std::deque< std::unique_ptr< T > > data
void remove(const std::size_t index)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
std::vector< index_type > data