New Paste :: Recent Pastes:: No Line Numbers
A Paste by Anonymous
1
#include <iostream> #include <string> #include <sstream> using namespace std; /////////////////////////////////////////////////////////////////////// class MultiString { std::string str; static std::stringstream tempStrStream; public: MultiString( std::string t ) : str(t) {} template< class T > T& To() { static T output; tempStrStream.clear(); tempStrStream.str( str ); tempStrStream >> output; return output; } template<> bool& To() { static bool output; output = (str=="true"?true:false); return output; } template<> std::string& To() { return str; } }; std::stringstream MultiString::tempStrStream;