Movatterモバイル変換


[0]ホーム

URL:


cplusplus.com

Reference

class
<iterator>

std::input_iterator_tag

struct input_iterator_tag {};
Input iterator category
Empty class to identify the category of an iterator as aninput iterator:

Input iterators


Input iterators are iterators that can be used in sequential input operations, where each value pointed by the iterator is read only once and then the iterator is incremented.

Allforward,bidirectional andrandom-access iterators are also validinput iterators.

There is not a single type ofinput iterator: Each container may define its own specific iterator type able to iterate through it and access its elements. But allinput iterators support -at least- the following operations:

propertyvalid expressions
Iscopy-constructible,copy-assignable anddestructibleX b(a);
b = a;
Can be compared for equivalence using the equality/inequality operators
(meaningful if both iterators are bein domain).
a == b
a != b
Can be dereferencedas anrvalue (if in adereferenceable state).*a
a->m
Can be incremented (if in adereferenceable state).
The result is either alsodereferenceable or apast-the-end iterator.
The previous iterator value is not required to bedereferenceable after the increase.
++a
(void)a++
*a++
Itsvalue type does not need to be assignablet = unot required
propertyvalid expressions
Iscopy-constructible,copy-assignable anddestructibleX b(a);
b = a;
Can be compared for equivalence using the equality/inequality operators
(meaningful if both iterators are bein domain).
a == b
a != b
Can be dereferencedas anrvalue (if in adereferenceable state).*a
a->m
Can be incremented (if in adereferenceable state).
The result is either alsodereferenceable or apast-the-end iterator.
The previous iterator value is not required to bedereferenceable after the increase.
++a
(void)a++
*a++
Itsvalue type does not need to be assignablet = unot required
Lvalues areswappable.swap(a,b)

WhereX is aninput iterator type,a andb are objects of this iterator type, andt andu are objects of the type pointed by the iterator type.

Algorithms requiringinput iterators should besingle-pass input algorithms: algorithms pass through an iterator position once at most.

See also

output_iterator_tag
Output iterator category(class)
forward_iterator_tag
Forward iterator category(class)
bidirectional_iterator_tag
Bidirectional iterator category(class)
random_access_iterator_tag
Random-access iterator category(class)
iterator
Iterator base class(class template)
Home page |Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved -v3.3.4s
Spotted an error? contact us

[8]ページ先頭

©2009-2026 Movatter.jp