49 getRows(std::string filename, std::uint32_t skipLines, std::uint32_t maxRows = 0) {
51 std::ifstream in(filename);
53 throw std::runtime_error(
"Couldn't open file: " + filename);
55 std::vector<std::tuple<Types...>> rows;
59 while (std::getline(in, current)) {
63 if (current[0] ==
'#')
71 std::vector<std::string> field_list;
73 std::istringstream row_stream(current);
76 while (std::getline(row_stream, field,
',')) {
78 const char *whitespaces =
" \t\r\n";
80 auto start = field.find_first_not_of(whitespaces);
81 if (start == std::string::npos) {
82 field_list.push_back(
"");
85 auto end = field.find_last_not_of(whitespaces);
88 field_list.push_back(field.substr(start, end - start + 1));
92 rows.push_back(castLine<Types...>(field_list));
95 if (maxRows > 0 && rows.size() >= maxRows)