Changeset 2673 for trunk/yat/utility/utility.h
- Timestamp:
- Dec 3, 2011, 1:30:12 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/0.8-stable (added) merged: 2616,2618-2620,2624-2625,2655-2659,2664-2671
- Property svn:mergeinfo changed
-
trunk/yat/utility/utility.h
r2581 r2673 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.