Ignore:
Timestamp:
Jun 15, 2010, 4:11:47 AM (12 years ago)
Author:
Peter
Message:

adding a test for load function (T=string) and fixed a bug in same function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/utility.h

    r2270 r2273  
    288288      if (line.empty() && ignore_empty)
    289289        continue;
    290       matrix.resize(matrix.size()+1);
    291       std::vector<double>& v=matrix.back();
     290      matrix.push_back(std::vector<T>());
     291      std::vector<T>& v=matrix.back();
    292292      v.reserve(nof_columns);
    293293      std::stringstream ss(line);
    294294      load(ss, v, sep);
    295       // add NaN for final separator
     295      // add NaN for final separator (or empty string if T=std::string)
     296      detail::VectorPusher<T> pusher;
    296297      if(sep!='\0' && !line.empty() && line[line.size()-1]==sep)
    297         v.push_back(std::numeric_limits<T>::quiet_NaN());
     298        pusher("", v);
    298299     
    299300      if (rectangle && nof_columns && v.size()!=nof_columns) {
     
    324325      if(!ok)
    325326        break;
    326      
    327327      pusher(element, vec);
    328328    }
Note: See TracChangeset for help on using the changeset viewer.