#include <iostream>
#include <memory>
class Base
{
public:
Base() {}
};
class Derived : public Base
{
public:
Derived() {}
Derived(std::initializer_list<std::pair<int, std::shared_ptr<Base>>>) {}
};
int main(int argc, char ** argv)
{
// auto example = new Derived({
// { 0, std::make_shared<Derived>() }
// });
// auto example = new Derived({
// { 0, std::make_shared<Derived>({
// { 0, std::make_shared<Derived>() }
// }) }
// });
auto example = new Derived({
{ 0, std::make_shared<Derived>(std::initializer_list<std::pair<int, std::shared_ptr<Base>>> {
{ 0, std::make_shared<Derived>() }
}) }
});
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5PgoKY2xhc3MgQmFzZQp7CnB1YmxpYzoKICAgIEJhc2UoKSB7fQp9OwoKY2xhc3MgRGVyaXZlZCA6IHB1YmxpYyBCYXNlCnsKcHVibGljOgogICAgRGVyaXZlZCgpIHt9CiAgICBEZXJpdmVkKHN0ZDo6aW5pdGlhbGl6ZXJfbGlzdDxzdGQ6OnBhaXI8aW50LCBzdGQ6OnNoYXJlZF9wdHI8QmFzZT4+Pikge30KfTsKCmludCBtYWluKGludCBhcmdjLCBjaGFyICoqIGFyZ3YpCnsKICAgIC8vIGF1dG8gZXhhbXBsZSA9IG5ldyBEZXJpdmVkKHsKICAgIC8vICAgICB7IDAsIHN0ZDo6bWFrZV9zaGFyZWQ8RGVyaXZlZD4oKSB9CiAgICAvLyB9KTsKCiAgICAvLyBhdXRvIGV4YW1wbGUgPSBuZXcgRGVyaXZlZCh7CiAgICAvLyAgICAgeyAwLCBzdGQ6Om1ha2Vfc2hhcmVkPERlcml2ZWQ+KHsKICAgIC8vICAgICAgICAgeyAwLCBzdGQ6Om1ha2Vfc2hhcmVkPERlcml2ZWQ+KCkgfQogICAgLy8gICAgIH0pIH0KICAgIC8vIH0pOwoKICAgIGF1dG8gZXhhbXBsZSA9IG5ldyBEZXJpdmVkKHsKICAgICAgICB7IDAsIHN0ZDo6bWFrZV9zaGFyZWQ8RGVyaXZlZD4oc3RkOjppbml0aWFsaXplcl9saXN0PHN0ZDo6cGFpcjxpbnQsIHN0ZDo6c2hhcmVkX3B0cjxCYXNlPj4+IHsKICAgICAgICAgICAgeyAwLCBzdGQ6Om1ha2Vfc2hhcmVkPERlcml2ZWQ+KCkgfQogICAgICAgIH0pIH0KICAgIH0pOwoKICAgIHJldHVybiAwOwp9