mercredi 4 novembre 2015

std::pair is calling the default constructor for one of its members

So I have this code line:

statesArray.push_back(std::pair<States, StateSettings>(States::funMode, StateSettings(1, 2, 3, 4, 5, 6)));

statesArray is an object of type QVector<std::pair<States, StateSettings> >.

StateSettings class have this two constructors (from witch the default one is deleted):

StateSettings() = delete;
StateSettings(int a, int b, int c, int d, int e = 0, int f = 0);

When compiling, I get this error:

Error   2   error C2280: 'StateSettings::StateSettings(void)' : attempting to reference a deleted function.

Why std::pair is trying to call the deleted default constructor, if I pass it an object explicitly-constructed with one non-default constructor?

How ho I solve this?

Aucun commentaire:

Enregistrer un commentaire