Код: Выделить всё
#include
using namespace std;
int main() {
vector vec{0, 1, 2, 3, 4};
int sum = 0;
for (int i = -1; i < vec.size(); i++) {
try {
throw vec.at(i);
} catch (int x) {
sum += x;
} catch (...) {
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/77686955/loop-breaks-after-exception-is-caught[/url]
Мобильная версия