Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 1.21 KB

op_greater_equal.md

File metadata and controls

65 lines (48 loc) · 1.21 KB

operator>=

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

概要

xy より大きいか等しいかの判定を行う。

引数

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

戻り値

xy より大きいか等しい場合に true, そうでない場合に false

計算量

size() に対して線形時間。

#include <iostream>
#include <set>

int main()
{
  std::multiset<int> s1, s2;
  s1.insert(10);
  s1.insert(20);
  s1.insert(30);
  s2 = s1;

  std::cout << (s1 >= s2) << std::endl;

  s2.insert(40);

  std::cout << (s1 >= s2) << std::endl;
}
  • =[color ff0000]

  • insert[link insert.md]

出力

1
0

参照