3 ms·
What do you mean by different C++ versions can't mix? Language, standard library implemention or something else?
by kldx 4y ago
What do you mean by different C++ versions can't mix? Language, standard library implemention or something else?
- tialaramex 4y agoTry it. Here's a completely reasonable line of C++ 17 code: int concept = 4; Now here's a completely reasonable line of C++ 20 code: template <class T> concept delicious = true; Huh. You can't have those in the same project because C++ 20 believes you can't name a variable "concept" and C++ 17 believes "concept" is an identifier and so you can't write your delicious concept template. These are both valid C++, it's just that they aren't simultaneously valid in any of the half dozen distinct versions of standard C++.
- zozbot234 4y agoC fixes this by using _Concept as the keyword and sticking a #define concept _Concept in a separate stdconcept.h header file. Or maybe it was about complex or whatever, but same deal.
- kldx 4y agoThanks for the example. Is it considered UB to compile the first example with -std=c++17, the second one with c++2a and link them together?