TR1
TR1 is the common shorthand for ISO/IEC TR19768, C++ Library
Extensions, which is the first major addition to the Standard C++
library. It is non-normative, which means it need not be provided
by a conforming C++ compiler. Nevertheless, the features in TR1
have been widely anticipated in the C++ programming community.
You can see the final draft of TR1 at
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf.
Even better, get the new book by Pete Becker, "The C++ Standard
Library Extensions: A Tutorial and Reference." It's a complete description
of TR1, containing hundreds of examples. Pete wrote much of our TR1 code,
tests, and documentation, so you can't find a better guide to our TR1
library. The book is available in computer book stores, or from
amazon.com:
http://www.amazon.com/gp/product/0321412990/
Broadly speaking, TR1 has three major components:
- C++ templates, such as hash tables, template metaprogramming aids,
sophisticated random-number generators, and a comprehensive
regular-expression parser --
This component is based largely on contributions made to the
Boost library over the past several years. They augment the
Standard C++ library in important ways, particularly in the rapidly
growing area of template metaprogramming.
- Special math functions, such as Bessel functions and elliptic integrals --
This component consists of math functions widely used in the
scientific community. They comprise the next logical step in
sophistication from the functions supplied with C99.
- C99 library, including all the numerous functions added to the
C Standard with C99, properly blended into the C++ environment --
This component reconciles minor conflicts between the Standard C
and Standard C++ libraries to make a coherent and more powerful
library. (It is based heavily on the Dinkum Unabridged Library
first released in early 2003.)
Note that components 1 and 3 have already been voted into the next
version of the C++ Standard (informally called C++0X), so much of TR1
is destined to become a normative requirement for Standard C++ in the
coming years.
For specific technical details of what's in TR1,
see the on-line reference.
For a comparison of other implementations of TR1, click here.
Note that TR1 often pushes the limits of the latest C++
technology. We work hard to support the older Microsoft compilers,
such as VC++ V6, V7, and the numerous embedded variants,
but we can't make everything in TR1 work for these compilers.
(By contrast, we fully support TR1 for VC++ V7.1 and V8, and GCC
V3 and V4.) Here are some constraints, by component:
- Most of component 1 is not supported by the older compilers.
Template classes array, unordered_map, and unordered_set work, as do regular expressions for
char strings only.
- All of special math is supported, except for the generic
overloading described below.
- All of C99 is supported, except the templates needed to
reproduce generic overloading of math functions. (For example,
pow(3.0L, 2) should call powl(3.0L, 2L) with TR1, but it
remains ambiguous with the older compilers.)