is_input_iterator¶
Header¶
#include <tick/traits/is_input_iterator.h>
Description¶
An input iterator is an iterator that can read from the pointed-to element.
Input iterators only guarantee validity for single pass algorithms: once an
inputIterator i
has been incremented, all copies of its previous value may
be invalidated.
Requirements¶
The type It
satisfies InputIterator if
- The type
It
satisfies is_iterator - The type
It
satisfies is_equality_comparable
And, given
i
andj
, values of typeIt
or const Itreference
, the type denoted bystd::iterator_traits<It>::reference
value_type
, the type denoted bystd::iterator_traits<It>::value_type
The following expressions must be valid and have their specified effects
Expression | Return | Equivalent expression | Notes |
---|---|---|---|
i != j |
contextually convertible to bool |
!(i == j) |
Precondition: (i, j) is in the domain of == . |
*i |
reference, convertible to value_type |
If i == j and (i, j) is in the domain of == then this is equivalent to *j . |
Precondition: i is dereferenceable. The expression (void)*i , *i is equivalent to *i . |
i->m |
(*i).m |
Precondition: i is dereferenceable. |
|
++i |
It& |
Precondition: i is dereferenceable. Postcondition: i is dereferenceable or i is past-the-end. Postcondition: Any copies of the previous value of i are no longer required to be either dereferenceable or to be in the domain of == . |
|
(void)i++ |
(void)++i |
||
*i++ |
convertible to value_type |
value_type x = *i; ++i; return x; |
Synopsis¶
TICK_TRAIT(is_input_iterator,
is_iterator<_>,
is_equality_comparable<_>
)
{
template<class I>
auto require(I&& i) -> valid<
decltype(returns<typename iterator_traits<I>::value_type>(*i)),
decltype(returns<typename iterator_traits<I>::value_type>(*i++))
>;
};