This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]