vincentlaucsb / csv-parser

A high-performance, fully-featured CSV parser and serializer for modern C++.
MIT License
901 stars 150 forks source link

n_rows() return error number, one less, I give up the code. #157

Closed alenwesker closed 3 years ago

alenwesker commented 3 years ago

begin() call a pop without adding the counter. There are multiple unoptimized code piece there, like operator vector, it will cost mutiple copy constructor, at lease use a right-ref version. I seriously doube the code quality, please make some serious unittest.

vincentlaucsb commented 3 years ago

Note: This is a less efficient method of accessing data than using the [] operator.

That's a direct quote on the documentation for operator vector(). That quote is also placed directly above the implementation for operator vector(). Notice how the documentation also tells you the most efficient alternative to operator vector?

How many rows (minus header) have been read so far.

That's a direct quote on the documentation for n_rows, which explains the pop() without adding to the counter.

I'm pretty impressed that you did a detailed analysis of my code while also simultaneously ignoring the comments, located right above the code, which would have directly answered your questions.

I'm going to assume this is an attempt to troll me, because nobody is seriously this stupid.

alenwesker commented 3 years ago

I read 11 rows a file(With the header is 12 lines), and n_rows returns 10. I may reply in the wrong way that makes you feel I am trolling you; that's my bad. Check that. In simple debug, I highly double that's caused by the begin() member function. But I am in a very hurry situation that more detailed debugging is up to you. Plus, https://www.reddit.com/r/cpp/comments/basvsa/sso_effects_minicsv_wins_string_view_csv_parser/
According to this page, some operations are dragging back. The operator vector may be or may not be the issue. I can see you put a lot of effort into this project, and I like some features. Just try to make it better regardless of what I said.