The puzzle of trying to put an object into a std::optional

The C++ standard library template type std::optional<T> has one of two states. It could be empty (not contain anything), or it could contain a T. Suppose you start with an empty std::optional<T>. How do you put a T into it? One of my colleagues tried to do it in what seemed to be the most […]

Click here to read the article