C++ Technical Report 1 is the common name for ISO/IEC TR 19768, C++ Library Extensions, which was a document proposing additions to the C++ standard library
C++ standard library
In C++, the C++ Standard Library is a collection of classes and functions, which are written in the core language and part of the C++ ISO Standard itself...
for the C++03 language standard. The additions include regular expression
Regular expression
In computing, a regular expression provides a concise and flexible means for "matching" strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp"...
In computer science, a smart pointer is an abstract data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking. These additional features are intended to reduce bugs caused by the misuse of pointers while retaining efficiency...
In computer science, a hash table or hash map is a data structure that uses a hash function to map identifying values, known as keys , to their associated values . Thus, a hash table implements an associative array...
s, and random number generators. TR1 is not a standard itself, but rather a draft document. However, most of its proposals became part of the current official standard, C++11. Before C++11 was standardized, vendors used this document as a guide to create extensions. The report's goal is "to build more widespread existing practice for an expanded C++ standard library."
Overview
Compilers need not include the TR1 components to be conforming, as the TR1 proposals are not yet officially part of the standard. Much of it is available from Boost, and several compiler/library distributors currently implement all or part of the components.
TR1 is not a complete list of additions to the library that appear in the next standard; for example, the current standard, C++11, supports threading
Thread (computer science)
In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...
A namespace is an abstract container or environment created to hold a logical grouping of unique identifiers or symbols . An identifier defined in a namespace is associated only with that namespace. The same identifier can be independently defined in multiple namespaces...
to distinguish them from the current standard library.
Some programming languages use header files. These files allow programmers to separate certain elements of a program's source code into reusable files. Header files commonly contain forward declarations of classes, subroutines, variables, and other identifiers...
- cref, ref, reference_wrapper
enables passing references, rather than copies, into algorithms or function objects
In computer programming, the adapter pattern is a design pattern that translates one interface for a class into a compatible interface...
reference is obtained from an instance of the template class reference_wrapper. Wrapper references are similar to normal references (‘&’) of the C++ language. To obtain a wrapper reference from any object the template class ref is used (for a constant reference cref is used).
Wrapper references are useful above all for template functions, when argument deduction would not deduce a reference (e.g. when forwarding arguments):
include
include
void f( int &r ) { ++r; }
template< class Funct, class Arg >
void g( Funct f, Arg t )
{
f(t);
}
int main
{
int i = 0;
g( f, i ); // 'g< void(int &r), int >' is instantiated
std::cout << i << "\n"; // Output: 0
Resource Acquisition Is Initialization is a programming idiom used in several object-oriented languages like C++, D and Ada. The technique was invented by Bjarne Stroustrup to deal with resource deallocation in C++...
stores all callables (function pointers, member function pointers, and function objects) that use a specified function call signature. The specific type of callable object is not required.
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....
to be treated as function objects
Metaprogramming and type traits
new header file - is_pod, has_virtual_destructor, remove_extent, etc.
In probability theory and statistics, the Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time and/or space if these events occur with a known average rate and independently of the time since...
, etc.
utilities for generating random numbers using any of several Pseudorandom number generators, engines, and probability distributions
Mathematical special functions
Some features of TR1, such as the mathematical special functions and certain C99 additions, are not included in the Visual C++ implementation of TR1.
The Mathematical special functions library was not standardized in C++11.
additions to the / header files - beta, legendre, etc.
These functions will likely be of principal interest to programmers in the engineering and scientific disciplines.
The following table shows all 23 special functions described in TR1.
Function name
Function prototype
Mathematical expression
Associated Laguerre polynomials
double assoc_laguerre( unsigned n, unsigned m, double x ) ;
In mathematics, the associated Legendre polynomials are the canonical solutions of the general Legendre equation\,y -2xy' + \left\,y = 0,\,or equivalently...
double assoc_legendre( unsigned l, unsigned m, double x ) ;
In mathematics, the exponential integral is a special function defined on the complex plane given the symbol Ei.-Definitions:For real, nonzero values of x, the exponential integral Ei can be defined as...
In mathematics, the Hermite polynomials are a classical orthogonal polynomial sequence that arise in probability, such as the Edgeworth series; in combinatorics, as an example of an Appell sequence, obeying the umbral calculus; in numerical analysis as Gaussian quadrature; and in physics, where...
double hermite( unsigned n, double x ) ;
Hypergeometric series
Hypergeometric series
In mathematics, a generalized hypergeometric series is a series in which the ratio of successive coefficients indexed by n is a rational function of n. The series, if convergent, defines a generalized hypergeometric function, which may then be defined over a wider domain of the argument by...
double hyperg( double a, double b, double c, double x ) ;
In mathematics, the Laguerre polynomials, named after Edmond Laguerre ,are the canonical solutions of Laguerre's equation:x\,y + \,y' + n\,y = 0\,which is a second-order linear differential equation....
double sph_legendre( unsigned l, unsigned m, double theta ) ;
Spherical Neumann functions
Spherical Bessel functions of the second kind
double sph_neumann( unsigned n, double x ) ;
Each function has two additional variants. Appending the suffix ‘f’ or ‘l’ to a function name gives a function that operates on float or long double values respectively. For example:
float sph_neumannf( unsigned n, float x ) ;
long double sph_neumannl( unsigned n, long double x ) ;
unordered_map is a class template representing a hash table in the C++ Technical Report 1 and the C++11 standard. It is similar to the hash_map class template of the original STL which was also included in several implementations of the C++ Standard Library unordered_map is a class template...
> header files
they implement the unordered_set, unordered_multiset, unordered_map, and unordered_multimap classes, analogous to set, multiset, map, and multimap, respectively
unfortunately, unordered_set and unordered_multiset cannot be used with the set_union, set_intersection, set_difference, set_symmetric_difference, and includes standard library functions, which work for set and multiset
new implementation, not derived from an existing library, not fully API compatible with existing libraries
In computer science, a hash table or hash map is a data structure that uses a hash function to map identifying values, known as keys , to their associated values . Thus, a hash table implements an associative array...
s, often provide constant time lookup of elements but the worst case can be linear in the size of the container
Regular expressions
new header file - regex, regex_match, regex_search, regex_replace, etc.
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
, but is not a strict superset of C due to diverging standards. TR1 attempts to reconcile some of these differences through additions to various headers in the C++ library, such as , , , etc. These changes help to bring C++ more in line with the C99 version of the C standard (not all parts of C99 are included in TR1).
Asio is a freely available, open source, cross-platform C++ library for network programming. It provides developers with a consistent asynchronous I/O model using a modern C++ approach....
C99 is a modern dialect of the C programming language. It extends the previous version with new linguistic and library features, and helps implementations make better use of available computer hardware and compiler technology.-History:...
, the most recent standard for the C programming language
Boost is a set of free software libraries that extend the functionality of C++.-Overview:Most of the Boost libraries are licensed under the Boost Software License, designed to allow Boost to be used with both free and proprietary software projects...
, a large collection of portable C++ libraries, several of which were included in TR1
The Standard Template Library is a C++ software library which later evolved into the C++ Standard Library. It provides four components called algorithms, containers, functors, and iterators. More specifically, the C++ Standard Library is based on the STL published by SGI. Both include some...
Dinkumware is a software company specializing in core libraries for C/.The company has provided the standard library implementation that ships with Microsoft since 1996, and claims to be the leading supplier of and libraries to the embedded community.They also provide libraries for Java and...
, the only commercial vendor to fully implement TR1