STL_set——set::end
来源:互联网 发布:凯文考试软件 编辑:程序博客网 时间:2024/06/16 00:18
Reference:
Returns an iterator that addresses the location succeeding the last element in a set.
Function:
const_iterator end( ) const;
iterator end( );
Return Value:
A bidirectional iterator that addresses the location succeeding the last element in a set. If the set is empty, then set::end ==set::begin.
Remarks:
end is used to test whether an iterator has reached the end of its set. The value returned by end should not be dereferenced.
Example:
Output:
The last element of s1 is 3
The last element of s1 is now 2
Returns an iterator that addresses the location succeeding the last element in a set.
Function:
const_iterator end( ) const;
iterator end( );
Return Value:
A bidirectional iterator that addresses the location succeeding the last element in a set. If the set is empty, then set::end ==set::begin.
Remarks:
end is used to test whether an iterator has reached the end of its set. The value returned by end should not be dereferenced.
Example:
#include <set>#include <iostream>int main( ){ using namespace std; set <int> s1; set <int> :: iterator s1_Iter; set <int> :: const_iterator s1_cIter; s1.insert( 1 ); s1.insert( 2 ); s1.insert( 3 ); s1_Iter = s1.end( ); s1_Iter--; cout << "The last element of s1 is " << *s1_Iter << endl; s1.erase( s1_Iter ); s1_cIter = s1.end( ); s1_cIter--; cout << "The last element of s1 is now " << *s1_cIter << endl;}
Output:
The last element of s1 is 3
The last element of s1 is now 2
0 0
- STL_set——set::end
- STL_set——set::begin
- STL_set——set::clear
- STL_set——set::count
- STL_set——set::empty
- STL_set——set::equal_range
- STL_set——set::erase
- STL_set——set::find
- STL_set——set::insert
- STL_set——set::size
- STL_set
- stl_set
- STL_set
- stl_set
- STL_set
- After end of result set
- stl_set.h
- STL_set用法
- 1001. A+B Format (20)
- poj1915
- 2014年7月20日晚笔记
- X264编码
- 关于PE病毒编写的学习(1)
- STL_set——set::end
- 编译内核模块
- JavaScript事件循环
- JDK中的设计模式
- 【Android】缓存目录:/data/data/.../cache和/sdcard/Android/cache/...
- HDU 4611 数学+YY
- HDU BestCoder Round #1 1002 项目管理
- 关于PE病毒编写的学习(2)
- Page_Load不要忘了if (!IsPostBack)