+ 3
C++: concepts in C++ STL not available when running C++ on SoloLearn
I tried running a program using the concept feature of C++20 on SoloLearn. It worked which means that SoloLearn is compiling the code using C++20. But even though the code is compiling using C++20, the concepts in STL (like same_as, integral) are not available. See: https://code.sololearn.com/cvK14aFiPsYD/?ref=app It works here http://coliru.stacked-crooked.com/a/685567040df7b2c7 The strange thing is that both SL and Coliru use GCC. So why can I use the STL concepts on Coliru but not on SoloLearn?
5 odpowiedzi
+ 2
Yes, but the underlying functionality apparently has been in GCC for quite a while as a technical specification:
https://en.cppreference.com/w/cpp/experimental/constraints
Maybe that's why the keywords and syntax work, but not the header. It's a bit weird that not everything works, for example compound requirements nonetheless cause a compilation error. But other than that, I don't really have an explanation.
+ 2
Actually, it seems SL does not compile with C++20:
https://code.sololearn.com/c18k2t3Mzvd5/?ref=app
This works on my local machine with GCC 10.2.0, and the same goes for many new headers like <bit>.
+ 2
Shadow
But aren't concepts a feature of C++20? We can use concepts on SoloLearn.
+ 2
Shadow
that makes sense. Thanks.
+ 1
@Martin Taylor
You're right. I had thought that gcc was using C++20 because the 'concept' keyword and type constraints worked which are features of C++20.