#ifndef CPPUNIT_TOOLS_STRINGHELPER_H #define CPPUNIT_TOOLS_STRINGHELPER_H #include #include #include #include CPPUNIT_NS_BEGIN /*! \brief Methods for converting values to strings. Replaces CPPUNIT_NS::StringTools::toString */ namespace StringHelper { // work around to handle C++11 enum class correctly. We need an own conversion to std::string // as there is no implicit coversion to int for enum class. template typename std::enable_if::value, std::string>::type toString(const T& x) { OStringStream ost; ost << x; return ost.str(); } template typename std::enable_if::value, std::string>::type toString(const T& x) { OStringStream ost; ost << static_cast::type>(x); return ost.str(); } } CPPUNIT_NS_END #endif // CPPUNIT_TOOLS_STRINGHELPER_H