Skip to content

Latest commit

 

History

History
71 lines (52 loc) · 1.28 KB

File metadata and controls

71 lines (52 loc) · 1.28 KB

operator!=

  • array[meta header]
  • std[meta namespace]
  • function template[meta id-type]
  • cpp11[meta cpp]
namespace std {
  template <class T, size_t N>
  bool operator!=(const array<T, N>& x, const array<T, N>& y);           // C++11

  template <class T, size_t N>
  constexpr bool operator!=(const array<T, N>& x, const array<T, N>& y); // C++20
}

概要

arrayオブジェクトの非等値比較を行う

要件

arrayの要素型Toperator==で比較可能であること。

戻り値

!(x == y)

計算量

線形時間

#include <iostream>
#include <array>

int main()
{
  std::array<int, 3> x = {1, 2, 3};
  std::array<int, 3> y = {1, 2, 3};

  if (x != y) {
    std::cout << "not equal" << std::endl;
  }
  else {
    std::cout << "equal" << std::endl;
  }
}

出力

equal

バージョン

言語

  • C++11

処理系

参照