C/C++ Arena

Step 3 of 6

optional for "maybe"

When the only failure is "no result", std::optional says it clearly in the return type and forces the caller to check.

Your turn: write std::optional<std::size_t> find_player(const std::vector<std::string>& team, const std::string& name) returning the index or std::nullopt.

Previous: Status codes Next: A Result type