API Evolution and Deprecation History

A list of user-visible changes, in chronological order

3.0

Extensions moved to include/ext.

Include files from the SGI/HP sources that pre-date the ISO standard are added. These files are placed into the include/backward directory and a deprecated warning is added that notifies on inclusion (-Wno-deprecated deactivates the warning.)

Deprecated include <backward/strstream> added.

Removal of include <builtinbuf.h>, <indstream.h>, <parsestream.h>, <PlotFile.h>, <SFile.h>, <stdiostream.h>, and <stream.h>.

3.1

Extensions from SGI/HP moved from namespace std to namespace __gnu_cxx. As part of this, the following new includes are added: <ext/algorithm>, <ext/functional>, <ext/iterator>, <ext/memory>, and <ext/numeric>.

Extensions to basic_filebuf introduced: __gnu_cxx::enc_filebuf, and __gnu_cxx::stdio_filebuf.

Extensions to tree data structures added in <ext/rb_tree>.

Removal of <ext/tree>, moved to <backward/tree.h>.

3.2

Symbol versioning introduced for shared library.

Removal of include <backward/strstream.h>.

Allocator changes. Change __malloc_alloc to malloc_allocator and __new_alloc to new_allocator.

For GCC releases from 2.95 through the 3.1 series, defining __USE_MALLOC on the gcc command line would change the default allocation strategy to instead use malloc and free. For the 3.2 and 3.3 release series the same functionality was spelled _GLIBCXX_FORCE_NEW. From GCC 3.4 onwards the default allocator uses new anyway, but for the optional pooling allocators the functionality is enabled by setting GLIBCXX_FORCE_NEW in the environment, see the mt allocator chapter for details.

Error handling in iostreams cleaned up, made consistent.

3.3

3.4

Large file support.

Extensions for generic characters and char_traits added in <ext/pod_char_traits.h>.

Support for wchar_t specializations of basic_filebuf enhanced to support UTF-8 and Unicode, depending on host. More hosts support basic wchar_t functionality.

Support for char_traits beyond builtin types.

Conformant allocator class and usage in containers. As part of this, the following extensions are added: <ext/bitmap_allocator.h>, <ext/debug_allocator.h>, <ext/mt_allocator.h>, <ext/malloc_allocator.h>,<ext/new_allocator.h>, <ext/pool_allocator.h>.

This is a change from all previous versions, and may require source-level changes due to allocator-related changes to structures names and template parameters, filenames, and file locations. Some, like __simple_alloc, __allocator, __alloc, and _Alloc_traits have been removed.

Default behavior of std::allocator has changed.

Previous versions prior to 3.4 cache allocations in a memory pool, instead of passing through to call the global allocation operators (i.e., __gnu_cxx::pool_allocator). More recent versions default to the simpler __gnu_cxx::new_allocator.

Previously, all allocators were written to the SGI style, and all STL containers expected this interface. This interface had a traits class called _Alloc_traits that attempted to provide more information for compile-time allocation selection and optimization. This traits class had another allocator wrapper, __simple_alloc<T,A>, which was a wrapper around another allocator, A, which itself is an allocator for instances of T. But wait, there's more: __allocator<T,A> is another adapter. Many of the provided allocator classes were SGI style: such classes can be changed to a conforming interface with this wrapper: __allocator<T, __alloc> is thus the same as allocator<T>.

The class allocator used the typedef __alloc to select an underlying allocator that satisfied memory allocation requests. The selection of this underlying allocator was not user-configurable.

Table B.6. Extension Allocators

Allocator (3.4)Header (3.4)Allocator (3.[0-3])Header (3.[0-3])
__gnu_cxx::new_allocator<T><ext/new_allocator.h>std::__new_alloc<memory>
__gnu_cxx::malloc_allocator<T><ext/malloc_allocator.h>std::__malloc_alloc_template<int><memory>
__gnu_cxx::debug_allocator<T><ext/debug_allocator.h>std::debug_alloc<T><memory>
__gnu_cxx::__pool_alloc<T><ext/pool_allocator.h>std::__default_alloc_template<bool,int><memory>
__gnu_cxx::__mt_alloc<T><ext/mt_allocator.h>
__gnu_cxx::bitmap_allocator<T><ext/bitmap_allocator.h>

