Skip to content
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

Use std::invoke for monadic interface #81

Open
ghost opened this issue Jan 24, 2020 · 0 comments
Open

Use std::invoke for monadic interface #81

ghost opened this issue Jan 24, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Jan 24, 2020

At the moment the functions map and flat_map use the function call syntax f(value()). This allows "only" global/static functions and function objects to be used. But it is not possible to use a member function of the wrapped type which would require different call syntax. Using std::invoke(f, value()) instead would lead to a more general interface. This was also proposed in P0798.
One drawback of this approach would be that (e. g. non-const/const) overloaded member functions weren't supported since their type couldn't be deferred (I think?). To support all the variations of no-ref/&/&&, const and noexcept, several new overloads would be needed. And even then, it may not work as expected (?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants