- span[meta header]
- std[meta namespace]
- span[meta class]
- function[meta id-type]
- cpp23[meta cpp]
constexpr const_reverse_iterator crend() const noexcept;先頭の前を指す読み取り専用逆イテレータを取得する。
return rend();- rend[link ./rend.md]
投げない
#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]
1
true
true
- C++23
- Clang: ??
- GCC: 13.1 [mark verified]
- Visual C++: 2022 Update 6 [mark verified]