stl 中list 或者vector正确使用find查找类对象
来源:互联网 发布:十三水组合推荐算法 编辑:程序博客网 时间:2024/05/01 04:50
关键做好类对象的运算符重载
#include "stdafx.h"
#include <vector>
#include <algorithm>
class people
{
public:
int age;
char name[32];
public:
bool operator == (const people&T)
{
if (age == T.age)
{
return true;
}
return false;
}
};
typedef std::vector<people> myPeople;
typedef myPeople::iterator myPeopleIt;
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
people m_p1;
myPeople m_p;
m_p.push_back(m_p1);
myPeopleIt it = find(m_p.begin(),m_p.end(),m_p1);
if (it != m_p.end())
{
printf("find it");
}
return 0;
}
- stl 中list 或者vector正确使用find查找类对象
- STL中Vector容器Find的使用(int查找)
- STL标准函数find进行vector list链表查找
- STL中的find,find_if函数(对类、容器(vector、list)进行查找)
- C++ Vector STL find 查找
- STL中vector,find,insert的使用
- STL中vector查找算法find()和find_if()深入比较
- C++ STL库中vector/list使用
- STL中vector和list的使用
- C++ vector 自定义类,重载==操作符,使用STL的find查找
- 【STL】STL 中vector和list的使用
- 【STL】标准库中容器对象vector list deque区别
- STL中Vector容器Find的使用(泛型)
- STL 查找vector容器中的指定对象:find()与find_if()算法
- STL中list/vector/deque
- stl vector list的使用
- STL vector find and sort vector的查找和排序
- stl中vector,list,deque的使用准则
- Spring--quartz中cronExpression配置说明
- HDOJ 1058:Humble Numbers
- HDOJ 1028:Ignatius and the Princess III
- OAuth流程介绍
- salary and have chance
- stl 中list 或者vector正确使用find查找类对象
- 关于科亿尔打击盗版被攻击的一个第三人的说法
- 使用jpa hql语句查询关联多个表 如何用struts的iterator接受显示数据
- 做asp.net的时候,偶尔碰到白屏
- c读写二进制文件
- ubuntu 下移植 python 程序
- error while loading shared libraries的解決方法
- 移动应用开发——手机硬基本形态了解
- VC修改注册表项权限