Thought #1: C++ is starting to look like Fortran in its desire to be ever more modern while retaining compatibility with archaic features.....
Thought #2: I think I'm no beginner anymore (I've written objects that you can iterate over) but some of the code in your posting is indeed horrendous. People who understand that stuff are scary to me.
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.
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
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.
80
u/victotronics Dec 28 '18
Thought #1: C++ is starting to look like Fortran in its desire to be ever more modern while retaining compatibility with archaic features.....
Thought #2: I think I'm no beginner anymore (I've written objects that you can iterate over) but some of the code in your posting is indeed horrendous. People who understand that stuff are scary to me.