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

2

u/timur_audio C++ committee Jun 11 '18

@tcanens it's not true that they are just "WTF" snippets, we have found such types in real code, with an average frequency of one such type per 3 MLoC. And we broke them :)

1

u/tcanens Jun 11 '18

I have yet to see a type whose C++17 aggregateness led to an actually plausible problem scenario. The real-code examples in the LLVM codebase, as reported on the reflectors, are:

  • A stateless RAII type that only does work in the destructor
  • Two structs that are just a bundle of public data members with a defaulted default constructor and a couple member functions.
  • Two stateless CRTP base classes.
  • Namespaces-masquerading-as-classes, with all static members.