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.1 by pcg, Mon Nov 24 17:28:08 2003 UTC vs.
Revision 1.2 by pcg, Mon Nov 24 19:52:16 2003 UTC

30 ++first; 30 ++first;
31 31
32 return first; 32 return first;
33} 33}
34 34
35template<typename T>
36struct auto_ptr {
37 T *p;
38
39 auto_ptr() : p(0) { }
40 auto_ptr(T *a) : p(a) { }
41
42 template<typename A>
43 auto_ptr(auto_ptr<A> &a)
44 {
45 p = a.p;
46 a.p = 0;
47 }
48
49 // void because it makes sense in our context
50 void operator =(T *a)
51 {
52 delete p;
53 p = a;
54 }
55
56 template<typename A>
57 void operator =(auto_ptr<A> &a)
58 {
59 *this = a.p;
60 a.p = 0;
61 }
62
63 operator T *() const { return p; }
64
65 T *operator ->() const { return p; }
66 T &operator *() const { return *p; }
67
68 T *get ()
69 {
70 T *r = p;
71 p = 0;
72 return r;
73 }
74};
75
76typedef auto_ptr<char> auto_str;
77
35#endif 78#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines