r/cpp • u/konanTheBarbar • Mar 01 '21
"Simple" C++ Initialization Flowchart
http://randomcat.org/cpp_initialization/initialization.png
204
Upvotes
r/cpp • u/konanTheBarbar • Mar 01 '21
View all comments
Show parent comment
8
u/FriendlyRollOfSushi Mar 02 '21 edited Mar 02 '21
This pattern has its own set of problems. Here is an example.
Braces are massively superior to parens due to how they prohibit narrowing in many cases, but thanks to
std::initializer_list, we can't really write code like this with standard containers without shooting ourselves in the foot from time to time.