Skip to content

Latest commit

 

History

History
58 lines (47 loc) · 1017 Bytes

File metadata and controls

58 lines (47 loc) · 1017 Bytes

operator!=

  • string_view[meta header]
  • std[meta namespace]
  • function template[meta id-type]
  • cpp17[meta cpp]
namespace std {
  template <class CharT, class Traits>
  constexpr bool operator!=(basic_string_view<CharT, Traits> x,
                            basic_string_view<CharT, Traits> y) noexcept;
}

概要

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

戻り値

return x.compare(y) != 0;
  • compare[link compare.md]

#include <iostream>
#include <string_view>

int main()
{
  std::string_view a = "aaa";
  std::string_view b = "bbb";

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

出力例

not equal

バージョン

言語

  • C++17

処理系