From 5a05e6a85dead3026794731f37c9bebfe354c9e9 Mon Sep 17 00:00:00 2001 From: Asvin Goel Date: Sat, 15 Jun 2024 21:24:28 +0200 Subject: [PATCH] Use const CSVFormat& in calculate_score (#236) Co-authored-by: Asvin Goel --- include/internal/csv_reader.cpp | 2 +- include/internal/csv_reader.hpp | 2 +- single_include/csv.hpp | 4 ++-- single_include_test/csv.hpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/internal/csv_reader.cpp b/include/internal/csv_reader.cpp index dfd0dc73..008a487a 100644 --- a/include/internal/csv_reader.cpp +++ b/include/internal/csv_reader.cpp @@ -38,7 +38,7 @@ namespace csv { return CSVRow(std::move(rows[format.get_header()])); } - CSV_INLINE GuessScore calculate_score(csv::string_view head, CSVFormat format) { + CSV_INLINE GuessScore calculate_score(csv::string_view head, const CSVFormat& format) { // Frequency counter of row length std::unordered_map row_tally = { { 0, 0 } }; diff --git a/include/internal/csv_reader.hpp b/include/internal/csv_reader.hpp index 1cdf6e0d..300e7dac 100644 --- a/include/internal/csv_reader.hpp +++ b/include/internal/csv_reader.hpp @@ -34,7 +34,7 @@ namespace csv { size_t header; }; - CSV_INLINE GuessScore calculate_score(csv::string_view head, CSVFormat format); + CSV_INLINE GuessScore calculate_score(csv::string_view head, const CSVFormat& format); CSVGuessResult _guess_format(csv::string_view head, const std::vector& delims = { ',', '|', '\t', ';', '^', '~' }); } diff --git a/single_include/csv.hpp b/single_include/csv.hpp index bbfb6449..a65bc44c 100644 --- a/single_include/csv.hpp +++ b/single_include/csv.hpp @@ -6238,7 +6238,7 @@ namespace csv { size_t header; }; - CSV_INLINE GuessScore calculate_score(csv::string_view head, CSVFormat format); + CSV_INLINE GuessScore calculate_score(csv::string_view head, const CSVFormat& format); CSVGuessResult _guess_format(csv::string_view head, const std::vector& delims = { ',', '|', '\t', ';', '^', '~' }); } @@ -7359,7 +7359,7 @@ namespace csv { return CSVRow(std::move(rows[format.get_header()])); } - CSV_INLINE GuessScore calculate_score(csv::string_view head, CSVFormat format) { + CSV_INLINE GuessScore calculate_score(csv::string_view head, const CSVFormat& format) { // Frequency counter of row length std::unordered_map row_tally = { { 0, 0 } }; diff --git a/single_include_test/csv.hpp b/single_include_test/csv.hpp index bbfb6449..a65bc44c 100644 --- a/single_include_test/csv.hpp +++ b/single_include_test/csv.hpp @@ -6238,7 +6238,7 @@ namespace csv { size_t header; }; - CSV_INLINE GuessScore calculate_score(csv::string_view head, CSVFormat format); + CSV_INLINE GuessScore calculate_score(csv::string_view head, const CSVFormat& format); CSVGuessResult _guess_format(csv::string_view head, const std::vector& delims = { ',', '|', '\t', ';', '^', '~' }); } @@ -7359,7 +7359,7 @@ namespace csv { return CSVRow(std::move(rows[format.get_header()])); } - CSV_INLINE GuessScore calculate_score(csv::string_view head, CSVFormat format) { + CSV_INLINE GuessScore calculate_score(csv::string_view head, const CSVFormat& format) { // Frequency counter of row length std::unordered_map row_tally = { { 0, 0 } };