#include SparseOHArray SparseOHArray::copy() { SparseOHArray result; result.n_elements = this->n_elements; for (auto const& element: this->elements) { auto value = element.second; result.elements[element.first] = value->getObjGen().isIndirect() ? value : value->copy(); } return result; }