#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
#include <queue>
#include <string>
class Person
{
Person(int age,string name):m_age(age),m_name(name)
{
}
public:
int m_age;
string m_name;
};
void test01()
{
queue<Person>q;
Person p1(10, "ggj");
Person p2(20, "ggj");
Person p3(30, "ggj");
q.push(p1);
q.push(p2);
q.push(p3);
while (!q.empty())
{
Person pFront = q.front();
cout << "队头元素 姓名: " << pFront.m_name << " 年龄: " << pFront.m_age << endl;
Person pBack = q.back();
cout << "队尾元素 姓名: " << pBack.m_name << " 年龄: " << pBack.m_age << endl;
q.pop();
}
}