c++ map 嵌套队列指针,队列嵌套结构体指针实例讲解
程序员文章站
2022-04-25 15:58:08
#include
#include
#include
#include
#include
//#include
usingnamespacestd;
queue qu...
#include
#include
#include
#include
#include
//#include
usingnamespacestd;
queue queue1;
/*queue* queue2;*/
//queue2 = (queue*)malloc(sizeof(queue));
for(inti = 0; i < 10; i++) {
RevDatarecvD;
recvD.size = i;
strcpy(recvD.data, "hello");
RevData* recvp = (RevData*)malloc(sizeof(RevData));
memcpy(recvp, &recvD, sizeof(RevData));
queue1.push(recvp);// recvp);
//queue1.push(&recvD);
}
map*> imap;
map*>* queue2;
//queue2 = (queue*)malloc(sizeof(queue));
for(inti = 0; i < 1; i++) {
imap[i]= &queue1;// recvp);
//imap[i]=&recvD;
}
queue2 = &imap;
for(inti = 0; i < 1; i++) {
queue* recv = (*queue2)[i];
for(intj = 0; j < 10; j++) {
RevData* recvd = recv->front();
cout <
cout <
intlenga = recv->size();
recv->pop();
}
}