C++ named requirements: BidirectionalIterator
From cppreference.com
A BidirectionalIterator is a ForwardIterator that can be moved in both directions (i.e. incremented and decremented).
Requirements
The type It
satisfies BidirectionalIterator if
- The type
It
satisfies ForwardIterator
And, given
-
a
andb
, iterators of typeIt
-
reference,
the type denoted bystd::iterator_traits<It>::reference
The following expressions must be valid and have their specified effects
Expression | Return | Equivalent expression | Notes |
---|---|---|---|
--a | It& | Preconditions:
Postconditions:
| |
a-- | convertible to const It& | It temp = a; --a; |
|
*a-- | reference |
A mutable BidirectionalIterator is a BidirectionalIterator that additionally satisfies the OutputIterator requirements.
Notes
The begin iterator is not decrementable and the behavior is undefined if --container.begin() is evaluated.
A bidirectional iterator does not have to be dereferenceable to be decrementable (in particular, the end iterator is not dereferenceable but is decrementable)
See also
specifies that a ForwardIterator is a bidirectional interator, supporting movement backwards (concept) |