clean-code/VectorFiller/atlas/collection/impl/AbstractVectorFactory.h

21 lines
472 B
C++

#pragma once
#include "../VectorFactory.h"
namespace atlas::collection {
template <typename T>
class AbstractVectorFactory : public VectorFactory<T> {
public:
using base_type = VectorFactory<T>;
auto createAndFillVector(size_t const size) -> typename base_type::product_type override final
{
auto result = std::make_shared<std::vector<T>>(size);
fill(*result);
return result;
}
virtual void fill(std::vector<T>&) = 0;
};
}