samedi 12 juin 2021

NO matching function for call to 'std::queue

I am solving a problem and came across this obstacle . Why this code gives me an error

queue<node>q;
node n;
q.push(n);
q.push(NULL);

'no matching function for call to 'std::queue::push(NULL)'

And when I do this change

queue<node*>q;
node* n = new node();
q.push(n);
q.push(NULL);

It works Fine!

Aucun commentaire:

Enregistrer un commentaire