Releases after gcc-3.4 have continued to add to the collection of available allocators. All of these new allocators are standard-style. The following table includes details, along with the first released version of GCC that included the extension allocator.

Table B.7. Extension Allocators Continued

AllocatorIncludeVersion
__gnu_cxx::array_allocator<T><ext/array_allocator.h>4.0.0
__gnu_cxx::throw_allocator<T><ext/throw_allocator.h>4.2.0

Debug mode first appears.

Precompiled header support PCH support.

Macro guard for changed, from _GLIBCPP_ to _GLIBCXX_.

Extension <ext/stdio_sync_filebuf.h> added.

Extension <ext/demangle.h> added.

4.0

TR1 features first appear.

Extension allocator <ext/array_allocator.h> added.

Extension codecvt specializations moved to <ext/codecvt_specializations.h>.

Removal of <ext/demangle.h>.

4.1

Removal of <cassert> from all standard headers: now has to be explicitly included for std::assert calls.

Extensions for policy-based data structures first added. New includes, types, namespace pb_assoc.

Extensions for typelists added in <ext/typelist.h>.

Extension for policy-based basic_string first added: __gnu_cxx::__versa_string in <ext/vstring.h>.

4.2

Default visibility attributes applied to namespace std. Support for -fvisibility.

TR1 <random>, <complex>, and C compatibility headers added.

Extensions for concurrent programming consolidated into <ext/concurrence.h> and <ext/atomicity.h>, including change of namespace to __gnu_cxx in some cases. Added types include _Lock_policy, __concurrence_lock_error, __concurrence_unlock_error, __mutex, __scoped_lock.

Extensions for type traits consolidated into <ext/type_traits.h>. Additional traits are added (__conditional_type, __enable_if, others.)

Extensions for policy-based data structures revised. New includes, types, namespace moved to __pb_ds.

Extensions for debug mode modified: now nested in namespace std::__debug and extensions in namespace __gnu_cxx::__debug.

Extensions added: <ext/typelist.h> and <ext/throw_allocator.h>.

4.3

C++0X features first appear.

TR1 <regex> and <cmath>'s mathematical special function added.

Backward include edit.

  • Removed

    <algobase.h> <algo.h> <alloc.h> <bvector.h> <complex.h> <defalloc.h> <deque.h> <fstream.h> <function.h> <hash_map.h> <hash_set.h> <hashtable.h> <heap.h> <iomanip.h> <iostream.h> <istream.h> <iterator.h> <list.h> <map.h> <multimap.h> <multiset.h> <new.h> <ostream.h> <pair.h> <queue.h> <rope.h> <set.h> <slist.h> <stack.h> <streambuf.h> <stream.h> <tempbuf.h> <tree.h> <vector.h>

  • Added

    <hash_map> and <hash_set>

  • Added in C++11

    <auto_ptr.h> and <binders.h>

Header dependency streamlining.

  • <algorithm> no longer includes <climits>, <cstring>, or <iosfwd>

  • <bitset> no longer includes <istream> or <ostream>, adds <iosfwd>

  • <functional> no longer includes <cstddef>

  • <iomanip> no longer includes <istream>, <istream>, or <functional>, adds <ioswd>

  • <numeric> no longer includes <iterator>

  • <string> no longer includes <algorithm> or <memory>

  • <valarray> no longer includes <numeric> or <cstdlib>

  • <tr1/hashtable> no longer includes <memory> or <functional>

  • <tr1/memory> no longer includes <algorithm>

  • <tr1/random> no longer includes <algorithm> or <fstream>

Debug mode for <unordered_map> and <unordered_set>.

Parallel mode first appears.

Variadic template implementations of items in <tuple> and <functional>.

Default what implementations give more elaborate exception strings for bad_cast, bad_typeid, bad_exception, and bad_alloc.

PCH binary files no longer installed. Instead, the source files are installed.

Namespace pb_ds moved to __gnu_pb_ds.

4.4

C++0X features.

  • Added.

    <atomic>, <chrono>, <condition_variable>, <forward_list>, <initializer_list>, <mutex>, <ratio>, <thread>

  • Updated and improved.

    <algorithm>, <system_error>, <type_traits>

  • Use of the GNU extension namespace association converted to inline namespaces.

  • Preliminary support for initializer_list and defaulted and deleted constructors in container classes.

  • unique_ptr.

  • Support for new character types char16_t and char32_t added to char_traits, basic_string, numeric_limits, and assorted compile-time type traits.

  • Support for string conversions to_string and to_wstring.

  • Member functions taking string arguments were added to iostreams including basic_filebuf, basic_ofstream, and basic_ifstream.

  • Exception propagation support, including exception_ptr, current_exception, copy_exception, and rethrow_exception.

Uglification of try to __try and catch to __catch.

Audit of internal mutex usage, conversion to functions returning static local mutex.

Extensions added: <ext/pointer.h> and <ext/extptr_allocator.h>. Support for non-standard pointer types has been added to vector and forward_list.

4.5

C++0X features.

  • Added.

    <functional>, <future>, <random>

  • Updated and improved.

    <atomic>, <system_error>, <type_traits>

  • Add support for explicit operators and standard layout types.

Profile mode first appears.

Support for decimal floating-point arithmetic, including decimal32, decimal64, and decimal128.

Python pretty-printers are added for use with appropriately-advanced versions of gdb.

Audit for application of function attributes nothrow, const, pure, and noreturn.

The default behavior for comparing typeinfo names changed, so in <typeinfo>, __GXX_MERGED_TYPEINFO_NAMES now defaults to zero.

Extensions modified: <ext/throw_allocator.h>.

4.6

Use constexpr and nullptr where appropriate throughout the library.

The library was updated to avoid including <stddef.h> in order to reduce namespace pollution.

Reference-count annotations to assist data race detectors.

Added make_exception_ptr as an alias of copy_exception.

4.7

Use of noexcept throughout library.

Partial support for C++11 allocators first appears.

monotonic_clock renamed to steady_clock as required by the final C++11 standard.

A new clocale model for newlib is available.

The library was updated to avoid including <unistd.h> in order to reduce namespace pollution.

Debug Mode was improved for unordered containers.

4.8

New random number engines and distributions. Optimisations for random.

New --enable-libstdcxx-verbose configure option

The --enable-libstdcxx-time configure option becomes unnecessary given a sufficiently recent glibc.

4.9

Implementation of regex completed.

C++14 library and TS implementations are added.

copy_exception deprecated.

__gnu_cxx::array_allocator deprecated.

5

ABI transition adds new implementations of several components, using the abi_tag attribute and the __cxx11 inline namespace to distinguish the new entities from the old ones.

  • Use of the new or old ABI can be selected per-translation unit with the Macros.

  • New non-reference-counted string implementation.

  • New list implementation containing a new data member in order to provide O(1) size().

  • New ios_base::failure implementation inheriting from system_error.

C++11 support completed (movable iostreams, new I/O manipulators, Unicode conversion utilities, atomic operations for shared_ptr, functions for notifying condition variables and making futures ready at thread exit).

Changed formatting of floating point types when ios_base::fixed|ios_base::scientific is set in a stream's format flags.

Improved C++14 support and TS implementations.

New random number engines and distributions.

GDB Xmethods for containers and unique_ptr added.

has_trivial_default_constructor, has_trivial_copy_constructor and has_trivial_copy_assign deprecated.

5.3

Experimental implementation of the C++ Filesystem TS added.

6

C++14 support completed.

Support for mathematical special functions (ISO/IEC 29124:2010) added.

Assertions to check function preconditions can be enabled by defining the _GLIBCXX_ASSERTIONS macro. The initial set of assertions are a subset of the checks enabled by the Debug Mode, but without the ABI changes and changes to algorithmic complexity that are caused by enabling the full Debug Mode.

7

The type of exception thrown by iostreams changed to the cxx11 ABI version of std::ios_base::failure.

Experimental C++17 support added, including most new library features. The meaning of shared_ptr<T[]> changed to match the C++17 semantics.

Macros added.

has_trivial_default_constructor, has_trivial_copy_constructor and has_trivial_copy_assign removed.

Profile Mode was deprecated.

7.2

Library Fundamentals TS header <experimental/source_location> added.

7.3

Including new C++14 or C++17 headers without a suitable -std no longer causes compilation to fail via #error. Instead the header is simply empty and doesn't define anything.

8

The exceptions thrown by iostreams can now be caught by handlers for either version of std::ios_base::failure.

Improved experimental C++17 support. Headers <charconv> and <filesystem>. Experimental implementation of the C++17 Filesystem library added.

Experimental C++2a support (to_address and endian).

AddressSanitizer annotations added to std::vector to detect out-of-range accesses to the unused capacity of a vector.

std::char_traits<char16_t>::to_int_type(u'\uFFFF') now returns 0xFFFD, as 0xFFFF is used for std::char_traits<char16_t>::eof().

The extension allowing arithmetic on std::atomic<void*> and types like std::atomic<R(*)()> was deprecated.

The std::uncaught_exception function was deprecated for C++17 mode.

The nested typedefs std::hash::result_type and std::hash::argument_type were deprecated for C++17 mode.

The deprecated iostream members ios_base::io_state, ios_base::open_mode, ios_base::seek_dir, and basic_streambuf::stossc were removed for C++17 mode.

The non-standard C++0x std::copy_exception function was removed.

For -std=c++11, -std=c++14, and -std=c++17 modes the <complex.h> header no longer includes the C99 <complex.h> header.

For the non-default --enable-symvers=gnu-versioned-namespace configuration, the shared library SONAME has been changed to libstdc++.so.8.

9

C++17 header <memory_resource> added.

Experimental C++2a support improved, with new headers <bit> and <version> added. Support for new character type char8_t added to char_traits, basic_string, numeric_limits, and relevant locale facets and type traits.

Experimental implementation of the Networking TS library added, with new headers <experimental/buffer>, <experimental/executor>, <experimental/internet>, <experimental/io_context>, <experimental/net>, <experimental/netfwd>, <experimental/socket>, and <experimental/timer>.

10

Deprecated features removed:

  • Profile Mode
  • __gnu_cxx::array_allocator

The non-standard std::__is_nullptr_t type trait was deprecated.

The std::packaged_task constructors taking an allocator argument are only defined for C++11 and C++14.

Several members of std::allocator were removed for C++20 mode. The removed functionality has been provided by std::allocator_traits since C++11 and that should be used instead.

The type of the std::iterator base class of std::istreambuf_iterator was changed to be consistent for all -std modes. Before GCC 10.1 the base class had one type in C++98 mode and a different type in C++11 and later modes. The type in C++98 mode was changed to be the same as for C++11 and later.

Experimental C++2a support improved, with new headers <concepts>, <ranges>, <compare>, <coroutine>, <numbers>, <span>, and <stop_token> added.

11

The --enable-cheaders=c_std configuration was deprecated.

When compiling as C++20, the operator>> overloads for extracting strings into character buffers only work with arrays, not raw pointers.

std::string::reserve(n) will no longer reduce the string's capacity. Calling reserve() with no arguments is equivalent to shrink_to_fit(), but is deprecated. shrink_to_fit() should be used instead.