#pragma once
#include <cstdint>
#include <memory_resource>
#include <vector>
class Color_Cache {
public:
    virtual ~Color_Cache() = default;
    virtual void clear() = 0;
    virtual void composite(const Color_Cache& source) = 0;
};
class Recording_Color_Cache : public Color_Cache {
public:
    explicit Recording_Color_Cache(std::pmr::memory_resource& memory_resource = *std::pmr::get_default_resource()) : values(&memory_resource) {}
    void clear() override {
        values.clear();
        ++revision;
    }
    void composite(const Color_Cache& source) override {
        const auto& cache = dynamic_cast<const Recording_Color_Cache&>(source);
        values.insert(values.end(), cache.values.begin(), cache.values.end());
        ++revision;
    }
    void append(std::uint64_t value) {
        values.push_back(value);
        ++revision;
    }
    std::pmr::vector<std::uint64_t> values;
    std::uint64_t revision{};
};
