jeudi 21 juillet 2016

Copy generic value from struct to variable c++

As said in the description i need to copy a value from a variable in struct to another one but it gives me no error and cmd keep crashing.

struct GateNode
{
    string gatename;
    bool gatenPos=1;
    vector<struct GateNode*>inputs;
    bool (*ptrf)(vector<bool>);//puntatore a una funzione;
};

Then in main()

int main()
{
vector<bool> Op;
GateNode *ptr,g;
ptr=&g;
Op[0]=ptr->gatenPos;
return 0;
}

Cmd crash and doesn't give me any error! How can i achieve this? if cout ptr->gatenPos it displays the correct value but i can't copy it!

Aucun commentaire:

Enregistrer un commentaire