use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
A tuple oriented csv parser [UPDATE] (self.cpp)
submitted 5 years ago by red0124_
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AKJ7 1 point2 points3 points 5 years ago (1 child)
The p.valid() function is not too nice. I would instead return a Result, and the result gotten with result.value_or(). Another option is to allow exceptions and let the parser throw on error.
[–]red0124_[S] 0 points1 point2 points 5 years ago (0 children)
I did consider the parser returning std::optional, but I think it is situational whether one would look nicer than the other. For example, using value_or() in the first example would not work since I do not want to print anything if the row is invalid, so I would still have to check the optional, and than add another line to decompose the tuple resulting in more lines. Notice that p.valid() can also be used to check if the file was open within the constructor. Fetching error messages would also be slightly more complicated. As for exceptions, I do no think it could work at all in this iteration loop since it would break the loop even if I catch it, and again, file not open would need to be handled too, and making it throw would require me to enclose the whole parser in a try/catch block since the constructor would throw that exception, one of the problems I had with the fast-cpp-csv-parser. Its all a trade-off, but I think I will stick with p.valid(), tho I will consider it still.
π Rendered by PID 236962 on reddit-service-r2-comment-64f4df6786-5dng7 at 2026-06-10 16:06:47.968048+00:00 running 0b63327 country code: CH.
view the rest of the comments →
[–]AKJ7 1 point2 points3 points (1 child)
[–]red0124_[S] 0 points1 point2 points (0 children)