constexpr auto size() const
requires (same_as<W, Bound> && advanceable<W>) || (integral<W> && integral<Bound>) || sized_sentinel_for<Bound, W>;
概要
iota_view
の大きさを取得する。
この関数は、iota_view
がsized_range
のときのみオーバーロード解決に参加する。
効果
if constexpr (is-integer-like<W> && is-integer-like<Bound>)
return (value_ < 0)
? ((bound_ < 0)
? to-unsigned-like(-value_) - to-unsigned-like(-bound_)
: to-unsigned-like(bound_) + to-unsigned-like(-value_))
: to-unsigned-like(bound_) - to-unsigned-like(value_);
else
return to-unsigned-like(bound_ - value_);
to-unsigned-like
は、処理系定義の型(例えば128ビット整数など)も含めて、符号なし整数へ変換する説明専用の関数。
例
出力
バージョン
言語
- C++20
処理系
- Clang: 13.0.0 ✅
- GCC: 10.1.0 ✅
- ICC: ?
- Visual C++: 2019 Update 10 ✅