operator==,!=,<,<=,>,>=(std::array)
提供: cppreference.com
(1) | ||
template< class T, std::size_t N > bool operator==( const std::array<T, N>& lhs, |
(C++20未満) | |
template< class T, std::size_t N > constexpr bool operator==( const std::array<T, N>& lhs, |
(C++20以上) | |
(2) | ||
template< class T, std::size_t N > bool operator!=( const std::array<T, N>& lhs, |
(C++20未満) | |
template< class T, std::size_t N > constexpr bool operator!=( const std::array<T, N>& lhs, |
(C++20以上) | |
(3) | ||
template< class T, std::size_t N > bool operator<( const std::array<T, N>& lhs, |
(C++20未満) | |
template< class T, std::size_t N > constexpr bool operator<( const std::array<T, N>& lhs, |
(C++20以上) | |
(4) | ||
template< class T, std::size_t N > bool operator<=( const std::array<T, N>& lhs, |
(C++20未満) | |
template< class T, std::size_t N > constexpr bool operator<=( const std::array<T, N>& lhs, |
(C++20以上) | |
(5) | ||
template< class T, std::size_t N > bool operator>( const std::array<T, N>& lhs, |
(C++20未満) | |
template< class T, std::size_t N > constexpr bool operator>( const std::array<T, N>& lhs, |
(C++20以上) | |
(6) | ||
template< class T, std::size_t N > bool operator>=( const std::array<T, N>& lhs, |
(C++20未満) | |
template< class T, std::size_t N > constexpr bool operator>=( const std::array<T, N>& lhs, |
(C++20以上) | |
2つの配列の内容を比較します。
1-2)
lhs
と rhs
の内容が等しいかどうか調べます。 つまり、 lhs
内のそれぞれの要素が rhs
内の同じ位置の要素と等しいかどうか比較します。[編集] 引数
lhs, rhs | - | 内容を比較するコンテナ |
型の要件 | ||
-オーバロード (1-2) を使用するためには T は EqualityComparable の要件を満たさなければなりません。
| ||
-オーバロード (3-6) を使用するためには T は LessThanComparable の要件を満たさなければなりません。 順序関係は全順序を確立しなければなりません。
|
[編集] 戻り値
1) コンテナの内容が等しい場合は true、そうでなければ false。
2) コンテナの内容が等しくない場合は true、そうでなければ false。
3)
lhs
の内容が rhs
の内容より辞書的に小さい場合は true、そうでなければ false。4)
lhs
の内容が rhs
の内容より辞書的に小さいまたは等しい場合は true、そうでなければ false。5)
lhs
の内容が rhs
の内容より辞書的に大きい場合は true、そうでなければ false。6)
lhs
の内容が rhs
の内容より辞書的に大きいまたは等しい場合は true、そうでなければ false。[編集] 計算量
コンテナのサイズに比例。