Difference between revisions of "cpp/named req/ConstexprIterator"
From cppreference.com
(Replaced content with "Nuck figgers") |
m (+ added link to std::optional (c++26)) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{cpp/named req/title|ConstexprIterator|notes={{mark since c++20}}}} | |
+ | {{cpp/named req/navbar}} | ||
+ | |||
+ | A {{named req|ConstexprIterator}} is a {{named req|Iterator}} that can be used during constant expression evaluation. | ||
+ | |||
+ | ===Requirements=== | ||
+ | The type {{c|It}} satisfies {{named req/core|ConstexprIterator}} if | ||
+ | |||
+ | * The type {{c|It}} satisfies some iterator requirements {{named req/core|MeowIterator}} | ||
+ | |||
+ | And, for every | ||
+ | * {{c|purr}}, an operation on {{c|It}} that is required to be supported by {{named req/core|MeowIterator}}, | ||
+ | * {{c|kittens...}}, a set of arguments to {{c|purr}} that meets the requirements for that operation, | ||
+ | |||
+ | Then | ||
+ | |||
+ | * {{c|purr(kittens...)}} may be used in a constant expression if {{c|kittens...}} can also be used. | ||
+ | |||
+ | ===Standard library=== | ||
+ | The following standard library types are {{named req|ConstexprIterator}}s. | ||
+ | |||
+ | * {{ltt|cpp/container/array|array::iterator}} and {{ltt|cpp/container/array|array::const_iterator}}. | ||
+ | * {{ltt|cpp/string/basic_string_view|basic_string_view::iterator}}. | ||
+ | * {{ltt|cpp/container/span|span::iterator}}. | ||
+ | * {{ltt|cpp/container/vector|vector::iterator}} and {{ltt|cpp/container/vector|vector::const_iterator}}. | ||
+ | {{rrev|since=c++26| | ||
+ | * {{ltt|cpp/utility/optional|optional::iterator}} and {{ltt|cpp/utility/optional|optional::const_iterator}} | ||
+ | }} | ||
+ | |||
+ | ===See also=== | ||
+ | {{dsc begin}} | ||
+ | {{see_also_iterator_library}} | ||
+ | {{dsc end}} | ||
+ | |||
+ | {{langlinks|es|ja|ru|zh}} |
Latest revision as of 16:08, 25 August 2024
A ConstexprIterator is a LegacyIterator that can be used during constant expression evaluation.
[edit] Requirements
The type It satisfies ConstexprIterator if
- The type It satisfies some iterator requirements MeowIterator
And, for every
- purr, an operation on It that is required to be supported by MeowIterator,
- kittens..., a set of arguments to purr that meets the requirements for that operation,
Then
- purr(kittens...) may be used in a constant expression if kittens... can also be used.
[edit] Standard library
The following standard library types are ConstexprIterators.
- array::iterator and array::const_iterator.
- basic_string_view::iterator.
- span::iterator.
- vector::iterator and vector::const_iterator.
(since C++26) |
[edit] See also
Iterator library | provides definitions for iterators, iterator traits, adaptors, and utility functions |