Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# const_iterator | ||
* iterator[meta header] | ||
* std[meta namespace] | ||
* type-alias[meta id-type] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
namespace std { | ||
template<input_iterator I> | ||
using const_iterator = /*see below*?; | ||
} | ||
``` | ||
* input_iterator[link input_iterator.md] | ||
## 概要 | ||
任意のイテレータ型`I`を、定数イテレータ型へ変換する。 | ||
## 効果 | ||
- `I`が[`constant-iterator`]のモデルとなる場合 : `I` | ||
- それ以外の場合 : [`basic_const_iterator`](basic_const_iterator.md)`<I>` | ||
## 例 | ||
```cpp example | ||
#include <iterator> | ||
int main() { | ||
static_assert(std::same_as<std::const_iterator<int*>, std::basic_const_iterator<int*>>); | ||
static_assert(std::same_as<std::const_iterator<const int*>, const int*>); | ||
using vec_iter = std::vector<int>::iterator; | ||
static_assert(std::same_as<std::const_iterator<vec_iter>, std::basic_const_iterator<vec_iter>>); | ||
static_assert(std::same_as<std::const_iterator<std::const_iterator<vec_iter>>, std::const_iterator<vec_iter>>); | ||
} | ||
``` | ||
* std::const_iterator[color ff0000] | ||
|
||
### 出力 | ||
``` | ||
``` | ||
|
||
## バージョン | ||
### 言語 | ||
- C++23 | ||
|
||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): 13.1 | ||
- [Visual C++](/implementation.md#visual_cpp): 2022 Update 6 | ||
|
||
## 参照 | ||
|
||
- [P2278R4 `cbegin` should always return a constant iterator](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2278r4.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# constant-iterator | ||
* iterator[meta header] | ||
* std[meta namespace] | ||
* concept[meta id-type] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
namespace std { | ||
template<class It> | ||
concept constant-iterator = | ||
input_iterator<It> && same_as<iter_const_reference_t<It>, iter_reference_t<It>>; | ||
} | ||
``` | ||
* input_or_output_iterator[link /reference/iterator/input_or_output_iterator.md] | ||
* same_as[link /reference/concepts/same_as.md] | ||
* iter_const_reference_t[link /reference/iterator/iter_const_reference_t.md] | ||
* iter_reference_t[link /reference/iterator/iter_reference_t.md] | ||
## 概要 | ||
`constant-iterator`はイテレータ型`It`が定数イテレータであることを表す説明専用のコンセプトである。定数イテレータは、間接参照を通してその要素を変更することができない。 | ||
## バージョン | ||
### 言語 | ||
- C++23 | ||
## 参照 | ||
- [P2278R4 `cbegin` should always return a constant iterator](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2278r4.html) |