New wonder:
I have the following free operator:
Code:
CTmplStringBaseTemplate CTmplStringBaseTmpl& operator +=
(CTmplStringBaseTmpl& rlhs, const CTmplStringBaseTmpl& rrhs);
But if I try to call it through the code:
Code:
Strings::CStringExW test( L"test" );
test += L"This is a test";
I simply get an error:
Code:
error C2784: 'Strings::CTmplStringBase<T,Strings::StrTraits<T>> &Strings::operator +=
(Strings::CTmplStringBase<T,Strings::StrTraits<T>> &,
const Strings::CTmplStringBase<T,Strings::StrTraits<T>> &)' :
could not deduce template argument for
'const Strings::CTmplStringBase<T,Strings::StrTraits<T>> &'
from
'const wchar_t [15]'
I even tried changing the function to:
Code:
template<typename T> CTmplStringBase<T, StrTraits<T>>& operator +=
(CTmplStringBase<T, StrTraits<T>>& rlhs,
const CTmplStringBase<T, StrTraits<T>>& rrhs/*const T* strData*/);
Yet still refuses to work. But technically, it should, because the class has constructors (not-explicit) for the types:
Code:
CTmplStringBase();
CTmplStringBase(const CTmplStringBase& rSrc);
#ifdef _MFC_VER
CTmplStringBase(const CStringT< T, StrTraitMFC_DLL<T> >& strSrc);
#endif
CTmplStringBase(const T* strData);
CTmplStringBase(const T cData);
CTmplStringBase(uint64_t nData);
CTmplStringBase(int64_t nData);
CTmplStringBase(long nData);
So shouldn't it be able to create a temp object for the wchar_t* (using CTmplStringBase<wchar_t>) and then pass via a const reference?
I must be doing something wrong here...