-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support C++20 module. #49
base: main
Are you sure you want to change the base?
Conversation
Thanks @stripe2933 . It's looking good, though I'm am wondering whether additional file is required? Can that work with a single reflect file which is either a module if the flag is defined or a header otherwise? That has been my approach so far as it keep things as simple as possible and less maintenance and/or integration is required, but not sure whether there are some other reasons to do so I'm not aware of? |
On the side note, one thing I'm extremely interested with modules is whether the static assert tests will be called just once per app. That's my assumption based on pch but I haven't tested it, yet. |
To my knowledge, since module file must be consist of:
(cppreference) For the second question: yes, if static assertions are not depend on template type given by user, all assertions can be verified in module compilation time. Therefore the macro region |
Thanks for the information and links @stripe2933. Indeed it looks like it's not possible to do it correctly within a single header. I have no issues with the MR though I have issues with coupling modules are introducing for example in the reflect header. Anyway, let me just do a few experiments with modules and will get back with my findings shortly. I'm not sure what I'm looking for yet but wanna be sure that complexity added is required due to C++ design. Thanks again for your work and help. |
Some more thoughts on module support. I've decided to remove any external dependencies from reflect as that make it more portable and easier to deal with and will allow to remove REFLECT_USE_STD_MODULE for the include part. So will get back shortly with that. One thing I wanted to ask is whether it's more beneficial to have a module per library or a common module per multiple libraries. Would the latter allow importing |
What you mean is removing standard library module ( I also have doubts about the
I'm also like your library But this is just my opinion. If I think about it another way, I would not complain much if boost ships |
Thank you for great library.
Since it targets to ≥ C++20, using module can reduce the compilation time significant faster.
reflect.cppm
file definereflect
module that export the symbols.Also according to this issue, the major 3 compiler vendors agreed to support standard library module from C++20, I add the macro option
REFLECT_USE_STD_MODULE
to make user can decide whether use module or not (default is 1).