标准C++

本文详细介绍了C++标准库的各个组成部分,包括动态内存管理、数值限制、错误处理、字符处理库、容器库、算法库等。同时,对比了C++与C在头文件上的兼容性和差异,为开发者提供了全面的C++标准库使用指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

标准c++

  • C ++标准库的接口由以下头文件集合定义。

0> 说明

  • 下面有的图片表面上看不清楚,可以点开它看,很清楚。

1> 公用库

公用库

2> 动态内存管理

  • 这部分的头文件,主要负责内存的分配管理。
    动态内存管理

3> 数值限制

  • INT_MIN、INT_MAX这种值都是在这里定义的。
    数值限制

4> 错误处理

  • exception、系统错误等都是在这里定义的。
    错误处理

5> 字符处理库

  • 关于字符串处理的库,比如熟悉的string。
    字符处理

6> 容器库

  • STL中常用的容器。
    容器

7> 算法库

  • 比如快排之类的算法实现。
    算法库

8> 迭代器库

  • 与容器配套使用的库,容器的算法基本都支持迭代器。
    迭代器

9> 数值相关库

  • 包含复数,伪随机数产生的库。
    数值库

10> 输入输出库

  • 最常见的输入输出,及格式化 ,也包括文件流。
    输入输出

11> 本地化库

本地化

12> 正则库

  • 处理正则表达式。
    正则

13> 原子操作库

  • 与线程库配套使用的。
    原子操作

14> 线程支持库

线程库

15> 文件系统

  • 文件操作,获取路径等。
    文件系统库

16> C兼容性头文件

对于xxx.h形式的某些C标准库头文件,C ++标准库都包含一个同名的头文件和另一个cxxx格式的头文件(上面列出了所有有意义的cxxx头文件)。

除了complex.h之外,C ++标准库中包含的每个xxx.h头文件,都在全局命名空间中放置了相应的cxxx头在std命名空间中放置的每个名称。

这些头文件也允许在std命名空间中声明相同的名称,并允许相应的cxxx头文件在全局命名空间中声明相同的名称:< cstdlib >肯定提供std :: malloc并且可能还提供了:: malloc 。<stdlib.h>肯定提供:: malloc,可能还提供了std :: malloc。这甚至适用于不属于C标准库的函数和函数重载。

c兼容头文件

17> 不兼容支持的c头文件

C头文件<stdatomic.h>,<stdnoreturn.h>和<threads.h>不包含在C ++中,并且没有对应的cxxx.h代替。

18> C中没有的库

头文件<complex.h>,< ccomplex >,<tgmath.h>和< ctgmath >不包含C标准库中的任何内容,而只包含C ++标准库中的其他头文件。

c中无的库

19> 毫无意义的C头文件

头文件< ciso646 >,< cstdalign >和< cstdbool >在C ++中没有意义,因为它们在C中提供的宏是C ++中的语言关键字。

无意义的c头文件

20> 参考资料

