namespace std {
template<class S, class I>
inline constexpr bool disable_sized_sentinel_for = false;
// reverse_iteratorに対する特殊化
template<class Iterator1, class Iterator2>
requires (!sized_sentinel_for<Iterator1, Iterator2>)
inline constexpr bool disable_sized_sentinel_for<reverse_iterator<Iterator1>,
reverse_iterator<Iterator2>> = true;
}
概要
disable_sized_sentinel_forは、任意のイテレータ型Iとその番兵型Sについてsized_sentinel_forを無効化するカスタマイゼーションポイントである。
イテレータ型I, Sがsized_sentinel_forを満たすがそのモデルとならない(意味論的な要件まで満足することができない)ようなイテレータをライブラリで使用するためのopt-outメカニズムとして提供されている。
要件
I, Sがプログラム定義型である場合に、非配列型かつオブジェクト型であるI, Sに対して特殊化が許可される。
そのような特殊化は定数式で使用可能であり、const bool型を持つ必要がある。
例
sized_sentinel_forのサンプルコードを参照。
バージョン
言語
- C++20
処理系
- Clang: ??
- GCC: 10.1 ✅
- Visual C++: 2019 Update 6 ✅