From e251dbf4e82efc3dcfe18f6d5d00ae3ce079d1bd Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 3 Jun 2009 15:00:12 +0200 Subject: ue5 --- ue5/shared_ptr.hpp | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 ue5/shared_ptr.hpp (limited to 'ue5/shared_ptr.hpp') diff --git a/ue5/shared_ptr.hpp b/ue5/shared_ptr.hpp new file mode 100644 index 0000000..87e4b01 --- /dev/null +++ b/ue5/shared_ptr.hpp @@ -0,0 +1,85 @@ +#ifndef SHARED_PTR_H +#define SHARED_PTR_H + +/* TODO includes */ + +#undef SOLVED_1 +//#define SOLVED_1 + +namespace Ti { + +/* TODO helpers */ + +template +class shared_ptr +{ +private: + /* TODO data */ + +public: + shared_ptr(); + T* get() const; + shared_ptr (const shared_ptr& other); + + template + shared_ptr (const shared_ptr& other); + + template + explicit shared_ptr (O* p); + shared_ptr& operator = (const shared_ptr& other); + + template + shared_ptr& operator = (const shared_ptr& other); + + ~shared_ptr (); + T& operator * () const; + T* operator -> () const; + + void swap (shared_ptr& other); + + inline void reset(); + +private: + template + friend shared_ptr make_shared (Args...); + + template + friend bool operator == (const shared_ptr& a, const shared_ptr& b); + + template + friend bool operator == (const shared_ptr& a, const U2* b); + + template + friend bool operator == (const U1* a, const shared_ptr& b); + + template + friend bool operator != (const shared_ptr& a, const U2* b); + + template + friend bool operator != (const U1* a, const shared_ptr& b); + + template + friend bool operator != (const shared_ptr& a, const shared_ptr& b); + + template + friend shared_ptr shared_dynamic_cast (const shared_ptr& from); +}; + + +template +shared_ptr make_shared (/* TODO */); + + +template +shared_ptr shared_dynamic_cast (const shared_ptr& from); + +} // end namespace ti + +namespace std { + using namespace Ti; + template + inline void swap (shared_ptr& t1, shared_ptr& t2); + /* TODO */ +} + +#endif -- cgit v1.2.3