LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ref.hh
Go to the documentation of this file.
1 
6 #ifndef MISC_REF_HH
7 # define MISC_REF_HH
8 
9 # include <memory>
10 
11 namespace misc
12 {
13 
18  template <typename T>
19  class ref : public std::shared_ptr<T>
20  {
21  public:
23  typedef std::shared_ptr<T> super_type;
25  typedef T element_type;
26 
29 
31  template <typename U>
32  ref(const ref<U>& other);
33 
41  ref(const ref<T>& other);
42 
47  ref(T* p = nullptr);
48 
51  ~ref();
53 
56 
59  bool operator==(const T* p) const;
60 
63  bool operator!=(const T* p) const;
64 
66 
69 
74  template <typename U> ref<U> cast() const;
75 
80  template <typename U> ref<U> unsafe_cast() const;
82 
87  template <typename U> bool is_a() const;
88  };
89 
90 
91 }
92 
93 # include <misc/ref.hxx>
94 
95 #endif // !MISC_REF_HH