(/w/cpp/iterator/inserter "cpp/iterator/inserter")  
[ insert_iterator  ](/w/cpp/iterator/insert_iterator "cpp/iterator/insert
iterator")  
[ front_inserter  ](/w/cpp/iterator/front_inserter "cpp/iterator/front
inserter")  
[ back_inserter  ](/w/cpp/iterator/back_inserter "cpp/iterator/back inserter")  
[ move_sentinel  ](/w/cpp/iterator/move_sentinel "cpp/iterator/move sentinel")
(C++20)  
  
  
  
|  [ common_iterator  ](/w/cpp/iterator/common_iterator "cpp/iterator/common
iterator") (C++20)  
---  
[ counted_iterator  ](/w/cpp/iterator/counted_iterator "cpp/iterator/counted
iterator") (C++20)  
[ basic_const_iterator  ](/w/cpp/iterator/basic_const_iterator
"cpp/iterator/basic const iterator") (C++23)  
[ const_iterator  ](/w/cpp/iterator/basic_const_iterator "cpp/iterator/basic
const iterator") (C++23)  
[ const_sentinel  ](/w/cpp/iterator/basic_const_iterator "cpp/iterator/basic
const iterator") (C++23)  
[ make_const_iterator  ](/w/cpp/iterator/basic_const_iterator
"cpp/iterator/basic const iterator") (C++23)  
[ make_const_sentinel  ](/w/cpp/iterator/basic_const_iterator
"cpp/iterator/basic const iterator") (C++23)  
  
  
  
|  Stream iterators  
---  
|  [ istream_iterator  ](/w/cpp/iterator/istream_iterator
"cpp/iterator/istream iterator")  
---  
[ ostream_iterator  ](/w/cpp/iterator/ostream_iterator "cpp/iterator/ostream
iterator")  
  
|  [ istreambuf_iterator  ](/w/cpp/iterator/istreambuf_iterator
"cpp/iterator/istreambuf iterator")  
---  
[ ostreambuf_iterator  ](/w/cpp/iterator/ostreambuf_iterator
"cpp/iterator/ostreambuf iterator")  
  
|  Iterator customization points  
---  
[ ranges::iter_move  ](/w/cpp/iterator/ranges/iter_move
"cpp/iterator/ranges/iter move") (C++20)  
[ ranges::iter_swap  ](/w/cpp/iterator/ranges/iter_swap
"cpp/iterator/ranges/iter swap") (C++20)  
  
|  Iterator operations  
---  
|  |  [ advance  ](/w/cpp/iterator/advance "cpp/iterator/advance")  
---  
[ distance  ](/w/cpp/iterator/distance "cpp/iterator/distance")  
[ prev  ](/w/cpp/iterator/prev "cpp/iterator/prev") (C++11)  
[ next  ](/w/cpp/iterator/next "cpp/iterator/next") (C++11)  
  
|  [ ranges::advance  ](/w/cpp/iterator/ranges/advance
"cpp/iterator/ranges/advance") (C++20)  
---  
[ ranges::distance  ](/w/cpp/iterator/ranges/distance
"cpp/iterator/ranges/distance") (C++20)  
[ ranges::prev  ](/w/cpp/iterator/ranges/prev "cpp/iterator/ranges/prev")
(C++20)  
[ ranges::next  ](/w/cpp/iterator/ranges/next "cpp/iterator/ranges/next")
(C++20)  
  
|  Range access  
---  
|  |  [ begin  cbegin  ](/w/cpp/iterator/begin "cpp/iterator/begin") (C++11)  (C++14)   
---  
[ rbegin  crbegin  ](/w/cpp/iterator/rbegin "cpp/iterator/rbegin") (C++14)
(C++14)  
  
|  [ end  cend  ](/w/cpp/iterator/end "cpp/iterator/end") (C++11)  (C++14)  
---  
[ rend  crend  ](/w/cpp/iterator/rend "cpp/iterator/rend") (C++14)  (C++14)  
  
|  [ size  ssize  ](/w/cpp/iterator/size "cpp/iterator/size") (C++17)  (C++20)  
---  
[ empty  ](/w/cpp/iterator/empty "cpp/iterator/empty") (C++17)  
[ data  ](/w/cpp/iterator/data "cpp/iterator/data") (C++17)  
  
[ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/iterator/navbar_content&action=edit)

Iterators are a generalization of [ pointers ](/w/cpp/language/pointer
"cpp/language/pointer") that allow a C++ program to work with different data
structures (for example, [ containers ](/w/cpp/container "cpp/container") and
[ ranges ](/w/cpp/ranges "cpp/ranges") (since C++20)  ) in a uniform manner.
The iterator library provides definitions for iterators, as well as iterator
traits, adaptors, and utility functions.

Since iterators are an abstraction of pointers, their semantics are a
generalization of most of the semantics of pointers in C++. This ensures that
every [ function template ](/w/cpp/language/function_template
"cpp/language/function template") that takes iterators works as well with
regular pointers.

##  Contents

  * 1  Iterator categories 
  * 2  Definitions 
    * 2.1  Types and wr