Hard
A std::span over a vector, followed by push_backs
What happens when this program runs?
main.cpp
#include <vector>
#include <span>
#include <iostream>
int main() {
std::vector<int> v = {1, 2, 3};
std::span<int> s(v); // (1) view over v's current buffer
for (int i = 0; i < 20; ++i)
v.push_back(i + 10); // (2) may trigger reallocation
std::cout << s[0] << std::endl; // (3) read through s
}67 of 117 in C++