operator== (<memory>)
Tests for equality between objects.
template<class Type, class Other>
bool operator==(
const allocator<Type>& _Left,
const allocator<Other>& _Right
) throw();
template<class Ty1, class Del1, class Ty2, class Del2>
bool operator==(
const unique_ptr<Ty1, Del1>& _Left,
const unique_ptr<Ty2, Del2>& _Right
);
Parameters
_Left
One of the objects to be tested for equality._Right
One of the objects to be tested for equality.
Return Value
true if the objects are equa, false if objects are not equal.
Remarks
The first template operator returns true. (All default allocators are equal.) The second and third template operators return _Left.get() == _Right.get().
Example
// memory_op_eq.cpp
// compile with: /EHsc
#include <memory>
#include <iostream>
#include <vector>
using namespace std;
int main( )
{
allocator<char> Alloc;
vector <int>:: allocator_type v1Alloc;
allocator<char> cAlloc(Alloc);
allocator<int> cv1Alloc(v1Alloc);
if ( cv1Alloc == v1Alloc )
cout << "The allocator objects cv1Alloc & v1Alloc are equal."
<< endl;
else
cout << "The allocator objects cv1Alloc & v1Alloc are not equal."
<< endl;
if ( cAlloc == Alloc )
cout << "The allocator objects cAlloc & Alloc are equal."
<< endl;
else
cout << "The allocator objects cAlloc & Alloc are not equal."
<< endl;
}
The allocator objects cv1Alloc & v1Alloc are equal.
The allocator objects cAlloc & Alloc are equal.
Requirements
Header: <memory>
Namespace: std