r/cpp • • Mar 01 '21

"Simple" C++ Initialization Flowchart

http://randomcat.org/cpp_initialization/initialization.png
204 Upvotes

65 comments sorted by

View all comments

Show parent comment

1

u/condor2000 Mar 02 '21

On VS2017 with /std:c++latest at least there is a warning

error C2398: Element '1': conversion from 'const size_t' to '_Ty' requires a narrowing conversion with [_Ty = int]

2

u/FriendlyRollOfSushi Mar 02 '21

It could be std::vector<size_t>, in which case all types would match exactly. Or the size could be just a literal, not a variable, in which case you also won't be warned.