namespace std { template <class T, class Allocator> bool operator!=(const forward_list<T, Allocator>& x, const forward_list<T, Allocator>& y); }
概要
forward_list
オブジェクトの非等値比較を行う。
要件
型T
がoperator==
で比較可能であること。
戻り値
!(x == y)
計算量
線形時間
例
#include <iostream> #include <forward_list> int main () { std::forward_list<int> ls1 = {1, 2, 3}; std::forward_list<int> ls2 = {1, 2, 3}; std::forward_list<int> ls3 = {1, 2, 3, 4}; std::cout << std::boolalpha; // 要素数と要素の値が等しい std::cout << (ls1 != ls2) << std::endl; // 要素の値は(左辺の要素数分まで)等しいが要素数が異なる std::cout << (ls1 != ls3) << std::endl; }
出力
false
true
バージョン
言語
- C++11
処理系
- Clang: ??
- GCC:
- GCC, C++11 mode: 4.7.0
- ICC: ??
- Visual C++: 2010, 2012, 2013, 2015, 2017