-
Notifications
You must be signed in to change notification settings - Fork 215
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
Add support for member function to member_ptr #449
base: develop
Are you sure you want to change the base?
Conversation
For symmetry with the member object version, it maybe be better to have
An other advantage of this solution is that one can introspect the type of the member functions in the same way than the member objects, e.g .
I have an implementation but that uses C++20 |
Why does it need For tests, I'd say Your statement about "symmetry" is correct. The interface to Currently the instance generated by the macros explodes if you give it a member function so this appears it would be a backwards compatible improvement provided you don't modify the interface to Here is your above code with the unmodified use of |
@ricejasonf Thanks for your feedback and for the GodBolt code, this is how I should have started this PR.
I did not mean to say that Ultimately I would like the function object returned by For now, I reverted my code to return the member function pointer (that breaks the symmetry, but works with CallableTraits): template <typename T, std::enable_if_t<std::is_member_function_pointer_v<Memptr>, int> = 0>
constexpr decltype(auto) operator()(T &&) const
{ return ptr; } Boost.Hana is not really a reflection library, I believe it's more a side effect, so I don't know if this PR is pushing in the right direction... |
22dfd8a
to
3cc1a71
Compare
3cc1a71
to
238714a
Compare
This PR adds an overload of
operator()
ofmember_ptr
to support member function so that the following use case is now supported:Could you give me some guidance about adding unit tests? I had a look in
test/concept/struct
but I am not sure where the new tests belongs...