Skip to content

Latest commit

 

History

History
77 lines (57 loc) · 1.78 KB

op_greater.md

File metadata and controls

77 lines (57 loc) · 1.78 KB

operator>

  • map[meta header]
  • std[meta namespace]
  • function template[meta id-type]
namespace std {
  // operator<=>により、以下の演算子が使用可能になる (C++20)
  template <class Key, class T, class Compare, class Allocator>
  bool
    operator>(const multimap<Key,T,Compare,Allocator>& x,
              const multimap<Key,T,Compare,Allocator>& y); // (1) C++98
  template <class Key, class T, class Compare, class Allocator>
  constexpr bool
    operator>(const multimap<Key,T,Compare,Allocator>& x,
              const multimap<Key,T,Compare,Allocator>& y); // (1) C++26
}

概要

x が y より大きいかどうかの判定を行う。

パラメータ

  • x, y
    比較するコンテナ。

戻り値

x が y より大きい場合に true, そうでない場合に false。

計算量

size に対して線形時間。

例

#include <iostream>
#include <map>

int main()
{
  std::multimap<char, int> m1, m2;
  m1.insert(std::make_pair('a', 10));
  m1.insert(std::make_pair('b', 20));
  m1.insert(std::make_pair('c', 30));
  m2 = m1;

  std::cout << (m1 > m2) << std::endl;

  m1.insert(std::make_pair('d', 40));

  std::cout << (m1 > m2) << std::endl;

  return 0;
}
  • insert[link insert.md]

出力

0
1

処理系

参照