Changeset 2805 in Sophya for trunk/SophyaLib/BaseTools/rcptr.h
- Timestamp:
- Jun 9, 2005, 6:20:00 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/rcptr.h
r287 r2805 4 4 #define RCPTR_H 5 5 6 // This implements a very simple "smart pointer" with reference counting. 7 // Many refinements are possible 6 /*! 7 \class RCPtr 8 \ingroup BaseTools 9 This implements a very simple "smart pointer" with reference counting. 10 Many refinements are possible 11 Eric Aubourg 1999 CEA/DAPNIA/SPP 8 12 9 // Principle : use RCPtr<T> instead of T* 10 // To use with type X, define 11 // typedef RCPtr<X> Xp; 12 // When creating a new object, use 13 // Xp xp = new X(...); 14 // xp can be used like a X* xp->field, xp->method(), *xp ... 15 // can be passed by reference, copied, etc 16 // the object is destroyed when the last Xp is destroyed. 13 \verbatim 14 Principle : use RCPtr<T> instead of T* 15 To use with type X, define 16 typedef RCPtr<X> Xp; 17 When creating a new object, use 18 Xp xp = new X(...); 19 xp can be used like a X* xp->field, xp->method(), *xp ... 20 can be passed by reference, copied, etc 21 the object is destroyed when the last Xp is destroyed. 17 22 18 // The class RCCPtr<X> is a const smart pointer, to be used like 19 // a X const *. 20 21 // Eric Aubourg 1999 CEA/DAPNIA/SPP 22 23 The class RCCPtr<X> is a const smart pointer, to be used like 24 a X const *. 25 \endverbatim 26 */ 23 27 24 28 template <class T> class RCCPtr; … … 69 73 70 74 71 // A const smart pointer75 //! A const smart pointer class 72 76 template <class T> 73 77 class RCCPtr {
Note:
See TracChangeset
for help on using the changeset viewer.