hedayet 13 hours ago

After all these years of returning magic values for “no result,” I finally came across std::optional<T> (added in C++17). It makes representing “maybe there’s a value, maybe not” so much cleaner and safer.

Has anyone else had a “how did I live without this?” moment? What’s your favorite underrated C++ feature?