1 #ifndef MSP_STRINGS_LEXICALCAST_H_
2 #define MSP_STRINGS_LEXICALCAST_H_
11 class LexicalError: public Exception
14 LexicalError(const std::string &w_): Exception(w_) { }
18 T lexical_cast(const std::string &s)
20 std::istringstream ss(s);
21 ss.setf(std::ios_base::fmtflags(0), std::ios_base::skipws);
26 if(ss.fail() || !ss.eof())
27 throw LexicalError("Conversion failure");
33 std::string lexical_cast(const T &v, const Fmt &f=Fmt())
35 std::ostringstream ss;