c++ STL vector存放自定义数据类型
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
//vector容器中存放自定义数据类型
class Person
{
public:
Person(string name,int age)
{
this->m_Name=name;
this->m_Age=age;
}
string m_Name;
int m_Age;
};
void test01()
{
vector<Person>v;
Person p1("aaa",10);
Person p2("aaa",10);
Person p3("aaa",10