Developers

Celebrating C++: State of the Art Standards for All

Riccardo Ressi
. 2 min read
- Bitmovin

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 was a historic month for computing – as it was the official month when the venerable coding language, C++, turned 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.

bitmovin-CPP

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)

About C++14

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:
C++ Auto Compiler
Capturing variables on lambda function also gained a lot of flexibility thanks to generalized lambda capture:
Generalized lambda capture

C++ contexpr

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:
C++ contexpr keyword
Finally, it’s worth mentioning that a standard way to deprecate features has been introduced:
C++ Deprecation

Coding with C++17

Variadic templates are much easier to implement with this evolutionary iteration of C++ thanks to folded expressions:
C++ Folded Expressions
It is possible to have conditional blocks to be evaluated only at compile time as an alternative to function overloads:
C++ Conditional Blocks
Nested namespaces are less verbose:
C++ Nested namespace
We can tell the compiler that a returned value should not be ignored by the caller, thereby preventing bugs:
- Bitmovin
But the feature that we like most at Bitmovin is structured binding:
C++ structured binding
That makes iterating maps much more expressive:
- Bitmovin
Very useful classes have been added to the standard library:
Template class std::optional:
C++ std::optional:
A non-mutable reference to a piece of text can be expressed with std::string_view:
C++ std::string_view:
Another template class std::variant has been added to implement type-safe unions:
C++ std::variant
With this evolutionary iteration C++ also gained standard support for file systems:
- Bitmovin

Conclusion

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!


Related Posts

- Bitmovin
Developers

Open-Source vs. Commercial Players: Understanding the True Cost of Ownership

Join the conversation