Changeset 1755 for code/trunk/src/util/Convert.h
- Timestamp:
- Sep 10, 2008, 1:37:36 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/gui (added) merged: 1636,1638,1640-1647,1649-1654,1656,1659-1665,1670,1672-1674,1686,1688-1692,1694-1697,1704 /code/branches/input (added) merged: 1629-1630
- Property svn:mergeinfo changed
-
code/trunk/src/util/Convert.h
r1747 r1755 643 643 }; 644 644 645 646 /////////////////////////// 647 // Static type detection // 648 /////////////////////////// 649 650 /** 651 Template class that determines whether type T converts implicitly to type U. 652 @note 653 This allows to detect type conversion at compile time. 654 From 'Modern C++ Design' (Alexandrescu 2001). 655 */ 656 template <class T, class U> 657 class StaticConversion 658 { 659 class Small { char dummy[1]; }; 660 class Big { char dummy[1024]; }; 661 static Small Test(U); 662 static Big Test(...); 663 static T MakeT(); 664 public: 665 enum { exists = sizeof(Test(MakeT())) == sizeof(Small) }; 666 }; 667 645 668 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC 646 669 #pragma warning(pop)
Note: See TracChangeset
for help on using the changeset viewer.