stl 中list 或者vector正確使用find查詢類物件
關鍵做好類物件的運算子過載
#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——STL中vector的實現原理
- 正確的折半查詢實現
- 陣列使用find查詢用法陣列
- STL Vector remove()和erase()的使用REM
- es中如何使用巢狀物件查詢巢狀物件
- C++ STL -- vectorC++
- Linux 查詢檔案的正確方式Linux
- 命令列查詢天氣的正確方式命令列
- 正確釋放Vector的記憶體記憶體
- c++中的查詢list元素C++
- 《STL原始碼剖析》-- stl_vector.h原始碼
- STL vector中的shrink_to_fit方法(32)
- find 查詢檔案
- 初探STL容器之Vector
- STL:vector用法總結
- ACM常用STL查詢手冊ACM
- Mysql日期查詢listMySql
- linux中查詢find命令的複雜用法Linux
- STL原始碼剖析——vector容器原始碼
- C++ STL學習——vectorC++
- STL 之 vector 容器詳解
- C++_STL—容器Vector篇C++
- 建立一個更高階別的查詢 API:正確使用Django ORM 的方式APIDjangoORM
- C++ STL listC++
- 【STL】list基礎
- C++ STL -- listC++
- java中的List介面(ArrayList、Vector、LinkedList)Java
- 查詢正序排列的List中缺失的日期資料的一個演算法演算法
- Android中Handler的正確使用Android
- 物件點查詢和中括號查詢的區別物件
- 《STL原始碼剖析》-- stl_list.h原始碼
- mysql 資料庫或者表空間使用查詢MySql資料庫
- 常用的 STL 查詢演算法演算法
- Linux歸檔及壓縮、重定向與管道操作、find精確查詢、vim高階使用Linux
- oracle 精確查詢和模糊查詢Oracle
- in list查詢計算cost
- 如何使用find和xargs查詢和處理檔案
- Unix 下使用 Find 命令查詢需要清理的檔案