Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Concept InputIterator
c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Concept InputIterator



An input iterator is an iterator that can read through a sequence of values. It is single-pass (old values of the iterator cannot be re-used), and read-only.

An input iterator represents a position in a sequence. Therefore, the iterator can point into the sequence (returning a value when dereferenced and being incrementable), or be off-the-end (and not dereferenceable or incrementable).

Refinement of

Associated types

  • value_type


    The value type of the iterator (not necessarily what *i returns)

  • difference_type


    The difference type of the iterator

  • category


    The category of the iterator


A type playing the role of iterator-type in the InputIterator concept.
i, j
Objects of type Iter
Object of type value_type

Type expressions

Category tag

category must be derived from std::input_iterator_tag, a model of DefaultConstructible, and a model of CopyConstructible.

Value type copy constructibility

value_type must be a model of CopyConstructible.

Difference type properties

difference_type must be a model of SignedInteger.

Valid expressions




Convertible to value_type

i is incrementable (not off-the-end)




Iter &

i is incrementable (not off-the-end)




i is incrementable (not off-the-end)

Equivalent to (void)(++i)

i is dereferenceable or off-the-end

Postincrement and dereference


Convertible to value_type

i is incrementable (not off-the-end)

Equivalent to {value_type t = *i; ++i; return t;}

i is dereferenceable or off-the-end


All iterator operations must take amortized constant time.


  • std::istream_iterator

See also

Last revised: , at GMTCopyright © 2001, 2002 Indiana University
Copyright © 2000, 2001 University of Notre Dame du Lac
Copyright © 2000 Jeremy Siek, Lie-Quan Lee, Andrew Lumsdaine
Copyright © 1996-1999 Silicon Graphics Computer Systems, Inc.
Copyright © 1994 Hewlett-Packard Company