#include <iostream>
struct SomeClass
{
SomeClass()
: value{7}
{ std::cout << "default" << std::endl; }
SomeClass(const SomeClass& other)
: value{other.value}
{ std::cout << "copy" << std::endl; }
SomeClass(SomeClass&& other)
: value{std::move(other.value)}
{ std::cout << "move" << std::endl; }
int value;
};
int main()
{
SomeClass a[] = {SomeClass{}, SomeClass{}, SomeClass{}};
for (const auto& i : a)
std::cout << i.value << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IFNvbWVDbGFzcwp7CiAgICBTb21lQ2xhc3MoKQogICAgICAgIDogdmFsdWV7N30KICAgIHsgc3RkOjpjb3V0IDw8ICJkZWZhdWx0IiA8PCBzdGQ6OmVuZGw7IH0KCiAgICBTb21lQ2xhc3MoY29uc3QgU29tZUNsYXNzJiBvdGhlcikKICAgICAgICA6IHZhbHVle290aGVyLnZhbHVlfQogICAgeyBzdGQ6OmNvdXQgPDwgImNvcHkiIDw8IHN0ZDo6ZW5kbDsgfQoKICAgIFNvbWVDbGFzcyhTb21lQ2xhc3MmJiBvdGhlcikKICAgICAgICA6IHZhbHVle3N0ZDo6bW92ZShvdGhlci52YWx1ZSl9CiAgICB7IHN0ZDo6Y291dCA8PCAibW92ZSIgPDwgc3RkOjplbmRsOyB9CgogICAgaW50IHZhbHVlOwp9OwoKaW50IG1haW4oKQp7CiAgICBTb21lQ2xhc3MgYVtdID0ge1NvbWVDbGFzc3t9LCBTb21lQ2xhc3N7fSwgU29tZUNsYXNze319OwoKICAgIGZvciAoY29uc3QgYXV0byYgaSA6IGEpCiAgICAgICAgc3RkOjpjb3V0IDw8IGkudmFsdWUgPDwgc3RkOjplbmRsOwoKICAgIHJldHVybiAwOwp9Cg==