Why doesn't this code work as I supposed?
for (auto it: *std::make_unique<std::vector<int>>(std::vector<int>({1, 2, 3, 4, 5}))) std::cout << it << std::endl;
The vector object is destroyed before executing the first iteration of the loop
Aucun commentaire:
Enregistrer un commentaire