idol
A C++ Framework for Optimization
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
11namespace idol {
12 template<class KeyT, class ValueT> class GeneratorPool;
13}
14
15template<class KeyT, class ValueT = idol::PrimalPoint>
17 std::list<std::pair<KeyT, ValueT>> m_values;
18public:
19 void add(KeyT t_key, ValueT t_value) {
20 m_values.template emplace_back(std::move(t_key), std::move(t_value));
21 }
22
23 typename std::list<std::pair<KeyT, ValueT>>::iterator erase(const typename std::list<std::pair<KeyT, ValueT>>::iterator & t_it) {
24 return m_values.erase(t_it);
25 }
26
27 [[nodiscard]] const ValueT& last_inserted() const { return m_values.back().second; }
28
29 void clear() { m_values.clear(); }
30
31 [[nodiscard]] unsigned int size() const { return m_values.size(); }
32
35
36 Values values() { return Values(m_values); }
37 [[nodiscard]] ConstValues values() const { return ConstValues(m_values); }
38};
39
40#endif //IDOL_GENERATORPOOL_H