Ugh. It's irritating that certain C++20 features still aren't in the most current #AppleClang :
- std::ranges
- `<=>`
- std::jthread and std::stop_token
- std::source_location

Especially for cases where one simply can't just use regular #Clang .

Check out the current support status across the board: https://en.cppreference.com/w/cpp/compiler_support/20

#cpp #cpp20 #ranges #spaceshipoperator

Compiler support for C++20 - cppreference.com

@netrom This is on llvm. Apple Clang is clang-14, so 6mo old. LLVM has been slow to roll out 20 features.

The part that is on Apple is they are not contributing, or much, to LLVM's C++ development, I think

@beached_whale Yes exactly. Hopefully they will update to LLVM 15 soon, which has more of C++20 implemented.

@netrom It's generally a 6mo and released about a month or so after clang proper. So Sept for Clang and Nov for Xcode, so 6mo from now.

I have found it's mostly headers for the concept things, so a lot of them aren't bad to implement. Ranges on the other hand is a beast.

@beached_whale Thanks. It's good to have an approximation for next release. Ranges is one of the remaining features we'll really need before making a transition to C++20.
@netrom Also, that cppreference link is often out of date. Use the feature flags. I think I have this up to date for all/most of c++23 flags https://github.com/beached/cpp_feature_flags. It will tell you the support of the compiler you compile it with, so use -std=stdneeded
GitHub - beached/cpp_feature_flags: Display the status of C++ feature flags

Display the status of C++ feature flags. Contribute to beached/cpp_feature_flags development by creating an account on GitHub.

GitHub
@beached_whale Oh, this is great! Thank you for sharing that. Might do something similar at work to ensure the features we want to use are supported on the range of compilers we use (or will be using).
@netrom For a few libraries I write I will often polyfill in the parts for older compilers/versions based on the feature flags/and or some builtin being there and use a macro for it. So things like bitcast/is constant evalutated are available in older compilers and versions. This in addtion to things like always inline and such. For the JSON Link library it has helped a bunch.

@beached_whale Yes, that works as well. Good points. We have some similar things here and there. For migrating to C++20, it's best for us to have as much of it available at the beginning such that company's developers doesn't get confused about availability. We'll see if we can wait another 6 months or not.. 😬​

EDIT: typo