Pārlūkot izejas kodu

ENH: Replaced cmStdString implementation to make it more transparently a std:string.

Brad King 24 gadi atpakaļ
vecāks
revīzija
eb6e54c64b
1 mainītis faili ar 17 papildinājumiem un 7 dzēšanām
  1. 17 7
      Source/cmStandardIncludes.h

+ 17 - 7
Source/cmStandardIncludes.h

@@ -136,13 +136,23 @@ inline bool operator==(std::string const& a, const char* b)
 // when combined with a map or set, the symbols can be > 2000 chars!
 struct cmStdString : public std::string
 {
-  typedef std::string Parent;
-  cmStdString(const char* s) : Parent(s)
-    {
-    }
-  cmStdString(std::string const&s) : Parent(s)
-    {
-    }
+  typedef std::string StdString;
+  typedef StdString::value_type             value_type;
+  typedef StdString::pointer                pointer;
+  typedef StdString::reference              reference;
+  typedef StdString::const_reference        const_reference;
+  typedef StdString::size_type              size_type;
+  typedef StdString::difference_type        difference_type;
+  typedef StdString::iterator               iterator;
+  typedef StdString::const_iterator         const_iterator;
+  typedef StdString::reverse_iterator       reverse_iterator;
+  typedef StdString::const_reverse_iterator const_reverse_iterator;
+  
+  cmStdString(): StdString() {}
+  cmStdString(const value_type* s): StdString(s) {}
+  cmStdString(const value_type* s, size_type n): StdString(s, n) {}
+  cmStdString(const StdString& s, size_type pos=0, size_type n=npos):
+    StdString(s, pos, n) {}
 };
   
 #endif