ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/utils/StringUtils.hpp
(Generate patch)

Comparing trunk/OOPSE-4/src/utils/StringUtils.hpp (file contents):
Revision 1930 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
Revision 1980 by tim, Mon Feb 7 19:13:43 2005 UTC

# 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(str);        
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines