Fix ambiguous overload resolution

One operator+ for CBotString is enough
dev-time-step
Piotr Dziwinski 2015-11-02 22:17:53 +00:00
parent eeea31408b
commit 13f0159705
5 changed files with 2 additions and 13 deletions

View File

@ -397,7 +397,6 @@ public:
const CBotString& operator=(const CBotString& stringSrc);
const CBotString& operator=(const char ch);
const CBotString& operator=(const char* pString);
friend CBotString operator+(const CBotString& string, const char* lpsz);
CBotString operator+(const CBotString& str);
const CBotString& operator+=(const char ch);

View File

@ -216,7 +216,7 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
if ( IsOfType(p, ID_NOT) )
{
CBotToken d("~" + p->GetString());
CBotToken d(CBotString("~") + p->GetString());
func->m_token = d;
}

View File

@ -337,13 +337,6 @@ const CBotString& CBotString::operator=(const CBotString& stringSrc)
return *this;
}
CBotString operator+(const CBotString& string, const char * lpsz)
{
CBotString s(string);
s += lpsz;
return s;
}
CBotString CBotString::operator+(const CBotString& stringSrc)
{
CBotString s(*this);

View File

@ -1703,7 +1703,7 @@ void CBotVarClass::DecrementUse()
pThis->SetPointer(this);
CBotVar* pResult = nullptr;
CBotString nom = "~" + m_pClass->GetName();
CBotString nom = CBotString("~") + m_pClass->GetName();
long ident = 0;
while ( pile->IsOk() && !m_pClass->ExecuteMethode(ident, nom, pThis, ppVars, pResult, pile, nullptr)) ; // waits for the end

View File

@ -277,9 +277,6 @@ TEST(CBotString_Test, operatorAdd)
botStr1 = botStr1 + botStr3;
EXPECT_STREQ(botStr1.CStr(), botStr4.CStr());
botStr1 = "C" + botStr3;
EXPECT_STREQ(botStr1.CStr(), botStr4.CStr());
botStr1.Empty();
botStr1 = botStr2 + cStr1;
EXPECT_STREQ(botStr1.CStr(), botStr4.CStr());