C++ module for CSV parsing. Moved to https://git.luispaulino.com/luispaulino/csv for SHA256 support.
  • C++ 77.9%
  • Meson 22.1%
Find a file
2026-05-15 16:49:48 -04:00
src Increase default buffer size to 1 GB 2026-05-15 16:49:48 -04:00
test Add performance test. 2026-05-15 16:40:52 -04:00
.clangd Add clangd file 2026-05-07 01:48:48 -04:00
.gitignore Update gitignore 2026-05-04 20:36:49 -04:00
LICENSE Initial commit 2026-04-18 05:18:07 +00:00
meson.build Move local modules out of platform-specific paths 2026-05-08 12:21:06 -04:00
README.md Remove GCC warning about mdspan 2026-05-07 12:12:04 -04:00

CSV Parser

C++ module for single-threaded CSV parsing.

Usage

A delimited file can be loaded into an std::vector<std::vector<std::string>> by calling csv::parse(pathname, delimiter).

Example

import csv;
import std;

int main() {
    std::string filepath = "/path/to/file";
    char delimiter = ',';

    auto parsed_data = csv::parse(filepath, delimiter)
    if (!parsed_data.has_value()) {
        std::println("{}", parsed_data.error().message);
        return -1;
    }

    auto [row_num, col_num, temp_data] = parsed_data.value();
    auto data = temp_data | std::views::join | std::ranges::to<std::vector>();
    
    auto data_view = std::mdspan<
        std::string,
        std::extents<std::size_t, std::dynamic_extent, std::dynamic_extent>,
        std::layout_left
    >(data.data(), row_num, col_num);
}