16 constexpr int get_char(std::string_view& str) {
if (str.empty()) {
return -1; }
const auto result =
static_cast<unsigned char>(str[0]); str.remove_prefix(1);
return result; }
17 constexpr int get_invalid_char(std::type_identity<std::string_view>) {
return -1; }
19 inline int get_char(std::istream&
strm) {
return strm.get(); }
21 requires std::derived_from<T, std::istream>
22 constexpr int get_invalid_char(std::type_identity<T>) {
return -1; }
42 template <
typename BUFFER,
typename ROW_CALLBACK>
45 using ghassanpl::formats::detail::get_char;
46 using ghassanpl::formats::detail::get_invalid_char;
48 static constexpr auto invalid_value = get_invalid_char(std::type_identity<std::remove_cvref_t<
decltype(
buffer)>>{});
52 std::vector<std::string>
row;
constexpr auto bit_count
Equal to the number of bits in the type.
intptr_t load(BUFFER &&buffer, ROW_CALLBACK &&row_callback)
Loads a CSV text file from buffer, calling row_callback for each row.
The below code is based on Sun's libm library code, which is licensed under the following license: