16#ifndef dealii_storage_h
17#define dealii_storage_h
53 std::is_default_constructible<T>::value,
54 "This class requires that the elements of type T are default constructible.");
70 add(
const T &element);
124 std::deque<std::unique_ptr<T>>
data;
130 std::deque<std::unique_ptr<T>>
cache;
142 : max_n_elements(max_elements)
152 auto el = std::move(data[ind]);
153 data.erase(data.begin() + ind);
155 cache.push_back(std::move(el));
168 std::unique_ptr<T> new_el;
169 if (data.size() < max_n_elements)
172 if (cache.size() == 0)
175 new_el = std::make_unique<T>(element);
181 new_el = std::move(cache.back());
191 new_el = std::move(data.back());
198 data.push_front(std::move(new_el));
240 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()