vrshoot
annotate libs/assimp/boost/lexical_cast.hpp @ 2:334d17aed7de
visual studio project files
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 02 Feb 2014 18:36:38 +0200 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 /// A quick replacement for boost::lexical_cast for all the Boost haters out there |
nuclear@0 | 2 |
nuclear@0 | 3 #ifndef __AI_BOOST_WORKAROUND_LEXICAL_CAST |
nuclear@0 | 4 #define __AI_BOOST_WORKAROUND_LEXICAL_CAST |
nuclear@0 | 5 |
nuclear@0 | 6 namespace boost |
nuclear@0 | 7 { |
nuclear@0 | 8 |
nuclear@0 | 9 /// A quick replacement for boost::lexical_cast - should work for all types a stringstream can handle |
nuclear@0 | 10 template <typename TargetType, typename SourceType> |
nuclear@0 | 11 TargetType lexical_cast( const SourceType& source) |
nuclear@0 | 12 { |
nuclear@0 | 13 std::stringstream stream; |
nuclear@0 | 14 TargetType result; |
nuclear@0 | 15 |
nuclear@0 | 16 stream << source; |
nuclear@0 | 17 stream >> result; |
nuclear@0 | 18 return result; |
nuclear@0 | 19 } |
nuclear@0 | 20 |
nuclear@0 | 21 } // namespace boost |
nuclear@0 | 22 |
nuclear@0 | 23 #endif // __AI_BOOST_WORKAROUND_LEXICAL_CAST |
nuclear@0 | 24 |