Loading...
Searching...
No Matches
GeneratorPool.h
1//
2// Created by henri on 13/12/22.
3//
4
5#ifndef IDOL_GENERATORPOOL_H
6#define IDOL_GENERATORPOOL_H
7
8#include "Point.h"
9#include <list>
10#include <idol/general/utils/IteratorForward.h>
11
12namespace idol {
13 template<class KeyT, class ValueT> class GeneratorPool;
14}
15
16template<class KeyT, class ValueT = idol::PrimalPoint>
18 std::list<std::pair<KeyT, ValueT>> m_values;
19public:
20 void add(KeyT t_key, ValueT t_value) {
21 m_values.emplace_back(std::move(t_key), std::move(t_value));
22 }
23
24 typename std::list<std::pair<KeyT, ValueT>>::iterator erase(const typename std::list<std::pair<KeyT, ValueT>>::iterator & t_it) {
25 return m_values.erase(t_it);
26 }
27
28 [[nodiscard]] const ValueT& last_inserted() const { return m_values.back().second; }
29
30 void clear() { m_values.clear(); }
31
32 [[nodiscard]] unsigned int size() const { return m_values.size(); }
33
36
37 Values values() { return Values(m_values); }
38 [[nodiscard]] ConstValues values() const { return ConstValues(m_values); }
39};
40
41#endif //IDOL_GENERATORPOOL_H