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

履歴 編集

function template
<tuple>

std::operator>(C++11)

namespace std {
  // operator<=>により、以下の演算子が使用可能になる (C++20)
  template<class... TTypes, class... UTypes>
  bool operator>(const tuple<TTypes...>& t,
                 const tuple<UTypes...>& u);           // (1) C++11

  template<class... TTypes, class... UTypes>
  constexpr bool operator>(const tuple<TTypes...>& t,
                           const tuple<UTypes...>& u); // (1) C++14
}

概要

2つのtupleにおいて、左辺が右辺より大きいかの比較を行う。

要件

2つのtupleの要素数が同じであること。

戻り値

u < t

#include <iostream>
#include <tuple>
#include <string>

int main()
{
  std::tuple<int, char, std::string> t1(1, 'a', "hello");
  std::tuple<int, char, std::string> t2(2, 'b', "world");

  std::cout << std::boolalpha;
  {
    bool result = t1 > t2;
    std::cout << result << std::endl;
  }
  {
    bool result = t2 > t1;
    std::cout << result << std::endl;
  }
}

出力

false
true

バージョン

言語

  • C++11

処理系

関連項目

参照