#include <iostream>
class P
{
public:
P(int i) : i(i) {
std::cout << "ctor: " << i << std::endl;
}
~P() {
std::cout << "dtor: " << i << std::endl;
}
private:
const int i;
};
static void f1() { static P p(1); }
static void f2() { static P p(2); }
static void f3() { static P p(3); }
static void f4() { static P p(4); }
int
main(void)
{
f4();
f3();
f1();
f2();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgUAp7CnB1YmxpYzoKICAgIFAoaW50IGkpIDogaShpKSB7CiAgICAgICAgc3RkOjpjb3V0IDw8ICJjdG9yOiAiIDw8IGkgPDwgc3RkOjplbmRsOwogICAgfQogICAgflAoKSB7CiAgICAgICAgc3RkOjpjb3V0IDw8ICJkdG9yOiAiIDw8IGkgPDwgc3RkOjplbmRsOwogICAgfQoKcHJpdmF0ZToKICAgIGNvbnN0IGludCBpOwp9OwoKc3RhdGljIHZvaWQgZjEoKSB7IHN0YXRpYyBQIHAoMSk7IH0Kc3RhdGljIHZvaWQgZjIoKSB7IHN0YXRpYyBQIHAoMik7IH0Kc3RhdGljIHZvaWQgZjMoKSB7IHN0YXRpYyBQIHAoMyk7IH0Kc3RhdGljIHZvaWQgZjQoKSB7IHN0YXRpYyBQIHAoNCk7IH0KCmludAptYWluKHZvaWQpCnsKICAgIGY0KCk7CiAgICBmMygpOwogICAgZjEoKTsKICAgIGYyKCk7CiAgICByZXR1cm4gMDsKfQ==