#include #include #include // Simple parser that returns {true,42} for the literal "42", // otherwise returns {false,0}. std::pair try_parse(std::string_view s) { if (s == "42") return {true, 42}; return {false, 0}; } int main() { std::string_view input = "42"; if (auto [ok, n] = try_parse(input); ok) { std::cout << "got " << n << '\n'; } return 0; }