私は古いc++コードを持っており、コンパイルしてc ++ builder 5にコンパイルしています。しかし今、このコードをc ++ builder 2009に更新/移行する必要があります。したがって、いくつかの問題があります。
int __fastcall TAllConversor::ListToStr(
const TStringList* pList,
AnsiString& strValue,
const long lngLimiteInferior,
const long lngLimiteSuperior) const
{
long lngIndice;
AnsiString strAux;
try
{
if (lngLimiteSuperior == 0)
lngIndice = pList->Count;
else
lngIndice = lngLimiteSuperior + lngLimiteInferior;
for (int i = lngLimiteInferior; i < lngIndice; i++)
{
strAux += pList->Strings[i] + ";";
}
strValue = strAux;
return 1;
}
catch(...)
{
return 0;
}
}
行"lngIndice=pList->Count;"で このエラーが発生します:「E2522非const関数_fastcall TStrings :: GetCount()がconstオブジェクトに対して呼び出されました」。
では、どうすればそれを解決(回避)できますか?