Browse Source

parser-inc: add missing template args to std containers

rdb 5 years ago
parent
commit
43961718fa
4 changed files with 36 additions and 25 deletions
  1. 15 11
      dtool/src/parser-inc/map
  2. 2 0
      dtool/src/parser-inc/ostream
  3. 9 8
      dtool/src/parser-inc/string
  4. 10 6
      dtool/src/parser-inc/vector

+ 15 - 11
dtool/src/parser-inc/map

@@ -24,19 +24,23 @@
 #include <stdcompare.h>
 #include <pair>
 
-template<class key, class element, class compare = less<key> >
+namespace std {
+  template<class T> class allocator;
+}
+
+template<class Key, class Element, class Compare = less<Key>, class Allocator = std::allocator<pair<const Key, T> > >
 class map {
 public:
-  typedef key key_type;
-  typedef element data_type;
-  typedef element mapped_type;
-  typedef pair<const key, element> value_type;
-  typedef compare key_compare;
-
-  typedef element *pointer;
-  typedef const element *const_pointer;
-  typedef element &reference;
-  typedef const element &const_reference;
+  typedef Key key_type;
+  typedef Element data_type;
+  typedef Element mapped_type;
+  typedef pair<const Key, Element> value_type;
+  typedef Compare key_compare;
+
+  typedef Element *pointer;
+  typedef const Element *const_pointer;
+  typedef Element &reference;
+  typedef const Element &const_reference;
 
   class iterator;
   class const_iterator;

+ 2 - 0
dtool/src/parser-inc/ostream

@@ -1,5 +1,7 @@
 #pragma once
 
+#include <iosfwd>
+
 namespace std {
   template<class CharT, class Traits>
   std::basic_ostream<CharT, Traits> &ends(std::basic_ostream<CharT, Traits> &os);

+ 9 - 8
dtool/src/parser-inc/string

@@ -26,6 +26,7 @@
 
 namespace std {
   template<class charT> struct char_traits;
+  template<class T> class allocator;
 
   template<> struct char_traits<char> {
     using char_type = char;
@@ -51,7 +52,7 @@ namespace std {
     using state_type = mbstate_t;
   };
 
-  template<class ctype>
+  template<class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT> >
   class basic_string {
   public:
     struct iterator;
@@ -63,17 +64,17 @@ namespace std {
     static const size_t npos = -1;
 
     basic_string();
-    basic_string(const basic_string<ctype> &copy);
-    void operator = (const basic_string<ctype> &copy);
-    basic_string(const ctype *string);
+    basic_string(const basic_string<CharT> &copy);
+    void operator = (const basic_string<CharT> &copy);
+    basic_string(const CharT *string);
     ~basic_string();
 
-    const ctype *c_str() const;
+    const CharT *c_str() const;
     size_t length() const;
 
-    ctype at(size_t pos) const;
-    ctype operator[](size_t pos) const;
-    ctype &operator[](size_t pos);
+    CharT at(size_t pos) const;
+    CharT operator[](size_t pos) const;
+    CharT &operator[](size_t pos);
   };
 
   typedef basic_string<char> string;

+ 10 - 6
dtool/src/parser-inc/vector

@@ -22,17 +22,21 @@
 
 #include <stdtypedefs.h>
 
+namespace std {
+  template<class T> class allocator;
+}
+
 inline namespace std {
 
-template<class element>
+template<class T, class Allocator = std::allocator<T> >
 class vector {
 public:
-  typedef element value_type;
+  typedef T value_type;
 
-  typedef element *pointer;
-  typedef const element *const_pointer;
-  typedef element &reference;
-  typedef const element &const_reference;
+  typedef T *pointer;
+  typedef const T *const_pointer;
+  typedef T &reference;
+  typedef const T &const_reference;
 
   typedef pointer iterator;
   typedef const_pointer const_iterator;