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

Function create

cpp_17/005_optional_optional.cpp:7–11  ·  view source on GitHub ↗

optional can be used as the return type of a factory that may fail

Source from the content-addressed store, hash-verified

5
6// optional can be used as the return type of a factory that may fail
7std::optional<std::string> create(bool b) {
8 if (b)
9 return "Godzilla";
10 return {};
11}
12
13// std::nullopt can be used to create any (empty) std::optional
14auto create2(bool b) {

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected