Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 21, 2008, 9:23:11 PM (16 years ago)
Author:
rgrieder
Message:
  • Finished CommandLineArgument completely. You can also use SetCommandLineSwitch to define boolean switches.
  • Added StaticConversion to Covert.h (compile time type conversion checking)
  • Fixed a bug in Exception
  • Added getAllStrings() to SubString
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/util/Convert.h

    r1625 r1664  
    690690};
    691691
     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*/
     703template <class T, class U>
     704class 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();
     711public:
     712    enum { exists = sizeof(Test(MakeT())) == sizeof(Small) };
     713};
     714
    692715#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
    693716#pragma warning(pop)
Note: See TracChangeset for help on using the changeset viewer.