operator<,<=,>,>=(std::basic_const_iterator<Iter>)
From cppreference.com
< cpp | iterator | basic const iterator
| template< /*not-a-const-iterator*/ I > friend constexpr bool operator<( const I& x, const basic_const_iterator& y ) |
(1) | (C++23から) |
| template< /*not-a-const-iterator*/ I > friend constexpr bool operator>( const I& x, const basic_const_iterator& y ) |
(2) | (C++23から) |
| template< /*not-a-const-iterator*/ I > friend constexpr bool operator<=( const I& x, const basic_const_iterator& y ) |
(3) | (C++23から) |
| template< /*not-a-const-iterator*/ I > friend constexpr bool operator>=( const I& x, const basic_const_iterator& y ) |
(4) | (C++23から) |
basic_const_iterator と別の値を比較します。左オペランドが basic_const_iterator でない場合に使用される関数テンプレートです。
I は、basic_const_iterator の特殊化ではない場合にのみ、exposition-only コンセプト /*not-a-const-iterator*/ を満たします。
これらの関数は、通常の 非修飾 または 修飾ルックアップ からは可視でなく、basic_const_iterator<Iter> が引数に関連付けられたクラスである場合にのみ、引数依存名前探索 によって見つけることができます。
目次 |
[編集] パラメータ
| x, y | - | 比較するイテレータ |
[編集] 戻り値
1) x < y.base()
2) x > y.base()
3) x <= y.base()
4) x >= y.base()
[編集] 注釈
左オペランドが basic_const_iterator である場合、メンバー比較関数が使用されます。
[編集] 例
このコードを実行
#include <iterator> int main() { static int arr[1]; static constexpr std::basic_const_iterator<int*> it = std::end(arr); static_assert(arr < it); }
[編集] 関連項目
| |||