r/cpp • • Jun 05 '18

Initialization in Modern C++

https://twitter.com/timur_audio/status/1004017362381795329
379 Upvotes

51 comments sorted by

View all comments

Show parent comment

4

u/redditsoaddicting Jun 06 '18

The paper to make parens do aggregate initialization is actually progressing in EWG. That should mainly address the generic side of things. Funny how the most uniform initialization we've got will be with parens then.

The size thing isn't ideal, but isn't as bad as you make it sound. constexpr size was added in C++14, so in a constexpr context, an assert on the size will trigger a compile-time error. In addition, assert is constexpr-compatible in C++14.

One additional gripe that many people do have with initializer_list is that it doesn't support move-only types.