Changeset 7266 for code/trunk/src/external/loki
- Timestamp:
- Aug 30, 2010, 5:04:12 PM (14 years ago)
- Location:
- code/trunk/src/external/loki
- Files:
-
- 8 added
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/external/loki/ScopeGuard.h
r7263 r7266 12 12 // suitability of this software for any purpose. It is provided "as is" 13 13 // without express or implied warranty. 14 // 15 // Changes by Orxonox (Reto Grieder) 16 // Moved one protected variable to the public section to allow the use of 17 // the ScopeGuard in a class definition. 14 18 //////////////////////////////////////////////////////////////////////////////// 15 19 #ifndef LOKI_SCOPEGUARD_INC_ … … 19 23 20 24 21 #include "RefToValue.h"25 #include <loki/RefToValue.h> 22 26 23 27 /// \defgroup ExceptionGroup Exception-safe code -
code/trunk/src/external/loki/TypeTraits.h
r7263 r7266 3 3 // Copyright (c) 2001 by Andrei Alexandrescu 4 4 // This code accompanies the book: 5 // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design 5 // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design 6 6 // Patterns Applied". Copyright (c) 2001. Addison-Wesley. 7 // Permission to use, copy, modify, distribute and sell this software for any 8 // purpose is hereby granted without fee, provided that the above copyright 9 // notice appear in all copies and that both that copyright notice and this 7 // Permission to use, copy, modify, distribute and sell this software for any 8 // purpose is hereby granted without fee, provided that the above copyright 9 // notice appear in all copies and that both that copyright notice and this 10 10 // permission notice appear in supporting documentation. 11 // The author or Addison-Wesley Longman make no representations about the 12 // suitability of this software for any purpose. It is provided "as is" 11 // The author or Addison-Wesley Longman make no representations about the 12 // suitability of this software for any purpose. It is provided "as is" 13 13 // without express or implied warranty. 14 14 // 15 // Changes by Orxonox (Reto )15 // Changes by Orxonox (Reto Grieder) 16 16 // Removed all stdInt, etc. type traits and function pointer traits 17 17 // and added UnqualifiedReferredType. … … 20 20 #define LOKI_TYPETRAITS_INC_ 21 21 22 // $Id: TypeTraits.h 835 2007-08-02 19:39:02Z syntheticpp $ 23 22 // $Id: TypeTraits.h 1069 2010-04-19 03:09:59Z rich_sposato $ 23 24 25 #include <loki/NullType.h> 24 26 25 27 #if (defined _MSC_VER) && (_MSC_VER < 1400) … … 29 31 30 32 #ifdef _MSC_VER 31 #pragma warning( push ) 33 #pragma warning( push ) 32 34 #pragma warning( disable : 4180 ) //qualifier applied to function type has no meaning; ignored 33 35 #endif … … 36 38 { 37 39 //////////////////////////////////////////////////////////////////////////////// 38 // class NullType39 // Used as a placeholder for "no type here"40 // Useful as an end marker in typelists41 ////////////////////////////////////////////////////////////////////////////////42 43 class NullType {};44 45 ////////////////////////////////////////////////////////////////////////////////46 40 // class template IsCustomUnsignedInt 47 41 // Offers a means to integrate nonstandard built-in unsigned integral types 48 // (such as unsigned __int64 or unsigned long long int) with the TypeTraits 42 // (such as unsigned __int64 or unsigned long long int) with the TypeTraits 49 43 // class template defined below. 50 44 // Invocation: IsCustomUnsignedInt<T> where T is any type … … 59 53 { 60 54 enum { value = 0 }; 61 }; 55 }; 62 56 63 57 //////////////////////////////////////////////////////////////////////////////// 64 58 // class template IsCustomSignedInt 65 59 // Offers a means to integrate nonstandard built-in unsigned integral types 66 // (such as unsigned __int64 or unsigned long long int) with the TypeTraits 60 // (such as unsigned __int64 or unsigned long long int) with the TypeTraits 67 61 // class template defined below. 68 62 // Invocation: IsCustomSignedInt<T> where T is any type … … 77 71 { 78 72 enum { value = 0 }; 79 }; 73 }; 80 74 81 75 //////////////////////////////////////////////////////////////////////////////// … … 94 88 { 95 89 enum { value = 0 }; 96 }; 90 }; 97 91 98 92 //////////////////////////////////////////////////////////////////////////////// … … 142 136 }; 143 137 }// namespace Private 144 138 145 139 //////////////////////////////////////////////////////////////////////////////// 146 140 // class template TypeTraits … … 150 144 // 151 145 // - isPointer : returns true if T is a pointer type 152 // - PointeeType : returns the type to which T points if T is a pointer 146 // - PointeeType : returns the type to which T points if T is a pointer 153 147 // type, NullType otherwise 154 148 // - isReference : returns true if T is a reference type 155 // - ReferredType : returns the type to which T refers if T is a reference 149 // - ReferredType : returns the type to which T refers if T is a reference 156 150 // type, NullType otherwise 157 // - ParameterType : returns the optimal type to be used as a parameter for 151 // - ParameterType : returns the optimal type to be used as a parameter for 158 152 // functions that take Ts 159 153 // - isConst : returns true if T is a const-qualified type … … 161 155 // - isVolatile : returns true if T is a volatile-qualified type 162 156 // - NonVolatileType : Type with removed 'volatile' qualifier from T, if any 163 // - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from 157 // - UnqualifiedType : Type with removed 'const' and 'volatile' qualifiers from 164 158 // T, if any 165 // - ParameterType : returns the optimal type to be used as a parameter 159 // - ParameterType : returns the optimal type to be used as a parameter 166 160 // for functions that take 'const T's 167 161 // … … 172 166 { 173 167 private: 174 168 175 169 template <class U> struct ReferenceTraits 176 170 { … … 178 172 typedef U ReferredType; 179 173 }; 180 174 181 175 template <class U> struct ReferenceTraits<U&> 182 176 { … … 184 178 typedef U ReferredType; 185 179 }; 186 180 187 181 template <class U> struct PointerTraits 188 182 { … … 190 184 typedef NullType PointeeType; 191 185 }; 192 186 193 187 template <class U> struct PointerTraits<U*> 194 188 { … … 196 190 typedef U PointeeType; 197 191 }; 198 192 199 193 template <class U> struct PointerTraits<U*&> 200 194 { … … 202 196 typedef U PointeeType; 203 197 }; 204 198 205 199 template <class U> struct PToMTraits 206 200 { 207 201 enum { result = false }; 208 202 }; 209 203 210 204 template <class U, class V> struct PToMTraits<U V::*> 211 205 { 212 206 enum { result = true }; 213 207 }; 214 208 215 209 template <class U, class V> struct PToMTraits<U V::*&> 216 210 { 217 211 enum { result = true }; 218 212 }; 219 213 220 214 template <class U> struct UnConst 221 215 { … … 223 217 enum { isConst = 0 }; 224 218 }; 225 219 226 220 template <class U> struct UnConst<const U> 227 221 { … … 235 229 enum { isConst = 1 }; 236 230 }; 237 231 238 232 template <class U> struct UnVolatile 239 233 { … … 241 235 enum { isVolatile = 0 }; 242 236 }; 243 237 244 238 template <class U> struct UnVolatile<volatile U> 245 239 { … … 253 247 enum { isVolatile = 1 }; 254 248 }; 255 249 256 250 public: 257 typedef typename UnConst<T>::Result 251 typedef typename UnConst<T>::Result 258 252 NonConstType; 259 typedef typename UnVolatile<T>::Result 253 typedef typename UnVolatile<T>::Result 260 254 NonVolatileType; 261 typedef typename UnVolatile<typename UnConst<T>::Result>::Result 255 typedef typename UnVolatile<typename UnConst<T>::Result>::Result 262 256 UnqualifiedType; 263 typedef typename PointerTraits<UnqualifiedType>::PointeeType 257 typedef typename PointerTraits<UnqualifiedType>::PointeeType 264 258 PointeeType; 265 typedef typename ReferenceTraits<T>::ReferredType 259 typedef typename ReferenceTraits<T>::ReferredType 266 260 ReferredType; 267 261 typedef typename ReferenceTraits<typename UnVolatile<typename UnConst<T>::Result>::Result>::ReferredType … … 273 267 enum { isPointer = PointerTraits< 274 268 typename ReferenceTraits<UnqualifiedType>::ReferredType >::result}; 275 269 276 270 }; 277 271 }
Note: See TracChangeset
for help on using the changeset viewer.