Changeset 1422 for trunk


Ignore:
Timestamp:
Dec 15, 2011, 12:59:52 AM (9 years ago)
Author:
Peter Johansson
Message:

latest yat

Location:
trunk/yat
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/config_public.h.in

    r1351 r1422  
    11#ifndef _theplu_yat_utility_config_public_
    2 #define _theplu_yat_utility_config_public_ 
     2#define _theplu_yat_utility_config_public_
    33
    4 // $Id: config_public.h.in 2431 2011-03-06 20:04:31Z peter $
     4// $Id: config_public.h.in 2673 2011-12-03 00:30:12Z peter $
    55
    66/*
     
    3131#undef YAT_HAVE_GCC_DEPRECATED
    3232
     33/// Define if compiler supports boost concept with constructor
     34#undef YAT_HAVE_BOOST_CONCEPT_WITH_CONSTRUCTOR
     35
    3336/// Version of yat in string format
    3437#undef YAT_VERSION
  • trunk/yat/utility.h

    r1399 r1422  
    22#define _theplu_yat_utility_utility_
    33
    4 // $Id: utility.h 2581 2011-10-05 18:43:27Z peter $
     4// $Id: utility.h 2673 2011-12-03 00:30:12Z peter $
    55
    66/*
     
    3535#include "Exception.h"
    3636
     37#include <algorithm>
     38#include <cctype>
    3739#include <cmath>
     40#include <functional>
    3841#include <limits>
     42#include <locale>
    3943#include <istream>
    4044#include <string>
     
    331335
    332336  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)
    334338  {
    335339    detail::VectorPusher<T> pusher;
     
    352356  bool convert(const std::string& s, T& result)
    353357  {
     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    }
    354368    std::istringstream ss(s);
    355369    ss >> result;
Note: See TracChangeset for help on using the changeset viewer.