• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function template
    <map>

    std::operator>=

    namespace std {
      // operator<=>により、以下の演算子が使用可能になる (C++20)
      template <class Key, class T, class Compare, class Allocator>
      bool
        operator>=(const map<Key,T, Compare,Allocator>& x,
                   const map<Key,T, Compare,Allocator>& y);
    }
    

    概要

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

    引数

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

    戻り値

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

    計算量

    size に対して線形時間。

    #include <iostream>
    #include <map>
    
    int main()
    {
      std::map<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;
    
      m2.insert(std::make_pair('d',40));
    
      std::cout << (m1 >= m2) << std::endl;
    
      return 0;
    }
    

    出力

    1
    0
    

    参照