您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

27 行
600 B

  1. /// A quick replacement for boost::lexical_cast for all the Boost haters out there
  2. #ifndef __AI_BOOST_WORKAROUND_LEXICAL_CAST
  3. #define __AI_BOOST_WORKAROUND_LEXICAL_CAST
  4. #include <sstream>
  5. namespace boost
  6. {
  7. /// A quick replacement for boost::lexical_cast - should work for all types a stringstream can handle
  8. template <typename TargetType, typename SourceType>
  9. TargetType lexical_cast( const SourceType& source)
  10. {
  11. std::stringstream stream;
  12. TargetType result;
  13. stream << source;
  14. stream >> result;
  15. return result;
  16. }
  17. } // namespace boost
  18. #endif // __AI_BOOST_WORKAROUND_LEXICAL_CAST