HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ScopedPtr.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_ScopedPtr.h (UT Library, C++)
7  *
8  * COMMENTS: A wrapper around hboost::scoped_ptr.
9  *
10  * WARNINGS:
11  * - Do NOT use this with ARRAY pointers
12  * - Do NOT store these in containers
13  */
14 
15 #ifndef __UT_SCOPEDPTR_H_INCLUDED__
16 #define __UT_SCOPEDPTR_H_INCLUDED__
17 
18 #include <SYS/SYS_Deprecated.h>
19 #include <hboost/scoped_ptr.hpp>
20 
21 /// @brief A smart pointer for unique ownership of dynamically allocated objects
22 ///
23 /// UT_ScopedPtr mimics a built-in pointer except that it guarantees deletion
24 /// of the object pointed to, either upon destruction or via an explicit
25 /// reset(). UT_ScopedPtr is a simple solution for simple needs; use
26 /// UT_SharedPtr/UT_IntrusivePtr if your needs are more complex.
27 ///
28 template<class T>
29 class UT_ScopedPtr : public hboost::scoped_ptr<T>
30 {
31 public:
33  UT_ScopedPtr(T *p = 0) : hboost::scoped_ptr<T>(p) { }
34 };
35 
36 #endif // __UT_SCOPEDPTR_H_INCLUDED__
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_ScopedPtr.h:29