parser-inc: add missing template args to std containers

This commit is contained in:
rdb 2020-06-14 12:11:42 +02:00
parent 97e6a314b1
commit 43961718fa
4 changed files with 35 additions and 24 deletions

View File

@ -24,19 +24,23 @@
#include <stdcompare.h> #include <stdcompare.h>
#include <pair> #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 { class map {
public: public:
typedef key key_type; typedef Key key_type;
typedef element data_type; typedef Element data_type;
typedef element mapped_type; typedef Element mapped_type;
typedef pair<const key, element> value_type; typedef pair<const Key, Element> value_type;
typedef compare key_compare; typedef Compare key_compare;
typedef element *pointer; typedef Element *pointer;
typedef const element *const_pointer; typedef const Element *const_pointer;
typedef element &reference; typedef Element &reference;
typedef const element &const_reference; typedef const Element &const_reference;
class iterator; class iterator;
class const_iterator; class const_iterator;

View File

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

View File

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

View File

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