找出移动后 vector 里的 bug

来自 移动语义
C++23 (GCC 13.3.0) 进阶 4分钟 找出 1处问题

找出代码对移动后 vector 所作的无效假设。

C++
#include <iostream>
#include <string>
#include <utility>
#include <vector>

void archive(std::vector<std::string> pending) {
    auto stored = std::move(pending);
    std::cout << pending[0] << '\n';
    std::cout << stored.size() << '\n';
}
在试验场中打开
报告错误