没有合适的资源?快使用搜索试试~ 我知道了~
首页C++11_[完整最新]技术报告 TR1
资源详情
资源评论
资源推荐

ISO/IEC DTR 19768
Doc No: N1836=05-0096
Date: 2005-06-24
Reply to: Matt Austern
austern@google.com
Draft Technical Report on C++ Library
Extensions

ii
ISO/IEC DTR 19768

Contents
Contents iii
List of Tables xi
1 General 1
1.1 Relation to C++ Standard Library Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Categories of extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Namespaces and headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 General Utilities 3
2.1 Reference wrappers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 Additions to header <functional> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.2 Class template reference_wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.2.1 reference_wrapper construct/copy/destroy . . . . . . . . . . . . . . . . . . . . . 4
2.1.2.2 reference_wrapper assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2.3 reference_wrapper access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2.4 reference_wrapper invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2.5 reference_wrapper helper functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Smart pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Additions to header <memory> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 Class bad_weak_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.3 Class template shared_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.3.1 shared_ptr constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.3.2 shared_ptr destructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2.3.3 shared_ptr assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2.3.4 shared_ptr modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.3.5 shared_ptr observers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.3.6 shared_ptr comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.3.7 shared_ptr I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.3.8 shared_ptr specialized algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.3.9 shared_ptr casts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.3.10 get_deleter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.4 Class template weak_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.4.1 weak_ptr constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

CONTENTS CONTENTS iv
2.2.4.2 weak_ptr destructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2.4.3 weak_ptr assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2.4.4 weak_ptr modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2.4.5 weak_ptr observers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2.4.6 weak_ptr comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.4.7 weak_ptr specialized algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.5 Class template enable_shared_from_this . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3 Function objects 21
3.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2 Additions to <functional> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.4 Function return types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.5 Function template mem_fn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6 Function object binders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6.1 Class template is_bind_expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6.2 Class template is_placeholder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.6.3 Function template bind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.6.4 Placeholders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.7 Polymorphic function wrappers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.7.1 Class bad_function_call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.7.1.1 bad_function_call constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.7.2 Class template function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.7.2.1 function construct/copy/destroy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.7.2.2 function modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.7.2.3 function capacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.7.2.4 function invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.7.2.5 function target access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.7.2.6 undefined operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.7.2.7 null pointer comparison operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.7.2.8 specialized algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4 Metaprogramming and type traits 33
4.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.2 Header <type_traits> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3 Helper classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.4 General Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.5 Unary Type Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.5.1 Primary Type Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.5.2 Composite type traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.5.3 Type properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.6 Relationships between types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.7 Transformations between types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.7.1 Const-volatile modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.7.2 Reference modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.7.3 Array modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
ISO/IEC DTR 19768

v CONTENTS CONTENTS
4.7.4 Pointer modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.8 Other transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.9 Implementation requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5 Numerical facilities 45
5.1 Random number generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.1.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.1.2 Header <random> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.1.3 Class template variate_generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.1.4 Random number engine class templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.1.4.1 Class template linear_congruential . . . . . . . . . . . . . . . . . . . . . . . . 53
5.1.4.2 Class template mersenne_twister . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.1.4.3 Class template subtract_with_carry . . . . . . . . . . . . . . . . . . . . . . . . 55
5.1.4.4 Class template subtract_with_carry_01 . . . . . . . . . . . . . . . . . . . . . . 57
5.1.4.5 Class template discard_block . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.1.4.6 Class template xor_combine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.1.5 Engines with predefined parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.1.6 Class random_device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.1.7 Random distribution class templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.1.7.1 Class template uniform_int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.1.7.2 Class bernoulli_distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.1.7.3 Class template geometric_distribution . . . . . . . . . . . . . . . . . . . . . . 65
5.1.7.4 Class template poisson_distribution . . . . . . . . . . . . . . . . . . . . . . . . 65
5.1.7.5 Class template binomial_distribution . . . . . . . . . . . . . . . . . . . . . . . 66
5.1.7.6 Class template uniform_real . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
5.1.7.7 Class template exponential_distribution . . . . . . . . . . . . . . . . . . . . . 67
5.1.7.8 Class template normal_distribution . . . . . . . . . . . . . . . . . . . . . . . . 68
5.1.7.9 Class template gamma_distribution . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.2 Mathematical special functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.2.1 Additions to header <cmath> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.2.1.1 associated Laguerre polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.2.1.2 associated Legendre functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.2.1.3 beta function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.2.1.4 (complete) elliptic integral of the first kind . . . . . . . . . . . . . . . . . . . . . . . 74
5.2.1.5 (complete) elliptic integral of the second kind . . . . . . . . . . . . . . . . . . . . . 74
5.2.1.6 (complete) elliptic integral of the third kind . . . . . . . . . . . . . . . . . . . . . . . 75
5.2.1.7 confluent hypergeometric functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.2.1.8 regular modified cylindrical Bessel functions . . . . . . . . . . . . . . . . . . . . . . 75
5.2.1.9 cylindrical Bessel functions (of the first kind) . . . . . . . . . . . . . . . . . . . . . 75
5.2.1.10 irregular modified cylindrical Bessel functions . . . . . . . . . . . . . . . . . . . . . 76
5.2.1.11 cylindrical Neumann functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.2.1.12 (incomplete) elliptic integral of the first kind . . . . . . . . . . . . . . . . . . . . . . 77
5.2.1.13 (incomplete) elliptic integral of the second kind . . . . . . . . . . . . . . . . . . . . 77
5.2.1.14 (incomplete) elliptic integral of the third kind . . . . . . . . . . . . . . . . . . . . . 77
5.2.1.15 exponential integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.2.1.16 Hermite polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
ISO/IEC DTR 19768
剩余197页未读,继续阅读

















安全验证
文档复制为VIP权益,开通VIP直接复制

评论6