Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

hijacking: What is a good reference to learn the minimal amount of C++ to do codewars/leetcode, write minor programs?

Would prefer something that keeps with modern C++ if possible.



I haven't used C++ very much, but I found "A Tour of C++" to be a great introduction. It focuses on the core of C++ OOP semantics and is written by Bjarne Stroustrup himself. I like the book because it doesn't try to answer the question "which feature is the canonical way to solve problem X", since from what I understand, the "canonical" way to solve a problem in C++ changes quite frequently as new features are added. It was recommended to me by one of my professors a few years back for being short and accessible to a person who is looking to learn what makes C++ special, not how to program from scratch.

EDIT: Reading the page again, it looks like the book does have some discussion of C++17 and C++20 features, but I focused on the first few chapters which really nail down the whole copy and move semantics feature as well as operator overloading.


When I went on a Modern C++ bender a year or two ago I went with Stroustrup's A Tour of C++ (2nd edition when I bought it, 3rd is out now). It was a good read, covered a lot of details quickly. The rest of my re-learning was using cppreference and reading through the list of standard types and functions/methods on them, trying to translate old (clunky, often subtly broken) C++03 code into modern C++.

https://www.stroustrup.com/tour3.html

https://en.cppreference.com/w/


"Minimal" and "C++" do not belong in the same sentence :-)

That said, C++ Primer by Lippman, Lajoie, Moo is a good book for beginners. I think the latest edition covers upto C++11. You can then followup with Modern C++ Cookbook by Marius Bancila for newer features upto C++20.


I write low latency C++ for a living. Read "A Tour of C++", focusing on the STL and the basics of the language, basics of templates. Anything else related to STL, look at cppreference.


Read leetcode solutions.

If you can already code you'll pick it up in seconds.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: