dimanche 7 mars 2021

Confused about the constructor of `std::valarray

After seemingly endless debugging, I happened to find that the ctor of std::valarray<T> is (const T& val, std::size_t count), rather than the corresponding one of std::vector<T> or other container, which is (explicit/constexpr) vector(size_type count, const T& value, const Allocator& alloc = Allocator()). Is this odd order beneficial or necessary?

Aucun commentaire:

Enregistrer un commentaire