Код: Выделить всё
template
class Dummy : public std::vector {
public:
using base_type = std::vector;
Dummy() = default;
...
private:
size_; // rank of the elements of Dummy
...
}
Код: Выделить всё
template
T &emplace_back(Args &&...args) {
T t(std::forward(args)...);
if (!this->empty() && size(t) != size_) {
throw std::runtime_error("sizes don't match");
}
return base_type::emplace_back(std::move(t));
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... -stdvector
Мобильная версия