全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Copy elision?

Definition 2.9 University Computer Science — Year 2 · 第 2 章 — Copying, Moving and Smart Pointers

Copy elision is the construction of an object directly in its final place, which removes a copy or move. Since C++17 it is guaranteed when an object is initialised from a prvalue of its type: T x = T(...), T x = f() with f returning a prvalue, and return T(...);. When a function returns a named local object, the compiler may also build it in the caller’s object (the named return value optimisation), but is not required to; if it does not, the return moves.

在原文中阅读 →