With 2020 coming into full swing – it’s time for Bitmovin and our engineering teams to not only reflect on the past year but also to celebrate the growth of standards in the development industry for the past half-century. December 2019 is a historic month for computing – as it’s the official month when the venerable coding language, C++, turns 40 years old.
At the very base, Engineers at Bitmovin use C++ for performance-critical parts of our Encoding service; but our usage extends to the rest of our teams as we are obsessed with state of the art code. We allow little-to-no leniency in our code for unnecessary computations, and yet, we’ve designed our code to remain expressive and easy to understand. This is one of the reasons behind the success of our products. In addition, using state of the art programming features enables speedy updates to satisfy any new features that our customers request from our products.
Growth of C++
As C++ evolves and improves, our Bitmovers are keen to upgrade our code alongside the powerhouse language. To do so, we look forward to implementing C++20 once compilers reach maturity with related features. As we prepare for the coming year, this blog acts as an opportunity to review all the features that have been added to C++ in 2014 and 2017 (as well as the improvements and uses that Bitmovin has applied)
With this evolutionary iteration of C++, lambda functions have been improved considerably.
We can use keyword auto to let the compiler infer the type of input parameters making lambda functions working as templates:
Capturing variables on lambda function also gained a lot of flexibility thanks to generalized lambda capture:
It is possible to move more computation to compile time thanks to the fact that it is possible to write constexpr functions made of multiple statements and with conditional blocks:
Finally, it’s worth mentioning that a standard way to deprecate features has been introduced:
Coding with C++17
Variadic templates are much easier to implement with this evolutionary iteration of C++ thanks to folded expressions:
It is possible to have conditional blocks to be evaluated only at compile time as an alternative to function overloads:
Nested namespaces are less verbose:
We can tell the compiler that a returned value should not be ignored by the caller, thereby preventing bugs:
But the feature that we like most at Bitmovin is structured binding:
That makes iterating maps much more expressive:
Very useful classes have been added to the standard library:
Template class std::optional:
A non-mutable reference to a piece of text can be expressed with std::string_view:
Another template class std::variant has been added to implement type-safe unions:
With this evolutionary iteration C++ also gained standard support for file systems:
C++ is a powerful, efficient and wide-spread language, but to reach maximum effectiveness – it’s application requires developers to invest significant time in mastering the language and its diverse set of functions.
Us “Bitmovers” are naturally curious people and are constantly driven to try or learn new things. So it’s a pleasure to discover new hidden features or more elegant coding patterns every week.
Did you enjoy this post? Then you may find the following blog posts interesting as well!