• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function template
    <map>

    std::operator==

    namespace std {
      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++03
    }
    

    概要

    xy と等しいかどうかの判定を行う。

    戻り値

    計算量

    size() に対して線形時間。ただし、xyのサイズが異なる場合は定数時間。

    備考

    • この演算子により、以下の演算子が使用可能になる (C++20):
      • operator!=

    #include <iostream>
    #include <map>
    
    int main()
    {
      std::multimap<int, char> m1;
      m1.insert(std::make_pair(0, 'a'));
    
      auto m2 = m1;
    
      std::cout << (m1 == m2) << std::endl;
    
      m2.insert(std::make_pair(0, 'b'));
    
      std::cout << (m1 == m2) << std::endl;
    
      return 0;
    }
    

    出力

    1
    0
    

    処理系

    参照