没有合适的资源?快使用搜索试试~ 我知道了~
首页C++标准库ISO/IEC14882:2003(E)概览
C++标准库ISO/IEC14882:2003(E)概览
4星 · 超过85%的资源 需积分: 13 13 下载量 145 浏览量
更新于2024-07-27
收藏 2.4MB PDF 举报
"C++标准库文件,包含了ISO/IEC14882:2003(E)标准,是C++编程语言的第二版国际标准,旨在提供跨平台的编程支持。"
C++标准库是C++编程语言的核心组成部分,它提供了大量的类和函数,使得开发者能够更高效、便捷地编写程序。C++标准库按照ISO/IEC14882:2003(E)标准制定,这个版本是2003年发布的第二版,由国际标准化组织(ISO)和国际电工委员会(IEC)联合制定,并被美国国家标准协会(ANSI)采纳为美国国家标准。
C++标准库的主要组件包括以下几个方面:
1. **输入/输出流**:iostream库,如cin、cout、cerr和clog,用于处理标准输入、输出、错误输出等。它定义了std::streambuf、std::ostream、std::istream等类,支持格式化输出和输入。
2. **容器**:如vector、list、deque、set、map、unordered_set、unordered_map等,它们是模板类,能够存储各种类型的数据并提供相应的操作,如增删改查。
3. **迭代器**:迭代器是一种特殊的指针,可以遍历容器中的元素,提供了统一的操作接口,如递增、递减、访问元素等。
4. **算法**:algorithm库包含大量通用的算法,如排序(sort)、查找(find)、复制(copy)、合并(merge)等。
5. **字符串**:string类提供了对字符串的操作,如拼接、比较、查找子串等功能。
6. **智能指针**:如unique_ptr、shared_ptr、weak_ptr,它们是C++11引入的,用于管理动态分配的内存,防止内存泄漏。
7. **异常处理**:异常处理机制,如try、catch、throw,用于捕获和处理程序运行时的错误。
8. **内存管理**:如new、delete运算符以及new[]、delete[]运算符,以及C++11引入的内存管理工具如std::make_unique和std::make_shared。
9. **函数对象(Functors)**:允许用户自定义操作符,如比较函数、转换函数等,通常用作算法的参数。
10. **类型转换**:如static_cast、dynamic_cast、reinterpret_cast、const_cast等,提供了不同类型的转换功能。
11. **预处理**:如#define、#include、宏定义等,虽然不是标准库的一部分,但与C++编程密切相关。
12. **线程支持**:C++11引入了对多线程编程的支持,如std::thread、std::mutex、std::condition_variable等,提供了线程安全的编程手段。
通过使用C++标准库,程序员可以编写出高效、可移植的代码,而无需关注底层实现的细节,大大提高了开发效率。同时,标准库的跨平台特性使得基于此编写的程序可以在多种操作系统和硬件平台上顺利运行。
ISO/IEC 14882:2003(E)
xvi © ISO/IEC 2003 — All rights reserved
21.3.5.8 basic_string::swap ..........................................................................................................403
21.3.6 basic_string string operations ................................................................................................403
21.3.6.1 basic_string::find ..........................................................................................................403
21.3.6.2 basic_string::rfind........................................................................................................404
21.3.6.3 basic_string::find_first_of.....................................................................................404
21.3.6.4 basic_string::find_last_of.......................................................................................405
21.3.6.5 basic_string::find_first_not_of...........................................................................405
21.3.6.6 basic_string::find_last_not_of .............................................................................406
21.3.6.7 basic_string::substr .....................................................................................................406
21.3.6.8 basic_string::compare...................................................................................................406
21.3.7 basic_string non-member functions ......................................................................................407
21.3.7.1 operator+................................................................................................................................407
21.3.7.2 operator== .............................................................................................................................408
21.3.7.3 operator!= .............................................................................................................................408
21.3.7.4 operator<................................................................................................................................409
21.3.7.5 operator>................................................................................................................................409
21.3.7.6 operator<= .............................................................................................................................409
21.3.7.7 operator>= .............................................................................................................................410
21.3.7.8 swap............................................................................................................................................410
21.3.7.9 Inserters and extractors ................................................................................................................410
21.4 Null-terminated sequence utilities .....................................................................................................411
22 Localization library ...............................................................................................................................415
22.1 Locales ...............................................................................................................................................415
22.1.1 Class locale ................................................................................................................................416
22.1.1.1 locale types .............................................................................................................................418
22.1.1.1.1 Type locale::category...................................................................................................418
22.1.1.1.2 Class locale::facet .........................................................................................................420
22.1.1.1.3 Class locale::id.................................................................................................................420
22.1.1.2 locale constructors and destructor ...........................................................................................421
22.1.1.3 locale members .......................................................................................................................422
22.1.1.4 locale operators .......................................................................................................................422
22.1.1.5 locale static members ..............................................................................................................423
22.1.2 locale globals .............................................................................................................................423
22.1.3 Convenience interfaces ...................................................................................................................423
22.1.3.1 Character classification ................................................................................................................423
22.1.3.2 Character conversions ..................................................................................................................424
22.2 Standard locale categories.............................................................................................................424
22.2.1 The ctype category ......................................................................................................................424
22.2.1.1 Class template ctype.................................................................................................................424
22.2.1.1.1 ctype members .......................................................................................................................425
22.2.1.1.2 ctype virtual functions ...........................................................................................................426
22.2.1.2 Class template ctype_byname................................................................................................427
22.2.1.3 ctype specializations .................................................................................................................428
22.2.1.3.1 ctype<char> destructor .......................................................................................................429
22.2.1.3.2 ctype<char> members ........................................................................................................429
22.2.1.3.3 ctype<char> static members ...............................................................................................430
22.2.1.3.4 ctype<char> virtual functions.............................................................................................430
22.2.1.4 Class ctype_byname<char>.........................................................................................................431
22.2.1.5 Class template codecvt............................................................................................................431
22.2.1.5.1 codecvt members ..................................................................................................................432
ANSI Store order #X185411 Downloaded: 5/29/2005 2:13:38 PM ET
Single user license only. Copying and networking prohibited.
ISO/IEC 14882:2003(E)
© ISO/IEC 2003 — All rights reserved xvii
22.2.1.5.2 codecvt virtual functions ......................................................................................................433
22.2.1.6 Class template codecvt_byname ...........................................................................................435
22.2.2 The numeric category .....................................................................................................................435
22.2.2.1 Class template num_get............................................................................................................435
22.2.2.1.1 num_get members ..................................................................................................................437
22.2.2.1.2 num_get virtual functions ......................................................................................................437
22.2.2.2 Class template num_put............................................................................................................439
22.2.2.2.1 num_put members ..................................................................................................................440
22.2.2.2.2 num_put virtual functions ......................................................................................................440
22.2.3 The numeric punctuation facet .......................................................................................................443
22.2.3.1 Class template numpunct..........................................................................................................443
22.2.3.1.1 numpunct members ...............................................................................................................444
22.2.3.1.2 numpunct virtual functions ....................................................................................................445
22.2.3.2 Class template numpunct_byname.........................................................................................445
22.2.4 The collate category ........................................................................................................................445
22.2.4.1 Class template collate............................................................................................................445
22.2.4.1.1 collate members ..................................................................................................................446
22.2.4.1.2 collate virtual functions ......................................................................................................446
22.2.4.2 Class template collate_byname ...........................................................................................447
22.2.5 The time category ...........................................................................................................................447
22.2.5.1 Class template time_get..........................................................................................................447
22.2.5.1.1 time_get members ...............................................................................................................448
22.2.5.1.2 time_get virtual functions ....................................................................................................449
22.2.5.2 Class template time_get_byname.........................................................................................450
22.2.5.3 Class template time_put..........................................................................................................450
22.2.5.3.1 time_put members ...............................................................................................................451
22.2.5.3.2 time_put virtual functions ....................................................................................................451
22.2.5.4 Class template time_put_byname.........................................................................................451
22.2.6 The monetary category ...................................................................................................................452
22.2.6.1 Class template money_get .......................................................................................................452
22.2.6.1.1 money_get members .............................................................................................................452
22.2.6.1.2 money_get virtual functions .................................................................................................452
22.2.6.2 Class template money_put .......................................................................................................454
22.2.6.2.1 money_put members .............................................................................................................454
22.2.6.2.2 money_put virtual functions .................................................................................................454
22.2.6.3 Class template moneypunct.....................................................................................................455
22.2.6.3.1 moneypunct members ...........................................................................................................456
22.2.6.3.2 moneypunct virtual functions ...............................................................................................456
22.2.6.4 Class template moneypunct_byname....................................................................................457
22.2.7 The message retrieval category.......................................................................................................458
22.2.7.1 Class template messages..........................................................................................................458
22.2.7.1.1 messages members ...............................................................................................................458
22.2.7.1.2 messages virtual functions ....................................................................................................459
22.2.7.2 Class template messages_byname.........................................................................................459
22.2.8 Program-defined facets ...................................................................................................................459
22.3 C Library Locales ..............................................................................................................................463
23 Containers library .................................................................................................................................465
23.1 Container requirements ......................................................................................................................465
23.1.1 Sequences .......................................................................................................................................468
23.1.2 Associative containers ....................................................................................................................471
ANSI Store order #X185411 Downloaded: 5/29/2005 2:13:38 PM ET
Single user license only. Copying and networking prohibited.
ISO/IEC 14882:2003(E)
xviii © ISO/IEC 2003 — All rights reserved
23.2 Sequences ..........................................................................................................................................474
23.2.1 Class template deque....................................................................................................................477
23.2.1.1 deque constructors, copy, and assignment ................................................................................479
23.2.1.2 deque capacity ...........................................................................................................................480
23.2.1.3 deque modifiers .........................................................................................................................480
23.2.1.4 deque specialized algorithms ....................................................................................................480
23.2.2 Class template list ......................................................................................................................481
23.2.2.1 list constructors, copy, and assignment ...................................................................................483
23.2.2.2 list capacity .............................................................................................................................484
23.2.2.3 list modifiers ...........................................................................................................................484
23.2.2.4 list operations ..........................................................................................................................484
23.2.2.5 list specialized algorithms .......................................................................................................486
23.2.3 Container adaptors ..........................................................................................................................486
23.2.3.1 Class template queue.................................................................................................................486
23.2.3.2 Class template priority_queue ...........................................................................................487
23.2.3.2.1 priority_queue constructors ............................................................................................488
23.2.3.2.2 priority_queue members .................................................................................................488
23.2.3.3 Class template stack.................................................................................................................488
23.2.4 Class template vector .................................................................................................................489
23.2.4.1 vector constructors, copy, and assignment ..............................................................................491
23.2.4.2 vector capacity .........................................................................................................................492
23.2.4.3 vector modifiers.......................................................................................................................492
23.2.4.4 vector specialized algorithms ..................................................................................................493
23.2.5 Class vector<bool>..................................................................................................................493
23.3 Associative containers .......................................................................................................................495
23.3.1 Class template map.........................................................................................................................497
23.3.1.1 map constructors, copy, and assignment .....................................................................................499
23.3.1.2 map element access .....................................................................................................................500
23.3.1.3 map operations ............................................................................................................................500
23.3.1.4 map specialized algorithms .........................................................................................................500
23.3.2 Class template multimap.............................................................................................................500
23.3.2.1 multimap constructors..............................................................................................................503
23.3.2.2 multimap operations ................................................................................................................503
23.3.2.3 multimap specialized algorithms .............................................................................................503
23.3.3 Class template set.........................................................................................................................503
23.3.3.1 set constructors, copy, and assignment .....................................................................................505
23.3.3.2 set specialized algorithms .........................................................................................................506
23.3.4 Class template multiset.............................................................................................................506
23.3.4.1 multiset constructors..............................................................................................................508
23.3.4.2 multiset specialized algorithms .............................................................................................508
23.3.5 Class template bitset .................................................................................................................509
23.3.5.1 bitset constructors ..................................................................................................................510
23.3.5.2 bitset members .......................................................................................................................511
23.3.5.3 bitset operators .......................................................................................................................514
24 Iterators library .....................................................................................................................................515
24.1 Iterator requirements ..........................................................................................................................515
24.1.1 Input iterators ..................................................................................................................................516
24.1.2 Output iterators ...............................................................................................................................517
24.1.3 Forward iterators .............................................................................................................................518
24.1.4 Bidirectional iterators .....................................................................................................................519
24.1.5 Random access iterators..................................................................................................................519
ANSI Store order #X185411 Downloaded: 5/29/2005 2:13:38 PM ET
Single user license only. Copying and networking prohibited.
ISO/IEC 14882:2003(E)
© ISO/IEC 2003 — All rights reserved xix
24.2 Header <iterator> synopsis ........................................................................................................520
24.3 Iterator primitives ..............................................................................................................................522
24.3.1 Iterator traits....................................................................................................................................522
24.3.2 Basic iterator ...................................................................................................................................523
24.3.3 Standard iterator tags ......................................................................................................................524
24.3.4 Iterator operations ...........................................................................................................................525
24.4 Predefined iterators ............................................................................................................................525
24.4.1 Reverse iterators .............................................................................................................................525
24.4.1.1 Class template reverse_iterator ......................................................................................526
24.4.1.2 reverse_iterator requirements .........................................................................................527
24.4.1.3 reverse_iterator operations .............................................................................................527
24.4.1.3.1 reverse_iterator constructor .........................................................................................527
24.4.1.3.2 Conversion ................................................................................................................................527
24.4.1.3.3 operator*.............................................................................................................................527
24.4.1.3.4 operator-> ..........................................................................................................................528
24.4.1.3.5 operator++ ..........................................................................................................................528
24.4.1.3.6 operator-- ..........................................................................................................................528
24.4.1.3.7 operator+.............................................................................................................................528
24.4.1.3.8 operator+= ..........................................................................................................................528
24.4.1.3.9 operator-.............................................................................................................................529
24.4.1.3.10 operator-= ........................................................................................................................529
24.4.1.3.11 operator[] ........................................................................................................................529
24.4.1.3.12 operator== ........................................................................................................................529
24.4.1.3.13 operator<...........................................................................................................................529
24.4.1.3.14 operator!= ........................................................................................................................529
24.4.1.3.15 operator>...........................................................................................................................529
24.4.1.3.16 operator>= ........................................................................................................................530
24.4.1.3.17 operator<= ........................................................................................................................530
24.4.1.3.18 operator-...........................................................................................................................530
24.4.1.3.19 operator+...........................................................................................................................530
24.4.2 Insert iterators .................................................................................................................................530
24.4.2.1 Class template back_insert_iterator.............................................................................531
24.4.2.2 back_insert_iterator operations ....................................................................................531
24.4.2.2.1 back_insert_iterator constructor ...............................................................................531
24.4.2.2.2 back_insert_iterator::operator=........................................................................531
24.4.2.2.3 back_insert_iterator::operator*........................................................................531
24.4.2.2.4 back_insert_iterator::operator++......................................................................531
24.4.2.2.5 back_inserter ...................................................................................................................532
24.4.2.3 Class template front_insert_iterator ..........................................................................532
24.4.2.4 front_insert_iterator operations .................................................................................532
24.4.2.4.1 front_insert_iterator constructor .............................................................................532
24.4.2.4.2 front_insert_iterator::operator=......................................................................532
24.4.2.4.3 front_insert_iterator::operator*......................................................................532
24.4.2.4.4 front_insert_iterator::operator++ ...................................................................533
24.4.2.4.5 front_inserter.................................................................................................................533
24.4.2.5 Class template insert_iterator.........................................................................................533
24.4.2.6 insert_iterator operations ................................................................................................533
24.4.2.6.1 insert_iterator constructor ...........................................................................................533
24.4.2.6.2 insert_iterator::operator=....................................................................................533
24.4.2.6.3 insert_iterator::operator*....................................................................................534
24.4.2.6.4 insert_iterator::operator++..................................................................................534
24.4.2.6.5 inserter ...............................................................................................................................534
ANSI Store order #X185411 Downloaded: 5/29/2005 2:13:38 PM ET
Single user license only. Copying and networking prohibited.
ISO/IEC 14882:2003(E)
xx © ISO/IEC 2003 — All rights reserved
24.5 Stream iterators ..................................................................................................................................534
24.5.1 Class template istream_iterator .........................................................................................534
24.5.1.1 istream_iterator constructors and destructor ...................................................................535
24.5.1.2 istream_iterator operations .............................................................................................535
24.5.2 Class template ostream_iterator .........................................................................................536
24.5.2.1 ostream_iterator constructors and destructor ...................................................................537
24.5.2.2 ostream_iterator operations .............................................................................................537
24.5.3 Class template istreambuf_iterator ..................................................................................537
24.5.3.1 Class template istreambuf_iterator::proxy ..............................................................538
24.5.3.2 istreambuf_iterator constructors ...................................................................................539
24.5.3.3 istreambuf_iterator::operator* .............................................................................539
24.5.3.4 istreambuf_iterator::operator++...........................................................................539
24.5.3.5 istreambuf_iterator::equal.......................................................................................539
24.5.3.6 operator== .............................................................................................................................539
24.5.3.7 operator!= .............................................................................................................................539
24.5.4 Class template ostreambuf_iterator ..................................................................................540
24.5.4.1 ostreambuf_iterator constructors ...................................................................................540
24.5.4.2 ostreambuf_iterator operations ......................................................................................540
25 Algorithms library ................................................................................................................................543
25.1 Non-modifying sequence operations .................................................................................................551
25.1.1 For each ..........................................................................................................................................551
25.1.2 Find .................................................................................................................................................552
25.1.3 Find End..........................................................................................................................................552
25.1.4 Find First.........................................................................................................................................552
25.1.5 Adjacent find ..................................................................................................................................553
25.1.6 Count...............................................................................................................................................553
25.1.7 Mismatch ........................................................................................................................................553
25.1.8 Equal ...............................................................................................................................................554
25.1.9 Search .............................................................................................................................................554
25.2 Mutating sequence operations ...........................................................................................................555
25.2.1 Copy ................................................................................................................................................555
25.2.2 Swap ...............................................................................................................................................555
25.2.3 Transform .......................................................................................................................................556
25.2.4 Replace ...........................................................................................................................................556
25.2.5 Fill ...................................................................................................................................................557
25.2.6 Generate ..........................................................................................................................................557
25.2.7 Remove ...........................................................................................................................................557
25.2.8 Unique.............................................................................................................................................558
25.2.9 Reverse ...........................................................................................................................................558
25.2.10 Rotate ............................................................................................................................................559
25.2.11 Random shuffle .............................................................................................................................559
25.2.12 Partitions .......................................................................................................................................560
25.3 Sorting and related operations ...........................................................................................................560
25.3.1 Sorting.............................................................................................................................................561
25.3.1.1 sort............................................................................................................................................561
25.3.1.2 stable_sort...........................................................................................................................561
25.3.1.3 partial_sort.........................................................................................................................561
25.3.1.4 partial_sort_copy.............................................................................................................562
25.3.2 Nth element .....................................................................................................................................562
25.3.3 Binary search ..................................................................................................................................562
ANSI Store order #X185411 Downloaded: 5/29/2005 2:13:38 PM ET
Single user license only. Copying and networking prohibited.
剩余785页未读,继续阅读
点击了解资源详情
点击了解资源详情
168 浏览量
2023-04-20 上传
2012-10-22 上传
2018-11-22 上传
mining_007
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MATLAB新功能:Multi-frame ViewRGB制作彩色图阴影
- XKCD Substitutions 3-crx插件:创新的网页文字替换工具
- Python实现8位等离子效果开源项目plasma.py解读
- 维护商店移动应用:基于PhoneGap的移动API应用
- Laravel-Admin的Redis Manager扩展使用教程
- Jekyll代理主题使用指南及文件结构解析
- cPanel中PHP多版本插件的安装与配置指南
- 深入探讨React和Typescript在Alias kopio游戏中的应用
- node.js OSC服务器实现:Gibber消息转换技术解析
- 体验最新升级版的mdbootstrap pro 6.1.0组件库
- 超市盘点过机系统实现与delphi应用
- Boogle: 探索 Python 编程的 Boggle 仿制品
- C++实现的Physics2D简易2D物理模拟
- 傅里叶级数在分数阶微分积分计算中的应用与实现
- Windows Phone与PhoneGap应用隔离存储文件访问方法
- iso8601-interval-recurrence:掌握ISO8601日期范围与重复间隔检查
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功