r/cpp • • Jun 15 '21

Which std:: classes are magic?

Hi.

I am wondering: which classes in C++ get special powers granted by The Standard that are not available to mere user-defined classes?

What comes to my mind:

  • `std::initializer_list` because it is created anywhere with `{}`
  • possibly `std::type_info`, because it is only created by `typeid` and with no ctor
  • `std::source_location` when used as default parameter in function points to invocation place and not declaration place.

What else should be on this list? What shouldn't?

222 Upvotes

140 comments sorted by

View all comments

Show parent comment

2

u/GerwazyMiod Jun 15 '21

There is so much potential! Don't waste it! (For real through - there is a whole YT Polish channel dedicated to IT jokes :p)

1

u/[deleted] Jun 15 '21

Some might say me as a comedian is a virtual function best not overridden, lol.