operator+为什么不能用两个参数
operator+为什么不能用两个参数,但string类的模板实现有
template<class _E, class _Tr, class _A> inline
basic_string<_E, _Tr, _A> __cdecl operator+(
const basic_string<_E, _Tr, _A>& _L,
const basic_string<_E, _Tr, _A>& _R)
{return (basic_string<_E, _Tr, _A>(_L) += _R); }
这里使用了const basic_string<_E, _Tr, _A>& _L
const basic_string<_E, _Tr, _A>& _R
两个参数
可是我在自定义的类里使用两个参数,编译时出现
binary 'operator +' has too many parameters
这是什么原因