jeudi 29 octobre 2015

Default-insertion, C++11, and libstdc++

The current working draft of the C++ Standard (http://ift.tt/1M1jxWT) introduces so-called default-insertion [§23.2.1(15.2)]. The vector::resize(sz) then appends sz - size() default-inserted elements to the sequence in case that sz > size() (effectively, this calls the construct() member function of the corresponding allocator for appended vector elements).

According to the C++11 Standard ISO/IEC 14882:2011(E), vector::resize(sz) appends sz - size() value-initialized elements to the sequence in such a case (allocator is not used at all).

However, the GNU Standard C++ Library v3 (libstdc++) implements default-insertion already for C++11 via the preprocessor branch #if __cplusplus >= 201103L (observed in libstdc++ 3.4.20).

I really appreciate the default-insertion concept, but doesn't it mean that libstdc++ breaks the C++11 compatibility?

Aucun commentaire:

Enregistrer un commentaire