最終更新日時(UTC):
が更新

履歴 編集

class template
<functional>

std::ranges::not_equal_to(C++20)

namespace std::ranges {
  struct not_equal_to {
    template<class T, class U>
      requires equality_comparable_with<T, U>
    constexpr bool operator()(T&& t, U&& u) const;

    using is_transparent = unspecified;
  };
}

概要

not_equal_toクラスは、非等値比較を行う関数オブジェクトである。

この関数オブジェクトは一切のメンバ変数を持たず、状態を保持しない。

テンプレートパラメータ制約

  • TU== および != で同値比較可能、もしくは declval<T>() == declval<U>() がポインタ同士を比較する組み込みの演算に帰着すること。

メンバ関数

名前 説明
operator () !ranges::equal_to{}(std::forward<T>(t), std::forward<U>(u)); と等価

メンバ型

名前 説明
is_transparent operator() が関数テンプレートである事を示すタグ型。
実装依存の型であるがあくまでタグ型であり、型そのものには意味はない。

#include <iostream>
#include <functional>

int main()
{
  std::cout << std::boolalpha << std::ranges::not_equal_to()(3, 3) << std::endl;
}

出力

false

参照