博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
stl & set
阅读量:4156 次
发布时间:2019-05-26

本文共 1267 字,大约阅读时间需要 4 分钟。

stl & set


/*set是根据元素值进行排序的集合,所插入的元素在集合中唯一,不存在重复元素。______________________________________________________________________size()          返回set中的元素数                              O(1)clear()         清空set                                        O(n)begin()         返回指向set开头的迭代器                        O(1)end()           返回指向set末尾的迭代器                        O(1)insert(key)     向set中插入元素key                             O(logn)erase(key)      删除含有key的元素                              O(logn)find(key)       搜索与key一致的元素,并返回指向该元素的迭代器  O(logn)                没有与key一致的元素,则返回末尾end()______________________________________________________________________output:4: 1 4 7 83: 1 4 84: 1 2 4 8not found.*/#include 
#include
using namespace std;voidprint(set
S) { cout << S.size() << ":"; for( set
:: iterator it = S.begin(); it != S.end(); it++ ) { cout << " " << (*it); } cout << endl;}intmain() { set
S; S.insert(8); S.insert(1); S.insert(7); S.insert(4); S.insert(8); S.insert(4); print(S); // 4: 1 4 7 8 S.erase(7); print(S); // 3: 1 4 8 S.insert(2); print(S); // 4: 1 2 4 8 if( S.end() == S.find(10) ) { cout << "not found." << endl; } return 0;}

转载地址:http://vpkxi.baihongyu.com/

你可能感兴趣的文章
CMFCShellListCtrl使用方法
查看>>
mapnik的demo运行
查看>>
python支持下的mapnik安装
查看>>
milvus手册
查看>>
查看pytorch基于cuda 的哪个版本
查看>>
多目标跟踪的简单理解
查看>>
Near-Online Multi-target Tracking with Aggregated Local Flow Descriptor
查看>>
Joint Tracking and Segmentation of Multiple Targets
查看>>
Subgraph Decomposition for Multi-Target Tracking
查看>>
JOTS: Joint Online Tracking and Segmentation
查看>>
CDT: Cooperative Detection and Tracking for Tracing Multiple Objects in Video Sequences
查看>>
Improving Multi-frame Data Association with Sparse Representations for Robust Near-online Multi-ob
查看>>
Virtual Worlds as Proxy for Multi-Object Tracking Analysis
查看>>
Multi-view People Tracking via Hierarchical Trajectory Composition
查看>>
Online Multi-Object Tracking via Structural Constraint Event Aggregation
查看>>
The Solution Path Algotithm for Identity-Aware Multi-Object Tracking
查看>>
Groupwise Tracking of Crowded Similar-Appearance Targets from Low-Continuity Image Sequences
查看>>
CDTS: Collaborative Detection, Tracking, and Segmentation for Online Multiple Object Segmentation
查看>>
Deep Network Flow for Multi-Object Tracking
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>