4 ms·
The worst part about this is that Apple has decided to once again violate the standard. They purposefully eliminated the `value()` accessor due to ABI issues as
by th0br0 8y ago
The worst part about this is that Apple has decided to once again violate the standard.
They purposefully eliminated the `value()` accessor due to ABI issues as far as I understand from the stack overflow comments: https://stackoverflow.com/questions/44217316/how-do-i-use-stdoptional-in-c https://stackoverflow.com/questions/44217316/how-do-i-use-st...
My recommendation would be to just use https://github.com/martinmoene/optional-lite https://github.com/martinmoene/optional-lite for cross-platform stuff.
- spullara 8y agoIt looks like this is just temporary until the feature is no longer experimental so they can modify the standard library.
- klodolph 8y ago"Violate the standard" might be a bit harsh. The fact that you are using <experimental/optional> instead of <optional> as your header should indicate that something else is going on. 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 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.
- th0br0 8y agoGCC moved it to <optional> with the release of GCC7. Note that we're now at GCC8, clang 4 added it - I believe we're now at clang 6. Therefore, it's by far no longer something that's experimental IMHO. (standardised in C++17 after all)