JSON Spirit has a convenient operator==
template< class Config >
bool Value_impl< Config >::operator==( const Value_impl& lhs ) const
{
if( this == &lhs ) return true;
if( type() != lhs.type() ) return false;
return v_ == lhs.v_;
}
The variable lhs
looks like the familiar "left hand side" from many other examples, implying to me that this will not work as expected if for what this operator is assigned is not on the left hand side.
Is that correct? If so, why?
In either case, please quote the standard.
b = x == y;
translates tob = x.operator==( y );
so anoperator==()
must be defined forx
which takes an argument of whatever typey
is.