Object Creation

The different methods of in-place object creation are discussed briefly in this lesson.

There are several ways you can create std::any object:

  • a default initialisation - then the object is empty
  • a direct initialisation with a value/object
  • in place std::in_place_type
  • via std::make_any

You can see it in the following example:

Get hands-on with 1400+ tech skills courses.