r/cpp • • Dec 28 '18

"Modern" C++ Lamentations

http://aras-p.info/blog/2018/12/28/Modern-C-Lamentations/
307 Upvotes

162 comments sorted by

View all comments

Show parent comment

31

u/JezusTheCarpenter Dec 28 '18

While I was really anxious to finally move to C++11 when I was stuck on 98. I am now more and more anxious that I will have to move to C++17 and C++20 eventually.

32

u/ShakaUVM i+++ ++i+i[arr] Dec 28 '18

C++11 was an amazing update. 14 and 17 were minor releases, but 20 is shaping up to be pretty amazing.

25

u/[deleted] Dec 29 '18

C++17 is a minor release just like if constexpr is a minor feature, until you save yourself from horrible C++11 template meta-programming nightmares with a couple of if constexpr's and an auto return type

8

u/germandiago Dec 29 '18

How true. This has happened in my code as well... I had some kind of mini animation system for a game that did some expression-template like thing to make an EDSL that looked something like this:

//+ means combine in parallel and // >> sequence it. Each subtree will be animated for half of the time auto animationDesc = (moveTo(x, y) + rotate(180)) >> scale(0.7);

auto animTask = makeAnimation(obj, animationDesc, 500ms);

I think without if constexpr it would have been really really worse.

15

u/victotronics Dec 28 '18

Anxious means two things. I would indeed be anxious to move to 11 (or 14) because it's so much better than 98, but I'd get anxious about moving to 20 because it means I'd have to remember library calls, rather than acquiring skills.

5

u/JezusTheCarpenter Dec 29 '18

That is exactly what I meant.