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

Unnecessary uses of DECAY_COPY #60

Open
jwakely opened this issue Mar 18, 2017 · 1 comment
Open

Unnecessary uses of DECAY_COPY #60

jwakely opened this issue Mar 18, 2017 · 1 comment
Assignees

Comments

@jwakely
Copy link
Member

jwakely commented Mar 18, 2017

The Executor requirements table and [async.system.exec.ops] both say:

Creates an object f1 initialized with DECAY_COPY(forward<Func>(f))

This performs an unnecessary copy, as DECAY_COPY already returns a new object, so this relies on elision to avoid two new objects being created. It also doesn't say what the type of f1 is, so calling f1() could do something entirely unrelated to f.

This seems simpler and more precise:

Creates an object f1 of type decay_t<Func>, initialized with forward<Func>(f).

@jwakely
Copy link
Member Author

jwakely commented Mar 18, 2017

Actually, in the Executor requirements table Func isn't even defined.

@jwakely jwakely self-assigned this Mar 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant