On Monday 14 October 2024 11:46:17 GMT-7 Mathias Hasselmann via Development wrote: > The QtCS24 misses the single one big reason you want to switch C++20 now > and whenever possible: Concepts.
Using them unconditionally means forcing users to C++20. We agreed we can't have that right now. However, as I pointed out to Ivan's code reviews on std::format: we can require them for other C++20 features. Preferably where all compilers that implement one thing also implement concepts, but I wouldn't be opposed to saying "you only get this if you also have that". Using them *conditionally* is possible. I've been exploring that in ways that improve error messages for C++20 users. My experience, for example, when you try to connect a signal to a non-matching slot is that the concept produces a much easier to understand and much shorter output. With C++17, you get a static assertion failure, followed by the expansion of code that doesn't compile producing even more errors. I do plan on submitting that and I will not care if I make the error output for C++17 users worse in the process. > They indeed are a total game changer and I'd boldy predict that 80% of > all meta-programming helpers in Qt's headers could be replaced by > concepts that are easier to understand, more expressive, more complete. > You simply do not like C++ if you are not eager to use concepts. Not exactly. We're missing one feature in concepts: private concepts inside a class. Or, more to the point, "concept aliases". The example of QHash was clear: I don't want to repeat the key type everywhere, but I have to with the current concept design. This means there are certain uses in our headers that would look worse with concepts than with their current private template aliases using std::enable_if. -- Thiago Macieira - thiago.macieira (AT) intel.com Principal Engineer - Intel DCAI Platform & System Engineering
smime.p7s
Description: S/MIME cryptographic signature
-- Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development