Transcription of C++ International Standard
1 Document Number: N4713. Date: 2017 -11-27. Revises: N4700. Reply to: Richard Smith Google Inc Working Draft, Standard for Programming Language C++. Note: this is an early draft. It's known to be incomplet and incorrekt, and it has lots of ba d formatting. ISO/IEC N4713. Contents 1 Scope 1. 2 Normative references 2. 3 Terms and definitions 3. 4 General principles 6. Implementation compliance .. 6. Structure of this document .. 8. Syntax notation .. 8. Acknowledgments .. 8. 5 Lexical conventions 9. Separate translation .. 9. Phases of translation .. 9. Character sets .. 10. Preprocessing tokens .. 11.
2 Alternative tokens .. 12. Tokens .. 12. Comments .. 12. Header names .. 12. Preprocessing numbers .. 13. Identifiers .. 13. Keywords .. 14. Operators and punctuators .. 15. Literals .. 15. 6 Basic concepts 24. Declarations and definitions .. 24. One-definition rule .. 26. Scope .. 29. Name lookup .. 34. Program and linkage .. 46. Memory and objects .. 48. Types .. 57. Program execution .. 63. 7 Standard conversions 75. Lvalue-to-rvalue conversion .. 76. Array-to-pointer conversion .. 76. Function-to-pointer conversion .. 76. Temporary materialization conversion .. 76. Qualification conversions .. 77.
3 Integral promotions .. 77. Floating-point promotion .. 78. Integral conversions .. 78. Floating-point conversions .. 78. Floating-integral conversions .. 78. Pointer conversions .. 78. Pointer-to-member conversions .. 79. Function pointer conversions .. 79. Boolean conversions .. 79. Contents ii ISO/IEC N4713. 8 Expressions 80. Preamble .. 80. Properties of expressions .. 80. Usual arithmetic conversions .. 83. Primary expressions .. 84. Compound expressions .. 99. Constant expressions .. 126. 9 Statements 130. Labeled statement .. 130. Expression statement .. 131. Compound statement or block .. 131.
4 Selection statements .. 131. Iteration statements .. 133. Jump statements .. 135. Declaration statement .. 137. Ambiguity resolution .. 137. 10 Declarations 139. Specifiers .. 140. Enumeration declarations .. 156. Namespaces .. 159. The asm declaration .. 171. Linkage specifications .. 171. Attributes .. 173. 11 Declarators 179. Type names .. 180. Ambiguity resolution .. 181. Meaning of declarators .. 182. Function definitions .. 192. Structured binding declarations .. 195. Initializers .. 196. 12 Classes 211. Class names .. 213. Class members .. 214. Unions .. 224. Local class declarations .. 226.
5 13 Derived classes 227. Multiple base classes .. 228. Member name lookup .. 229. Virtual functions .. 232. Abstract classes .. 236. 14 Member access control 238. Access specifiers .. 239. Accessibility of base classes and base class members .. 240. Friends .. 242. Protected member access .. 245. Access to virtual functions .. 245. Multiple access .. 246. Nested classes .. 246. 15 Special member functions 247. Constructors .. 247. Temporary objects .. 249. Conversions .. 252. Destructors .. 255. Contents iii ISO/IEC N4713. Free store .. 257. Initialization .. 259. Construction and destruction .. 265.
6 Copying and moving class objects .. 267. Comparisons .. 274. 16 Overloading 276. Overloadable declarations .. 276. Declaration matching .. 278. Overload resolution .. 279. Address of overloaded function .. 298. Overloaded operators .. 299. Built-in operators .. 303. 17 Templates 306. Template parameters .. 307. Names of template specializations .. 312. Template arguments .. 314. Template constraints .. 319. Type equivalence .. 322. Template declarations .. 323. Name resolution .. 341. Template instantiation and specialization .. 354. Function template specializations .. 366. Deduction guides .. 385.
7 18 Exception handling 386. Throwing an exception .. 387. Constructors and destructors .. 388. Handling an exception .. 389. Exception specifications .. 390. Special functions .. 393. 19 Preprocessing directives 395. Conditional inclusion .. 396. Source file inclusion .. 398. Macro replacement .. 399. Line control .. 404. Error directive .. 404. Pragma directive .. 404. Null directive .. 404. Predefined macro names .. 404. Pragma operator .. 406. 20 Library introduction 407. General .. 407. The C Standard library .. 408. Definitions .. 408. Method of description (Informative) .. 410. Library-wide requirements.
8 415. 21 Language support library 434. General .. 434. Common definitions .. 434. Implementation properties .. 438. Integer types .. 446. Start and termination .. 447. Dynamic memory management .. 448. Type identification .. 455. Contents iv ISO/IEC N4713. Exception handling .. 457. Initializer lists .. 461. Comparisons .. 462. Other runtime support .. 469. 22 Diagnostics library 472. General .. 472. Exception classes .. 472. Assertions .. 475. Error numbers .. 476. System error support .. 477. 23 General utilities library 487. General .. 487. Utility components .. 487. Compile-time integer sequences.
9 491. Pairs .. 492. Tuples .. 495. Optional objects .. 505. Variants .. 518. Storage for any type .. 528. Bitsets .. 533. Memory .. 539. Smart pointers .. 552. Memory resources .. 579. Class template scoped_allocator_adaptor .. 588. Function objects .. 593. Metaprogramming and type traits .. 614. Compile-time rational arithmetic .. 636. Time utilities .. 639. Class type_index .. 653. Execution policies .. 654. Primitive numeric conversions .. 656. 24 Strings library 660. General .. 660. Character traits .. 660. String classes .. 665. String view classes .. 694. Null-terminated sequence utilities.
10 704. 25 Localization library 708. General .. 708. Header <locale> synopsis .. 708. Locales .. 709. Standard locale categories .. 716. C library locales .. 748. 26 Containers library 750. General .. 750. Container requirements .. 750. Sequence containers .. 782. Associative containers .. 809. Unordered associative containers .. 826. Container adaptors .. 847. 27 Iterators library 855. General .. 855. Iterator requirements .. 855. Contents v ISO/IEC N4713. Header <iterator> synopsis .. 860. Iterator primitives .. 863. Iterator adaptors .. 865. Stream iterators .. 876. Range access .. 882. Container access.
