Changeset 1312 for trunk/yat/utility/utility.cc
 Timestamp:
 May 19, 2008, 6:30:52 PM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/utility/utility.cc
r1304 r1312 39 39 bool is_double(const std::string& s) 40 40 { 41 if (is_nan(s)  is_equal(s, "inf")  is_equal(s, "inf")) 42 return true; 43 std::stringstream ss(s); 44 double a; 45 ss>>a; 46 if(ss.fail()) 47 return false; 48 // Check that nothing is left on stream 49 std::string b; 50 ss >> b; 51 return (b.size() ? false : true); 41 return is<double>(s); 52 42 } 53 43 … … 70 60 bool is_float(const std::string& s) 71 61 { 72 if (is_nan(s)  is_equal(s, "inf")  is_equal(s, "inf")) 73 return true; 74 std::stringstream ss(s); 75 float a; 76 ss>>a; 77 if(ss.fail()) 78 return false; 79 // Check that nothing is left on stream 80 std::string b; 81 ss >> b; 82 return (b.size() ? false : true); 62 return is<float>(s); 83 63 } 84 64 … … 86 66 bool is_int(const std::string& s) 87 67 { 88 if (is_nan(s)  is_equal(s, "inf")  is_equal(s, "inf")) 89 return true; 90 std::stringstream ss(s); 91 int a; 92 ss >> a; 93 if(ss.fail()) 94 return false; 95 // Check that nothing is left on stream 96 std::string b; 97 ss >> b; 98 return (b.size() ? false : true); 68 return is<int>(s); 99 69 } 100 70
Note: See TracChangeset
for help on using the changeset viewer.