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.");
122 std::deque<std::unique_ptr<T>>
data;
128 std::deque<std::unique_ptr<T>>
cache;
140 : max_n_elements(max_elements)
150 auto el = std::move(data[ind]);
151 data.erase(data.begin() + ind);
153 cache.push_back(std::move(el));
166 std::unique_ptr<T> new_el;
167 if (data.size() < max_n_elements)
170 if (cache.size() == 0)
173 new_el = std::make_unique<T>(element);
179 new_el = std::move(cache.back());
189 new_el = std::move(data.back());
196 data.push_front(std::move(new_el));
236 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()