From efa8224a55395ec781d3e365b09ff02bc90fe665 Mon Sep 17 00:00:00 2001 From: hirohira Date: Tue, 15 Oct 2024 08:20:04 +0900 Subject: [PATCH] Support for non null-terminated string views --- include/internal/csv_utility.cpp | 2 +- single_include/csv.hpp | 2 +- single_include_test/csv.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/internal/csv_utility.cpp b/include/internal/csv_utility.cpp index 953a9e50..da0eb280 100644 --- a/include/internal/csv_utility.cpp +++ b/include/internal/csv_utility.cpp @@ -12,7 +12,7 @@ namespace csv { * @snippet tests/test_read_csv.cpp Parse Example */ CSV_INLINE CSVReader parse(csv::string_view in, CSVFormat format) { - std::stringstream stream(in.data()); + std::stringstream stream(std::string(in.data(), in.length())); return CSVReader(stream, format); } diff --git a/single_include/csv.hpp b/single_include/csv.hpp index 811c8e14..01fa4e71 100644 --- a/single_include/csv.hpp +++ b/single_include/csv.hpp @@ -8515,7 +8515,7 @@ namespace csv { * @snippet tests/test_read_csv.cpp Parse Example */ CSV_INLINE CSVReader parse(csv::string_view in, CSVFormat format) { - std::stringstream stream(in.data()); + std::stringstream stream(std::string(in.data(), in.length())); return CSVReader(stream, format); } diff --git a/single_include_test/csv.hpp b/single_include_test/csv.hpp index 811c8e14..01fa4e71 100644 --- a/single_include_test/csv.hpp +++ b/single_include_test/csv.hpp @@ -8515,7 +8515,7 @@ namespace csv { * @snippet tests/test_read_csv.cpp Parse Example */ CSV_INLINE CSVReader parse(csv::string_view in, CSVFormat format) { - std::stringstream stream(in.data()); + std::stringstream stream(std::string(in.data(), in.length())); return CSVReader(stream, format); }