#include <cstddef>
#include <iostream>
struct Pig {
Pig() {std::cout << this << " oinks!" << std::endl;}
~Pig() {std::cout << this << " is bacon!" << std::endl;}
};
class PigFarm {
public:
explicit PigFarm(std::size_t n): sp(new Pig[n]) {throw "FARM FIRE!";}
~PigFarm() {delete[] sp;}
private:
Pig *sp;
};
int main()
{
try {
PigFarm pf(4);
}
catch (const char *pc) {
std::cerr << pc << std::endl;
}
}
I2luY2x1ZGUgPGNzdGRkZWY+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCnN0cnVjdCBQaWcgewoJUGlnKCkge3N0ZDo6Y291dCA8PCB0aGlzIDw8ICIgb2lua3MhIiA8PCBzdGQ6OmVuZGw7fQoJflBpZygpIHtzdGQ6OmNvdXQgPDwgdGhpcyA8PCAiIGlzIGJhY29uISIgPDwgc3RkOjplbmRsO30KfTsKCmNsYXNzIFBpZ0Zhcm0gewpwdWJsaWM6CglleHBsaWNpdCBQaWdGYXJtKHN0ZDo6c2l6ZV90IG4pOiBzcChuZXcgUGlnW25dKSB7dGhyb3cgIkZBUk0gRklSRSEiO30KCX5QaWdGYXJtKCkge2RlbGV0ZVtdIHNwO30KcHJpdmF0ZToKCVBpZyAqc3A7Cn07CgppbnQgbWFpbigpCnsKCXRyeSB7CgkJUGlnRmFybSBwZig0KTsKCX0KCWNhdGNoIChjb25zdCBjaGFyICpwYykgewoJCXN0ZDo6Y2VyciA8PCBwYyA8PCBzdGQ6OmVuZGw7Cgl9Cn0K