-
Notifications
You must be signed in to change notification settings - Fork 136
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
[FR] noexcept prototypes/signatures #61
Comments
Thank you for the feedback! We have decided to add support for
Please try Please note that types in namespace
Although we expect the helper macros PRO_DEF_MEMBER_DISPATCH(Draw, void());
PRO_DEF_FACADE(Drawable, Draw); ... is equivalent to struct Draw {
using overload_types = std::tuple<void()>;
void operator()(auto& self) requires(requires{ self.Draw(); }) {
self.Draw();
}
};
struct Drawable {
using dispatch_types = std::tuple<Draw>;
static constexpr auto constraints = pro::relocatable_ptr_constraints;
using reflection_type = void;
}; It is allowed to add custom compiler attributes to these implementations, but you may need to think twice before doing so. If you ever find writing this code is more comfortable than using the helper macros, please let us know and we will evaluate whether to add support from library side. Thank you again for the valuable feedback! |
Thanks for the update, noexcept invoke now works :)
Adding the attributes to dispatch definitions/prototype declarations won't do anything, just like for noexcept: the attributes would need to be propagated to the vtable/meta pointers. Unfortunately there is no conditional/template support for compiler specific function attributes in compilers themselves - making it a good opportunity to add that also to the standardization proposal :) - until then we're stuck specifing those through the constraints traits structure. While we're at it - I've implemented an eerily similar 'constraints traits' policy (exactly with support-level enums) approach years ago in https://github.com/psiha/functionoid/blob/master/include/boost/functionoid/policies.hpp ... were you aware of this? :) |
We need to evaluate each attribute case by case. While
If the motivation is enough, I think it should be reasonable to suggest an attribute into the standard.
Interesting implementation! I did not notice the design of |
i.e. please support noecept signatures, e.g.:
at least it does not compile for me with the current master (Clang 17 and latest MSVC)
ps. likewise - a 'bit' harder :D - support custom compiler attributes (like [[gnu::pure]])
pps. If you could also give examples/documentation on how to use the library w/o the macros and detail namespace helpers?
The text was updated successfully, but these errors were encountered: