oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • C++ Reference
  • About
    • Help
    • Terms of Use
    • Technical Specifications
    • Credits

C++ Reference as of 28 May 2018

C++ concepts: Iterator - cppreference.com

C++ concepts: Iterator

From cppreference.com
< cpp‎ | concept
 
C++
Language
Headers
Library concepts
Language support library
Diagnostics library
Utilities library
Strings library
Containers library
Algorithms library
Iterators library
Numerics library
Input/output library
Localizations library
Regular expressions library (C++11)
Atomic operations library (C++11)
Thread support library (C++11)
Filesystem library (C++17)
Technical Specifications
 
C++ concepts
Basic
DefaultConstructible
CopyAssignable
CopyConstructible
MoveAssignable
(C++11)
MoveConstructible
(C++11)
Destructible
Layout
TrivialType
(C++11)
TriviallyCopyable
(C++11)
StandardLayoutType
(C++11)
PODType
Library-Wide
EqualityComparable
LessThanComparable
Swappable
(C++11)
ValueSwappable
(C++11)
NullablePointer
(C++11)
Hash
(C++11)
Allocator
FunctionObject
Callable
Predicate
BinaryPredicate
Compare
Container
Container
SequenceContainer
ContiguousContainer
(C++17)
ReversibleContainer
AssociativeContainer
AllocatorAwareContainer
UnorderedAssociativeContainer
(C++11)
Container Elements
DefaultInsertable
(C++11)
CopyInsertable
(C++11)
MoveInsertable
(C++11)
EmplaceConstructible
(C++11)
Erasable
(C++11)
Iterator
Iterator
OutputIterator
InputIterator
ForwardIterator
BidirectionalIterator
RandomAccessIterator
ContiguousIterator
(C++17)
Stream I/O
FormattedInputFunction
UnformattedInputFunction
FormattedOutputFunction
UnformattedOutputFunction
Random Numbers
SeedSequence
(C++11)
RandomNumberEngine
(C++11)
RandomNumberDistribution
(C++11)
UniformRandomBitGenerator
(C++11)
RandomNumberEngineAdaptor
(C++11)
Concurrency
BasicLockable
(C++11)
Lockable
(C++11)
TimedLockable
(C++11)
Mutex
(C++11)
TimedMutex
(C++11)
SharedMutex
(C++17)
SharedTimedMutex
(C++14)
Other
CharTraits
RegexTraits
(C++11)
BitmaskType
NumericType
LiteralType
(C++11)
UnaryTypeTrait
(C++11)
BinaryTypeTrait
(C++11)
TransformationTrait
(C++11)
Clock
(C++11)
TrivialClock
(C++11)
 

The Iterator concept describes types that can be used to identify and traverse the elements of a container.

Iterator is the base concept used by other iterator types: InputIterator, OutputIterator, ForwardIterator, BidirectionalIterator, and RandomAccessIterator. Iterators can be thought of as an abstraction of pointers.

Requirements

The type It satisfies Iterator if

  • The type It satisfies CopyConstructible, and
  • The type It satisfies CopyAssignable, and
  • The type It satisfies Destructible, and
  • lvalues of type It satisfy Swappable, and
  • std::iterator_traits<It> has member typedefs value_type, difference_type, reference, pointer, and iterator_category , and

Given

  • r, an lvalue of type It.

The following expressions must be valid and have their specified effects:

Expression Return Type Precondition
*r unspecified r is dereferenceable (see below)
++r It& r is incrementable (the behavior of the expression ++r is defined)

Dereferenceable iterators

Iterators for which the behavior of the expression *i is defined are called dereferenceable.

Iterators are not dereferenceable if

  • they are past-the-end iterators (including pointers past the end of an array) or before-begin iterators. Such iterators may be dereferenceable in a particular implementation, but the library never assumes that they are.
  • they are singular iterators, that is, iterators that are not associated with any sequence. A null pointer, as well as a default-constructed pointer (holding an indeterminate value) is singular
  • they were invalidated by one of the iterator-invalidating operations on the sequence to which they refer.

See also

Iterator
specifies that objects of a type can be incremented and dereferenced
(concept)
  • Iterator library
Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/concept/Iterator&oldid=92577"
Hidden category:
  • Pages with unreviewed LWG DR marker
Navigation
  • Online version
  • Offline version retrieved 2018-04-14 22:05.
  • This page was last modified on 24 April 2017, at 09:20.
  • This page has been accessed 146,785 times.
mrJudge 31.05.2018 (F43DD)
Copyright © 2018 mrJudge. All rights reserved.

Under Construction

Stats Tab Content

Under Construction too