这段程序会输出什么?
C++
#include <iostream>
#include <stdexcept>
struct Guard {
int id;
Guard(int value) : id(value) { std::cout << "+" << id << '\n'; }
~Guard() { std::cout << "-" << id << '\n'; }
};
void run() {
Guard first(1);
Guard second(2);
throw std::runtime_error("stop");
}
int main() {
try { run(); }
catch (const std::exception&) { std::cout << "caught\n"; }
}