if I look into < complex> header from msvc 2008, I find that each operator definition is doubled with _Other type template operation, like for example
_Myt& operator+=(const _Myt& _Right)
{ // add other complex
this->_Add(_Right);
return (*this);
}
template<class _Other> inline
_Myt& operator+=(const complex<_Other>& _Right)
{ // add other complex
this->_Add(_Right);
return (*this);
}
The question is why would not the second definition alone suffice?
PS:
It seems in gcc there is only second definition present, now I do not worry any more. 🙂
The first case also catches a right-hand-side that’s convertible to
_Myt.