My recommendation would be to just use https://github.com/martinmoene/optional-lite for cross-platform stuff.
My recommendation would be to just use https://github.com/martinmoene/optional-lite for cross-platform stuff.
Practically speaking, it takes a while for features implemented upstream to make it into your OS of choice. If these are really critical features, you can get third-party implementations of <optional> or you can compile your own toolchain, neither of these are particularly difficult options. It can be a bit frustrating, yes, when language feature arrives on a different schedule in the library and compiler (which happens).
Mind you, #include <optional> doesn't work on my Linux box either, with GCC. And if you look at the GCC web page, https://gcc.gnu.org/projects/cxx-status.html#cxx17, it says that GCC's support for C++17 is "experimental". I know that GCC != Clang, but let's give them some time to test things before a million projects get the code compiled in and we're stuck with the implementation.
Therefore, it's by far no longer something that's experimental IMHO. (standardised in C++17 after all)