diff --git a/main.h b/main.h index 18821a4..f437081 100644 --- a/main.h +++ b/main.h @@ -7,14 +7,14 @@ * Utility function to split a string by the delimiter */ inline std::vector -split(const std::string& record, char delimiter = ',') +split(std::string_view record, char delimiter = ',') { std::vector fields; size_t begin = 0, end; do { end = record.find_first_of(delimiter, begin); - fields.push_back(record.substr(begin, end - begin)); + fields.emplace_back(record.substr(begin, end - begin)); begin = end + 1; } while (end != std::string::npos);