Changeset 1746 for code/branches/core3
- Timestamp:
- Sep 9, 2008, 12:36:31 AM (16 years ago)
- Location:
- code/branches/core3/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/util/Convert.h
r1745 r1746 153 153 }; 154 154 155 template <int asdf>156 class ExplicitConversion<float, int, asdf>157 {158 private:159 static float objectFromType; // helper object to handle private c'tor and d'tor160 static int objectToType; // helper object to handle private c'tor and d'tor161 public:162 enum { exists = sizeof(explicitConversion(&objectToType, objectFromType)) == sizeof(VerySmallStruct) };163 static void test() { TemplateDebugger<sizeof(explicitConversion(&objectToType, objectFromType)), sizeof(VerySmallStruct)>::debug(1,2); }164 };155 //template <int asdf> 156 //class ExplicitConversion<float, int, asdf> 157 //{ 158 //private: 159 // static float objectFromType; // helper object to handle private c'tor and d'tor 160 // static int objectToType; // helper object to handle private c'tor and d'tor 161 //public: 162 // enum { exists = sizeof(explicitConversion(&objectToType, objectFromType)) == sizeof(VerySmallStruct) }; 163 // static void test() { TemplateDebugger<sizeof(explicitConversion(&objectToType, objectFromType)), sizeof(VerySmallStruct)>::debug(1,2); } 164 //}; 165 165 166 166 // checks for conversion via istringstream … … 239 239 /////////////////////// 240 240 241 // template that is used when no explicit template specialisation is available242 template <class ToType, class FromType>243 struct ConverterSpecialised244 {245 static bool convert(ToType* output, const FromType& input)246 {247 // check for explicit conversion via function overloading248 return conversion::convert(output, input,249 conversion::ExplicitPossible<ExplicitConversion<FromType, ToType>::exists>());250 }251 };252 253 241 namespace conversion 254 242 { … … 271 259 //return ConverterSpecialised<ToType, FromType>::convert(output, input); 272 260 } 273 274 261 } 262 263 // template that is used when no explicit template specialisation is available 264 template <class ToType, class FromType> 265 struct ConverterSpecialised 266 { 267 static bool convert(ToType* output, const FromType& input) 268 { 269 // check for explicit conversion via function overloading 270 return conversion::convert(output, input, 271 conversion::ExplicitPossible<ExplicitConversion<FromType, ToType>::exists>()); 272 } 273 }; 274 275 namespace conversion 276 { 275 277 ///////////////// 276 278 //Implicit Cast// -
code/branches/core3/src/util/Math.cc
r1745 r1746 233 233 return false; 234 234 } 235
Note: See TracChangeset
for help on using the changeset viewer.