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

Awful callable types #1

Open
brunocodutra opened this issue Jan 22, 2017 · 2 comments
Open

Awful callable types #1

brunocodutra opened this issue Jan 22, 2017 · 2 comments

Comments

@brunocodutra
Copy link

Have you considered adding callable types that overload the operator () on combinations of lr-value-ness vs const-ness?

E.g.

struct void_ {};

struct rvalueconstcallable {
    constexpr void_ operator ()(...) const&& {
        return {};
    }
};

This would be useful to check whether generic algorithms forward callable objects correctly up to the point they are invoked.

@ldionne
Copy link
Owner

ldionne commented Jan 22, 2017

Very interesting. So for example, one would test a generic algorithm by sending it a function object that would only be callable with a (possibly-const) rvalue, and see whether the algorithm is forwarding up to the point of instantiation? That seems like a good idea.

@brunocodutra
Copy link
Author

brunocodutra commented Jan 22, 2017

Precisely.

E.g. given the example above, a library that makes the naive assumption that function objects should be callable through lvalue const references would break for instances of rvalueconstcallable.

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

2 participants