55* Header-only library
66* Fast, asynchronous, multi-threaded processing using:
77 - [ Lock-free Concurrent Queues] ( https://github.com/cameron314/concurrentqueue )
8- - [ Robin hood Hashing] ( https://github.com/Tessil /robin-map )
9- * Requires C++11
8+ - [ Robin hood Hashing] ( https://github.com/martinus /robin-hood-hashing )
9+ * Requires C++17
1010* MIT License
1111
1212## Table of Contents
2929Simply include reader.hpp and you're good to go.
3030
3131``` cpp
32- #include < reader.hpp>
32+ #include < csv/ reader.hpp>
3333```
3434To start parsing CSV files, create a ``` csv::Reader ``` object and call ``` .read(filename) ``` .
3535
@@ -43,8 +43,8 @@ This ```.read``` method is non-blocking. The reader spawns multiple threads to t
4343``` cpp
4444while (foo.busy()) {
4545 if (foo.has_row()) {
46- auto row = foo.next_row(); // Each row is a robin_map ( https:// github.com/Tessil /robin-map )
47- auto foo = row[ "foo"] // You can use it just like an std::unordered_map
46+ auto row = foo.next_row(); // Each row is a csv::unordered_flat_map ( github.com/martinus /robin-hood-hashing )
47+ auto foo = row[ "foo"] // You can use it just like an std::unordered_map
4848 auto bar = row[ "bar"] ;
4949 // do something
5050 }
@@ -256,7 +256,7 @@ Note: Do not provide num_rows greater than the actual number of rows in the file
256256void parse (const std::string& filename) {
257257 csv::Reader foo;
258258 foo.read(filename);
259- std::vector<csv::robin_map <std::string , std::string>> rows;
259+ std::vector<csv::unordered_flat_map <std::string_view , std::string>> rows;
260260 while (foo.busy()) {
261261 if (foo.ready()) {
262262 auto row = foo.next_row();
@@ -267,7 +267,7 @@ void parse(const std::string& filename) {
267267```
268268
269269```bash
270- $ g++ -pthread -std=c++11 -O3 -Iinclude/ -o test benchmark.cpp
270+ $ g++ -pthread -std=c++17 -O3 -Iinclude/ -o test benchmark.cpp
271271$ time ./test
272272```
273273
@@ -289,7 +289,7 @@ Here are the average-case execution times:
289289Simply include writer.hpp and you're good to go.
290290
291291``` cpp
292- #include < writer.hpp>
292+ #include < csv/ writer.hpp>
293293```
294294To start writing CSV files, create a ``` csv::Writer ``` object and provide a filename:
295295
@@ -308,13 +308,13 @@ foo.configure_dialect()
308308Now it's time to write rows. You can do this in multiple ways:
309309
310310``` cpp
311- foo.write_row(" 1" , " 2" , " 3" ); // parameter packing
312- foo.write_row({"4", "5", "6"}); // std::vector
313- foo.write_row(std::map<std::string, std::string>{ // std::map
311+ foo.write_row(" 1" , " 2" , " 3" ); // parameter packing
312+ foo.write_row({"4", "5", "6"}); // std::vector
313+ foo.write_row(std::map<std::string, std::string>{ // std::map
314314 {"a", "7"}, {"b", "8"}, {"c", "9"} });
315- foo.write_row(std::unordered_map<std::string, std::string>{ // std::unordered_map
315+ foo.write_row(std::unordered_map<std::string, std::string>{ // std::unordered_map
316316 {"a", "7"}, {"b", "8"}, {"c", "9"} });
317- foo.write_row(csv::robin_map <std::string, std::string>{ // robin_map
317+ foo.write_row(csv::unordered_flat_map <std::string, std::string>{ // csv::unordered_flat_map
318318 {"a", "7"}, {"b", "8"}, {"c", "9"} });
319319```
320320
0 commit comments