ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtutil.h
(Generate patch)

Comparing rxvt-unicode/src/rxvtutil.h (file contents):
Revision 1.50 by sf-exg, Mon Jan 23 14:29:24 2012 UTC vs.
Revision 1.54 by sf-exg, Fri May 25 07:38:05 2012 UTC

14# define NOTHROW throw() 14# define NOTHROW throw()
15# define THROW(x) throw x 15# define THROW(x) throw x
16#endif 16#endif
17 17
18// various utility functions 18// various utility functions
19template<typename T, typename U> static inline void min_it (T &a, U b) { a = a < (T)b ? a : (T)b; } 19template<typename T, typename U> static inline void min_it (T &a, U b) { a = a < (T)b ? a : (T)b; }
20template<typename T, typename U> static inline void max_it (T &a, U b) { a = a > (T)b ? a : (T)b; } 20template<typename T, typename U> static inline void max_it (T &a, U b) { a = a > (T)b ? a : (T)b; }
21 21
22template<typename T, typename U, typename V> static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; } 22template<typename T, typename U, typename V> static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; }
23template<typename T, typename U, typename V> static inline void clamp_it (T &v, U a, V b) { v = v < (T)a ? a : v >(T)b ? b : v; } 23template<typename T, typename U, typename V> static inline void clamp_it (T &v, U a, V b) { v = v < (T)a ? a : v >(T)b ? b : v; }
24 24
25template<typename T> static inline T squared_diff (T a, T b) { return (a-b)*(a-b); } 25template<typename T> static inline T squared_diff (T a, T b) { return (a - b) * (a - b); }
26 26
27// linear interpolation 27// linear interpolation
28template<typename T, typename U, typename P> 28template<typename T, typename U, typename P>
29static inline 29static inline
30T lerp (T a, U b, P p) 30T lerp (T a, U b, P p)
110 ~auto_ptr () 110 ~auto_ptr ()
111 { 111 {
112 free (p); 112 free (p);
113 } 113 }
114 114
115 // void because it makes sense in our context 115 void reset (T *a)
116 void operator = (T *a)
117 { 116 {
118 free (p); 117 free (p);
119 p = a; 118 p = a;
120 } 119 }
121 120
121 // void because it makes sense in our context
122 void operator = (auto_ptr &a) 122 void operator = (auto_ptr &a)
123 { 123 {
124 *this = a.p; 124 *this = a.p;
125 a.p = 0; 125 a.p = 0;
126 } 126 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines