34 #ifndef _lib_util_misc_sharedptr_h
35 #define _lib_util_misc_sharedptr_h
38 #ifdef ECLIPSE_PARSER_ONLY
46 shared_ptr(T* ptr){ assert(
false &&
"should never get here"); ptr_ = ptr; }
47 T operator*(){ assert(
false &&
"should never get here");
return *ptr_; }
48 const T operator*()
const { assert(
false &&
"should never get here");
return *ptr_; }
49 T* operator->(){ assert(
false &&
"should never get here");
return ptr_; }
50 const T operator->()
const { assert(
false &&
"should never get here");
return *ptr_; }
51 T* get(){ assert(
false &&
"should never get here");
return ptr_; }
52 const T* get()
const { assert(
false &&
"should never get here");
return ptr_; }
61 shared_ptr(T* ptr){ assert(
false &&
"should never get here"); ptr_ = ptr; }
62 T operator*(){ assert(
false &&
"should never get here");
return *ptr_; }
63 const T operator*()
const { assert(
false &&
"should never get here");
return *ptr_; }
64 T* operator->(){ assert(
false &&
"should never get here");
return ptr_; }
65 const T operator->()
const { assert(
false &&
"should never get here");
return *ptr_; }
66 T* get(){ assert(
false &&
"should never get here");
return ptr_; }
67 const T* get()
const { assert(
false &&
"should never get here");
return ptr_; }
75 template<
typename... Args>
77 operator()(Args args...){
78 return shared_ptr<T>(
new T(args...));
84 template <
typename T>
using weak_ptr = shared_ptr<T>;