summaryrefslogtreecommitdiffstats
path: root/ue5/shared_ptr.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ue5/shared_ptr.hpp')
-rw-r--r--ue5/shared_ptr.hpp99
1 files changed, 50 insertions, 49 deletions
diff --git a/ue5/shared_ptr.hpp b/ue5/shared_ptr.hpp
index 87e4b01..4492fff 100644
--- a/ue5/shared_ptr.hpp
+++ b/ue5/shared_ptr.hpp
@@ -8,78 +8,79 @@
8 8
9namespace Ti { 9namespace Ti {
10 10
11/* TODO helpers */ 11 /* TODO helpers */
12 12
13template <typename T> 13 template <typename T>
14class shared_ptr 14 class shared_ptr
15{ 15 {
16private: 16 private:
17 /* TODO data */ 17 /* TODO data */
18 18
19public: 19 public:
20 shared_ptr(); 20 shared_ptr();
21 T* get() const; 21 T* get() const;
22 shared_ptr (const shared_ptr<T>& other); 22 shared_ptr (const shared_ptr<T>& other);
23 23
24 template <typename O> 24 template <typename O>
25 shared_ptr (const shared_ptr<O>& other); 25 shared_ptr (const shared_ptr<O>& other);
26 26
27 template <typename O> 27 template <typename O>
28 explicit shared_ptr (O* p); 28 explicit shared_ptr (O* p);
29 shared_ptr& operator = (const shared_ptr<T>& other); 29 shared_ptr& operator = (const shared_ptr<T>& other);
30 30
31 template <typename O> 31 template <typename O>
32 shared_ptr& operator = (const shared_ptr<O>& other); 32 shared_ptr& operator = (const shared_ptr<O>& other);
33 33
34 ~shared_ptr (); 34 ~shared_ptr ();
35 T& operator * () const; 35 T& operator * () const;
36 T* operator -> () const; 36 T* operator -> () const;
37 37
38 void swap (shared_ptr<T>& other); 38 void swap (shared_ptr<T>& other);
39 39
40 inline void reset(); 40 inline void reset();
41 41
42private: 42 private:
43 template <typename R, typename... Args> 43 template <typename R, typename... Args>
44 friend shared_ptr<R> make_shared (Args...); 44 friend shared_ptr<R> make_shared (Args...);
45 45
46 template<typename U1, typename U2> 46 template<typename U1, typename U2>
47 friend bool operator == (const shared_ptr<U1>& a, const shared_ptr<U2>& b); 47 friend bool operator == (const shared_ptr<U1>& a, const shared_ptr<U2>& b);
48 48
49 template<typename U1, typename U2> 49 template<typename U1, typename U2>
50 friend bool operator == (const shared_ptr<U1>& a, const U2* b); 50 friend bool operator == (const shared_ptr<U1>& a, const U2* b);
51 51
52 template<typename U1, typename U2> 52 template<typename U1, typename U2>
53 friend bool operator == (const U1* a, const shared_ptr<U2>& b); 53 friend bool operator == (const U1* a, const shared_ptr<U2>& b);
54 54
55 template<typename U1, typename U2> 55 template<typename U1, typename U2>
56 friend bool operator != (const shared_ptr<U1>& a, const U2* b); 56 friend bool operator != (const shared_ptr<U1>& a, const U2* b);
57 57
58 template<typename U1, typename U2> 58 template<typename U1, typename U2>
59 friend bool operator != (const U1* a, const shared_ptr<U2>& b); 59 friend bool operator != (const U1* a, const shared_ptr<U2>& b);
60 60
61 template<typename U1, typename U2> 61 template<typename U1, typename U2>
62 friend bool operator != (const shared_ptr<U1>& a, const shared_ptr<U2>& b); 62 friend bool operator != (const shared_ptr<U1>& a, const shared_ptr<U2>& b);
63 63
64 template <typename R, typename F> 64 template <typename R, typename F>
65 friend shared_ptr<R> shared_dynamic_cast (const shared_ptr<F>& from); 65 friend shared_ptr<R> shared_dynamic_cast (const shared_ptr<F>& from);
66}; 66 };
67 67
68 68
69template <typename T /* TODO */ > 69 template <typename T /* TODO */ >
70shared_ptr<T> make_shared (/* TODO */); 70 shared_ptr<T> make_shared (/* TODO */);
71 71
72 72 template <typename T, typename F>
73template <typename T, typename F> 73 shared_ptr<T> shared_dynamic_cast (const shared_ptr<F>& from);
74shared_ptr<T> shared_dynamic_cast (const shared_ptr<F>& from);
75 74
76} // end namespace ti 75} // end namespace ti
77 76
78namespace std { 77namespace std {
79 using namespace Ti; 78 using namespace Ti;
80 template <typename T> 79 template <typename T>
81 inline void swap (shared_ptr<T>& t1, shared_ptr<T>& t2); 80 inline void swap (shared_ptr<T>& t1, shared_ptr<T>& t2);
82 /* TODO */ 81 /* TODO */
83} 82}
84 83
85#endif 84#endif
85
86/* vim: set et sw=2 ts=2: */