|
1 | 1 |
|
2 |
| -typedef unsigned long size_t; |
| 2 | +#include "stl.h" |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
3 | 100 |
|
4 |
| -namespace std |
5 |
| -{ |
6 |
| - template<class charT> struct char_traits; |
7 |
| - |
8 |
| - typedef size_t streamsize; |
9 |
| - |
10 |
| - struct ptrdiff_t; |
11 |
| - |
12 |
| - template <class iterator_category, |
13 |
| - class value_type, |
14 |
| - class difference_type = ptrdiff_t, |
15 |
| - class pointer_type = value_type*, |
16 |
| - class reference_type = value_type&> |
17 |
| - struct iterator { |
18 |
| - iterator &operator++(); |
19 |
| - iterator operator++(int); |
20 |
| - bool operator==(iterator other) const; |
21 |
| - bool operator!=(iterator other) const; |
22 |
| - reference_type operator*() const; |
23 |
| - }; |
24 |
| - |
25 |
| - struct input_iterator_tag {}; |
26 |
| - struct forward_iterator_tag : public input_iterator_tag {}; |
27 |
| - struct bidirectional_iterator_tag : public forward_iterator_tag {}; |
28 |
| - struct random_access_iterator_tag : public bidirectional_iterator_tag {}; |
29 |
| - |
30 |
| - template <class T> class allocator { |
31 |
| - public: |
32 |
| - allocator() throw(); |
33 |
| - typedef size_t size_type; |
34 |
| - }; |
35 |
| - |
36 |
| - template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > |
37 |
| - class basic_string { |
38 |
| - public: |
39 |
| - typedef typename Allocator::size_type size_type; |
40 |
| - |
41 |
| - explicit basic_string(const Allocator& a = Allocator()); |
42 |
| - basic_string(const charT* s, const Allocator& a = Allocator()); |
43 |
| - |
44 |
| - const charT* c_str() const; |
45 |
| - |
46 |
| - typedef std::iterator<random_access_iterator_tag, charT> iterator; |
47 |
| - typedef std::iterator<random_access_iterator_tag, const charT> const_iterator; |
48 |
| - |
49 |
| - iterator begin(); |
50 |
| - iterator end(); |
51 |
| - const_iterator begin() const; |
52 |
| - const_iterator end() const; |
53 |
| - const_iterator cbegin() const; |
54 |
| - const_iterator cend() const; |
55 |
| - |
56 |
| - template<class T> basic_string& operator+=(const T& t); |
57 |
| - basic_string& operator+=(const charT* s); |
58 |
| - basic_string& append(const basic_string& str); |
59 |
| - basic_string& append(const charT* s); |
60 |
| - basic_string& append(size_type n, charT c); |
61 |
| - }; |
62 |
| - |
63 |
| - template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(const basic_string<charT, traits, Allocator>& lhs, const basic_string<charT, traits, Allocator>& rhs); |
64 |
| - template<class charT, class traits, class Allocator> basic_string<charT, traits, Allocator> operator+(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs); |
65 |
| - |
66 |
| - typedef basic_string<char> string; |
67 |
| - |
68 |
| - template <class charT, class traits = char_traits<charT> > |
69 |
| - class basic_istream /*: virtual public basic_ios<charT,traits> - not needed for this test */ { |
70 |
| - public: |
71 |
| - basic_istream<charT,traits>& operator>>(int& n); |
72 |
| - }; |
73 |
| - |
74 |
| - template <class charT, class traits = char_traits<charT> > |
75 |
| - class basic_ostream /*: virtual public basic_ios<charT,traits> - not needed for this test */ { |
76 |
| - public: |
77 |
| - typedef charT char_type; |
78 |
| - basic_ostream<charT,traits>& write(const char_type* s, streamsize n); |
79 |
| - |
80 |
| - basic_ostream<charT, traits>& operator<<(int n); |
81 |
| - }; |
82 |
| - |
83 |
| - template<class charT, class traits> basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, const charT*); |
84 |
| - template<class charT, class traits, class Allocator> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const basic_string<charT, traits, Allocator>& str); |
85 |
| - |
86 |
| - template<class charT, class traits = char_traits<charT>> |
87 |
| - class basic_iostream : public basic_istream<charT, traits>, public basic_ostream<charT, traits> { |
88 |
| - public: |
89 |
| - }; |
90 |
| - |
91 |
| - template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>> |
92 |
| - class basic_stringstream : public basic_iostream<charT, traits> { |
93 |
| - public: |
94 |
| - explicit basic_stringstream(/*ios_base::openmode which = ios_base::out|ios_base::in - not needed for this test*/); |
95 |
| - |
96 |
| - basic_string<charT, traits, Allocator> str() const; |
97 |
| - }; |
98 |
| - |
99 |
| - using stringstream = basic_stringstream<char>; |
100 |
| -} |
101 | 101 |
|
102 | 102 | char *source();
|
103 | 103 | void sink(const char *s) {};
|
@@ -273,27 +273,27 @@ void test_range_based_for_loop_string() {
|
273 | 273 |
|
274 | 274 |
|
275 | 275 |
|
276 |
| -namespace std { |
277 |
| - template <class T> |
278 |
| - class vector { |
279 |
| - private: |
280 |
| - void *data_; |
281 |
| - public: |
282 |
| - vector(int size); |
283 | 276 |
|
284 |
| - T& operator[](int idx); |
285 |
| - const T& operator[](int idx) const; |
286 | 277 |
|
287 |
| - typedef std::iterator<random_access_iterator_tag, T> iterator; |
288 |
| - typedef std::iterator<random_access_iterator_tag, const T> const_iterator; |
289 | 278 |
|
290 |
| - iterator begin() noexcept; |
291 |
| - iterator end() noexcept; |
292 | 279 |
|
293 |
| - const_iterator begin() const noexcept; |
294 |
| - const_iterator end() const noexcept; |
295 |
| - }; |
296 |
| -} |
| 280 | + |
| 281 | + |
| 282 | + |
| 283 | + |
| 284 | + |
| 285 | + |
| 286 | + |
| 287 | + |
| 288 | + |
| 289 | + |
| 290 | + |
| 291 | + |
| 292 | + |
| 293 | + |
| 294 | + |
| 295 | + |
| 296 | + |
297 | 297 |
|
298 | 298 | void sink(int);
|
299 | 299 |
|
|
0 commit comments