]> git.saurik.com Git - wxWidgets.git/commitdiff
declared private wxString::operator=(int) to prevent code like "str = 17;" from compiling
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 24 Aug 2001 14:37:30 +0000 (14:37 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 24 Aug 2001 14:37:30 +0000 (14:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/string.h

index 7bb5e7db412a17f3bd12a011df89557081010fe1..5907c0600de62fc026a421e2a619e826abf8e1b0 100644 (file)
@@ -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