HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_MakePtrConst.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_MakePtrConst.h (UT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __UT_MAKEPTRCONST_H_INCLUDED__
12 #define __UT_MAKEPTRCONST_H_INCLUDED__
13 
14 /// @file
15 /// UT_MakePtrConst adds const to a pointer.
16 ///
17 /// For example, it will turn "int*" into "const int*"
18 ///
19 /// NOTE: This template will NOT WORK for FUNCTION POINTER types.
20 /// The previous incarnation of this code used hboost::mpl to handle
21 /// this case but gcc 3.3.6 would periodically crash.
22 ///
23 /// Usage:
24 /// @code
25 /// typedef typename UT_MakePtrConst<int *>::type ConstIntPtr;
26 /// @endcode
27 ///
28 /// It is safe to use this when the pointer type argument is
29 /// already const. In that case, the resulting type will be
30 /// equivalent to the input type.
31 
32 template< typename V >
34 
35 template< typename V >
36 struct UT_MakePtrConst<V*>
37 {
38  typedef const V* type;
39 };
40 
41 #endif // __UT_MAKEPTRCONST_H_INCLUDED__