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

Comparing rxvt-unicode/src/rxvtvec.h (file contents):
Revision 1.2 by pcg, Mon Nov 24 19:52:16 2003 UTC vs.
Revision 1.3 by pcg, Tue Nov 25 11:52:42 2003 UTC

4template<typename T> static inline T min (T a, long b) { return a < b ? a : b; } 4template<typename T> static inline T min (T a, long b) { return a < b ? a : b; }
5template<typename T> static inline T max (T a, long b) { return a > b ? a : b; } 5template<typename T> static inline T max (T a, long b) { return a > b ? a : b; }
6 6
7#include <cstring> 7#include <cstring>
8#include "simplevec.h" 8#include "simplevec.h"
9
10#include <cstdio>
9 11
10#if 0 12#if 0
11template<typename T> 13template<typename T>
12struct rxvt_vec : simplevec<void *> { 14struct rxvt_vec : simplevec<void *> {
13 typedef T *iterator; 15 typedef T *iterator;
37 T *p; 39 T *p;
38 40
39 auto_ptr() : p(0) { } 41 auto_ptr() : p(0) { }
40 auto_ptr(T *a) : p(a) { } 42 auto_ptr(T *a) : p(a) { }
41 43
44 auto_ptr(auto_ptr &a)
45 {
46 p = a.p;
47 a.p = 0;
48 }
49
42 template<typename A> 50 template<typename A>
43 auto_ptr(auto_ptr<A> &a) 51 auto_ptr(auto_ptr<A> &a)
44 { 52 {
45 p = a.p; 53 p = a.p;
46 a.p = 0; 54 a.p = 0;
47 } 55 }
48 56
57 ~auto_ptr()
58 {
59 delete p;
60 }
61
49 // void because it makes sense in our context 62 // void because it makes sense in our context
50 void operator =(T *a) 63 void operator =(T *a)
51 { 64 {
52 delete p; 65 delete p;
53 p = a; 66 p = a;
67 }
68
69 void operator =(auto_ptr &a)
70 {
71 *this = a.p;
72 a.p = 0;
54 } 73 }
55 74
56 template<typename A> 75 template<typename A>
57 void operator =(auto_ptr<A> &a) 76 void operator =(auto_ptr<A> &a)
58 { 77 {
73 } 92 }
74}; 93};
75 94
76typedef auto_ptr<char> auto_str; 95typedef auto_ptr<char> auto_str;
77 96
97struct stringvec : simplevec<char *>
98{
99 ~stringvec ()
100 {
101 for (char **c = begin(); c != end(); c++)
102 delete [] *c;
103 }
104};
105
78#endif 106#endif
107

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines