《c++ primer》讲到右值引用绑定到左值的时候,用了clobber the lvalue这个词,这是什么意思?书中翻译为截断左值(我还是不懂),网上将clobber翻译为连续打击。
Binding an rvalue reference to an lvalue gives code that operates on the rvalue reference permission to clobber the lvalue
. There are times, such as in our StrVec reallocate function in § 13.6.1 (p. 533), when we know it is safe to clobber an lvalue. By letting us do the cast, the language allows this usage. By forcing us to use a cast, the language tries to prevent us from doing so accidentally.
就是字面意思啊…
我的理解是这个左值不再用了,expire了,就通过右值截断,接管它。它这个名字对应的内存中的值或其他资源就不归它管理了。
感觉不太好说啊,表达能力捉鸡…