X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d836ee960a711635c706e26f5503137f9295e4fb..bd73ba41f93a040ecf9c18040d7f788992d0a6ec:/include/wx/string.h diff --git a/include/wx/string.h b/include/wx/string.h index 7bb5e7db41..c7c6893e30 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -287,14 +287,20 @@ private: void CopyBeforeWrite(); void AllocBeforeWrite(size_t); - // this method is not implemented - there is _no_ conversion from int to + // if we hadn't made these operators private, it would be possible to + // compile "wxString s; s = 17;" without any warnings as 17 is implicitly + // converted to char in C and we do have operator=(char) + // + // NB: we don't need other versions (short/long and unsigned) as attempt + // to assign another numeric type to wxString will now result in + // ambiguity between operator=(char) and operator=(int) + wxString& operator=(int); + + // these methods are not implemented - there is _no_ conversion from int to // string, you're doing something wrong if the compiler wants to call it! // // try `s << i' or `s.Printf("%d", i)' instead wxString(int); - wxString(unsigned int); - wxString(long); - wxString(unsigned long); public: // constructors and destructor @@ -623,7 +629,7 @@ public: wxString operator()(size_t start, size_t len) const { return Mid(start, len); } - // check that the tring starts with prefix and return the rest of the + // check that the string starts with prefix and return the rest of the // string in the provided pointer if it is not NULL, otherwise return // FALSE bool StartsWith(const wxChar *prefix, wxString *rest = NULL) const; @@ -632,7 +638,7 @@ public: wxString Left(size_t nCount) const; // get last nCount characters wxString Right(size_t nCount) const; - // get all characters before the first occurence of ch + // get all characters before the first occurance of ch // (returns the whole string if ch not found) wxString BeforeFirst(wxChar ch) const; // get all characters before the last occurence of ch