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
5 changed files
with
289 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# cbegin | ||
* span[meta header] | ||
* std[meta namespace] | ||
* span[meta class] | ||
* function[meta id-type] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
constexpr const_iterator cbegin() const noexcept; | ||
``` | ||
* const_iterator[link /reference/iterator/const_iterator.md.nolink] | ||
|
||
## 概要 | ||
先頭要素を指す読み取り専用イテレータを取得する。 | ||
|
||
|
||
## 戻り値 | ||
|
||
```cpp | ||
return begin(); | ||
``` | ||
* begin[link ./begin.md] | ||
|
||
|
||
## 例外 | ||
投げない | ||
|
||
## 例 | ||
```cpp example | ||
#include <iostream> | ||
#include <span> | ||
#include <vector> | ||
|
||
int main() { | ||
std::vector<int> v = {1, 2, 3, 4, 5}; | ||
std::span<int, 5> sp{v}; | ||
|
||
auto cit = sp.cbegin(); | ||
|
||
std::cout << *cit << '\n'; | ||
|
||
// これはできない | ||
// *cit = 0; | ||
} | ||
``` | ||
* cbegin()[color ff0000] | ||
|
||
### 出力 | ||
``` | ||
1 | ||
``` | ||
|
||
## バージョン | ||
### 言語 | ||
- 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,77 @@ | ||
# cend | ||
* span[meta header] | ||
* std[meta namespace] | ||
* span[meta class] | ||
* function[meta id-type] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
constexpr const_iterator cend() const noexcept; | ||
``` | ||
* const_iterator[link /reference/iterator/const_iterator.md.nolink] | ||
|
||
## 概要 | ||
末尾要素の次を指すイテレータを取得する。 | ||
|
||
|
||
## 戻り値 | ||
|
||
```cpp | ||
return end(); | ||
``` | ||
* end[link ./end.md] | ||
|
||
|
||
## 例外 | ||
投げない | ||
|
||
## 例 | ||
```cpp example | ||
#include <iostream> | ||
#include <span> | ||
#include <vector> | ||
|
||
template<typename I, std::sentinel_for<I> S> | ||
bool is_iter_pair(I, S) { | ||
return true; | ||
} | ||
|
||
bool is_iter_pair(...) { | ||
return false; | ||
} | ||
|
||
int main() { | ||
std::vector<int> v = {1, 2, 3, 4, 5}; | ||
std::span<int, 5> sp{v}; | ||
|
||
auto cit = sp.cend(); | ||
--cit; | ||
|
||
std::cout << *cit << '\n'; | ||
|
||
std::cout << std::boolalpha; | ||
std::cout << is_iter_pair(sp.cbegin(), sp.cend()) << '\n'; | ||
std::cout << is_iter_pair(sp.begin(), sp.cend()) << '\n'; | ||
} | ||
``` | ||
* cend()[color ff0000] | ||
* sentinel_for[link /reference/iterator/sentinel_for.md] | ||
### 出力 | ||
``` | ||
5 | ||
true | ||
true | ||
``` | ||
## バージョン | ||
### 言語 | ||
- 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,63 @@ | ||
# crbegin | ||
* span[meta header] | ||
* std[meta namespace] | ||
* span[meta class] | ||
* function[meta id-type] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
constexpr const_reverse_iterator crbegin() const noexcept; | ||
``` | ||
* const_iterator[link /reference/iterator/const_iterator.md.nolink] | ||
|
||
## 概要 | ||
末尾要素の次を指すイテレータを取得する。 | ||
|
||
|
||
## 戻り値 | ||
|
||
```cpp | ||
return rbegin(); | ||
``` | ||
* rbegin[link ./rbegin.md] | ||
|
||
|
||
## 例外 | ||
投げない | ||
|
||
## 例 | ||
```cpp example | ||
#include <iostream> | ||
#include <span> | ||
#include <vector> | ||
|
||
int main() { | ||
std::vector<int> v = {1, 2, 3, 4, 5}; | ||
std::span<int, 5> sp{v}; | ||
|
||
auto cit = sp.crbegin(); | ||
|
||
std::cout << *cit << '\n'; | ||
|
||
// これはできない | ||
// *cit = 0; | ||
} | ||
``` | ||
* crbegin()[color ff0000] | ||
|
||
### 出力 | ||
``` | ||
5 | ||
``` | ||
|
||
## バージョン | ||
### 言語 | ||
- 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,77 @@ | ||
# crend | ||
* span[meta header] | ||
* std[meta namespace] | ||
* span[meta class] | ||
* function[meta id-type] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
constexpr const_reverse_iterator crend() const noexcept; | ||
``` | ||
* const_iterator[link /reference/iterator/const_iterator.md.nolink] | ||
|
||
## 概要 | ||
末尾要素の次を指すイテレータを取得する。 | ||
|
||
|
||
## 戻り値 | ||
|
||
```cpp | ||
return rend(); | ||
``` | ||
* rend[link ./rend.md] | ||
|
||
|
||
## 例外 | ||
投げない | ||
|
||
## 例 | ||
```cpp example | ||
#include <iostream> | ||
#include <span> | ||
#include <vector> | ||
|
||
template<typename I, std::sentinel_for<I> S> | ||
bool is_iter_pair(I, S) { | ||
return true; | ||
} | ||
|
||
bool is_iter_pair(...) { | ||
return false; | ||
} | ||
|
||
int main() { | ||
std::vector<int> v = {1, 2, 3, 4, 5}; | ||
std::span<int, 5> sp{v}; | ||
|
||
auto cit = sp.crend(); | ||
--cit; | ||
|
||
std::cout << *cit << '\n'; | ||
|
||
std::cout << std::boolalpha; | ||
std::cout << is_iter_pair(sp.crbegin(), sp.crend()) << '\n'; | ||
std::cout << is_iter_pair(sp.rbegin(), sp.crend()) << '\n'; | ||
} | ||
``` | ||
* crend()[color ff0000] | ||
* sentinel_for[link /reference/iterator/sentinel_for.md] | ||
### 出力 | ||
``` | ||
1 | ||
true | ||
true | ||
``` | ||
## バージョン | ||
### 言語 | ||
- 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) |