Changeset 11068 for code/branches/cpp11_v3/src/libraries/util/Math.h
- Timestamp:
- Jan 17, 2016, 6:41:22 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
/code/branches/cpp11_v2 merged: 10996-11008,11010
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/libraries/util/Math.h
r11054 r11068 47 47 #include <cstdlib> 48 48 #include <random> 49 #include <type_traits> 49 50 50 51 #include <OgreMath.h> … … 178 179 @c Vector3 you get <tt>Vector3(0, 0, 0)</tt>. 179 180 */ 180 template <typename T> 181 inline Tzeroise()181 template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value, T>::type 182 inline /*T*/ zeroise() 182 183 { 183 184 // If you reach this code, you abused zeroise()! 184 185 static_assert(sizeof(T) != sizeof(T), "No template specialization available for T"); 186 } 187 /// Implementation for enum classes: uses the underlying type to create a zero value. 188 template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value, T>::type 189 inline /*T*/ zeroise() 190 { 191 return static_cast<T>(zeroise<typename std::underlying_type<T>::type>()); 185 192 } 186 193
Note: See TracChangeset
for help on using the changeset viewer.