C++14 International Standard
The most relevant news is that we have approved C++14 for DIS. Formally this means that we send the document to ISO for a final ballot. There is an unlikely possibility that and additional ballot is needed. In practice, it means that C++14 is ready. There is a huge possibility that it is published during 2014 and a small possibility that is published in early 2015. So, this time we got it for the year we were expecting to. Wow!More on C++ Technical Specifications
We also approved the initial drafts for some technical specifications. In particular:
- A working paper of the Concepts Lite technical specification. In essence, this will allow to constrain templates with predicates. When concepts are out there, you will get (finally) meaningful error messages for most generic code.
- A working paper for the Parallelism technical specification.
- A working paper for the Concurrency technical specification.
We decided to have one more technical specification on Transactional Memory.
A significant progress has been made for the Library Fundamentals technical specification.
Besides, the File System technical specification has gone through the resolution of many national body comments. It is highly likely that we will have a final ballot of this technical specification after the next committee meeting (to be held in June in Switzerland).
C++14 last minute modifications
You may be aware of the status of C++14, so here you will only find an incomplete list of changes.
First of all, many corrections from defect reports and comments issued by National Bodies have been made, both to the library and to the language. In this post I do not enumerate those minor changes.
Perhaps, you already have seen the excelent explanation from Stephan T. Lavavej about why we should not use the rand() function. If you didn't, please have a look at this video. C++14 is not deprecating rand() but it will contain a strong note discouraging the use of rand() because of its questionable quality and performance.
A new metafunction alias called tuple_element_t has been introduced. This allows a simpler writing when extracting a type from a tuple, and
typename tuple_element<I, tuple<T...>>::type
becomes
tuple_element_t<I,tuple<T...>>
There are also a number of chages related to concurrency in C++14:
There are also a number of chages related to concurrency in C++14:
- shared_timed_mutex is the new name for the old shared_mutex. This makes naming of mutexes more consistent and leaves room for a future extension.
- A set of clarifications has been introduced about the interactions of a signal handler and threads that are running.
- The concept of lock-free execution has also been clarified.
The Library Fundamentals Technical Specification
A collection of components has been incorporated in the Library Fundamentals TS. Some of them are:
- string_view: A ligthweight type to reference a sequence of inmutable char-like objects. Simliar types have been previously developed by Google, LLVM, and Bloomberg, justifying the need for standardization.
- any: A type safe container for a single value. This class is heavily based on boost::any.
- A set of facilities for allocators that make easy that allocator is not part of types.
- Faster string search algorithms (Boyer-Moore and Boyer-Moore-Horspool).
- sample(): An algorithm for randomly sampling elements from a sequence.
- A set of variable templates that allow a simple way of spelling type traits (is_arithmetic_v<T> instead of is_arithmetic<T>::value).
- apply(): Allows applyinf an arbitrary function to a tuple.
- A reformulation of iterator_traits so that the do not generate a hard error when its template argument does not have the expected member types. This allows to use this trait in an SFINAE context.
- A reformulation of the type trait common_type to avoid a hard error when there is no common type. This allows to use this trait in an SFINAE context.
- shared_ptr extensions to support arrays (this allows both shared_ptr<T[]> and shared_ptr<T[N]>).
- A library solution for performing byte ordering conversions (through hton<T>(T x) and ntoh<T>(T x)). These functions were originally planned for the networking technical specification, but have been finally moved here.
- optional: A class to support types that may or may not hold a value. This type is highly influenced by boost::opetional.
- invocation_type and raw_invocation_type: Type traits for callable objects.
The Parallelism Technical Specification
An initial working draft has been approved. This technical specification contains a library interface for a set of algorithms that can be excuted under different execution policies (including sequential, parallel, vector).
The Concurrency Technical Specification
An initial working draft has been approved.
The techcnical specification will include executors, which are objects that can execute unit of work in the form of function objects. The concept of thread pool is included here.
Besides, this TS also includes improvements to std::future.