MCPcopy Create free account
hub / github.com/0voice/cpp_new_features / create2

Function create2

cpp_17/005_optional_optional.cpp:14–16  ·  view source on GitHub ↗

std::nullopt can be used to create any (empty) std::optional

Source from the content-addressed store, hash-verified

12
13// std::nullopt can be used to create any (empty) std::optional
14auto 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
19auto create_ref(bool b) {

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected