48 getRows(std::string filename, std::uint32_t skipLines, std::uint32_t maxRows = 0) {
50 std::ifstream in(filename);
52 throw std::runtime_error(
"Couldn't open file: " + filename);
54 std::vector<std::tuple<Types...>> rows;
58 while (std::getline(in, current)) {
62 if (current[0] ==
'#')
70 std::vector<std::string> field_list;
72 std::istringstream row_stream(current);
75 while (std::getline(row_stream, field,
',')) {
77 const char *whitespaces =
" \t\r\n";
79 auto start = field.find_first_not_of(whitespaces);
80 if (start == std::string::npos) {
81 field_list.push_back(
"");
84 auto end = field.find_last_not_of(whitespaces);
87 field_list.push_back(field.substr(start, end - start + 1));
91 rows.push_back(castLine<Types...>(field_list));
94 if (maxRows > 0 && rows.size() >= maxRows)