operator== <memory>
shared_ptr equal comparison.
template<class Ty1, class Ty2>
bool operator==(const shared_ptr<Ty1>& left;,
const shared_ptr<Ty2>& right);
Parámetros
Ty1
The type controlled by the left shared pointer.Ty2
The type controlled by the right shared pointer.left
The left shared pointer.right
The right shared pointer.
Comentarios
The template operator returns left.get() == right.get().
Ejemplo
// std_tr1__memory__operator_eq.cpp
// compile with: /EHsc
#include <memory>
#include <iostream>
int main()
{
std::shared_ptr<int> sp0(new int(0));
std::shared_ptr<int> sp1(new int(0));
std::cout << "sp0 == sp0 == " << std::boolalpha
<< (sp0 == sp0) << std::endl;
std::cout << "sp0 == sp1 == " << std::boolalpha
<< (sp0 == sp1) << std::endl;
return (0);
}
sp0 == sp0 == true
sp0 == sp1 == false
Requisitos
Header: <memory>
Namespace: std