16 #error no need to expose this header to Swig
20 #ifndef BORNAGAIN_BASE_TYPES_CLONEABLEVECTOR_H
21 #define BORNAGAIN_BASE_TYPES_CLONEABLEVECTOR_H
35 template <
class T>
class CloneableVector :
public std::vector<std::unique_ptr<T>> {
36 using super = std::vector<std::unique_ptr<T>>;
42 super::reserve(other.size());
43 for (
const std::unique_ptr<T>& t : other)
44 super::emplace_back(t->clone());
46 void push_back(T* t) { super::emplace_back(std::unique_ptr<T>(t)); }
47 void emplace_back(std::unique_ptr<T>&& t) { super::emplace_back(t); }
A vector of unique pointers to objects that are cloneable.
CloneableVector(const CloneableVector &other)
void emplace_back(std::unique_ptr< T > &&t)
std::vector< std::unique_ptr< T > > super