15#ifndef dealii_storage_h
16#define dealii_storage_h
52 std::is_default_constructible_v<T>,
53 "This class requires that the elements of type T are default constructible.");
69 add(
const T &element);
123 std::deque<std::unique_ptr<T>>
data;
129 std::deque<std::unique_ptr<T>>
cache;
141 : max_n_elements(max_elements)
151 auto el = std::move(data[ind]);
152 data.erase(data.begin() + ind);
154 cache.push_back(std::move(el));
167 std::unique_ptr<T> new_el;
168 if (data.size() < max_n_elements)
174 new_el = std::make_unique<T>(element);
180 new_el = std::move(cache.back());
190 new_el = std::move(data.back());
197 data.push_front(std::move(new_el));
239 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()