Changeset 1422
- Timestamp:
- Dec 15, 2011, 12:59:52 AM (11 years ago)
- Location:
- trunk/yat
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/config_public.h.in
r1351 r1422 1 1 #ifndef _theplu_yat_utility_config_public_ 2 #define _theplu_yat_utility_config_public_ 2 #define _theplu_yat_utility_config_public_ 3 3 4 // $Id: config_public.h.in 2 431 2011-03-06 20:04:31Z peter $4 // $Id: config_public.h.in 2673 2011-12-03 00:30:12Z peter $ 5 5 6 6 /* … … 31 31 #undef YAT_HAVE_GCC_DEPRECATED 32 32 33 /// Define if compiler supports boost concept with constructor 34 #undef YAT_HAVE_BOOST_CONCEPT_WITH_CONSTRUCTOR 35 33 36 /// Version of yat in string format 34 37 #undef YAT_VERSION -
trunk/yat/utility.h
r1399 r1422 2 2 #define _theplu_yat_utility_utility_ 3 3 4 // $Id: utility.h 2 581 2011-10-05 18:43:27Z peter $4 // $Id: utility.h 2673 2011-12-03 00:30:12Z peter $ 5 5 6 6 /* … … 35 35 #include "Exception.h" 36 36 37 #include <algorithm> 38 #include <cctype> 37 39 #include <cmath> 40 #include <functional> 38 41 #include <limits> 42 #include <locale> 39 43 #include <istream> 40 44 #include <string> … … 331 335 332 336 template<typename T> 333 void load(std::istream& is, std::vector<T>& vec, char sep ='\0')337 void load(std::istream& is, std::vector<T>& vec, char sep) 334 338 { 335 339 detail::VectorPusher<T> pusher; … … 352 356 bool convert(const std::string& s, T& result) 353 357 { 358 if (!std::numeric_limits<T>::is_signed) { 359 // first non-whitespace character 360 std::string::const_iterator iter = s.begin(); 361 while (iter!=s.end() && std::isspace(*iter)) 362 ++iter; 363 // unsigned int cannot start with a '-' and with some compilers 364 // operation ss >> result won't fail so catch it like this instead. 365 if (iter==s.end() || *iter=='-') 366 return false; 367 } 354 368 std::istringstream ss(s); 355 369 ss >> result;
Note: See TracChangeset
for help on using the changeset viewer.