[Issue 19904] move semantics fail through the `emplace` pipeline
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon May 27 20:04:27 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19904
kinke at gmx.net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kinke at gmx.net
--- Comment #1 from kinke at gmx.net ---
(In reply to Manu from comment #0)
> Note there is no `forward!args` then it is passed to `emplaceRef`. This
> causes the arguments to be unnecessarily copied, potentially executing a
> bunch of copy code.
No copy code should be executed. The `auto ref` param will be a ref for an
lvalue arg, and a moved bitcopy for an rvalue arg (D move semantics - arg isn't
destructed and param's postblit is skipped, but a memcpy is performed).
emplaceRef uses `auto ref Args` too. So when calling it in emplace() with its
(lvalue) parameters as arguments, they are passed by reference.
--
More information about the Digitalmars-d-bugs
mailing list