suppose I got a node like this:
struct node{
int a;
int b;
}
Now I want to make a queue structure in cpp. If the data type was int then we could do that easily in this way:
queue<int> a;
And we could also push or pop elements like this: a. push_back(12) or a. pop(12)
But in the earlier case when out data type is user defined how can we make such a queue and push or pop elemeqnts from it?
std::queue<node>
as you like. (Didn't dv BTW)int
withnode
. Have you even tried it?node
and then push it.a.push_back(node{11,12})
maybe?