exhale
exhale copied to clipboard
Add support for C++20 concepts
CC @lums658 refs #160 I couldn't push to that branch (I think because it's the main branch of your repo), I'm sorry for the very long delay. In order to support C++ concepts I needed to fix the testing framework for doxygen 1.9.x in order to actually test for this. This one will take me some time to flesh out entirely (there's a handful of test framework changes which would be a nightmare for not me (well for me too, but way worse for anyone else)).
However, would you be willing to add some code to the newly created testing/projects/cpp_concepts/include/concepts/concepts.hpp
and associated usages (where applicable) in src/tests.cpp
? The tests.cpp
exists mostly to guarantee that anything added in concepts.hpp
actually compiles. The infrastructure is up, but it would be really helpful to have a more exhaustive list of concepts code -- I'm not up to speed, just anything that would stress test doxygen / breathe from a documentation perspective. Note the testing code license is CC0 (please add yourself to the license at the top though!). Only other rule for code there is keep it PG-13, but otherwise the content (or docs) are less than meaningful anywhere else :wink:
I get the impression it would be fairly easy for you to PR to this branch with some nice modern concepts code there :pray:
There's definitely no rush ... it'll take me some time to finalize things (I anticipate CI being troublesome here), but after the code is in place I will be able to inspect the implementation / create unit tests for the project. Having the test project in place helps me look at the output of exhale and confirm it's working as desired.
Just want to say that I'm quite interested in concepts support as well.
The doxygen compatibility problems have been resolved, but I still need test code that exhausts concepts options. Been perusing cppreference but still trying to work it out (haven't had the luxury of using c++20 in production and not enough time to catch up on my own).
Questions that come up:
- Is there any concept inheritance?
- Can there be nested concepts (like nested classes / structs, or can a concept be declared in a nested scope like in a class definition)?
- Any other known "fancy edge cases"?
I'm definitely down to merge something we think covers the bases and fix it later if needed. But having code on the tests is required, it's the only reason this project still limps along. The absurd implementation is brittle and small changes elsewhere can and do break other things. Sample code would be most welcome (header file and usage examples). From there I can integrate that code into the rest of the (very complicated) testing framework. I've got some flights coming up, the last one I was able to make some good progress on updating tree view html / css. This one is also high priority for me, lack of concepts is an eyesore (it's almost 2023!)
I apologize for completely missing your response on #160 back in June…. I can try to put in some example / testing code in the next couple of weeks or so.
Best Regards, Andrew Lumsdaine
On Nov 20, 2022, at 10:40 AM, Stephen McDowell @.@.>> wrote:
The doxygen compatibility problems have been resolved, but I still need test code that exhausts concepts options. Been perusing cppreference but still trying to work it out (haven't had the luxury of using c++20 in production and not enough time to catch up on my own).
Questions that come up:
- Is there any concept inheritance?
- Can there be nested concepts (like nested classes / structs, or can a concept be declared in a nested scope like in a class definition)?
- Any other known "fancy edge cases"?
I'm definitely down to merge something we think covers the bases and fix it later if needed. But having code on the tests is required, it's the only reason this project still limps along. The absurd implementation is brittle and small changes elsewhere can and do break other things. Sample code would be most welcome (header file and usage examples). From there I can integrate that code into the rest of the (very complicated) testing framework. I've got some flights coming up, the last one I was able to make some good progress on updating tree view html / css. This one is also high priority for me, lack of concepts is an eyesore (it's almost 2023!)
— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/svenevs/exhale/pull/166*issuecomment-1321210466__;Iw!!K-Hz7m0Vt54!iPD9y_1byAiuT3jWTd73k1T8geGKunvJJvMZZDcz0_ZzYPPu02uFx-fTMetoi_8q6s-rjYofWKximfRA0AFfOQ$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AGKPFDMOU3AVW3D6RW7MXWLWJJWDFANCNFSM5ZBLLFOQ__;!!K-Hz7m0Vt54!iPD9y_1byAiuT3jWTd73k1T8geGKunvJJvMZZDcz0_ZzYPPu02uFx-fTMetoi_8q6s-rjYofWKximfQsXwF_1Q$. You are receiving this because you were mentioned.Message ID: @.***>
No apology necessary, I responded very late... Ok, great, thank you so much!!! To be clear I only need help with the C++ source code, the python side / exhale test case side I will take care of 🙂
Thanks for the fast response. Maybe I can help a bit.
Can there be nested concepts (like nested classes / structs, or can a concept be declared in a nested scope like in a class definition)?
Not to my knowledge.
Is there any concept inheritance?
I don't think so. But you can combine concepts easily, like
template <typename T>
concept Number = std::integral<T> || std::floating_point<T>;
(Taken from https://www.sandordargo.com/blog/2021/02/24/cpp-concepts-with-classes)
Any other known "fancy edge cases"?
According to cppreference there are three types of constraints:
- conjunctions
- disjunctions
- atomic constraints
So having an example per type seems to be a good start.
One edge case might be the inline declaration of a concept. Although bad style it's valid:
template <typename T> requires requires (T x) { x + x; }
T add(T a, T b) { return a + b; }
See it on compiler explorer.. But I'm not sure how this should be documented.