1 #pragma clang system_header 2 3 namespace std { 4 template <class T1, class T2> 5 struct pair { 6 T1 first; 7 T2 second; 8 9 pair() : first(), second() {} 10 pair(const T1 &a, const T2 &b) : first(a), second(b) {} 11 12 template<class U1, class U2> 13 pair(const pair<U1, U2> &other) : first(other.first), second(other.second) {} 14 }; 15 16 typedef __typeof__(sizeof(int)) size_t; 17 18 template<typename T> 19 class vector { 20 T *_start; 21 T *_finish; 22 T *_end_of_storage; 23 public: 24 vector() : _start(0), _finish(0), _end_of_storage(0) {} 25 ~vector(); 26 27 size_t size() const { 28 return size_t(_finish - _start); 29 } 30 31 void push_back(); 32 T pop_back(); 33 34 T &operator[](size_t n) { 35 return _start[n]; 36 } 37 38 const T &operator[](size_t n) const { 39 return _start[n]; 40 } 41 42 T *begin() { return _start; } 43 const T *begin() const { return _start; } 44 45 T *end() { return _finish; } 46 const T *end() const { return _finish; } 47 }; 48 49 class exception { 50 public: 51 exception() throw(); 52 virtual ~exception() throw(); 53 virtual const char *what() const throw() { 54 return 0; 55 } 56 }; 57 } 58