- ranges[meta header]
- std::ranges[meta namespace]
- iota_view[meta class]
- class template[meta id-type]
- cpp20[meta cpp]
iota_view
が有限長かつcommon_range
ではない場合の番兵型。
iota_view
の終端要素型の値を1つ記憶していて、比較演算は内部の値同士の比較となる。
このクラスの名前は規定されておらず、振る舞いのみが規定されている。
このクラスの型を取得したい場合、sentinel_t
を使用できる。
なお、iota_view
の番兵型は、無限長のときはunreachable_sentinel_t
、有限長でcommon_range
のときはiterator
である。
namespace std::ranges {
template<weakly_incrementable W, semiregular Bound>
requires weakly-equality-comparable-with<W, Bound>
struct iota_view<W, Bound>::sentinel {
private:
Bound bound_ = Bound();
public:
sentinel() = default;
constexpr explicit sentinel(Bound bound): bound_{bound} {
}
friend constexpr bool operator==(const iterator& x, const sentinel& y) {
return x.value_ == y.bound_;
}
friend constexpr iter_difference_t<W> operator-(const iterator& x, const sentinel& y) requires sized_sentinel_for<Bound, W> {
return x.value_ - y.bound_;
}
friend constexpr iter_difference_t<W> operator-(const sentinel& x, const iterator& y) requires sized_sentinel_for<Bound, W> {
return -(y - x);
}
};
}
- iterator[link iterator.md]
- iota_view[link ../iota_view.md]
- weakly_incrementable[link /reference/iterator/weakly_incrementable.md]
- sized_sentinel_for[link /reference/iterator/sized_sentinel_for.md]
- iter_difference_t[link /reference/iterator/iter_difference_t.md]
- semiregular[link /reference/concepts/semiregular.md]
- weakly-equality-comparable-with[link /reference/concepts/equality_comparable.md]
- C++20
- Clang: 13.0.0 [mark verified]
- GCC: 10.1.0 [mark verified]
- ICC: ?
- Visual C++: 2019 Update 10 [mark verified]