Il 28/10/18 11:22, Elvis Stansvik ha scritto:
Though hmm, even if we'd lose move-construction, for the copy we'd get
instead, wouldn't copy elision kick in and elide it? So we wouldn't
have to pay for the ref count up/down?

GCE is one thing, and applies in a very specific case (returning a prvalue).

(N)RVO is another thing, and may or may not be applied depending on whether the compiler *can* apply it and *will* apply it.

In the general case, you won't have either, and thus having a move will be cheaper than a copy. Returning const objects for types which benefit from moves is a bad idea.

My 2 c,

--
Giuseppe D'Angelo | [email protected] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to