#include <iostream>
#include <vector>
using HuySize = std::size_t;
class Bydlo {
public:
Bydlo(HuySize hs = 1) : huy_size{ new HuySize{ hs } } {}
Bydlo(const Bydlo& bydlo) : huy_size{ new HuySize{ *bydlo.huy_size + 1 } } {}
~Bydlo() { delete this->huy_size; }
auto syebi(void) { return this->huy_size; }
private:
HuySize* huy_size;
};
int main()
{
Bydlo bydlo{};
std::vector<Bydlo> mnogo_bydla( 10, bydlo );
std::cout << *bydlo.syebi() << std::endl;
for (auto& bydla : mnogo_bydla) {
std::cout << *bydla.syebi() << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgSHV5U2l6ZSA9IHN0ZDo6c2l6ZV90OwoKY2xhc3MgQnlkbG8gewpwdWJsaWM6CglCeWRsbyhIdXlTaXplIGhzID0gMSkgOiBodXlfc2l6ZXsgbmV3IEh1eVNpemV7IGhzIH0gfSB7fSAKCUJ5ZGxvKGNvbnN0IEJ5ZGxvJiBieWRsbykgOiBodXlfc2l6ZXsgbmV3IEh1eVNpemV7ICpieWRsby5odXlfc2l6ZSArIDEgfSB9IHt9Cgl+QnlkbG8oKSB7IGRlbGV0ZSB0aGlzLT5odXlfc2l6ZTsgfQoJYXV0byBzeWViaSh2b2lkKSB7IHJldHVybiB0aGlzLT5odXlfc2l6ZTsgfSAKcHJpdmF0ZToKCUh1eVNpemUqIGh1eV9zaXplOwp9OwoKCmludCBtYWluKCkKewoJQnlkbG8gYnlkbG97fTsKCXN0ZDo6dmVjdG9yPEJ5ZGxvPiBtbm9nb19ieWRsYSggMTAsIGJ5ZGxvICk7CglzdGQ6OmNvdXQgPDwgKmJ5ZGxvLnN5ZWJpKCkgPDwgc3RkOjplbmRsOwoJZm9yIChhdXRvJiBieWRsYSA6IG1ub2dvX2J5ZGxhKSB7CgkJc3RkOjpjb3V0IDw8ICpieWRsYS5zeWViaSgpIDw8IHN0ZDo6ZW5kbDsKCX0KCXJldHVybiAwOwp9