= Operator should check for self-assignment

This commit is contained in:
Moshe Kaplan
2014-07-03 09:33:25 -04:00
parent 63f1eea7ca
commit c0b790cb1f
+4 -2
View File
@@ -46,8 +46,10 @@ pos_map_queue::pos_map_queue( const pos_map_queue &cpy )
pos_map_queue &pos_map_queue::operator=( const pos_map_queue &rhs )
{
delete m_pImpl;
m_pImpl = new pos_map_impl( *rhs.m_pImpl );
if (this != &rhs){
delete m_pImpl;
m_pImpl = new pos_map_impl( *rhs.m_pImpl );
}
return *this;
}