mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
fix typo in code example in C.43 (#2040)
This commit is contained in:
parent
e1a453b0b0
commit
e80373f226
|
@ -5603,7 +5603,7 @@ A default constructor often simplifies the task of defining a suitable [moved-fr
|
|||
};
|
||||
|
||||
vector<Date> vd1(1000); // default Date needed here
|
||||
vector<Date> vd2(1000, Date{Month::October, 7, 1885}); // alternative
|
||||
vector<Date> vd2(1000, Date{7, Month::October, 1885}); // alternative
|
||||
|
||||
The default constructor is only auto-generated if there is no user-declared constructor, hence it's impossible to initialize the vector `vd1` in the example above.
|
||||
The absence of a default value can cause surprises for users and complicate its use, so if one can be reasonably defined, it should be.
|
||||
|
|
Loading…
Reference in New Issue
Block a user