Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Overview  





2 Components  



2.1  General utilities  





2.2  Function objects  





2.3  Metaprogramming and type traits  





2.4  Numerical facilities  



2.4.1  Random number generation  





2.4.2  Mathematical special functions  







2.5  Containers  



2.5.1  Tuple types  





2.5.2  Fixed size array  





2.5.3  Hash tables  







2.6  Regular expressions  





2.7  C compatibility  







3 Technical Report 2  





4 See also  





5 References  



5.1  Sources  







6 External links  














C++ Technical Report 1






Català
فارسی


Polski
Русский
Suomi

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


C++ Technical Report 1 (TR1) is the common name for ISO/IEC TR 19768, C++ Library Extensions, which is a document that proposed additions to the C++ standard library for the C++03 language standard. The additions include regular expressions, smart pointers, hash tables, and random number generators. TR1 was not a standard itself, but rather a draft document. However, most of its proposals became part of the later official standard, C++11. Before C++11 was standardized, vendors used this document as a guide to create extensions. The report's goal was "to build more widespread existing practice for an expanded C++ standard library".

The report was first circulated in draft form in 2005 as Draft Technical Report on C++ Library Extensions, then published in 2007 as an ISO/IEC standard as ISO/IEC TR 19768:2007.

Overview[edit]

Compilers did not need to include the TR1 components in order to conform to the C++ standard, because TR1 proposals were not part of the standard itself, only a set of possible additions that were still to be ratified. However, most of TR1 was available from Boost, and several compiler/library distributors implemented all or some of the components. TR1 is not the complete list of additions to the library that appeared in C++11. For example, C++11 includes a thread support library that is not available in TR1.

The new components were defined in the std::tr1 namespace to distinguish them from the then-current standard library.

Components[edit]

TR1 includes the following components:

General utilities[edit]

Reference wrapper – enables passing references, rather than copies, into algorithms or function objects. The feature was based on Boost.Ref.[1]Awrapper 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 <iostream>
#include <tr1/functional>

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

  g( f, std::tr1::ref(i) );    // 'g< void(int &r), reference_wrapper<int> >' is instanced
  std::cout << i << "\n";      // Output: 1
}

Smart pointers – adds several classes that simplify object lifetime management in complex cases. Three main classes are added:

The proposal is based on Boost Smart Pointer library.[2]

Function objects[edit]

These four modules are added to the <functional> header file:

Polymorphic function wrapper (function) – can store any callable function (function pointers, member function pointers, and function objects) that uses a specified function call signature. The type does not depend on the kind of the callable used. Based on Boost.Function[3]

Function object binders (bind) – can bind any parameter parameters to function objects. Function composition is also allowed. This is a generalized version of the standard std::bind1st and std::bind2nd bind functions. The feature is based on Boost Bind library.[4]

Function return types (result_of) – determines the type of a call expression.

Member functions (mem_fn) – enhancement to the standard std::mem_fun and std::mem_fun_ref. Allows pointers to member functions to be treated as function objects. Based on Boost Mem Fn library.[5]

Metaprogramming and type traits[edit]

There is now <type_traits> header file that contains many useful trait meta-templates, such as is_pod, has_virtual_destructor, remove_extent, etc. It facilitates metaprogramming by enabling queries on and transformation between different types. The proposal is based on Boost Type Traits library.[6]

Numerical facilities[edit]

Random number generation[edit]

Mathematical special functions[edit]

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.

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 ) ;
Associated Legendre polynomials double assoc_legendre( unsigned l, unsigned m, double x ) ;
Beta function double beta( double x, double y ) ;
Complete elliptic integral of the first kind double comp_ellint_1( double k ) ;
Complete elliptic integral of the second kind double comp_ellint_2( double k ) ;
Complete elliptic integral of the third kind double comp_ellint_3( double k, double nu ) ;
Confluent hypergeometric functions double conf_hyperg( double a, double c, double x ) ;
Regular modified cylindrical Bessel functions double cyl_bessel_i( double nu, double x ) ;
Cylindrical Bessel functions of the first kind double cyl_bessel_j( double nu, double x ) ;
Irregular modified cylindrical Bessel functions double cyl_bessel_k( double nu, double x ) ;
Cylindrical Neumann functions

Cylindrical Bessel functions of the second kind

double cyl_neumann( double nu, double x ) ;
Incomplete elliptic integral of the first kind double ellint_1( double k, double phi ) ;
Incomplete elliptic integral of the second kind double ellint_2( double k, double phi ) ;
Incomplete elliptic integral of the third kind double ellint_3( double k, double nu, double phi ) ;
Exponential integral double expint( double x ) ;
Hermite polynomials double hermite( unsigned n, double x ) ;
Hypergeometric series double hyperg( double a, double b, double c, double x ) ;
Laguerre polynomials double laguerre( unsigned n, double x ) ;
Legendre polynomials double legendre( unsigned l, double x ) ;
Riemann zeta function double riemann_zeta( double x ) ;
Spherical Bessel functions of the first kind double sph_bessel( unsigned n, double x ) ;
Spherical associated Legendre functions 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 floatorlong double values respectively. For example:

float sph_neumannf( unsigned n, float x ) ;
long double sph_neumannl( unsigned n, long double x ) ;

Containers[edit]

Tuple types[edit]

Fixed size array[edit]

Hash tables[edit]

Regular expressions[edit]

C compatibility[edit]

C++ is designed to be compatible with the C programming language, 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 <complex>, <locale>, <cmath>, 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).

Technical Report 2[edit]

In 2005, a request for proposals for a TR2 was made with a special interest in Unicode, XML/HTML, Networking and usability for novice programmers.TR2 call for proposals.

Some of the proposals included:

After the call was issued for proposals for TR2, ISO procedures were changed, so there will not be a TR2. Instead, enhancements to C++ will be published in a number of Technical Specifications. Some of the proposals listed above are already included in the C++ standard or in draft versions of the Technical Specifications.

See also[edit]

References[edit]

  1. ^ "ref - 1.72.0". www.boost.org.
  • ^ "Boost.SmartPtr: The Smart Pointer Library - 1.72.0". www.boost.org.
  • ^ "Chapter 16. Boost.Function - 1.72.0". www.boost.org.
  • ^ "Chapter 1. Boost.Bind - 1.72.0". www.boost.org.
  • ^ "Chapter 1. Boost.Member Function - 1.72.0". www.boost.org.
  • ^ "Chapter 1. Boost.TypeTraits - 1.37.0". www.boost.org.
  • ^ "The Boost Tuple Library – Boost 1.48.0". Archived from the original on 2006-05-26. Retrieved 2006-05-27.
  • ^ "Chapter 5. Boost.Array - 1.72.0". www.boost.org.
  • ^ "Boost.Regex - 1.36.0". www.boost.org.
  • Sources[edit]

    External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=C%2B%2B_Technical_Report_1&oldid=1193072052"

    Category: 
    C++ Standard Library
    Hidden categories: 
    Articles with short description
    Short description is different from Wikidata
    Wikipedia articles that are too technical from October 2021
    All articles that are too technical
    Articles needing additional references from October 2021
    All articles needing additional references
    Wikipedia articles with style issues from October 2021
    All articles with style issues
    Articles with multiple maintenance issues
     



    This page was last edited on 1 January 2024, at 22:34 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki