-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintrusiveptr.h
58 lines (41 loc) · 1.64 KB
/
intrusiveptr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* START OF 'intrusiveptr.h' FILE */
#pragma once
#ifndef INTRUSIVEPTR_H
#define INTRUSIVEPTR_H
template<typename PTR_TYPE>
class INTRUSIVE_PTR {
template<typename OTHER>
friend class INTRUSIVE_PTR;
public:
INTRUSIVE_PTR (void);
INTRUSIVE_PTR (PTR_TYPE * ptr);
INTRUSIVE_PTR (const INTRUSIVE_PTR & intrPtr);
template<typename OTHER>
INTRUSIVE_PTR (const INTRUSIVE_PTR<OTHER> & intrPtr);
~INTRUSIVE_PTR (void);
INTRUSIVE_PTR & operator= (const INTRUSIVE_PTR & intrPtr);
INTRUSIVE_PTR & operator= (PTR_TYPE * ptr);
bool operator== (const INTRUSIVE_PTR & intrPtr) const;
bool operator== (const PTR_TYPE * ptr) const;
bool operator!= (const INTRUSIVE_PTR & intrPtr) const;
bool operator!= (const PTR_TYPE * ptr) const;
bool operator< (const INTRUSIVE_PTR & intrPtr) const;
PTR_TYPE & operator* (void) const;
PTR_TYPE * operator-> (void) const;
bool operator! (void) const;
friend bool operator== (const PTR_TYPE * ptr, const INTRUSIVE_PTR & intrPtr) { return ptr == intrPtr.ptr; }
friend bool operator!= (const PTR_TYPE * ptr, const INTRUSIVE_PTR & intrPtr) { return ptr != intrPtr.ptr; }
template<typename OTHER>
INTRUSIVE_PTR & operator= (const INTRUSIVE_PTR<OTHER> & intrPtr);
PTR_TYPE * Get (void) const;
bool IsValid (void) const;
void Swap (INTRUSIVE_PTR & rp);
private:
template<typename OTHER>
void Assign (const INTRUSIVE_PTR<OTHER> & ptr);
private:
PTR_TYPE * ptr;
};
#include "intrusiveptr.hpp"
#endif // INTRUSIVEPTR_H
/* END OF 'intrusiveptr.h' FILE */