I make my living working with web scripting languages. In my free time however I’ve been in an eccentric orbit with C++ for years, periodically diving deep into the STL gravity well, basking in the glow of the low level control and the bewildering array of semantic options, until some hangup flings me back outward, narrowly escaping immolation.
Starting with C++11, I began to think maybe this is something I could work into a micro-service, and not hate myself. Smart pointers, type inference and lambdas were the first features that made me tell people “You should check out (modern) C++, there is some cool stuff happening”. Now with C++17 finalized and compilers getting closer to the standard every day, I’m super excited about what’s next.
Previously my experience with C++ has been mashing my programs against clang until the types line up correctly and something compiled. I was eventually able to get something out, but it wasn’t a pleasant encounter. Recently, however, I had my very first moment of C++ nirvana. I’ve had this happen in other languages, where an intuitive application of some part of the language “just works” when applied in some other context. (Un)marshalling json strings in/out of nested Go structs comes to mind. Until now, this had eluded me with C++. The moment came when I tried using a struct initializer as a function param. Below is a simple outline of the situation:
There are still a few features I’d like to see implemented for C++ (modules, and reflection especially), but I feel that right now, it’s on the right track to compete with new languages for mind-share.