samedi 27 février 2016

Automatic move constructor

If I have the following type:

struct Data
{
    std::string str;
    std::vector<int> vec;
    float f;
private:
    Data(){}
};

and I don't define a move constructor, a copy will happen if I do the following?

Data d1;
d1.str = "abc";
d1.vec = {1, 2, 3};
Data d2 = d1;

Aucun commentaire:

Enregistrer un commentaire