CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: const String [] operator
Two possible solutions:
1) Cast to non-const String& the 'old' argument:
if(const_cast<String&>(old)[2] < 'a')
.......
2) Extend the AnsiString interface by adding a const operator[] (in
dstring.h):
this is the existing method:
char& __fastcall operator[](const int idx) {return Data[idx-1];}
this is the additional method:
char __fastcall operator[](const int idx) const {return Data[idx-1];}
the latter is a read-only version of the former
W Komornicki's Home Page |
Main Index |
Thread Index