该资源不适合C、C++初学者,可作为C++高手向大师级进化的参考书。 内容: ... 17 Library introduction 17.1 General 17.2 The C standard library 17.3 Definitions 17.4 Additional definitions 17.5 Method of description (Informative) 17.6 Library-wide requirements 18 Language support library 18.1 General 18.2 Types 18.3 Implementation properties 18.4 Integer types 18.5 Start and termination 18.6 Dynamic memory management CONTENTS v c ISO/IEC N3000=09-0190 18.7 Type identification 18.8 Exception handling 18.9 Initializer lists 18.10Other runtime support 19 Diagnostics library 456 19.1 General 19.2 Exception classes 19.3 Assertions 19.4 Error numbers 19.5 System error support 20 General utilities library 20.1 General 20.2 Requirements 20.3 Utility components 20.4 Compile-time rational arithmetic 20.5 Tuples 20.6 Metaprogramming and type traits 20.7 Function objects . 520 20.8 Memory 541 20.9 Time utilities 583 20.10Date and time functions 596 20.11Class type_index 596 21 Strings library 599 21.1 General 599 21.2 Character traits 599 21.3 String classes 605 21.4 Class template basic_string 608 21.5 Numeric Conversions 635 21.6 Null-terminated sequence utilities . 636 22 Localization library 640 22.1 General 640 22.2 Header <locale> synopsis 640 22.3 Locales 641 22.4 Standard locale categories . 653 22.5 Standard code conversion facets 693 22.6 C Library Locales 695 23 Containers library 696 23.1 General 696 23.2 Container requirements 696 23.3 Sequence containers 719 23.4 Associative containers . 758 23.5 Unordered associative containers . 776 24 Iterators library 791 24.1 General 791 24.2 Iterator requirements 791 CONTENTS vi c ISO/IEC N3000=09-0190 24.3 Header <iterator> synopsis 796 24.4 Iterator primitives 799 24.5 Iterator adaptors . 802 24.6 Stream iterators . 816 25 Algorithms library 825 25.1 General 825 25.2 Non-modifying sequence operations 835 25.3 Mutating sequence operations 839 25.4 Sorting and related operations 848 25.5 C library algorithms 862 26 Numerics library 864 26.1 General 864 26.2 Numeric type requirements . 864 26.3 The floating-point environment 865 26.4 Complex numbers 866 26.5 Random number generation . 876 26.6 Numeric arrays 920 26.7 Generalized numeric operations 940 26.8 C Library 944 27 Input/output library 949 27.1 General 949 27.2 Iostreams requirements . 950 27.3 Forward declarations 950 27.4 Standard iostream objects 952 27.5 Iostreams base classes . 954 27.6 Stream buffers 972 27.7 Formatting and manipulators 982 27.8 String-based streams 1009 27.9 File-based streams 1021 28 Regular expressions library 1036 28.1 General 1036 28.2 Definitions 1036 28.3 Requirements 1037 28.4 Header <regex> synopsis 1039 28.5 Namespace std::regex_constants 1045 28.6 Class regex_error 1048 28.7 Class template regex_traits 1048 28.8 Class template basic_regex 1051 28.9 Class template sub_match 1056 28.10Class template match_results 1062 28.11Regular expression algorithms 1066 28.12Regular expression Iterators . 1070 28.13Modified ECMAScript regular expression grammar 1076 29 Atomic operations library 1079 29.1 General 1079 29.2 Header <atomic> synopsis 1079 CONTENTS vii c ISO/IEC N3000=09-0190 29.3 Order and Consistency . 1082 29.4 Lock-free Property 1084 29.5 Atomic Types 1085 29.6 Operations on Atomic Types 1094 29.7 Flag Type and Operations 1098 29.8 Fences . 1099 30 Thread support library 1101 30.1 General 1101 30.2 Requirements 1101 30.3 Threads 1102 30.4 Mutual exclusion . 1107 30.5 Condition variables 1121 30.6 Futures 1129 A Grammar summary 1149 A.1 Keywords 1149 A.2 Lexical conventions 1149 A.3 Basic concepts 1154 A.4 Expressions . 1154 A.5 Statements . 1158 A.6 Declarations . 1159 A.7 Declarators . 1162 A.8 Classes . 1164 A.9 Derived classes 1165 A.10 Special member functions 1165 A.11 Overloading . 1165 A.12 Templates 1166 A.13 Exception handling 1167 A.14 Preprocessing directives 1167 B Implementation quantities 1169 C Compatibility 1171 C.1 C++ and ISO C 1171 C.2 Standard C library 1181 D Compatibility features 1185 D.1 Increment operator with bool operand . 1185 D.2 static keyword . 1185 D.3 Access declarations 1185 D.4 Implicit conversion from const strings . 1185 D.5 register keyword 1185 D.6 C standard library headers . 1185 D.7 Old iostreams members 1186 D.8 char* streams 1187 D.9 Binders 1196 D.10 auto_ptr 1198 E Cross references 1201 Index 1218 CONTENTS viii ISO/IEC N3000=09-0190 Index of Grammar Productions 1243 Index of Library Names 1246 Index of Implementation Defined Behavior 1280
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值