jeudi 25 mai 2017

Combining std::vector Default and Fill Constructor

I had a fairly quick question. The std::vector provides the following two constructors:

explicit vector( const Allocator& alloc = Allocator());      // default constructor

explicit vector( size_type count,                            // fill constructor
             const T& value = T(),
             const Allocator& alloc = Allocator());

Is there any particular reason the default constructor is not implemented with a default value of 0 for the first parameter in the fill constructor? I can imagine there must be a reason but I can't immediately see one.

Aucun commentaire:

Enregistrer un commentaire