cplusplus
.com
教程
參考
文章
論壇
C++
教程
參考
文章
論壇
參考
C 庫
<cassert> (assert.h)
<cctype> (ctype.h)
<cerrno> (errno.h)
C++11
<cfenv> (fenv.h)
<cfloat> (float.h)
C++11
<cinttypes> (inttypes.h)
<ciso646> (iso646.h)
<climits> (limits.h)
<clocale> (locale.h)
<cmath> (math.h)
<csetjmp> (setjmp.h)
<csignal> (signal.h)
<cstdarg> (stdarg.h)
C++11
<cstdbool> (stdbool.h)
<cstddef> (stddef.h)
C++11
<cstdint> (stdint.h)
<cstdio> (stdio.h)
<cstdlib> (stdlib.h)
<cstring> (string.h)
C++11
<ctgmath> (tgmath.h)
<ctime> (time.h)
C++11
<cuchar> (uchar.h)
<cwchar> (wchar.h)
<cwctype> (wctype.h)
容器
C++11
<array>
<deque>
C++11
<forward_list>
<list>
<map>
<queue>
<set>
<stack>
C++11
<unordered_map>
C++11
<unordered_set>
<vector>
輸入/輸出
<fstream>
<iomanip>
<ios>
<iosfwd>
<iostream>
<istream>
<ostream>
<sstream>
<streambuf>
多執行緒
C++11
<atomic>
C++11
<condition_variable>
C++11
<future>
C++11
<mutex>
C++11
<thread>
其他
<algorithm>
<bitset>
C++11
<chrono>
C++11
<codecvt>
<complex>
<exception>
<functional>
C++11
<initializer_list>
<iterator>
<limits>
<locale>
<memory>
<new>
<numeric>
C++11
<random>
C++11
<ratio>
C++11
<regex>
<stdexcept>
<string>
C++11
<system_error>
C++11
<tuple>
C++11
<type_traits>
C++11
<typeindex>
<typeinfo>
<utility>
<valarray>
<iterator>
迭代器
iterator_traits
函式
advance
back_inserter
C++11
begin
distance
C++11
end
front_inserter
inserter
C++11
make_move_iterator
C++11
next
C++11
prev
迭代器類別
bidirectional_iterator_tag
forward_iterator_tag
input_iterator_tag
output_iterator_tag
random_access_iterator_tag
預定義迭代器
back_insert_iterator
front_insert_iterator
insert_iterator
istream_iterator
istreambuf_iterator
C++11
move_iterator
ostream_iterator
ostreambuf_iterator
reverse_iterator
參考
<iterator>
output_iterator_tag
類
<iterator>
std::
output_iterator_tag
struct output_iterator_tag {};
輸出迭代器類別
用於標識迭代器為
輸出迭代器
的空類
輸出迭代器
輸入
輸出
前向
雙向
隨機訪問
輸出迭代器是可用於順序輸出操作的迭代器,透過該迭代器指向的每個元素只能寫入一次值,然後迭代器遞增。
所有
前向
、
雙向
和
隨機訪問
迭代器(非
常量迭代器
)也都是有效的
輸出迭代器
。
不存在單一型別的
輸出迭代器
:每個容器可能定義自己的特定迭代器型別,能夠遍歷容器並訪問其元素。但所有
輸出迭代器
至少支援以下操作:
屬性
有效的表示式
是
可複製構造
、
可複製賦值
和
可析構
的
X b(a);
b = a;
可以作為
左值
解引用(如果處於
可解引用
狀態)。
它只能作為賦值語句的左側被解引用。
一旦解引用,其迭代器值可能不再
可解引用
。
*a = t
可以遞增。
++a
a++
*a++ = t
屬性
有效的表示式
是
可複製構造
、
可複製賦值
和
可析構
的
X b(a);
b = a;
可以作為
左值
解引用(如果處於
可解引用
狀態)。
它只能作為賦值語句的左側被解引用。
一旦解引用,其迭代器值可能不再
可解引用
。
*a = t
可以遞增。
++a
a++
*a++ = t
左值是
可交換的
。
swap
(a,b)
其中
X
是
輸出迭代器型別
,
a
和
b
是該迭代器型別的物件,而
t
是由迭代器型別指向的物件型別(或可以賦值給由型別
X
的物件解引用返回的
左值
的其他型別)的物件。
需要
輸出迭代器
的演算法應該是
單趟輸出演算法
:每個迭代器位置最多解引用一次。
另見
input_iterator_tag
輸入迭代器類別
(類)
forward_iterator_tag
前向迭代器類別
(class)
bidirectional_iterator_tag
雙向迭代器類別
(class)
random_access_iterator_tag
隨機訪問迭代器類別
(class)
迭代器
迭代器基類
(class template)