Skip to content

Files

Latest commit

ce7e3b0 · Oct 6, 2022

History

History
56 lines (43 loc) · 1.03 KB

op_equal.md

File metadata and controls

56 lines (43 loc) · 1.03 KB

operator==

  • memory[meta header]
  • std[meta namespace]
  • function template[meta id-type]
namespace std {
  template <class T1, class T2>
  bool operator==(const allocator<T1>&,
                  const allocator<T2>&) throw();           // (1) C++03

  template <class T, class U>
  bool operator==(const allocator<T>&,
                  const allocator<U>&) noexcept;           // (1) C++11

  template <class T, class U>
  constexpr bool operator==(const allocator<T>&,
                            const allocator<U>&) noexcept; // (1) C++20
}

概要

2つのallocatorオブジェクトを等値比較する。

戻り値

true

#include <iostream>
#include <memory>

int main()
{
  std::allocator<int> a;
  std::allocator<int> b;

  if (a == b) {
    std::cout << "equal" << std::endl;
  }
  else {
    std::cout << "not equal" << std::endl;
  }
}

出力例

equal

参照