… | |
… | |
4 | #include <new> |
4 | #include <new> |
5 | #include <stdlib.h> |
5 | #include <stdlib.h> |
6 | #include <string.h> |
6 | #include <string.h> |
7 | #include "ecb.h" |
7 | #include "ecb.h" |
8 | #include "estl.h" |
8 | #include "estl.h" |
|
|
9 | |
|
|
10 | #include "emman.h" |
9 | |
11 | |
10 | // increases code size unless -fno-enforce-eh-specs |
12 | // increases code size unless -fno-enforce-eh-specs |
11 | #if __GNUC__ |
13 | #if __GNUC__ |
12 | # define NOTHROW |
14 | # define NOTHROW |
13 | # define THROW(x) |
15 | # define THROW(x) |
… | |
… | |
86 | const T &operator [] (int i) const { return * (const T *) (& ((* (const simplevec<void *> *)this)[i])); } |
88 | const T &operator [] (int i) const { return * (const T *) (& ((* (const simplevec<void *> *)this)[i])); } |
87 | }; |
89 | }; |
88 | #endif |
90 | #endif |
89 | |
91 | |
90 | inline void * |
92 | inline void * |
91 | operator new (size_t size) |
93 | operator new (size_t size) throw (std::bad_alloc) |
92 | { |
94 | { |
93 | // TODO: use rxvt_malloc |
95 | // TODO: use rxvt_malloc |
94 | return malloc (size); |
96 | return malloc (size); |
95 | } |
97 | } |
96 | |
98 | |
97 | inline void |
99 | inline void |
98 | operator delete (void *p) |
100 | operator delete (void *p) throw () |
99 | { |
101 | { |
100 | free (p); |
102 | free (p); |
101 | } |
103 | } |
102 | |
104 | |
103 | template<typename T> |
105 | template<typename T> |
… | |
… | |
135 | } |
137 | } |
136 | |
138 | |
137 | // void because it makes sense in our context |
139 | // void because it makes sense in our context |
138 | void operator =(auto_ptr &a) |
140 | void operator =(auto_ptr &a) |
139 | { |
141 | { |
140 | *this = a.p; |
142 | reset (a.release ()); |
141 | a.p = 0; |
|
|
142 | } |
143 | } |
143 | |
144 | |
144 | template<typename A> |
145 | template<typename A> |
145 | void operator =(auto_ptr<A> &a) |
146 | void operator =(auto_ptr<A> &a) |
146 | { |
147 | { |
147 | *this = a.p; |
148 | reset (a.release ()); |
148 | a.p = 0; |
|
|
149 | } |
149 | } |
150 | |
150 | |
151 | T *operator ->() const { return p; } |
151 | T *operator ->() const { return p; } |
152 | T &operator *() const { return *p; } |
152 | T &operator *() const { return *p; } |
153 | |
153 | |