prefer ++pos over pos++
This is because it might have better
performance than the postincrement operator. The latter involves a temporary object because it
must return the old position of the iterator. For this reason, it generally is best to prefer ++pos
over pos++.
This is because it might have better
performance than the postincrement operator. The latter involves a temporary object because it
must return the old position of the iterator. For this reason, it generally is best to prefer ++pos
over pos++.
本文探讨了在迭代器操作中使用前置递增操作符(++pos)而非后置递增操作符(pos++)的原因。前置递增通常提供更好的性能,因为它避免了创建临时对象来保存旧位置。

299

被折叠的 条评论
为什么被折叠?



