00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Side Effects Software Inc 00008 * 123 Front Street West, Suite 1401 00009 * Toronto, Ontario 00010 * Canada M5J 2M2 00011 * 416-504-9876 00012 * 00013 * NAME: UT_MakePtrConst.h (UT Library, C++) 00014 * 00015 * COMMENTS: 00016 */ 00017 00018 #ifndef __UT_MAKEPTRCONST_H_INCLUDED__ 00019 #define __UT_MAKEPTRCONST_H_INCLUDED__ 00020 00021 /// @file 00022 /// UT_MakePtrConst adds const to a pointer. 00023 /// 00024 /// For example, it will turn "int*" into "const int*" 00025 /// 00026 /// NOTE: This template will NOT WORK for FUNCTION POINTER types. 00027 /// The previous incarnation of this code used boost::mpl to handle 00028 /// this case but gcc 3.3.6 would periodically crash. 00029 /// 00030 /// Usage: 00031 /// @code 00032 /// typedef typename UT_MakePtrConst<int *>::type ConstIntPtr; 00033 /// @endcode 00034 /// 00035 /// It is safe to use this when the pointer type argument is 00036 /// already const. In that case, the resulting type will be 00037 /// equivalent to the input type. 00038 00039 template< typename V > 00040 struct UT_MakePtrConst; 00041 00042 template< typename V > 00043 struct UT_MakePtrConst<V*> 00044 { 00045 typedef const V* type; 00046 }; 00047 00048 #endif // __UT_MAKEPTRCONST_H_INCLUDED__
1.5.9