--- rxvt-unicode/src/rxvtutil.h 2014/10/28 09:05:33 1.60 +++ rxvt-unicode/src/rxvtutil.h 2014/12/14 04:52:10 1.63 @@ -1,7 +1,6 @@ #ifndef RXVT_UTIL_H #define RXVT_UTIL_H -#include #include #include #include "ecb.h" @@ -25,8 +24,6 @@ template static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; } template static inline void clamp_it (T &v, U a, V b) { v = v < (T)a ? a : v >(T)b ? b : v; } -template static inline T squared_diff (T a, T b) { return (a - b) * (a - b); } - // linear interpolation template static inline T @@ -63,10 +60,6 @@ void operator delete (void *p, size_t s); }; -// alas new/delete cannot be specified as inline in C++11 (see 17.6.4.6) -void *operator new (size_t s) throw (std::bad_alloc); -void operator delete (void *p) throw (); - struct stringvec : simplevec { ~stringvec () @@ -93,67 +86,7 @@ }; #endif -template -struct auto_ptr -{ - T *p; - - auto_ptr () : p (0) { } - - explicit - auto_ptr (T *a) : p (a) { } - - auto_ptr (auto_ptr &a) - { - p = a.p; - a.p = 0; - } - - template - auto_ptr (auto_ptr &a) - { - p = a.p; - a.p = 0; - } - - ~auto_ptr () - { - delete p; - } - - void reset (T *a) - { - delete p; - p = a; - } - - // void because it makes sense in our context - void operator =(auto_ptr &a) - { - reset (a.release ()); - } - - template - void operator =(auto_ptr &a) - { - reset (a.release ()); - } - - T *operator ->() const { return p; } - T &operator *() const { return *p; } - - operator T *() { return p; } - T *get () const { return p; } - - T *release() - { - T *r = p; - p = 0; - return r; - } -}; - -typedef auto_ptr auto_str; +typedef estl::scoped_array auto_str; #endif