csv-parser icon indicating copy to clipboard operation
csv-parser copied to clipboard

feature request: std::vector style at() or [] index operator to get a row

Open qingfengxia opened this issue 5 years ago • 1 comments

it may exists such a smilar API, but I did not see it in my scan. thank you!

qingfengxia avatar Jun 18 '20 13:06 qingfengxia

The parser might not load the entire file at once if it's large, and once it reads a row, it discards it (unless you save it), so a random access [] operator can't be really be done.

Whenever I want to grab a specific row, I would just use a for loop with a counter variable. Furthermore, it would be pretty easy to just write a function that save all rows that a CSVReader produces into an std::vector.

Note that if you have a CSVRow row then you can use the conversion operator std::vector<std::string>(row).

vincentlaucsb avatar Jul 04 '20 03:07 vincentlaucsb