Changeset 1664 for code/branches/gui/src/util/Convert.h
- Timestamp:
- Aug 21, 2008, 9:23:11 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/util/Convert.h
r1625 r1664 690 690 }; 691 691 692 693 /////////////////////////// 694 // Static type detection // 695 /////////////////////////// 696 697 /** 698 Template class that determines whether type T converts implicitly to type U. 699 @note 700 This allows to detect type conversion at compile time. 701 From 'Modern C++ Design' (Alexandrescu 2001). 702 */ 703 template <class T, class U> 704 class StaticConversion 705 { 706 class Small { char dummy[1]; }; 707 class Big { char dummy[1024]; }; 708 static Small Test(U); 709 static Big Test(...); 710 static T MakeT(); 711 public: 712 enum { exists = sizeof(Test(MakeT())) == sizeof(Small) }; 713 }; 714 692 715 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC 693 716 #pragma warning(pop)
Note: See TracChangeset
for help on using the changeset viewer.