… | |
… | |
61 | { |
61 | { |
62 | void *operator new (size_t s); |
62 | void *operator new (size_t s); |
63 | void operator delete (void *p, size_t s); |
63 | void operator delete (void *p, size_t s); |
64 | }; |
64 | }; |
65 | |
65 | |
|
|
66 | // alas new/delete cannot be specified as inline in C++11 (see 17.6.4.6) |
|
|
67 | void *operator new (size_t s) throw (std::bad_alloc); |
|
|
68 | void operator delete (void *p) throw (); |
|
|
69 | |
66 | struct stringvec : simplevec<char *> |
70 | struct stringvec : simplevec<char *> |
67 | { |
71 | { |
68 | ~stringvec () |
72 | ~stringvec () |
69 | { |
73 | { |
70 | for (char **c = begin (); c != end (); c++) |
74 | for (char **c = begin (); c != end (); c++) |
… | |
… | |
86 | iterator end () const { return (iterator)simplevec<void *>::end (); } |
90 | iterator end () const { return (iterator)simplevec<void *>::end (); } |
87 | T &operator [] (int i) { return * (T *) (& ((* (simplevec<void *> *)this)[i])); } |
91 | T &operator [] (int i) { return * (T *) (& ((* (simplevec<void *> *)this)[i])); } |
88 | const T &operator [] (int i) const { return * (const T *) (& ((* (const simplevec<void *> *)this)[i])); } |
92 | const T &operator [] (int i) const { return * (const T *) (& ((* (const simplevec<void *> *)this)[i])); } |
89 | }; |
93 | }; |
90 | #endif |
94 | #endif |
91 | |
|
|
92 | inline void * |
|
|
93 | operator new (size_t size) throw (std::bad_alloc) |
|
|
94 | { |
|
|
95 | // TODO: use rxvt_malloc |
|
|
96 | return malloc (size); |
|
|
97 | } |
|
|
98 | |
|
|
99 | inline void |
|
|
100 | operator delete (void *p) throw () |
|
|
101 | { |
|
|
102 | free (p); |
|
|
103 | } |
|
|
104 | |
95 | |
105 | template<typename T> |
96 | template<typename T> |
106 | struct auto_ptr |
97 | struct auto_ptr |
107 | { |
98 | { |
108 | T *p; |
99 | T *p; |