Skip to content

Instantly share code, notes, and snippets.

@ParadoxV5
Created May 27, 2025 21:37
Show Gist options
  • Save ParadoxV5/4184f2f101e2cf25d59b79e6debddce5 to your computer and use it in GitHub Desktop.
Save ParadoxV5/4184f2f101e2cf25d59b79e6debddce5 to your computer and use it in GitHub Desktop.
#include <optional>
#include <cstdio>
int main() {
std::optional<int> optional_of_none(std::nullopt);
std::optional<std::optional<int>> optional_of_optional(optional_of_none);
std::printf(
"optional_of_none.has_value():\t%d\n"
"optional_of_optional.has_value():\t%d\n",
optional_of_none.has_value(), optional_of_optional.has_value()
);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment