[RFC] libstdc++/9626 and std::vector constructors

Paolo Carlini pcarlini@unitus.it
Sat Feb 8 12:34:00 GMT 2003


Hi everyone,

I'm looking a bit into this report and need your help. Is all
about the constructors we currently have in v3:

      explicit
      vector(const allocator_type& __a = allocator_type());

      vector(size_type __n, const value_type& __value,
         const allocator_type& __a = allocator_type());

      explicit
      vector(size_type __n);

In my reading of the standard (23.2.4.1), seems "obvious" that
they should be changed to:

      explicit
      vector(const allocator_type& __a = allocator_type());

      explicit
      vector(size_type __n, const value_type& __value,
         const allocator_type& __a = allocator_type());

Indeed, with this change submitter's testcase

      std::vector<std::vector<int> > v(2, 4);

is rejected according to his expectations.

*However*, if I really do this *naive* change std::vector
breaks apart horribly and v3 is *not* functional anymore
(dozens of tests fail)

Could you please help me a bit through the mysteries of the
'explicit' keyword and all that?

Thanks in advance,
Paolo.



More information about the Libstdc++ mailing list