std::nullopt can be used to create any (empty) std::optional
| 12 | |
| 13 | // std::nullopt can be used to create any (empty) std::optional |
| 14 | auto create2(bool b) { |
| 15 | return b ? std::optional<std::string>{"Godzilla"} : std::nullopt; |
| 16 | } |
| 17 | |
| 18 | // std::reference_wrapper may be used to return a reference |
| 19 | auto create_ref(bool b) { |