Use of C++14 in rippled
Posted by Howard Hinnant
C++ is a language under constant development, resulting in alternating minor and major releases. The last major release of C++ was C++11. A minor release has just been approved by all participating national bodies (zero negative votes). This will be C++14. C++17 is the next planned major release and is currently under development by the committee.
Rippled has already adopted a number of useful C++14 features. We’ve done this through the development environment where native support is available, or by emulating the features through providing compatible implementations using our beast cxx14 compatibility library ( https://github.com/ripple/rippled/tree/develop/src/beast/beast/cxx14).
A brief list of notable features:
Use of std::make_unique for secure and exception safe allocations. For a more in-depth discussion, have a look at this wikipedia article on Resource Acquisition is Initialization
Simplified use of type transformations with type aliased type_traits. See cppreference.com for some developer friendly details.
Resistance to buffer overrun attacks via secure <algorithm>
integer_sequence facilitates interoperation with the
boost::asioasynchronous network library
Like its predecessors, C++14 represents another significant improvement to an already-great language in the area of producing verifiably correct and concise algorithms. Since Ripple Labs operates in the space of financial transactions, the rippled team uses all available tools to ensure that its software behaves predictably and remains auditable to field experts.
Howard Hinnant is a Sr. C++ Engineer at Ripple Labs as well as Library Working Group Chair Emeritus at the Standard C++ Foundation. He was lead author of several C++11 features including: move semantics,
unique_ptr, and the headers
<chrono>. For C++14 he contributed the
<shared_mutex> library. Howard was the lead author of the
std::lib implementation libc++ found at libcxx.llvm.org.