#include <iostream>
#include <initializer_list>
#include <vector>
#include <utility>
struct Obj
{
Obj() {
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
Obj(Obj&&) {
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
Obj(Obj const &) {
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
Obj& operator=(Obj&&) = default;
Obj& operator=(Obj const &) = delete;
};
template <class T>
std::vector<T> make_vector(std::initializer_list<T> lst) {
std::vector<T> result;
result.reserve(lst.size());
for(const T& item: lst) {
T& item2 = const_cast<T&>(item);
result.emplace_back(std::move(item2));
}
return result;
}
int main() {
auto a = Obj();
std::cout << "---" << std::endl << std::endl;
make_vector({ a, Obj(), Obj() });
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW5pdGlhbGl6ZXJfbGlzdD4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHV0aWxpdHk+CgpzdHJ1Y3QgT2JqCnsKICBPYmooKSB7CiAgICBzdGQ6OmNvdXQgPDwgX19QUkVUVFlfRlVOQ1RJT05fXyA8PCBzdGQ6OmVuZGw7CiAgfQogIE9iaihPYmomJikgewogICAgc3RkOjpjb3V0IDw8IF9fUFJFVFRZX0ZVTkNUSU9OX18gPDwgc3RkOjplbmRsOwogIH0KICBPYmooT2JqIGNvbnN0ICYpIHsKICAJc3RkOjpjb3V0IDw8IF9fUFJFVFRZX0ZVTkNUSU9OX18gPDwgc3RkOjplbmRsOwogIH0KICAKICBPYmomIG9wZXJhdG9yPShPYmomJikgPSBkZWZhdWx0OwogIE9iaiYgb3BlcmF0b3I9KE9iaiBjb25zdCAmKSA9IGRlbGV0ZTsKfTsKCnRlbXBsYXRlIDxjbGFzcyBUPgpzdGQ6OnZlY3RvcjxUPiBtYWtlX3ZlY3RvcihzdGQ6OmluaXRpYWxpemVyX2xpc3Q8VD4gbHN0KSB7CglzdGQ6OnZlY3RvcjxUPiByZXN1bHQ7CglyZXN1bHQucmVzZXJ2ZShsc3Qu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