lundi 27 mai 2019

Structure init fails with C2280

I have a problem with structure init. It fails with compiler error C2280.

I have a structure like this

struct myStruct final
{
    myStruct() = default;

    int val1;
    int val2;
    bool val3;
    string name;

    myStruct(int _val1, int _val2, bool _val3, string _name) :
    val1(_val1), val2(_val2), val3(_val3), name(_name) {}
};

Then i want to init struct this way

myStruct ms;

This fails with error C2280 - attempting to reference a deleted function.

Aucun commentaire:

Enregistrer un commentaire