#include <iostream>
#include <vector>

struct A{
        A(int id):  id(id){
                std::cout << id << ": constructing" << std::endl;
        }

        ~A(){
                auto &s = std::cout << id << ": destroying";
                if (isCopy)
                        s << " a copy";
                s << std::endl;
        }

        A(const A& a) : id(a.id), isCopy(true) {
                std::cout << id << ": copy constructor" << std::endl;
        }
private:
        int id;
        bool isCopy = false;
};

void Copy(){
        std::cout << "Via copy" << std::endl;
        std::vector<A> v;
        v.reserve(3);
        v.push_back(A(1));
        v.push_back(A(2));
        v.push_back(A(3));
}

void Move(){
        std::cout << std::endl;
        std::cout << "Via move" << std::endl;
        std::vector<A> v;
        v.reserve(3);
        v.emplace_back(4);
        v.emplace_back(5);
        v.emplace_back(6);
}

int main(){
        Copy();
        Move();
        return 0;
}
