HACKER Q&A
📣 iudqnolq

Is A Tour of C++ the best way to learn c++?


I know Rust, but after hitting my head against a wall trying to generate Rust bindings for a templated c++ library[1] I realized I should just write this part of my project in c++.

My current plan is to read through Stroustrup's A Tour of C++, then start working on my project. When I encounter issues I'll look the topic up in Stroustrup's The C++ Programming Language.

I'm hoping someone with relevant experience can tell me if this is a decent plan, and if there's a better or faster way to learn enough C++ to write a small program that calls such a library.

[1]: https://github.com/mapnik/mapnik


  👤 jstx1 Accepted Answer ✓
It's fine, you'll only get so far with a book anyway. It's a good idea to get the book phase out of the way as soon as possible and A Tour of C++ is a fine way to do it.

👤 nuancebydefault
Learning C++ is a big endeavor, I think you first need to think about what you want to achieve. As I read it, I think it would be easier to just write a little simple Cpp class layer or even rather simple functional C API on top of the functionality you need from the templated lib, and then bind that to Rust. For those bindings, you can find more easily simple examples. Saves you entering a big rabbit hole, the hassle of needing to know about many cpp aspects, they are plentiful.

👤 synesthesiam
Is there a good guide for writing Rust-like C++, e.g. using stuff in the recent standards to avoid the many footguns?