- Timestamp:
- Sep 1, 2012, 11:32:20 AM (12 years ago)
- Location:
- code/branches/testing
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/testing/src/libraries/util/MultiType.h
r9226 r9356 330 330 /// Converts the current value to type T. 331 331 template <typename T> inline bool convert() { return this->force<T>(MultiType(*this)); } 332 // template <typename T> inline bool convert() { return this->force<T>(this->get<typename Loki::TypeTraits<T>::UnqualifiedReferredType>()); }333 332 334 333 /// Resets value and type. Type will be void afterwards and null() returns true. -
code/branches/testing/test/util/ConvertTest.cc
r9114 r9356 91 91 EXPECT_EQ('\n', multi_cast<char>(std::string("\n"))); 92 92 EXPECT_EQ('\0', multi_cast<char>(std::string(""))); 93 EXPECT_EQ('1', multi_cast<char>(std::string("123"))); 93 94 94 95 // bool 95 96 EXPECT_TRUE(multi_cast<bool>(std::string("true"))); 96 97 EXPECT_FALSE(multi_cast<bool>(std::string("false"))); 98 EXPECT_FALSE(multi_cast<bool>(std::string("0"))); 99 EXPECT_FALSE(multi_cast<bool>(std::string("0.123"))); 100 EXPECT_TRUE(multi_cast<bool>(std::string("1"))); 101 EXPECT_TRUE(multi_cast<bool>(std::string("123.456"))); 97 102 98 103 // TODO: Check consistency of conversion depending on MathConvert.h and reversibility
Note: See TracChangeset
for help on using the changeset viewer.