# | Line 112 | Line 112 | namespace oopse { | |
---|---|---|
112 | */ | |
113 | template<typename T> | |
114 | std::string toString(const T& v) { | |
115 | < | std::ostringstream oss; |
116 | < | T result; |
117 | < | |
118 | < | oss << v; |
115 | > | std::ostringstream oss; |
116 | > | if (!oss << v) { |
117 | > | std::cerr << "toString Error" << std::endl; |
118 | > | } |
119 | return oss.str(); | |
120 | } | |
121 | ||
122 | + | template<typename T> |
123 | + | T lexi_cast(const std::string& str) { |
124 | + | T result; |
125 | + | std::istringstream iss; |
126 | + | if (iss >> result) { |
127 | + | std::cerr << "lexi_cast Error" << std::endl; |
128 | + | } |
129 | + | return result; |
130 | + | } |
131 | + | |
132 | /**@todo need implementation */ | |
133 | std::string getPrefix(const std::string& str); | |
134 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |