1#ifndef HEURISTICS_ARRAY_POOL_H
2#define HEURISTICS_ARRAY_POOL_H
20const int INVALID_INDEX = -1;
25 friend class ArrayPool;
27 ArrayPoolIndex(
int position)
28 : position(position) {
32 : position(INVALID_INDEX) {
38 using Iterator = std::vector<Value>::const_iterator;
47 friend class ArrayPool;
52 ArrayPoolSlice(Iterator first, Iterator last)
59 std::vector<Value> data;
61 ArrayPoolIndex append(
const std::vector<Value> &vec) {
62 ArrayPoolIndex index(data.size());
63 data.insert(data.end(), vec.begin(), vec.end());
67 ArrayPoolSlice get_slice(ArrayPoolIndex index,
int size)
const {
68 assert(index.position >= 0 &&
70 index.position + size <=
static_cast<int>(data.size()));
71 return ArrayPoolSlice(data.begin() + index.position, data.begin() + index.position + size);