 Google C++ Style Guidewidely used code, it may be 2 more acceptable to use trickier language constructs, because any benefits of more complex implementation are multiplied widely by usage, and the cost in understanding the other issues. • The performance costs of value semantics are often overestimated, so the performance benefits of ownership transfer might not justify the readabil- ity and complexity costs. • APIs that transfer such reason is to avoid expensive copy operations, but you should only do this if the performance benefits are significant, and the underlying object is im- mutable (i.e. std::shared_ptr Google C++ Style Guidewidely used code, it may be 2 more acceptable to use trickier language constructs, because any benefits of more complex implementation are multiplied widely by usage, and the cost in understanding the other issues. • The performance costs of value semantics are often overestimated, so the performance benefits of ownership transfer might not justify the readabil- ity and complexity costs. • APIs that transfer such reason is to avoid expensive copy operations, but you should only do this if the performance benefits are significant, and the underlying object is im- mutable (i.e. std::shared_ptr- ). If 0 码力 | 83 页 | 238.71 KB | 1 年前3
共 1 条
- 1













