comparison c/utils.cpp @ 230:bc4ea09b1743

compatibility modifications for visual studio compilation
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 29 Jun 2012 16:15:13 -0400
parents c8a149fccfda
children c389fae9689a
comparison
equal deleted inserted replaced
207:48f83ff769fd 230:bc4ea09b1743
6 #include <fstream> 6 #include <fstream>
7 #include <sstream> 7 #include <sstream>
8 8
9 using namespace std; 9 using namespace std;
10 10
11 vector<vector<float> > loadNumbers(const string& filename, const string& separator /* = " " */) { 11 std::vector<std::vector<float> > loadNumbers(const string& filename, const string& separator /* = " " */) {
12 ifstream in(filename.c_str()); 12 ifstream in(filename.c_str());
13 vector<vector<float> > result; 13 std::vector<std::vector<float> > result;
14 14
15 if (::openCheck(in, filename, "loadNumbers")) { 15 if (::openCheck(in, filename, "loadNumbers")) {
16 while (!in.eof()) { 16 while (!in.eof()) {
17 string line = ::getlineComment(in); 17 string line = ::getlineComment(in);
18 vector<string> tokens; 18 std::vector<string> tokens;
19 ::split(tokens, line, separator); 19 ::split(tokens, line, separator);
20 vector<float> numbers; 20 std::vector<float> numbers;
21 BOOST_FOREACH(string s, tokens) 21 BOOST_FOREACH(string s, tokens)
22 numbers.push_back(::toFloat(s)); 22 numbers.push_back(::toFloat(s));
23 if (!numbers.empty()) 23 if (!numbers.empty())
24 result.push_back(numbers); 24 result.push_back(numbers);
25 } 25 }