cplusplus/networking-ts

Unnecessary uses of DECAY_COPY

jwakely opened this issue · 1 comments

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).

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