在下面的代码片段中:
std::vector<double> a(100, 4.2);
auto* a_ptr = a.data();
auto b = std::move(a);
auto* b_ptr = b.data();
std::cout << ((b_ptr == a_ptr) ? "TRUE" : "FALSE") << '\n';
C++标准是否保证在std::move
后b_ptr
始终等于a_ptr
? 在wandbox上运行代码将打印TRUE
。
std::vector
的末尾迭代器没有额外的保证吗? - Deduplicatorcppreference
,而不是cccpreference
。后者应该是给前苏联的粉丝们的 ;) - nneonneo