Is there a book like this for C++?

Is there a book like this for C++?

A C++ equivalent of this I mean

iirc Stroustrup's C++ reference is like 6 million pages long

No. C++ is best learned with Youtube tutorials.

It pains me that this post was probably made unironically, and even if it wasn't that there are posts like this every day that are made sincerely on Sup Forums

A Tour of C++ is the closest you'll get. It basically gives you the rundown on what you need to know to actually use C++.
The C++ programming language I use more for reference than learning.

C++ changed a lot over the years. If you plan to work on modern projects, you'll want a book that teaches the modern style.

C++ is too big and covers too many styles to cover everything that K&R could.

This guy has it right.

What about the two most commonly recommended books: C++ Primer and Accelerated C++?

...

Those are good if you need to learn C++ from scratch. The two books recommended there are mainly references.

Is it better to learn C first then learn C++ or just learn C++?

I think knowing basic C (K&R is good for that) would be an advantage.

C and C++ are very different languages. While it may be true that C++ is a rough superset of C, modern C++ isn't written much like C.

My advice is to learn C first and get comfortable with it before you start learning C++. C is a complete and small language, so it shouldn't be too time consuming.
Don't fall into the trap of writing C++ the same as you write C or the same as you write Java, pay attention to the best practices for C++ specifically.

I'm reading through that but I find the exercises at the end of the chapters particularly difficult to complete with the knowledge given in the same chapter, I might read through the whole book and try them again after.

Yeah, I think that's normal. K&R's exercises are pretty difficult.

Thanks, I was getting real demotivated every time I had to refer to the Internet for help

As long as you actually try you can just look up solutions if you're stuck, and do your best to understand them, then redo the exercise on your own.

I started with 2 books
K&r the c programming language
And the schildt c: the complete programming reference
Then when I moved to c++ i used
Stroustrups the c++ programming language (which is a reference and if you know the oop concepts it's what you will only need)

If you want to gitgud on ooo and generally programming you should read
Design patterns: elements of reusable oo s/w
And last but not least
Effective c++.

For those who want to dive more into project linking, object files e.t.c.
I'd recommend also the
Advanced linking and compiling c and c++
And that's all.

Ok so do i understand that this thread correctly, learning modern c++ is very important because it differs strongly from old c++.
And c is even more different.

So if i am naive in c style languages and want to learn powerful c++ i should just start by learning modern c++?

Is pic related any good for that task?
Why do those books have to have 1300 pages? I know arrays from other languages, why do i have to wait till chapter 18??

>Ok so do i understand that this thread correctly, learning modern c++ is very important because it differs strongly from old c++.
>And c is even more different
Yep. C++11 is practically a new language. Most of what changed afterwards is minor. Anything older is trash.
>So if i am naive in c style languages and want to learn powerful c++ i should just start by learning modern c++?
Learn C first, if only for context.
>Why do those books have to have 1300 pages? I know arrays from other languages, why do i have to wait till chapter 18??
Arrays in C and C++ are weird.

Learning modern c++ is for those that want to brag about "muh lamda functions" and other similar staff.
That's the reason why many projects avoid c++ and go for c or other languages.
If you want to learn modern c++ you'll have to read the news every couple of years to keep up with the shitload of features.
Personally I code in prior to c++11 but when possible, e.g. target compiler, I use the convinient enum class feature.
I believe the rest of the modern c++ features bloat your code and make it unreadable for most c++ devs.
...but that's just me, others overdo it with the new features...but their source code look worse than perl code.

>Effective c++.
is that the oreilly one with a bird on the cover?

Yes, you can pick whatever versiin of it, pre or post c++11

I thought pre-11 c++ wasn't worth learning?

Opinions differ I guess.
Personally I'd just disregard them. The single best reason to use C++ is RAII and prior to C++11's move semantics it was either broken or a waste.

Depends on what you do.
If you want your code to be portable, light weight, use small footprint, can target embedded devices and other good staff... Then use pre c++11 features.
Imagine if I had to write some kernel or usersoace program in my work and I put some lambda expressions in there. The boss would come and hit me with a shovel on the head.
Imagine if you try to optimize c++ and open up the fsource code and see a flood of auto pointers.
First we had pointers... Which were replaced with references... And then auto pointers....what's next?
That's basically java with a different name.

>First we had pointers... Which were replaced with references... And then auto pointers....what's next?
>That's basically java with a different name.
You really have no idea what the fuck you're talking about.

I want to start writing on a genetic algorithm for a very specific scientific topic in my masters degree. My masters degree time starts in 6 weeks.
I have no time to read K&R before starting with c++

What book should i start now?

I hope you have plenty of programming experience already. A Tour Of C++ covers everything you need to know in breadth but not depth.

I almost killed myself when i saw it.

I have only experience in fortran and a little bit of c#, but no fundamental just hacking around with existing code and introducing new features.

Does this book introduce those new concepts i will encounter by moving from my past experience to c++?
I think it will be much easier and faster in the long run to create, maintain and expand a great program with c++ instead of fortran

The hacking around was meant for c#.
I have created code from the ground up in fortran.

I just dont have any knowledge of the arcane concepts introduced by oop and c++'s other (not yet known to myself) features

To be completely honest, there's no point learning C++ now. Rust is a modern and better designed language and it's going to replace C++ going forward.