Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么在 C++ 中前缀返回引用但后缀返回值?
因为使用前缀你修改对象然后返回它(所以它可以是左值),使用后缀你返回未更改的对象(即副本)然后才更新它(这当然是通过首先将副本存储在临时的,更新原始对象,然后按值返回临时对象。)