-
Notifications
You must be signed in to change notification settings - Fork 8
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
concept Callable should perfectly forward its function to invoke
#189
Comments
Originally, the function & callable concepts treated functions as lvalues since the algorithms accept functions by value, and therefore always invoke lvalue expressions. Given that we will almost certainly be using the |
Then it seems we should also remove the |
IIRC, the algorithms never use template <class F, class...Is>
concept bool IndirectCallable() {
return (Readable<Is>() && ...) &&
Callable<F, value_type_t<Is>...>();
} to template <class F, class...Is>
concept bool IndirectCallable() {
return (Readable<Is>() && ...) &&
CopyConstructible<F>() &&
Callable<F&, value_type_t<Is>...>();
} |
Sure. And about |
If we want |
except for the |
You mean to add |
Yes. |
Another interesting test case is: IndirectlyCallable{C, I}
void foo(I, C&) {}
void bar(int&) {}
int main() {
int *p=nullptr;
foo(p, bar);
} Here, The algorithm signatures "fix" this by taking all function-like things by value, causing the function reference to decay to function pointers. But still, this is weird and we should think about it. EDIT: So, our design question is: do we narrowly limit the indirect-callable concepts to standard-like facilities that take their function arguments by value, or do we generalize them to handle perfectly-forwarded function objects? I vote for the former. |
invoke
, right?invoke
Fix customization point objects' use of Callable |
Review discussion:
|
Correct me if I'm wrong: |
Agree. |
Rework Callable concepts to TS spec + ericniebler/stl2#189
See below for discussion.
Proposed Resolution
(The proposed resolution is relative to P0022R2 (proxy iterators) and also includes the resolution to #237.)
Change the definition of
Callable
([concepts.lib.callables.regularcallable]) as follows:Change the definition of
Predicate
([concepts.lib.callables.predicate]) as follows:Change the definition of
IndirectCallable
in [indirectcallables.indirectfunc] to:Change
IndirectRegularCallable
in likewise fashion.Change
IndirectCallablePredicate
to:Change
IndirectCallableRelation
to:Change
IndirectCallableStrictWeakOrder
to:Change the signatures of the
generate
andgenerate_n
algorithms as follows:The text was updated successfully, but these errors were encountered: