21.9. Technical Report 1

Technical Report 1 (TR1) describes proposed additions to the C++ Standard Library. Many of the libraries in TR1 will be accepted by the C++ Standards Committee but they are not considered part of the C++ standard until the next version is finalized. The library additions provide solutions for many common programming problems. We described the 11 Boost libraries in TR1 in Section 21.6; descriptions of the three additional TR1 libraries follow. Many libraries didn't make it into TR1 due to time constraints. Technical Report 2 (TR2), which will be released shortly after C++0x, contains additional library proposals that weren't included in TR1. The release of TR2 will bring even more functionality to the standard library without having to wait for another new standard.

Unordered Associative Containers[13]

[13] Matthew Austern, "A Proposal to Add Hash Tables to the Standard Library," Document Number N1456=03-0039, April 9, 2003, www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1456.html.

The Unordered Associative Containers library defines four new containers—unordered_set, unordered_map, unordered_multiset and unordered_multimap. These associative containers are implemented as hash tables. A hash table is split into sections sometimes called "buckets." A key is used to determine where to store an element in the container. The key is passed to a hash function which returns a size_t. The size_t returned by the hash function determines the "bucket" that the value is placed in. If two values are equal, so are the size_ts returned by the hash function. Multiple values can be placed in the same "bucket." You retrieve an element from the container using the key much as you do with a set or map. The key determines which "bucket" the value was placed in, then the "bucket" is searched for the value.

With unordered_set and unordered_multiset, the element itself is used as the key. unordered_map and unordered_multimap use a separate key to determine where to place the element—the arguments are passed as a pair< const Key, Value >. unordered_set and unordered_map require that all the keys used are unique;unordered_multiset and unordered_multimap don't enforce that restriction. The containers are defined in the <unordered_set> and <undordered_map> headers.

Mathematical Special Functions[14]

[14] Walter E. Brown, "A Proposal to Add Mathematical Special Functions to the C++ Standard Library," Document Number N1422=03-0004, February 24, 2003, std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1422.html.

This library incorporates mathematical functions added to C99—the C standard published in 1999—that are missing in the C++ Standard. C99 supplies trigonometric, hyperbolic, exponential, logarithmic, power and special functions. This library adds those functions, among others, to C++ in the <cmath> header.

Increased Compatibility with C99[15]

[15] P. J. Plauger, "Proposed Additions to TR-1 to Improve Compatibility With C99," Document Number N1568=04-0008, www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1568.htm.

C++ evolved from the C programming language. Most C++ compilers can also compile C programs, but there are some incompatibilities between the languages. The goal of this library is to increase compatibility between C++ and C99. Most of this library involves adding items to C++ headers to support C99 features—this is often accomplished by including the corresponding C99 headers.