14
INCITS/ISO/IEC 14882:2017 (2018) (ISO/IEC 14882:2017, IDT) Programming languages - C++ This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

INCITS/ISO/IEC 14882:2017 (2018) (ISO/IEC 14882:2017, IDT)...2018/06/29  · INCITS/ISO/IEC 14882:2017 (2018) (ISO/IEC 14882:2017, IDT) Programming languages - C++ This is a preview

  • Upload
    others

  • View
    17

  • Download
    0

Embed Size (px)

Citation preview

  • INCITS/ISO/IEC 14882:2017 (2018) (ISO/IEC 14882:2017, IDT)

    Programming languages - C++

    This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • INCITS/ISO/IEC 14882:2017 (2018)

    PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat accepts no liability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below.

    Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard. Date of ANSI Approval: 6/29/2018 Published by American National Standards Institute, 25 West 43rd Street, New York, New York 10036 Copyright 2018 by Information Technology Industry Council (ITI). All rights reserved. These materials are subject to copyright claims of International Standardization Organization (ISO), International Electrotechnical Commission (IEC), American National Standards Institute (ANSI), and Information Technology Industry Council (ITI). Not for resale. No part of this publication may be reproduced in any form, including an electronic retrieval system, without the prior written permission of ITI. All requests pertaining to this standard should be submitted to ITI, 1101 K Street NW, Suite 610, Washington DC 20005. Printed in the United States of America

    ii © ITIC 2018 – All rights reserved

    This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • Programming languages — C++Langages de programmation — C++

    INTERNATIONAL STANDARD

    ISO/IEC14882

    Reference numberISO/IEC 14882:2017(E)

    Fifth edition2017-12

    © ISO/IEC 2017

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ii © ISO/IEC 2017 – All rights reserved

    COPYRIGHT PROTECTED DOCUMENT

    © ISO/IEC 2017, Published in SwitzerlandAll rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of the requester.

    ISO copyright officeCh. de Blandonnet 8 • CP 401CH-1214 Vernier, Geneva, SwitzerlandTel. +41 22 749 01 11Fax +41 22 749 09 [email protected]

    ISO/IEC 14882:2017(E)

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    ContentsForeword xi

    1 Scope 1

    2 Normative references 2

    3 Terms and definitions 3

    4 General principles 74.1 Implementation compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74.2 Structure of this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84.3 Syntax notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84.4 The C++ memory model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84.5 The C++ object model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.6 Program execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.7 Multi-threaded executions and data races . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.8 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    5 Lexical conventions 225.1 Separate translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225.2 Phases of translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225.3 Character sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235.4 Preprocessing tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245.5 Alternative tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255.6 Tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255.7 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.8 Header names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.9 Preprocessing numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.10 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275.11 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285.12 Operators and punctuators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295.13 Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    6 Basic concepts 396.1 Declarations and definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396.2 One-definition rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446.4 Name lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506.5 Program and linkage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636.6 Start and termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666.7 Storage duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706.8 Object lifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746.9 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776.10 Lvalues and rvalues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836.11 Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

    Contents © ISO/IEC 2017 – All rights reserved iii

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    7 Standard conversions 867.1 Lvalue-to-rvalue conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877.2 Array-to-pointer conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877.3 Function-to-pointer conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887.4 Temporary materialization conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887.5 Qualification conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887.6 Integral promotions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897.7 Floating-point promotion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897.8 Integral conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897.9 Floating-point conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907.10 Floating-integral conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907.11 Pointer conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907.12 Pointer to member conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907.13 Function pointer conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917.14 Boolean conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917.15 Integer conversion rank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    8 Expressions 938.1 Primary expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 968.2 Postfix expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1098.3 Unary expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1208.4 Explicit type conversion (cast notation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1298.5 Pointer-to-member operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1308.6 Multiplicative operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1318.7 Additive operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1318.8 Shift operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1328.9 Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1338.10 Equality operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1338.11 Bitwise AND operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1358.12 Bitwise exclusive OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1358.13 Bitwise inclusive OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1358.14 Logical AND operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1358.15 Logical OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1358.16 Conditional operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1368.17 Throwing an exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1378.18 Assignment and compound assignment operators . . . . . . . . . . . . . . . . . . . . . . . 1378.19 Comma operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1388.20 Constant expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

    9 Statements 1449.1 Labeled statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1459.2 Expression statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1459.3 Compound statement or block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1459.4 Selection statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1459.5 Iteration statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1489.6 Jump statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1509.7 Declaration statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1529.8 Ambiguity resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

    Contents © ISO/IEC 2017 – All rights reserved iv

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    10 Declarations 15510.1 Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15710.2 Enumeration declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17410.3 Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17810.4 The asm declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19110.5 Linkage specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19110.6 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

    11 Declarators 20111.1 Type names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20211.2 Ambiguity resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20311.3 Meaning of declarators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20411.4 Function definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21611.5 Structured binding declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21911.6 Initializers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

    12 Classes 23712.1 Class names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23912.2 Class members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24112.3 Unions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25112.4 Local class declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254

    13 Derived classes 25513.1 Multiple base classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25613.2 Member name lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25813.3 Virtual functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26113.4 Abstract classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265

    14 Member access control 26714.1 Access specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26814.2 Accessibility of base classes and base class members . . . . . . . . . . . . . . . . . . . . . . 26914.3 Friends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27214.4 Protected member access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27514.5 Access to virtual functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27614.6 Multiple access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27614.7 Nested classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

    15 Special member functions 27815.1 Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27815.2 Temporary objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28115.3 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28315.4 Destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28615.5 Free store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28915.6 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29115.7 Construction and destruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29815.8 Copying and moving class objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

    16 Overloading 30916.1 Overloadable declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30916.2 Declaration matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31116.3 Overload resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312

    Contents © ISO/IEC 2017 – All rights reserved v

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    16.4 Address of overloaded function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33316.5 Overloaded operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33416.6 Built-in operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339

    17 Templates 34217.1 Template parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34317.2 Names of template specializations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34717.3 Template arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34817.4 Type equivalence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35417.5 Template declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35517.6 Name resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37317.7 Template instantiation and specialization . . . . . . . . . . . . . . . . . . . . . . . . . . . 38817.8 Function template specializations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40017.9 Deduction guides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421

    18 Exception handling 42218.1 Throwing an exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42318.2 Constructors and destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42518.3 Handling an exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42518.4 Exception specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42718.5 Special functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430

    19 Preprocessing directives 43219.1 Conditional inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43319.2 Source file inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43519.3 Macro replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43619.4 Line control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44119.5 Error directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44219.6 Pragma directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44219.7 Null directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44219.8 Predefined macro names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44219.9 Pragma operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444

    20 Library introduction 44520.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44520.2 The C standard library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44620.3 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44620.4 Method of description (Informative) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44920.5 Library-wide requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454

    21 Language support library 47621.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47621.2 Common definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47621.3 Implementation properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48121.4 Integer types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49021.5 Start and termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49121.6 Dynamic memory management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49221.7 Type identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50021.8 Exception handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50221.9 Initializer lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50721.10 Other runtime support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508

    Contents © ISO/IEC 2017 – All rights reserved vi

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    22 Diagnostics library 51122.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51122.2 Exception classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51122.3 Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51522.4 Error numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51522.5 System error support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

    23 General utilities library 52823.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52823.2 Utility components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52823.3 Compile-time integer sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53623.4 Pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53723.5 Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54123.6 Optional objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55323.7 Variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56723.8 Storage for any type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58023.9 Bitsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58623.10 Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59223.11 Smart pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60723.12 Memory resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63423.13 Class template scoped_allocator_adaptor . . . . . . . . . . . . . . . . . . . . . . . . . . 64523.14 Function objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65123.15 Metaprogramming and type traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67523.16 Compile-time rational arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69923.17 Time utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70223.18 Class type_index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71923.19 Execution policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720

    24 Strings library 72324.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72324.2 Character traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72324.3 String classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72924.4 String view classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76224.5 Null-terminated sequence utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772

    25 Localization library 77825.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77825.2 Header synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77825.3 Locales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78025.4 Standard locale categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78725.5 C library locales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825

    26 Containers library 82626.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82626.2 Container requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82626.3 Sequence containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86426.4 Associative containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89626.5 Unordered associative containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91826.6 Container adaptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 942

    Contents © ISO/IEC 2017 – All rights reserved vii

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    27 Iterators library 95227.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95227.2 Iterator requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95227.3 Header synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95827.4 Iterator primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96127.5 Iterator adaptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96427.6 Stream iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97727.7 Range access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98427.8 Container access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 985

    28 Algorithms library 98628.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98628.2 Header synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98628.3 Algorithms requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100528.4 Parallel algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100628.5 Non-modifying sequence operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100928.6 Mutating sequence operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101728.7 Sorting and related operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102728.8 C library algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046

    29 Numerics library 104729.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104729.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104729.3 Numeric type requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104729.4 The floating-point environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104829.5 Complex numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104929.6 Random number generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105929.7 Numeric arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110229.8 Generalized numeric operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112229.9 Mathematical functions for floating-point types . . . . . . . . . . . . . . . . . . . . . . . . 1136

    30 Input/output library 115330.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115330.2 Iostreams requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115430.3 Forward declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115430.4 Standard iostream objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115630.5 Iostreams base classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115830.6 Stream buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117530.7 Formatting and manipulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118430.8 String-based streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121130.9 File-based streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122130.10 File systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123530.11 C library files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1288

    31 Regular expressions library 129231.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129231.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129231.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129331.4 Header synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129531.5 Namespace std::regex_constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130131.6 Class regex_error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1304

    Contents © ISO/IEC 2017 – All rights reserved viii

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    31.7 Class template regex_traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130531.8 Class template basic_regex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130731.9 Class template sub_match . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131331.10 Class template match_results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131831.11 Regular expression algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132431.12 Regular expression iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132931.13 Modified ECMAScript regular expression grammar . . . . . . . . . . . . . . . . . . . . . . 1335

    32 Atomic operations library 133832.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133832.2 Header synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133832.3 Type aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134232.4 Order and consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134232.5 Lock-free property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134432.6 Class template atomic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134532.7 Non-member functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135232.8 Flag type and operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135232.9 Fences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1353

    33 Thread support library 135533.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135533.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135533.3 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135833.4 Mutual exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136333.5 Condition variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138433.6 Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1391

    A Grammar summary 1408A.1 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1408A.2 Lexical conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1408A.3 Basic concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1413A.4 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1413A.5 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1417A.6 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1418A.7 Declarators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1422A.8 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1424A.9 Derived classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1425A.10 Special member functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1426A.11 Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1426A.12 Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1426A.13 Exception handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1427A.14 Preprocessing directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1428

    B Implementation quantities 1430

    C Compatibility 1432C.1 C++ and ISO C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1432C.2 C++ and ISO C++ 2003 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1441C.3 C++ and ISO C++ 2011 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1447C.4 C++ and ISO C++ 2014 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1449C.5 C standard library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1453

    Contents © ISO/IEC 2017 – All rights reserved ix

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    D Compatibility features 1456D.1 Redeclaration of static constexpr data members . . . . . . . . . . . . . . . . . . . . . . 1456D.2 Implicit declaration of copy functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1456D.3 Deprecated exception specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1456D.4 C++ standard library headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1456D.5 C standard library headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1457D.6 char* streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1457D.7 uncaught_exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1466D.8 Old adaptable function bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1466D.9 The default allocator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1471D.10 Raw storage iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1472D.11 Temporary buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1473D.12 Deprecated type traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1474D.13 Deprecated iterator primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1475D.14 Deprecated shared_ptr observers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1475D.15 Deprecated standard code conversion facets . . . . . . . . . . . . . . . . . . . . . . . . . . 1475D.16 Deprecated convenience conversion interfaces . . . . . . . . . . . . . . . . . . . . . . . . . 1477

    Bibliography 1482

    Cross references 1483

    Cross references from ISO C++ 2014 1504

    Index 1506

    Index of grammar productions 1539

    Index of library names 1543

    Index of implementation-defined behavior 1601

    Contents © ISO/IEC 2017 – All rights reserved x

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    ForewordISO (the International Organization for Standardization) is a worldwide federation of national standardsbodies (ISO member bodies). The work of preparing International Standards is normally carried out throughISO technical committees. Each member body interested in a subject for which a technical committee hasbeen established has the right to be represented on that committee. International organizations, governmentaland non-governmental, in liaison with ISO, also take part in the work. ISO collaborates closely with theInternational Electrotechnical Commission (IEC) on all matters of electrotechnical standardization.The procedures used to develop this document and those intended for its further maintenance are describedin the ISO/IEC Directives, Part 1. In particular the different approval criteria needed for the different typesof ISO documents should be noted. This document was drafted in accordance with the editorial rules of theISO/IEC Directives, Part 2 (see www.iso.org/directives).Attention is drawn to the possibility that some of the elements of this document may be the subject of patentrights. ISO shall not be held responsible for identifying any or all such patent rights. Details of any patentrights identified during the development of the document will be in the Introduction and/or on the ISO listof patent declarations received (see www.iso.org/patents).Any trade name used in this document is information given for the convenience of users and does notconstitute an endorsement.For an explanation on the voluntary nature of standards, the meaning of ISO specific terms and ex-pressions related to conformity assessment, as well as information about ISO’s adherence to the WorldTrade Organization (WTO) principles in the Technical Barriers to Trade (TBT) see the following URL:www.iso.org/iso/foreword.html.This document was prepared by Technical Committee ISO/IEC JTC 1, Information technology, SubcommitteeSC 22, Programming languages, their environments and system software interfaces.This fifth edition cancels and replaces the fourth edition (ISO/IEC 14882:2014), which has been technicallyrevised.The main changes compared to the previous edition are as follows:

    — expression evaluation order is specified in more cases— removal of trigraphs— adjustments to value categories resulting in copy elision being mandatory— additional character and floating point literal syntaxes— lambda expressions extended to permit capture of *this and use in constant expressions— initializer statements for if and switch statements— addition of constexpr if statements— range-based for statement generalized to support heterogeneous begin and end types— addition of structured bindings— addition of inline variables— list initialization extended to support enumerations and aggregates with base classes— message in static_assert is now optional— addition of nested namespace definition syntax

    Foreword © ISO/IEC 2017 – All rights reserved xi

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    http://www.iso.org/directiveshttp://www.iso.org/patentshttp://www.iso.org/iso/foreword.htmlhttps://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview

  • ISO/IEC 14882:2017(E)

    — extended support for attributes— exception specifications are now part of function types— template argument deduction is now supported for class templates— addition of fold expressions— pack expansion can be performed on using declarations— permitted forms of template parameters and template arguments have been generalized— dynamic allocation is supported for over-aligned types— preprocessor can detect presence of header files with __has_include— new utility functions, types, and templates in the standard library, including

    — an any type— an optional class template— a variant class template— a clamp function— a std::byte type— a not_fn function— a void_t alias template— conjunction, disjunction, and negation templates— an invoke function, and is_invocable and invoke_result type traits— an is_swappable type trait

    — extended constant expression evaluation support in the standard library— elementary conversion functions between strings and numeric types added— constructors for pair and tuple are conditionally-explicit— shared_ptrs of array types now supported— additional algorithms for managing uninitialized memory— addition of polymorphic memory resources— addition of substring search facilities providing the Boyer-Moore and Boyer-Moore-Horspool search

    algorithms— addition of variable templates for type traits— addition of a non-owning string view template— ability to splice elements between containers for maps and sets— better support for element insertion in unique-key maps— support for incomplete types in containers— addition of parallel algorithms— addition of sample algorithm— addition of mathematical special functions, and gcd, lcm, and three-argument hypot functions— addition of support for operations on file systems— addition of shared mutexes and variadic lock guards— removal of deprecated features

    Foreword © ISO/IEC 2017 – All rights reserved xii

    This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "ISO/IEC 14882:2017". Click here to purchase the full version from the ANSI store.This is a preview of "INCITS/ISO/IEC 14882...". Click here to purchase the full version from the ANSI store.

    https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2014882:2017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017&source=previewhttps://webstore.ansi.org/Standards/ISO/ISOIEC148822017?source=previewhttps://webstore.ansi.org/Standards/INCITS/INCITSISOIEC1488220172018?source=preview