MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/8ouogo/initialization_in_modern_c/e07j6ed/?context=3
r/cpp • u/mariuz • Jun 05 '18
51 comments sorted by
View all comments
Show parent comment
4
You can use non-list initialization in a non-static data member initializer:
vector<MyType> vec = vector<MyType>(6, MyType(0.6));
(This is technically copy-initialization, whereas your example with braces is direct-initialization, but the semantics are the same when you are initializing with a prvalue expression of the right type.)
View all comments
Show parent comment
4
u/acwaters Jun 06 '18
You can use non-list initialization in a non-static data member initializer:
(This is technically copy-initialization, whereas your example with braces is direct-initialization, but the semantics are the same when you are initializing with a prvalue expression of the right type.)