diff --git a/README.rst b/README.rst index 1b598e7bfec..b3b2823624f 100644 --- a/README.rst +++ b/README.rst @@ -40,7 +40,7 @@ Getting Started on Fedora Install the following packages: - dnf install texlive texlive-isodate texlive-relsize texlive-ulem texlive-fixme texlive-extract + dnf install latexmk texlive texlive-isodate texlive-relsize texlive-ulem texlive-fixme texlive-extract ----------------------------- Getting Started on Arch Linux diff --git a/papers/n4778.pdf b/papers/n4778.pdf new file mode 100644 index 00000000000..e3ffd53b481 Binary files /dev/null and b/papers/n4778.pdf differ diff --git a/papers/n4779.html b/papers/n4779.html new file mode 100644 index 00000000000..9abdfc9d6f6 --- /dev/null +++ b/papers/n4779.html @@ -0,0 +1,456 @@ +N4779 +

N4779 Editors' Report -- Programming Languages -- C++

+ +

2018-10-08
+Richard Smith (editor) (Google Inc)
+Dawn Perchik (co-editor) (Bright Side Computing, LLC)
+Jens Maurer (co-editor)
+Thomas Köppe (co-editor) (Google DeepMind)
+<cxxeditor@gmail.com>

+ +

Acknowledgements

+ +

Thanks to all those who have submitted editorial +issues +and to those who have provided pull requests with fixes.

+ +

New papers

+ + + +

Motions incorporated into working draft

+ +

This revision contains only editorial changes relative to N4762.

+ +

Minor editorial fixes

+ +

A log of editorial fixes made to the working draft since N4762 is below. +This list excludes changes +that do not affect the body text or only affect whitespace or typeface. For a +complete list including such changes (or for the actual deltas applied by these +changes), consult the draft sources on github.

+ +
commit 51df4bef36abd6a559279634b357e606af5dd9d4
+Author: Casey Carter <Casey@Carter.net>
+Date:   Mon Jul 16 15:20:16 2018 -0700
+
+    [library.general] Fix up the library categories table (#2262)
+
+    by ordering [localization] correctly, and adding a row for [time]
+
+commit 6cee2110159f4a8abfa5254de044154633a9acdb
+Author: Casey Carter <Casey@Carter.net>
+Date:   Tue Jul 17 06:52:36 2018 -0700
+
+    [iterators.general] Fix up Iterators library summary table (#2263)
+
+    by correcting the title for [predef.iterators] to "Iterator adaptors", and adding rows for [iterator.range] and [iterator.container].
+
+commit a47d6ac11530630d0d1f78f3727e118e5f19070d
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Jul 19 23:04:51 2018 +0200
+
+    [string.view] Move complexity requirement into [string.view.template]. (#2261)
+
+commit 15715f3347aaba6b2cc03c477a17e1f6462a8074
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Jul 19 23:05:53 2018 +0200
+
+    [span.overview] Move requirements on types to after the synposis. (#2260)
+
+    As described in [structure.specifications]
+
+commit 437add693809d43ea30ada757987240d3581f929
+Author: Jonathan Wakely <github@kayari.org>
+Date:   Mon Jul 23 22:05:47 2018 +0100
+
+    [mem.res.class] Add default constructor (#2268)
+
+    The addition of a copy constructor by P0619R4 caused the default
+    constructor to be suppressed, which was not intended.
+
+commit ed0e9c0bc6b54dfe14193345cb85a389b6dd2e5b
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Mon Jul 23 23:06:38 2018 +0200
+
+    [std] Fix cross-references that should point to [class.prop] (#2253)
+
+commit a07890ba525e87955ac147bfe5b8e7b2ec7ae584
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Mon Jul 23 23:05:36 2018 +0200
+
+    [dcl.dcl] Remove incorrect footnote about the implicit int rule.
+
+commit 1091b51ff14a1af1cb3c7524eab261574ec9c732
+Author: Marshall Clow <marshall@idio.com>
+Date:   Wed Jul 25 21:30:14 2018 -0700
+
+    Fix spelling error "Tueday" --> "Tuesday" (4x)
+
+commit b21456eca47a5fcdf3cf6dc647943b45b7bde663
+Author: Marshall Clow <marshall@idio.com>
+Date:   Wed Sep 12 06:07:37 2018 -0700
+
+    [map] Use `mapped_type` rather than `T` for indexing operations (#2330)
+
+    The specification of `unordered_map` already uses `mapped_type`. I'm going to change `flat_map` to do so, too.  We use `mapped_type` in other places. The description (line 6311) even says "a reference to the `mapped_type`".
+
+commit c39932f1fb2a511358040100e8a5ef759a5b0453
+Author: Kazutoshi SATODA <k_satoda@f2.dion.ne.jp>
+Date:   Wed Sep 12 22:08:28 2018 +0900
+
+    [temp.constr.order] Fix typo: conjuctive -> conjunctive (#2322)
+
+commit 5ee42bdd4a7a391865ab2988c806ac908e81a5c2
+Author: Koichi Murase <myoga.murase@gmail.com>
+Date:   Wed Sep 12 22:09:17 2018 +0900
+
+    [expr.prim.id] Fix typo "the the" (#2314)
+
+commit c1007bd673169cfafb43b216476335d20e62411d
+Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
+Date:   Wed Sep 12 09:41:19 2018 -0700
+
+    [basic.types] Replace redundant "cv-unqualified scalar types" with just "scalar types"
+
+    The redundant phrasing "cv-unqualified scalar types [...] and cv-qualified versions of these types" is cruft that was accidentally left over from the dueling resolutions of CWG 1746 (which added "cv-unqualified") and CWG 2094 (which added "and cv-qualified versions of these types").
+
+commit 414c2706f75f4bb76ecc444e98ac2e2dcc3c6b00
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Wed Sep 19 09:15:36 2018 +0200
+
+    [dcl.init.aggr] initializer-list (grammar) is never empty
+
+commit e160ea1300e21eb412feaa7733f1e7cd0e1875d8
+Author: Olivier <okannen@gmail.com>
+Date:   Sat Sep 22 01:45:19 2018 +0200
+
+    [temp.param] Remove vestigial restriction on non-type template parameters of class type.
+
+    P0732R2 intended to remove this restriction, but missed one of the places where we repeated the rule.
+
+commit 61e5815fd137e3e0ecd03823f507d175be897fb8
+Author: Alisdair Meredith <public@alisdairm.net>
+Date:   Thu Oct 4 07:17:54 2018 -0700
+
+    [class.copy.ctor] Add missing cross-references to Annex D (#2344)
+
+    Add the missing cross-references to corresponding Annex D entry for the deprecated implicit declaration of copy constructor and copy assignment operator when either the destructor or other
+    copy operation is user-declared.
+
+commit 3f0a2f353aa348e23a334110ae32764588fa6b8a
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sun Jul 8 21:45:34 2018 +0200
+
+    [expr.pre] Add note on operator regrouping here,
+
+    moved from [intro.abstract].
+
+commit 5af570b491d11bbd423494c61f2829667c3c74bd
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Tue Oct 9 02:15:04 2018 +0200
+
+    [copy.ctor] Rearrange constructor subclauses (#2270)
+
+    * [class.default.ctor] Create new subclause under [class.copy],
+    move [class.copy.ctor] there, and rearrange the general
+    descriptions in [class.copy]. Move a statement that applies
+    during construction to [class.cdtor].
+
+    * Fix cross-references for 'default constructor'
+
+commit 6997ed2799111ddf57dfa49418be581adfd7c03b
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Jul 20 20:18:01 2018 +0200
+
+    [stmt.switch] Clarify comparison for case labels
+
+commit 214782433d53a93ada321cb19665e1b7719427ba
+Author: Eelis van der Weegen <eelis@eelis.net>
+Date:   Sun Jul 22 13:46:03 2018 +0200
+
+    [class.dtor] Clean up awkward '.. is the type of the class' phrasing.
+
+commit 408141121e70bebc943af3fb03ef957ee0f51e43
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Tue Jul 24 21:49:01 2018 +0200
+
+    [containers,utilities] Mark exposition-only names
+
+    with italics teletype and use hyphens, not underscores,
+    to highlight that these are not standard-prescribed names.
+
+commit 16f23d1c59787a6cfbe747c0ec66b1102db26223
+Author: Richard Smith <richard@metafoo.co.uk>
+Date:   Mon Oct 8 17:43:19 2018 -0700
+
+    [container.node.overview] Remove suggestion that an implementation could
+    define a class named 'node-handle'.
+
+commit e0613813ad63aaaea9883a1067c5a3c04d88328f
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Jul 27 00:01:46 2018 +0200
+
+    [expr.new] Use 'object', not 'entity', for new-expression.
+
+    The term 'entity' is too generic here.
+    Also move the specification of the non-array return
+    value just before the array case, after the description
+    of the parsing disambiguation.
+
+commit 340573ca6936c39eaec1949e824609d0f9ac51b1
+Author: timsong-cpp <rs2740@gmail.com>
+Date:   Mon Oct 8 20:45:59 2018 -0400
+
+    [temp.param] fix spaceship example (#2291)
+
+    A two parameter spaceship can't be a member, and the parameter types for a defaulted operator can only be const C& ([class.compare.default]p1).
+
+commit e3e8ce46c3d4ff58601e104b6d4c4ba1e789b7b2
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sun Aug 12 00:10:30 2018 +0200
+
+    [std] Replace use of 'structure' by 'class'
+
+commit a5c05c2a07d22cfbbfc32e657017a6e2ce837618
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Tue Oct 9 02:52:47 2018 +0200
+
+    [class.virtual] Define 'virtual function' (#2297)
+
+commit 28bd28f7db5b4d463d1f5fd8b252b45ad3b35528
+Author: S. B. Tam <cpplearner@outlook.com>
+Date:   Tue Oct 9 08:59:19 2018 +0800
+
+    [dcl.init] Rephrase "user-defined conversion sequence" (#2298)
+
+    1. The conversion sequence is governed by the rules defined here. Saying "conversion sequence" here will cause circular definition.
+    2. Overload resolution selects a function, not a conversion sequence.
+
+commit c85202d90102b8ed9c7e0d9532fdc2ef3b43e7c8
+Author: languagelawyer <38548419+languagelawyer@users.noreply.github.com>
+Date:   Tue Oct 9 04:00:53 2018 +0300
+
+    [basic.life] Change "class or aggregate type" to "class or array type" (#2309)
+
+commit 4c431f712a35199f3b9b064a0b6580ec2b224386
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sun Sep 2 23:38:53 2018 +0200
+
+    [expr.add] Clarify if/otherwise ladder
+
+commit ad121b96df829872565285cca7f00f6bd22cb428
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sun Sep 2 23:59:14 2018 +0200
+
+    [basic.lval] Clarify result object for prvalues as operands
+
+commit 27675c7bbe749aaaa19c1072a68cedc10114e9bd
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Mon Sep 3 00:05:58 2018 +0200
+
+    [class.member.lookup] 'unqualified-id' is the correct complement for 'qualified-id'
+
+commit 897e3dd719499017e9866a21f7eb88433264c67d
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Mon Sep 3 00:20:48 2018 +0200
+
+    [class.this] A pointer represents more than an address
+
+commit 32ac0796318a35104f541f33c0ddec6c8c7f8081
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Mon Sep 3 00:33:05 2018 +0200
+
+    [class.temporary] prvalues are not materialized,
+
+    temporary objects are.
+
+commit 846998e6eaf76fb5a0a6bbbe00c5ed0ba8b7523d
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Sep 6 22:36:45 2018 +0200
+
+    [basic.def.odr] Replace undefined term 'non-trivial function'
+
+commit a297a3d2b5d98b3ae224223466f8ccddd00fd14e
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Sep 6 22:46:44 2018 +0200
+
+    [basic.def.odr] Clarify antecedent for declarative region
+
+commit 781374ba343aafb23772b6326abce1cccade2030
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Sep 6 23:15:13 2018 +0200
+
+    [unique.ptr.single.ctor] Simplify description of unique_ptr constructors
+
+commit cb3d918b38dc439da28e688365c0877685130c85
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Sep 14 22:37:27 2018 +0200
+
+    [class.union] use 'class', not (undefined) 'struct'
+
+commit 9a9a49077702815c49cdb0bd78fe58ca477b16ae
+Author: Louis Dionne <ldionne@apple.com>
+Date:   Sun Sep 23 11:29:35 2018 -0700
+
+    [editorial] Use struct instead of class to make example valid
+
+    P0732R2 [1] was merged in Rapperswil, but one example is invalid because
+    the constructor for A is private, so it can't be constructed from the
+    string literal.
+
+    [1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0732r2.pdf
+
+commit 6df3eb6de13fd1d98cb2a2988361811556927882
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Mon Sep 24 22:37:52 2018 +0200
+
+    [dcl.attr.contract.check] Violation handlers are not 'user-provided'
+
+commit 82cfc5b67b33ca076a80184b508ed2172af9d3aa
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Sep 27 10:22:44 2018 +0200
+
+    [temp] Add 'static' to examples for static data member template
+
+    A non-static data member cannot be a template.
+
+commit f23f1d0613099496e74cabf0c87cceccb94fb919
+Author: JF Bastien <github@jfbastien.com>
+Date:   Mon Oct 8 18:29:41 2018 -0700
+
+    Move "plain ints" statement to a note (#2346)
+
+commit ad6b6f27e803671f0d0280d05990950d16909afa
+Author: Alberto Barbati <2210776+iaanus@users.noreply.github.com>
+Date:   Tue Oct 9 03:38:23 2018 +0200
+
+    [fs.filesystem.syn] Remove vestige of removed trivial-clock type
+
+    The removed paragraph refers to trivial-clock that has now been replaced by chrono::file_clock.
+
diff --git a/papers/n4779.md b/papers/n4779.md new file mode 100644 index 00000000000..86419503df3 --- /dev/null +++ b/papers/n4779.md @@ -0,0 +1,330 @@ +# N4779 Editors' Report -- Programming Languages -- C++ + +2018-10-08 +Richard Smith (editor) (Google Inc) +Dawn Perchik (co-editor) (Bright Side Computing, LLC) +Jens Maurer (co-editor) +Thomas Köppe (co-editor) (Google DeepMind) +`` + +## Acknowledgements + +Thanks to all those who have [submitted editorial +issues](https://github.com/cplusplus/draft/wiki/How-to-submit-an-editorial-issue) +and to those who have provided pull requests with fixes. + +## New papers + + * [N4778](http://wg21.link/n4778) is the current C++ working draft. It replaces [N4762](http://wg21.link/n4762). + * N4779 is this Editors' Report. + +## Motions incorporated into working draft + +This revision contains only editorial changes relative to N4762. + +## Minor editorial fixes + +A log of editorial fixes made to the working draft since N4762 is below. +This list excludes changes +that do not affect the body text or only affect whitespace or typeface. For a +complete list including such changes (or for the actual deltas applied by these +changes), consult the [draft sources on github](https://github.com/cplusplus/draft/compare/n4762...n4778). + + commit 51df4bef36abd6a559279634b357e606af5dd9d4 + Author: Casey Carter + Date: Mon Jul 16 15:20:16 2018 -0700 + + [library.general] Fix up the library categories table (#2262) + + by ordering [localization] correctly, and adding a row for [time] + + commit 6cee2110159f4a8abfa5254de044154633a9acdb + Author: Casey Carter + Date: Tue Jul 17 06:52:36 2018 -0700 + + [iterators.general] Fix up Iterators library summary table (#2263) + + by correcting the title for [predef.iterators] to "Iterator adaptors", and adding rows for [iterator.range] and [iterator.container]. + + commit a47d6ac11530630d0d1f78f3727e118e5f19070d + Author: Jens Maurer + Date: Thu Jul 19 23:04:51 2018 +0200 + + [string.view] Move complexity requirement into [string.view.template]. (#2261) + + commit 15715f3347aaba6b2cc03c477a17e1f6462a8074 + Author: Jens Maurer + Date: Thu Jul 19 23:05:53 2018 +0200 + + [span.overview] Move requirements on types to after the synposis. (#2260) + + As described in [structure.specifications] + + commit 437add693809d43ea30ada757987240d3581f929 + Author: Jonathan Wakely + Date: Mon Jul 23 22:05:47 2018 +0100 + + [mem.res.class] Add default constructor (#2268) + + The addition of a copy constructor by P0619R4 caused the default + constructor to be suppressed, which was not intended. + + commit ed0e9c0bc6b54dfe14193345cb85a389b6dd2e5b + Author: Jens Maurer + Date: Mon Jul 23 23:06:38 2018 +0200 + + [std] Fix cross-references that should point to [class.prop] (#2253) + + commit a07890ba525e87955ac147bfe5b8e7b2ec7ae584 + Author: Jens Maurer + Date: Mon Jul 23 23:05:36 2018 +0200 + + [dcl.dcl] Remove incorrect footnote about the implicit int rule. + + commit 1091b51ff14a1af1cb3c7524eab261574ec9c732 + Author: Marshall Clow + Date: Wed Jul 25 21:30:14 2018 -0700 + + Fix spelling error "Tueday" --> "Tuesday" (4x) + + commit b21456eca47a5fcdf3cf6dc647943b45b7bde663 + Author: Marshall Clow + Date: Wed Sep 12 06:07:37 2018 -0700 + + [map] Use `mapped_type` rather than `T` for indexing operations (#2330) + + The specification of `unordered_map` already uses `mapped_type`. I'm going to change `flat_map` to do so, too. We use `mapped_type` in other places. The description (line 6311) even says "a reference to the `mapped_type`". + + commit c39932f1fb2a511358040100e8a5ef759a5b0453 + Author: Kazutoshi SATODA + Date: Wed Sep 12 22:08:28 2018 +0900 + + [temp.constr.order] Fix typo: conjuctive -> conjunctive (#2322) + + commit 5ee42bdd4a7a391865ab2988c806ac908e81a5c2 + Author: Koichi Murase + Date: Wed Sep 12 22:09:17 2018 +0900 + + [expr.prim.id] Fix typo "the the" (#2314) + + commit c1007bd673169cfafb43b216476335d20e62411d + Author: Arthur O'Dwyer + Date: Wed Sep 12 09:41:19 2018 -0700 + + [basic.types] Replace redundant "cv-unqualified scalar types" with just "scalar types" + + The redundant phrasing "cv-unqualified scalar types [...] and cv-qualified versions of these types" is cruft that was accidentally left over from the dueling resolutions of CWG 1746 (which added "cv-unqualified") and CWG 2094 (which added "and cv-qualified versions of these types"). + + commit 414c2706f75f4bb76ecc444e98ac2e2dcc3c6b00 + Author: Jens Maurer + Date: Wed Sep 19 09:15:36 2018 +0200 + + [dcl.init.aggr] initializer-list (grammar) is never empty + + commit e160ea1300e21eb412feaa7733f1e7cd0e1875d8 + Author: Olivier + Date: Sat Sep 22 01:45:19 2018 +0200 + + [temp.param] Remove vestigial restriction on non-type template parameters of class type. + + P0732R2 intended to remove this restriction, but missed one of the places where we repeated the rule. + + commit 61e5815fd137e3e0ecd03823f507d175be897fb8 + Author: Alisdair Meredith + Date: Thu Oct 4 07:17:54 2018 -0700 + + [class.copy.ctor] Add missing cross-references to Annex D (#2344) + + Add the missing cross-references to corresponding Annex D entry for the deprecated implicit declaration of copy constructor and copy assignment operator when either the destructor or other + copy operation is user-declared. + + commit 3f0a2f353aa348e23a334110ae32764588fa6b8a + Author: Jens Maurer + Date: Sun Jul 8 21:45:34 2018 +0200 + + [expr.pre] Add note on operator regrouping here, + + moved from [intro.abstract]. + + commit 5af570b491d11bbd423494c61f2829667c3c74bd + Author: Jens Maurer + Date: Tue Oct 9 02:15:04 2018 +0200 + + [copy.ctor] Rearrange constructor subclauses (#2270) + + * [class.default.ctor] Create new subclause under [class.copy], + move [class.copy.ctor] there, and rearrange the general + descriptions in [class.copy]. Move a statement that applies + during construction to [class.cdtor]. + + * Fix cross-references for 'default constructor' + + commit 6997ed2799111ddf57dfa49418be581adfd7c03b + Author: Jens Maurer + Date: Fri Jul 20 20:18:01 2018 +0200 + + [stmt.switch] Clarify comparison for case labels + + commit 214782433d53a93ada321cb19665e1b7719427ba + Author: Eelis van der Weegen + Date: Sun Jul 22 13:46:03 2018 +0200 + + [class.dtor] Clean up awkward '.. is the type of the class' phrasing. + + commit 408141121e70bebc943af3fb03ef957ee0f51e43 + Author: Jens Maurer + Date: Tue Jul 24 21:49:01 2018 +0200 + + [containers,utilities] Mark exposition-only names + + with italics teletype and use hyphens, not underscores, + to highlight that these are not standard-prescribed names. + + commit 16f23d1c59787a6cfbe747c0ec66b1102db26223 + Author: Richard Smith + Date: Mon Oct 8 17:43:19 2018 -0700 + + [container.node.overview] Remove suggestion that an implementation could + define a class named 'node-handle'. + + commit e0613813ad63aaaea9883a1067c5a3c04d88328f + Author: Jens Maurer + Date: Fri Jul 27 00:01:46 2018 +0200 + + [expr.new] Use 'object', not 'entity', for new-expression. + + The term 'entity' is too generic here. + Also move the specification of the non-array return + value just before the array case, after the description + of the parsing disambiguation. + + commit 340573ca6936c39eaec1949e824609d0f9ac51b1 + Author: timsong-cpp + Date: Mon Oct 8 20:45:59 2018 -0400 + + [temp.param] fix spaceship example (#2291) + + A two parameter spaceship can't be a member, and the parameter types for a defaulted operator can only be const C& ([class.compare.default]p1). + + commit e3e8ce46c3d4ff58601e104b6d4c4ba1e789b7b2 + Author: Jens Maurer + Date: Sun Aug 12 00:10:30 2018 +0200 + + [std] Replace use of 'structure' by 'class' + + commit a5c05c2a07d22cfbbfc32e657017a6e2ce837618 + Author: Jens Maurer + Date: Tue Oct 9 02:52:47 2018 +0200 + + [class.virtual] Define 'virtual function' (#2297) + + commit 28bd28f7db5b4d463d1f5fd8b252b45ad3b35528 + Author: S. B. Tam + Date: Tue Oct 9 08:59:19 2018 +0800 + + [dcl.init] Rephrase "user-defined conversion sequence" (#2298) + + 1. The conversion sequence is governed by the rules defined here. Saying "conversion sequence" here will cause circular definition. + 2. Overload resolution selects a function, not a conversion sequence. + + commit c85202d90102b8ed9c7e0d9532fdc2ef3b43e7c8 + Author: languagelawyer <38548419+languagelawyer@users.noreply.github.com> + Date: Tue Oct 9 04:00:53 2018 +0300 + + [basic.life] Change "class or aggregate type" to "class or array type" (#2309) + + commit 4c431f712a35199f3b9b064a0b6580ec2b224386 + Author: Jens Maurer + Date: Sun Sep 2 23:38:53 2018 +0200 + + [expr.add] Clarify if/otherwise ladder + + commit ad121b96df829872565285cca7f00f6bd22cb428 + Author: Jens Maurer + Date: Sun Sep 2 23:59:14 2018 +0200 + + [basic.lval] Clarify result object for prvalues as operands + + commit 27675c7bbe749aaaa19c1072a68cedc10114e9bd + Author: Jens Maurer + Date: Mon Sep 3 00:05:58 2018 +0200 + + [class.member.lookup] 'unqualified-id' is the correct complement for 'qualified-id' + + commit 897e3dd719499017e9866a21f7eb88433264c67d + Author: Jens Maurer + Date: Mon Sep 3 00:20:48 2018 +0200 + + [class.this] A pointer represents more than an address + + commit 32ac0796318a35104f541f33c0ddec6c8c7f8081 + Author: Jens Maurer + Date: Mon Sep 3 00:33:05 2018 +0200 + + [class.temporary] prvalues are not materialized, + + temporary objects are. + + commit 846998e6eaf76fb5a0a6bbbe00c5ed0ba8b7523d + Author: Jens Maurer + Date: Thu Sep 6 22:36:45 2018 +0200 + + [basic.def.odr] Replace undefined term 'non-trivial function' + + commit a297a3d2b5d98b3ae224223466f8ccddd00fd14e + Author: Jens Maurer + Date: Thu Sep 6 22:46:44 2018 +0200 + + [basic.def.odr] Clarify antecedent for declarative region + + commit 781374ba343aafb23772b6326abce1cccade2030 + Author: Jens Maurer + Date: Thu Sep 6 23:15:13 2018 +0200 + + [unique.ptr.single.ctor] Simplify description of unique_ptr constructors + + commit cb3d918b38dc439da28e688365c0877685130c85 + Author: Jens Maurer + Date: Fri Sep 14 22:37:27 2018 +0200 + + [class.union] use 'class', not (undefined) 'struct' + + commit 9a9a49077702815c49cdb0bd78fe58ca477b16ae + Author: Louis Dionne + Date: Sun Sep 23 11:29:35 2018 -0700 + + [editorial] Use struct instead of class to make example valid + + P0732R2 [1] was merged in Rapperswil, but one example is invalid because + the constructor for A is private, so it can't be constructed from the + string literal. + + [1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0732r2.pdf + + commit 6df3eb6de13fd1d98cb2a2988361811556927882 + Author: Jens Maurer + Date: Mon Sep 24 22:37:52 2018 +0200 + + [dcl.attr.contract.check] Violation handlers are not 'user-provided' + + commit 82cfc5b67b33ca076a80184b508ed2172af9d3aa + Author: Jens Maurer + Date: Thu Sep 27 10:22:44 2018 +0200 + + [temp] Add 'static' to examples for static data member template + + A non-static data member cannot be a template. + + commit f23f1d0613099496e74cabf0c87cceccb94fb919 + Author: JF Bastien + Date: Mon Oct 8 18:29:41 2018 -0700 + + Move "plain ints" statement to a note (#2346) + + commit ad6b6f27e803671f0d0280d05990950d16909afa + Author: Alberto Barbati <2210776+iaanus@users.noreply.github.com> + Date: Tue Oct 9 03:38:23 2018 +0200 + + [fs.filesystem.syn] Remove vestige of removed trivial-clock type + + The removed paragraph refers to trivial-clock that has now been replaced by chrono::file_clock. diff --git a/source/basic.tex b/source/basic.tex index 845de84588b..f80d293c183 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -54,7 +54,7 @@ an object. The variable's name, if any, denotes the reference or object. \pnum -A \defn{local entity} is a variable with +A \defnadj{local}{entity} is a variable with automatic storage duration\iref{basic.stc.auto}, a structured binding\iref{dcl.struct.bind} whose corresponding variable is such an entity, @@ -216,7 +216,7 @@ \begin{note} \indextext{implementation-generated}% In some circumstances, \Cpp{} implementations implicitly define the -default constructor\iref{class.ctor}, +default constructor\iref{class.default.ctor}, copy constructor, move constructor\iref{class.copy.ctor}, copy assignment operator, move assignment operator\iref{class.copy.assign}, or destructor\iref{class.dtor} member functions. @@ -355,10 +355,11 @@ \pnum A variable \tcode{x} whose name appears as a -potentially-evaluated expression \tcode{ex} is \defn{odr-used} by \tcode{ex} unless +potentially-evaluated expression \tcode{ex} is \defnx{odr-used}{odr-use} by \tcode{ex} unless applying the lvalue-to-rvalue conversion\iref{conv.lval} to \tcode{x} yields -a constant expression\iref{expr.const} that does not invoke any non-trivial -functions +a constant expression\iref{expr.const} +that does not invoke a function +other than a trivial special member function\iref{special} and, if \tcode{x} is an object, \tcode{ex} is an element of the set of potential results of an expression \tcode{e}, where either the lvalue-to-rvalue conversion\iref{conv.lval} is applied to \tcode{e}, or \tcode{e} is @@ -412,8 +413,8 @@ within the innermost enclosing class or non-lambda function definition scope), either: \begin{itemize} -\item the declarative region is a block scope, or -\item the declarative region is the function parameter scope of a \grammarterm{lambda-expression} +\item the intervening declarative region is a block scope, or +\item the intervening declarative region is the function parameter scope of a \grammarterm{lambda-expression} that has a \grammarterm{simple-capture} naming the entity or has a \grammarterm{capture-default}. \end{itemize} \end{itemize} @@ -440,8 +441,8 @@ outside of a discarded statement\iref{stmt.if}; no diagnostic required. The definition can appear explicitly in the program, it can be found in the standard or a user-defined library, or (when appropriate) it is -implicitly defined (see~\ref{class.ctor}, \ref{class.dtor}, -\ref{class.copy.ctor}, and \ref{class.copy.assign}). +implicitly defined (see~\ref{class.default.ctor}, \ref{class.copy.ctor}, +\ref{class.dtor}, and \ref{class.copy.assign}). An inline function or variable shall be defined in every translation unit in which it is odr-used outside of a discarded statement. @@ -561,7 +562,8 @@ and violation continuation mode; and \item if \tcode{D} is a class with an implicitly-declared -constructor\iref{class.ctor}, it is as if the constructor was +constructor (\ref{class.default.ctor}, \ref{class.copy.ctor}), +it is as if the constructor was implicitly defined in every translation unit where it is odr-used, and the implicit definition in every translation unit shall call the same constructor for a subobject of \tcode{D}. @@ -972,17 +974,14 @@ namespace in a \grammarterm{using-directive}; see~\ref{namespace.qual}. \pnum -\indextext{scope!global namespace}% -\indextext{scope!global}% The outermost declarative region of a translation unit is also a -namespace, called the \defn{global namespace}. A name declared in -the global namespace has \defn{global namespace scope} (also called -\defn{global scope}). The potential scope of such a name begins at +namespace, called the \defnadj{global}{namespace}. A name declared in +the global namespace has \defnadj{global}{namespace scope} (also called +\defnadj{global}{scope}). The potential scope of such a name begins at its point of declaration\iref{basic.scope.pdecl} and ends at the end of the translation unit that is its declarative region. -\indextext{name!global}% A name with global namespace scope is said to be a -\defnx{global name}{global}. +\defnadj{global}{name}. \rSec2[basic.scope.class]{Class scope} \indextext{scope!class}% @@ -2318,7 +2317,7 @@ \pnum \indextext{program}% -A \defn{program} consists of one or more \defnx{translation units}{translation unit}\iref{lex} +A \defn{program} consists of one or more translation units\iref{lex} linked together. A translation unit consists of a sequence of declarations. @@ -2588,7 +2587,7 @@ width. \end{note} \pnum -\begin{example} A structure declared as +\begin{example} A class declared as \begin{codeblock} struct { @@ -2840,8 +2839,8 @@ \indextext{object lifetime|(}% The \defn{lifetime} of an object or reference is a runtime property of the object or reference. -An object is said to have \defnx{non-vacuous initialization}{initialization!non-vacuous} if it is of a class or -aggregate type and it or one of its subobjects is initialized by a constructor +An object is said to have \defnadj{non-vacuous}{initialization} if it is of a class or +array type and it or one of its subobjects is initialized by a constructor other than a trivial default constructor. \begin{note} Initialization by a trivial copy/move constructor is non-vacuous initialization. \end{note} The lifetime of an object of type \tcode{T} begins when: @@ -3167,9 +3166,9 @@ \rSec3[basic.stc.thread]{Thread storage duration} \pnum -\indextext{storage duration!thread}% -All variables declared with the \tcode{thread_local} keyword have \defn{thread -storage duration}. The storage for these entities shall last for the duration of +All variables declared with the \tcode{thread_local} keyword have +\defnadj{thread}{storage duration}. +The storage for these entities shall last for the duration of the thread in which they are created. There is a distinct object or reference per thread, and use of the declared name refers to the entity associated with the current thread. @@ -3181,11 +3180,10 @@ \rSec3[basic.stc.auto]{Automatic storage duration} \pnum -\indextext{storage duration!automatic}% \indextext{storage duration!local object}% Block-scope variables not explicitly declared \tcode{static}, \tcode{thread_local}, or \tcode{extern} have -\defn{automatic storage duration}. The storage +\defnadj{automatic}{storage duration}. The storage for these entities lasts until the block in which they are created exits. \pnum @@ -3365,7 +3363,7 @@ \pnum A deallocation function -is a \defn{destroying operator delete} +is a \defnadj{destroying}{operator delete} if it has at least two parameters and its second parameter is of type \tcode{std::destroying_delete_t}. @@ -3558,7 +3556,7 @@ greater than \tcode{alignof(std::max_align_t)}. It is \impldef{support for extended alignments} whether any extended alignments are supported and the contexts in which they are supported\iref{dcl.align}. A type having an extended alignment -requirement is an \defnx{over-aligned type}{type!over-aligned}. \begin{note} +requirement is an \defnadj{over-aligned}{type}. \begin{note} Every over-aligned type is or contains a class type to which extended alignment applies (possibly through a non-static data member). \end{note} @@ -3617,7 +3615,7 @@ Temporary objects are created \begin{itemize} \item -when a prvalue is materialized so that it can be used as a glvalue\iref{conv.rval}, +when a prvalue is converted to an xvalue\iref{conv.rval}, \item when needed by the implementation to pass or return an object of trivially-copyable type (see below), and @@ -3731,7 +3729,7 @@ \indextext{temporary!destructor for}% \indextext{temporary!destruction of}% When an implementation introduces a temporary object of a class that has a -non-trivial constructor~(\ref{class.ctor}, \ref{class.copy.ctor}), +non-trivial constructor~(\ref{class.default.ctor}, \ref{class.copy.ctor}), it shall ensure that a constructor is called for the temporary object. Similarly, the destructor shall be called for a temporary with a non-trivial destructor\iref{class.dtor}. @@ -4053,7 +4051,7 @@ A class that has been declared but not defined, an enumeration type in certain contexts\iref{dcl.enum}, or an array of unknown bound or of incomplete element type, is an -\defnx{incompletely-defined object type}{object type!incompletely-defined}.% +\defnadj{incompletely-defined}{object type}.% \footnote{The size and layout of an instance of an incompletely-defined object type is unknown.} Incompletely-defined object types and \cv{}~\tcode{void} are @@ -4123,14 +4121,14 @@ cv-qualified\iref{basic.type.qualifier} versions of these types are collectively called \defnx{scalar types}{scalar type}. -Cv-unqualified scalar types, trivially copyable class types\iref{class}, +Scalar types, trivially copyable class types\iref{class.prop}, arrays of such types, and cv-qualified versions of these types are collectively called \defn{trivially copyable types}. -Scalar types, trivial class types\iref{class}, +Scalar types, trivial class types\iref{class.prop}, arrays of such types and cv-qualified versions of these types are collectively called \defn{trivial types}. Scalar types, standard-layout class -types\iref{class}, arrays of such types and +types\iref{class.prop}, arrays of such types and cv-qualified versions of these types are collectively called \defn{standard-layout types}. @@ -4240,14 +4238,13 @@ extended signed integer types are collectively called \defnx{signed integer types}{signed integer type}. \indextext{integral type!implementation-defined \tcode{sizeof}}% -Plain -\tcode{int}s have the natural size suggested by the architecture of the -execution environment% -\footnote{\tcode{int} must also be large enough -to contain any value in the range -\crange{INT_MIN}{INT_MAX}, -as defined in the header \tcode{}.}; +\begin{note} +Plain \tcode{int}s +are intended to have +the natural size suggested by the architecture of the +execution environment; the other signed integer types are provided to meet special needs. +\end{note} \pnum \indextext{type!\idxcode{unsigned}}% @@ -4433,8 +4430,8 @@ \defnx{references}{reference} to objects or functions of a given type, \ref{dcl.ref}. There are two types of references: \begin{itemize} -\item \defn{lvalue reference} -\item \defn{rvalue reference} +\item lvalue reference +\item rvalue reference \end{itemize} \item @@ -4450,7 +4447,7 @@ \item \defnx{enumerations}{\idxcode{enum}}, which comprise a set of named constant values. Each distinct enumeration constitutes a different -\defnx{enumerated type}{type!enumerated}, \ref{dcl.enum}; +\defnadj{enumerated}{type}, \ref{dcl.enum}; \item \indextext{member pointer to|see{pointer to member}}% \defnx{pointers to non-static class members}{pointer to member},% @@ -4579,7 +4576,7 @@ \indextext{\idxcode{const}}% \indextext{\idxcode{volatile}}% A type mentioned in~\ref{basic.fundamental} and~\ref{basic.compound} is -a \defnx{cv-unqualified type}{type!cv-unqualified}. Each type which is a +a \defnadj{cv-unqualified}{type}. Each type which is a cv-unqualified complete or incomplete object type or is \tcode{void}\iref{basic.types} has three corresponding cv-qualified versions of its type: a \defn{const-qualified} version, a @@ -4591,14 +4588,14 @@ \grammarterm{type-id}\iref{dcl.name}, or \grammarterm{new-type-id}\iref{expr.new} when the object is created. \begin{itemize} -\item A \defnx{const object}{object!const} is an object of type \tcode{const T} or a +\item A \defnadj{const}{object} is an object of type \tcode{const T} or a non-mutable subobject of such an object. -\item A \defnx{volatile object}{object!volatile} is an object of type +\item A \defnadj{volatile}{object} is an object of type \tcode{volatile T}, a subobject of such an object, or a mutable subobject of a const volatile object. -\item A \defnx{const volatile object}{object!const volatile} is an object of type +\item A \defnadj{const volatile}{object} is an object of type \tcode{const volatile T}, a non-mutable subobject of such an object, a const subobject of a volatile object, or a non-mutable volatile subobject of a const object. @@ -5212,7 +5209,7 @@ \end{note} \pnum -A \defnx{visible side effect}{side effects!visible} \placeholder{A} on a scalar object or bit-field \placeholder{M} +A \defnadj{visible}{side effect} \placeholder{A} on a scalar object or bit-field \placeholder{M} with respect to a value computation \placeholder{B} of \placeholder{M} satisfies the conditions: \begin{itemize} diff --git a/source/classes.tex b/source/classes.tex index af6e193cdc7..858b766b394 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -156,7 +156,7 @@ \pnum A \defnadj{trivial}{class} is a class that is trivially copyable and -has one or more default constructors\iref{class.ctor}, +has one or more default constructors\iref{class.default.ctor}, all of which are either trivial or deleted and at least one of which is not deleted. \begin{note} In particular, a trivially copyable or trivial class does not have @@ -232,10 +232,10 @@ \end{example} \pnum -A \defnx{standard-layout struct}{struct!standard-layout} is a standard-layout class +A \defnadj{standard-layout}{struct} is a standard-layout class defined with the \grammarterm{class-key} \tcode{struct} or the \grammarterm{class-key} \tcode{class}. -A \defnx{standard-layout union}{union!standard-layout} is a standard-layout class +A \defnadj{standard-layout}{union} is a standard-layout class defined with the \grammarterm{class-key} \tcode{union}. @@ -760,7 +760,7 @@ \tcode{T} shall have a name different from \tcode{T}. \pnum -The \defn{common initial sequence} of two standard-layout struct\iref{class} +The \defn{common initial sequence} of two standard-layout struct\iref{class.prop} types is the longest sequence of non-static data members and bit-fields in declaration order, starting with the first such entity in each of the structs, such that corresponding entities @@ -785,7 +785,7 @@ \end{example} \pnum -Two standard-layout struct\iref{class} types are +Two standard-layout struct\iref{class.prop} types are \defnx{layout-compatible classes}{layout-compatible!class} if their common initial sequence comprises all members and bit-fields of both classes\iref{basic.types}. @@ -1062,8 +1062,8 @@ \pnum \indextext{this pointer@\tcode{this} pointer|see{\tcode{this}}}% In the body of a non-static\iref{class.mfct} member function, the -keyword \tcode{this} is a prvalue whose value is the -address of the object for which the function is called. +keyword \tcode{this} is a prvalue whose value is +a pointer to the object for which the function is called. \indextext{\idxcode{this}!type of}% The type of \tcode{this} in a member function of a class \tcode{X} is \tcode{X*}. @@ -1146,7 +1146,7 @@ \indextext{constructor!move}% \indextext{assignment operator!copy}% \indextext{assignment operator!move}% -The default constructor\iref{class.ctor}, +The default constructor\iref{class.default.ctor}, copy constructor, move constructor\iref{class.copy.ctor}, copy assignment operator, move assignment operator\iref{class.copy.assign}, and destructor\iref{class.dtor} are @@ -1247,15 +1247,42 @@ \end{example} \pnum +\indextext{constructor!explicit call}% A constructor is used to initialize objects of its class type. Because constructors do not have names, they are never found during name lookup; however an explicit type conversion using the functional notation\iref{expr.type.conv} will cause a constructor to be called to initialize an object. \begin{note} +The syntax looks like an explicit call of the constructor. +\end{note} +\begin{example} +\begin{codeblock} +complex zz = complex(1,2.3); +cprint( complex(7.8,1.2) ); +\end{codeblock} +\end{example} +\begin{note} For initialization of objects of class type see~\ref{class.init}. \end{note} +\pnum +\indextext{object!unnamed}% +An object created in this way is unnamed. +\begin{note} +\ref{class.temporary} describes the lifetime of temporary objects. +\end{note} +\begin{note} +Explicit constructor calls do not yield lvalues, see~\ref{basic.lval}. +\end{note} + +\pnum +\begin{note} +\indextext{member function!constructor and}% +Some language constructs have special semantics when used during construction; +see~\ref{class.base.init} and~\ref{class.cdtor}. +\end{note} + \pnum \indextext{\idxcode{const}!constructor and}% \indextext{\idxcode{volatile}!constructor and}% @@ -1274,17 +1301,22 @@ They come into effect when the constructor for the most derived object\iref{intro.object} ends. +\pnum +\indextext{restriction!constructor}% +A +\tcode{return} +statement in the body of a constructor shall not specify a return value. +\indextext{constructor!address of}% +The address of a constructor shall not be taken. + +\rSec3[class.default.ctor]{Default constructors} + \pnum \indextext{constructor!inheritance of}% \indextext{constructor!non-trivial}% -A -\defnx{default}{constructor!default} -constructor for a class -\tcode{X} -is a constructor of class -\tcode{X} -for which -each parameter +A \defnadj{default}{constructor} for a class \tcode{X} +is a constructor of class \tcode{X} +for which each parameter that is not a function parameter pack has a default argument (including the case of a constructor with no parameters). @@ -1412,82 +1444,7 @@ describes how arguments can be specified for the calls to these constructors. \end{note} -\pnum -\indextext{restriction!constructor}% -A -\tcode{return} -statement in the body of a constructor shall not specify a return value. -\indextext{constructor!address of}% -The address of a constructor shall not be taken. - -\pnum -\indextext{object!unnamed}% -\indextext{constructor!explicit call}% -A functional notation type conversion\iref{expr.type.conv} can be used -to create new objects of its type. -\begin{note} -The syntax looks like an explicit call of the constructor. -\end{note} -\begin{example} -\begin{codeblock} -complex zz = complex(1,2.3); -cprint( complex(7.8,1.2) ); -\end{codeblock} -\end{example} - -\pnum -An object created in this way is unnamed. -\begin{note} -\ref{class.temporary} describes the lifetime of temporary objects. -\end{note} -\begin{note} -Explicit constructor calls do not yield lvalues, see~\ref{basic.lval}. -\end{note} - -\pnum -\begin{note} -\indextext{member function!constructor and}% -Some language constructs have special semantics when used during construction; -see~\ref{class.base.init} and~\ref{class.cdtor}. -\end{note} - -\pnum -During the construction of an object, -if the value of the object or any of its subobjects is -accessed through a glvalue that is not obtained, directly or indirectly, from -the constructor's -\tcode{this} -pointer, the value of the object or subobject thus obtained is unspecified. -\begin{example} - -\begin{codeblock} -struct C; -void no_opt(C*); - -struct C { - int c; - C() : c(0) { no_opt(this); } -}; - -const C cobj; - -void no_opt(C* cptr) { - int i = cobj.c * 100; // value of \tcode{cobj.c} is unspecified - cptr->c = 1; - cout << cobj.c * 100 // value of \tcode{cobj.c} is unspecified - << '\n'; -} - -extern struct D d; -struct D { - D(int a) : a(a), b(d.a) {} - int a, b; -}; -D d = D(1); // value of \tcode{d.b} is unspecified -\end{codeblock} -\end{example} - -\rSec2[class.copy.ctor]{Copy/move constructors}% +\rSec3[class.copy.ctor]{Copy/move constructors}% \pnum \indextext{constructor!copy|(}% @@ -1620,7 +1577,7 @@ constructor is defined as deleted; otherwise, it is defined as defaulted\iref{dcl.fct.def}. The latter case is deprecated if the class has a user-declared copy assignment -operator or a user-declared destructor. +operator or a user-declared destructor \iref{depr.impldec}. \pnum The implicitly-declared copy constructor for a class @@ -1644,7 +1601,7 @@ implicitly-declared copy constructor cannot bind to a \tcode{volatile} -lvalue; see~\ref{diff.special}.} +lvalue; see~\ref{diff.class}.} Otherwise, the implicitly-declared copy constructor will have the form \begin{codeblock} @@ -1866,7 +1823,7 @@ assignment operator is defined as deleted; otherwise, it is defined as defaulted\iref{dcl.fct.def}. The latter case is deprecated if the class has a user-declared copy constructor -or a user-declared destructor. +or a user-declared destructor \iref{depr.impldec}. The implicitly-declared copy assignment operator for a class \tcode{X} will have the form @@ -1908,7 +1865,7 @@ \tcode{M}.\footnote{This implies that the reference parameter of the implicitly-declared copy assignment operator cannot bind to a \tcode{volatile} -lvalue; see~\ref{diff.special}.} +lvalue; see~\ref{diff.class}.} \end{itemize} Otherwise, the implicitly-declared copy @@ -2281,7 +2238,7 @@ \tcode{X}'s non-virtual direct base classes and, if \tcode{X} -is the type of the most derived class\iref{class.base.init}, +is the most derived class\iref{class.base.init}, its destructor calls the destructors for \tcode{X}'s virtual base classes. @@ -2357,9 +2314,10 @@ If the lookup fails or if the deallocation function has a deleted definition\iref{dcl.fct.def}, the program is ill-formed. \begin{note} -This assures that a deallocation function corresponding to the dynamic type of an -object is available for the -\grammarterm{delete-expression}\iref{class.free}. +This assures that a deallocation function +is available for a \grammarterm{delete-expression}\iref{class.free}, +even if the static type of the object to which the operand points +is a base class of the object to be deleted. \end{note} \pnum @@ -2541,7 +2499,7 @@ the types of its parameters (if any) to the type of its class. Such a constructor is called a -\defnx{converting constructor}{constructor!converting}. +\defnadj{converting}{constructor}. \begin{example} \indextext{Jessie}% @@ -3028,7 +2986,7 @@ \pnum A class can be declared within another class. A class declared within -another is called a \defnx{nested}{nested class} class. The name of a nested class +another is called a \defnadj{nested}{class}. The name of a nested class is local to its enclosing class. \indextext{nested class!scope of}% The nested class is in the scope of its enclosing class. @@ -3154,7 +3112,7 @@ \pnum The size of a union is sufficient to contain the largest of its non-static data members. Each non-static data member is allocated -as if it were the sole member of a struct. +as if it were the sole member of a non-union class. \begin{note} A union object and its non-static data members are pointer-interconvertible~(\ref{basic.compound}, \ref{expr.static.cast}). @@ -3175,7 +3133,7 @@ reference type the program is ill-formed. \begin{note} Absent default member initializers\iref{class.mem}, if any non-static data member of a union has a non-trivial -default constructor\iref{class.ctor}, +default constructor\iref{class.default.ctor}, copy constructor, move constructor\iref{class.copy.ctor}, copy assignment operator, move assignment operator\iref{class.copy.assign}, or destructor\iref{class.dtor}, the corresponding member function @@ -3388,7 +3346,7 @@ \pnum A class can be declared within a function definition; such a class is -called a \defnx{local}{local class} class. The name of a local class is local to +called a \defnadj{local}{class}. The name of a local class is local to its enclosing scope. \indextext{local class!scope of}% The local class is in the scope of the enclosing scope, and has the same @@ -3505,7 +3463,7 @@ an incompletely defined class\iref{class}. The class denoted by the \grammarterm{class-or-decltype} of a \grammarterm{base-specifier} is called a -\defnx{direct base class}{base class!direct} +\defnadj{direct}{base class} for the class being defined. \indextext{base class}% \indextext{derivation|see{inheritance}}% @@ -3514,7 +3472,7 @@ \grammarterm{class-name}, the program is ill-formed. A class \tcode{B} is a base class of a class \tcode{D} if it is a direct base class of \tcode{D} or a direct base class of one of \tcode{D}'s base classes. -A class is an \defnx{indirect}{base class!indirect} base class of another if it is a base +A class is an \defnadj{indirect}{base class} of another if it is a base class but not a direct base class. A class is said to be (directly or indirectly) \term{derived} from its (direct or indirect) base classes. @@ -3670,9 +3628,9 @@ \pnum \indextext{base class!virtual}% A base class specifier that does not contain the keyword -\tcode{virtual} specifies a \defnx{non-virtual base class}{base class!non-virtual}. A base +\tcode{virtual} specifies a \defnadj{non-virtual}{base class}. A base class specifier that contains the keyword \tcode{virtual} specifies a -\defnx{virtual base class}{base class!virtual}. For each distinct occurrence of a +\defnadj{virtual}{base class}. For each distinct occurrence of a non-virtual base class in the class lattice of the most derived class, the most derived object\iref{intro.object} shall contain a corresponding distinct base class subobject of that type. For each @@ -3764,23 +3722,27 @@ \indextext{type!polymorphic}% \pnum +A non-static member function is a \defnadj{virtual}{function} +if it is first declared with the keyword \tcode{virtual} or +if it overrides a virtual member function declared in a base class +(see below).\footnote{The use of the \tcode{virtual} specifier in the +declaration of an overriding function is valid but redundant (has empty +semantics).} \begin{note} Virtual functions support dynamic binding and object-oriented programming. \end{note} A class that declares or inherits a virtual function is -called a \defnx{polymorphic class}{class!polymorphic}. +called a \defnadj{polymorphic}{class}. \pnum If a virtual member function \tcode{vf} is declared in a class \tcode{Base} and in a class \tcode{Derived}, derived directly or indirectly from \tcode{Base}, a member function \tcode{vf} with the same name, parameter-type-list\iref{dcl.fct}, cv-qualification, and ref-qualifier -(or absence of same) as -\tcode{Base::vf} is declared, then \tcode{Derived::vf} is also virtual -(whether or not it is so declared) and it \term{overrides}\footnote{A function with the same name but a different parameter list\iref{over} +(or absence of same) as \tcode{Base::vf} is declared, +then \tcode{Derived::vf} \term{overrides}\footnote{A function +with the same name but a different parameter list\iref{over} as a virtual function is not necessarily virtual and -does not override. The use of the \tcode{virtual} specifier in the -declaration of an overriding function is legal but redundant (has empty -semantics). Access control\iref{class.access} is not considered in +does not override. Access control\iref{class.access} is not considered in determining overriding.} \tcode{Base::vf}. For convenience we say that any virtual function overrides itself. @@ -4159,7 +4121,7 @@ \begin{note} Such a function might be inherited: see below. \end{note} -A class is an \defnx{abstract class}{class!abstract} +A class is an \defnadj{abstract}{class} if it has at least one pure virtual function. \begin{note} An abstract class can be used only as a base class of some other class; @@ -4264,8 +4226,8 @@ \pnum Member name lookup determines the meaning of a name (\grammarterm{id-expression}) in a class scope\iref{basic.scope.class}. -Name lookup can result in an \term{ambiguity}, in which case the -program is ill-formed. For an \grammarterm{id-expression}, name lookup +Name lookup can result in an ambiguity, in which case the +program is ill-formed. For an \grammarterm{unqualified-id}, name lookup begins in the class scope of \tcode{this}; for a \grammarterm{qualified-id}, name lookup begins in the scope of the \grammarterm{nested-name-specifier}. Name lookup takes place before access @@ -6280,6 +6242,42 @@ \end{codeblock} \end{example} +\pnum +During the construction of an object, +if the value of the object or any of its subobjects is +accessed through a glvalue that is not obtained, directly or indirectly, from +the constructor's +\tcode{this} +pointer, the value of the object or subobject thus obtained is unspecified. +\begin{example} + +\begin{codeblock} +struct C; +void no_opt(C*); + +struct C { + int c; + C() : c(0) { no_opt(this); } +}; + +const C cobj; + +void no_opt(C* cptr) { + int i = cobj.c * 100; // value of \tcode{cobj.c} is unspecified + cptr->c = 1; + cout << cobj.c * 100 // value of \tcode{cobj.c} is unspecified + << '\n'; +} + +extern struct D d; +struct D { + D(int a) : a(a), b(d.a) {} + int a, b; +}; +D d = D(1); // value of \tcode{d.b} is unspecified +\end{codeblock} +\end{example} + \pnum \indextext{construction!pointer to member or base}% \indextext{destruction!pointer to member or base}% @@ -6662,13 +6660,13 @@ \pnum \indextext{structural comparison operator|see{operator, structural comparison}}% A three-way comparison operator for a class type \tcode{C} -is a \defnx{structural comparison operator}{operator!structural comparison} +is a \defnadj{structural comparison}{operator} if it is defined as defaulted in the definition of \tcode{C}, and all three-way comparison operators it invokes are structural comparison operators. \indextext{strong structural equality|see{equality, strong structural}}% A type \tcode{T} -has \defnx{strong structural equality}{equality!strong structural} +has \defnadj{strong structural}{equality} if, for a glvalue \tcode{x} of type \tcode{const T}, \tcode{x <=> x} is a valid expression of type \tcode{std::strong_ordering} or \tcode{std::strong_equality} diff --git a/source/compatibility.tex b/source/compatibility.tex index 6947f19b6f0..7f8c443cb91 100644 --- a/source/compatibility.tex +++ b/source/compatibility.tex @@ -195,7 +195,7 @@ \howwide Common. -\rSec2[diff.conv]{\ref{conv}: standard conversions} +\rSec2[diff.expr]{\ref{expr}: expressions} \diffref{conv.ptr} \change Converting \tcode{void*} to a pointer-to-object type requires casting. @@ -232,8 +232,6 @@ Some ISO C translators will give a warning if the cast is not used. -\rSec2[diff.expr]{\ref{expr}: expressions} - \diffref{expr.call} \change Implicit declaration of functions is not allowed. \rationale @@ -487,54 +485,6 @@ \difficulty Syntactic transformation. \howwide Rare. -\diffref{dcl.enum} -\change \Cpp{} objects of enumeration type can only be assigned values of the same enumeration type. -In C, objects of enumeration type can be assigned values of any integral type. - -Example: -\begin{codeblock} -enum color { red, blue, green }; -enum color c = 1; // valid C, invalid \Cpp{} -\end{codeblock} - -\rationale -The type-safe nature of \Cpp{}. -\effect -Deletion of semantically well-defined feature. -\difficulty -Syntactic transformation. -(The type error produced by the assignment can be automatically -corrected by applying an explicit cast.) -\howwide -Common. - -\diffref{dcl.enum} -\change In \Cpp{}, the type of an enumerator is its enumeration. In C, the type of an enumerator is \tcode{int}. - -Example: - -\begin{codeblock} -enum e { A }; -sizeof(A) == sizeof(int) // in C -sizeof(A) == sizeof(e) // in \Cpp{} -/* and @sizeof(int)@ is not necessarily equal to @sizeof(e)@ */ -\end{codeblock} - -\rationale -In \Cpp{}, an enumeration is a distinct type. -\effect -Change to semantics of well-defined feature. -\difficulty -Semantic transformation. -\howwide -Seldom. -The only time this affects existing C code is when the size of an -enumerator is taken. -Taking the size of an enumerator is not a -common C coding practice. - -\rSec2[diff.decl]{\ref{dcl.decl}: declarators} - \diffref{dcl.fct} \change In \Cpp{}, a function declared with an empty parameter list takes no arguments. In C, an empty parameter list means that the number and type of the function arguments are unknown. @@ -661,6 +611,52 @@ Seldom. This style of array initialization is seen as poor coding style. +\diffref{dcl.enum} +\change \Cpp{} objects of enumeration type can only be assigned values of the same enumeration type. +In C, objects of enumeration type can be assigned values of any integral type. + +Example: +\begin{codeblock} +enum color { red, blue, green }; +enum color c = 1; // valid C, invalid \Cpp{} +\end{codeblock} + +\rationale +The type-safe nature of \Cpp{}. +\effect +Deletion of semantically well-defined feature. +\difficulty +Syntactic transformation. +(The type error produced by the assignment can be automatically +corrected by applying an explicit cast.) +\howwide +Common. + +\diffref{dcl.enum} +\change In \Cpp{}, the type of an enumerator is its enumeration. In C, the type of an enumerator is \tcode{int}. + +Example: + +\begin{codeblock} +enum e { A }; +sizeof(A) == sizeof(int) // in C +sizeof(A) == sizeof(e) // in \Cpp{} +/* and @sizeof(int)@ is not necessarily equal to @sizeof(e)@ */ +\end{codeblock} + +\rationale +In \Cpp{}, an enumeration is a distinct type. +\effect +Change to semantics of well-defined feature. +\difficulty +Semantic transformation. +\howwide +Seldom. +The only time this affects existing C code is when the size of an +enumerator is taken. +Taking the size of an enumerator is not a +common C coding practice. + \rSec2[diff.class]{\ref{class}: classes} \diffref{class.name} [see also \ref{dcl.typedef}] @@ -702,6 +698,52 @@ \howwide Seldom. +\diffref{class.copy.ctor} +\change Copying volatile objects. + +The implicitly-declared copy constructor and +implicitly-declared copy assignment operator +cannot make a copy of a volatile lvalue. +For example, the following is valid in ISO C: + +\begin{codeblock} +struct X { int i; }; +volatile struct X x1 = {0}; +struct X x2 = x1; // invalid \Cpp{} +struct X x3; +x3 = x1; // also invalid \Cpp{} +\end{codeblock} + +\rationale +Several alternatives were debated at length. +Changing the parameter to +\tcode{volatile} +\tcode{const} +\tcode{X\&} +would greatly complicate the generation of +efficient code for class objects. +Discussion of +providing two alternative signatures for these +implicitly-defined operations raised +unanswered concerns about creating +ambiguities and complicating +the rules that specify the formation of +these operators according to the bases and +members. +\effect +Deletion of semantically well-defined feature. +\difficulty +Semantic transformation. +If volatile semantics are required for the copy, +a user-declared constructor or assignment must +be provided. +If non-volatile semantics are required, +an explicit +\tcode{const_cast} +can be used. +\howwide +Seldom. + \diffref{class.bit} \change \indextext{bit-field!implementation-defined sign of}% @@ -788,54 +830,6 @@ \howwide Seldom. -\rSec2[diff.special]{\ref{special}: special member functions} - -\diffref{class.copy.ctor} -\change Copying volatile objects. - -The implicitly-declared copy constructor and -implicitly-declared copy assignment operator -cannot make a copy of a volatile lvalue. -For example, the following is valid in ISO C: - -\begin{codeblock} -struct X { int i; }; -volatile struct X x1 = {0}; -struct X x2 = x1; // invalid \Cpp{} -struct X x3; -x3 = x1; // also invalid \Cpp{} -\end{codeblock} - -\rationale -Several alternatives were debated at length. -Changing the parameter to -\tcode{volatile} -\tcode{const} -\tcode{X\&} -would greatly complicate the generation of -efficient code for class objects. -Discussion of -providing two alternative signatures for these -implicitly-defined operations raised -unanswered concerns about creating -ambiguities and complicating -the rules that specify the formation of -these operators according to the bases and -members. -\effect -Deletion of semantically well-defined feature. -\difficulty -Semantic transformation. -If volatile semantics are required for the copy, -a user-declared constructor or assignment must -be provided. -If non-volatile semantics are required, -an explicit -\tcode{const_cast} -can be used. -\howwide -Seldom. - \rSec2[diff.cpp]{\ref{cpp}: preprocessing directives} \diffref{cpp.predefined} @@ -923,7 +917,7 @@ Certain integer literals larger than can be represented by \tcode{long} could change from an unsigned integer type to \tcode{signed long long}. -\rSec2[diff.cpp03.conv]{\ref{conv}: standard conversions} +\rSec2[diff.cpp03.expr]{\ref{expr}: expressions} \diffref{conv.ptr} \change Only literals are integer null pointer constants. @@ -941,8 +935,6 @@ } \end{codeblock} -\rSec2[diff.cpp03.expr]{\ref{expr}: expressions} - \diffref{expr.mul} \change Specify rounding for results of integer \tcode{/} and \tcode{\%}. \rationale Increase portability, C99 compatibility. @@ -976,8 +968,6 @@ Standard, \tcode{auto} indicates that the type of a variable is to be deduced from its initializer expression. -\rSec2[diff.cpp03.dcl.decl]{\ref{dcl.decl}: declarators} - \diffref{dcl.init.list} \change Narrowing restrictions in aggregate initializers. \rationale Catches bugs. @@ -991,9 +981,9 @@ int x[] = { 2.0 }; \end{codeblock} -\rSec2[diff.cpp03.special]{\ref{special}: special member functions} +\rSec2[diff.cpp03.class]{\ref{class}: classes} -\diffrefs{class.ctor}{class.dtor}, \ref{class.copy.ctor}, \ref{class.copy.assign} +\diffrefs{class.default.ctor}{class.dtor}, \ref{class.copy.ctor}, \ref{class.copy.assign} \change Implicitly-declared special member functions are defined as deleted when the implicit definition would have been ill-formed. \rationale Improves template argument deduction failure. @@ -1428,8 +1418,6 @@ }; \end{codeblock} -\rSec2[diff.cpp11.dcl.decl]{\ref{dcl.decl}: declarators} - \diffref{dcl.init.aggr} \change Classes with default member initializers can be aggregates. \rationale Necessary to allow default member initializers to be used @@ -1552,8 +1540,6 @@ auto x2{1, 2}; // was \tcode{std::initializer_list}, now ill-formed \end{codeblock} -\rSec2[diff.cpp14.decl]{\ref{dcl.decl}: declarators} - \diffref{dcl.fct} \change Make exception specifications be part of the type system. \rationale Improve type-safety. @@ -1592,7 +1578,7 @@ derived d2; // still OK \end{codeblock} -\rSec2[diff.cpp14.special]{\ref{special}: special member functions} +\rSec2[diff.cpp14.class]{\ref{class}: classes} \diffref{class.inhctor.init} \change @@ -1840,7 +1826,7 @@ if those entities are only referenced in contexts that do not result in an odr-use. -\rSec2[diff.cpp17.dcl.decl]{\ref{dcl.decl}: declarators} +\rSec2[diff.cpp17.dcl.dcl]{\ref{dcl.dcl}: declarations} \diffref{dcl.init.aggr} \change A class that has user-declared constructors is never an aggregate. @@ -1883,7 +1869,7 @@ Y y{X{}}; // copy constructor call; previously aggregate-initialization \end{codeblock} -\rSec2[diff.cpp17.special]{\ref{special}: special member functions} +\rSec2[diff.cpp17.class]{\ref{class}: classes} \diffrefs{class.ctor}{class.conv.fct} \change diff --git a/source/config.tex b/source/config.tex index 66a8d75772c..a5b16113e76 100644 --- a/source/config.tex +++ b/source/config.tex @@ -2,7 +2,7 @@ %%-------------------------------------------------- %% Version numbers \newcommand{\docno}{Dxxxx} -\newcommand{\prevdocno}{N4762} +\newcommand{\prevdocno}{N4778} \newcommand{\cppver}{201703L} %% Release date diff --git a/source/containers.tex b/source/containers.tex index 6c2e03ba0d1..2312bd54caa 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -1236,9 +1236,7 @@ is empty, it contains no allocator. \pnum -Class \tcode{\placeholder{node_handle}} is for exposition only. An implementation is -permitted to provide equivalent functionality without providing a class with -this name. +Class \tcode{\placeholder{node-handle}} is for exposition only. \pnum If a user-defined specialization of \tcode{pair} exists for @@ -1249,7 +1247,7 @@ \begin{codeblock} template<@\unspecnc@> -class @\placeholder{node_handle}@ { +class @\placeholder{node-handle}@ { public: // These type declarations are described in Tables \ref{tab:containers.associative.requirements} and \ref{tab:HashRequirements}. using value_type = @\seebelownc{}@; // not present for map containers @@ -1266,12 +1264,12 @@ public: // \ref{container.node.cons}, constructors, copy, and assignment - constexpr @\placeholdernc{node_handle}@() noexcept : ptr_(), alloc_() {} - @\placeholdernc{node_handle}@(@\placeholdernc{node_handle}@&&) noexcept; - @\placeholdernc{node_handle}@& operator=(@\placeholdernc{node_handle}@&&); + constexpr @\placeholdernc{node-handle}@() noexcept : ptr_(), alloc_() {} + @\placeholdernc{node-handle}@(@\placeholdernc{node-handle}@&&) noexcept; + @\placeholdernc{node-handle}@& operator=(@\placeholdernc{node-handle}@&&); // \ref{container.node.dtor}, destructor - ~@\placeholdernc{node_handle}@(); + ~@\placeholdernc{node-handle}@(); // \ref{container.node.observers}, observers value_type& value() const; // not present for map containers @@ -1283,11 +1281,11 @@ [[nodiscard]] bool empty() const noexcept; // \ref{container.node.modifiers}, modifiers - void swap(@\placeholdernc{node_handle}@&) + void swap(@\placeholdernc{node-handle}@&) noexcept(ator_traits::propagate_on_container_swap::value || ator_traits::is_always_equal::value); - friend void swap(@\placeholdernc{node_handle}@& x, @\placeholdernc{node_handle}@& y) noexcept(noexcept(x.swap(y))) { + friend void swap(@\placeholdernc{node-handle}@& x, @\placeholdernc{node-handle}@& y) noexcept(noexcept(x.swap(y))) { x.swap(y); } }; @@ -1296,19 +1294,19 @@ \rSec3[container.node.cons]{Constructors, copy, and assignment} \begin{itemdecl} -@\placeholdernc{node_handle}@(@\placeholdernc{node_handle}@&& nh) noexcept; +@\placeholdernc{node-handle}@(@\placeholdernc{node-handle}@&& nh) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs a \tcode{\placeholder{node_handle}} object initializing +\effects Constructs a \tcode{\placeholder{node-handle}} object initializing \tcode{ptr_} with \tcode{nh.ptr_}. Move constructs \tcode{alloc_} with \tcode{nh.alloc_}. Assigns \tcode{nullptr} to \tcode{nh.ptr_} and assigns \tcode{nullopt} to \tcode{nh.alloc_}. \end{itemdescr} \begin{itemdecl} -@\placeholdernc{node_handle}@& operator=(@\placeholdernc{node_handle}@&& nh); +@\placeholdernc{node-handle}@& operator=(@\placeholdernc{node-handle}@&& nh); \end{itemdecl} \begin{itemdescr} @@ -1344,7 +1342,7 @@ \rSec3[container.node.dtor]{Destructor} \begin{itemdecl} -~@\placeholdernc{node_handle}@(); +~@\placeholdernc{node-handle}@(); \end{itemdecl} \begin{itemdescr} @@ -1447,7 +1445,7 @@ \rSec3[container.node.modifiers]{Modifiers} \begin{itemdecl} -void swap(@\placeholdernc{node_handle}@& nh) +void swap(@\placeholdernc{node-handle}@& nh) noexcept(ator_traits::propagate_on_container_swap::value || ator_traits::is_always_equal::value); \end{itemdecl} @@ -1469,11 +1467,11 @@ \pnum The associative containers with unique keys and the unordered containers with unique keys have a member function \tcode{insert} that returns a nested type \tcode{insert_return_type}. -That return type is a specialization of the type specified in this subclause. +That return type is a specialization of the template specified in this subclause. \begin{codeblock} template -struct @\placeholder{INSERT_RETURN_TYPE}@ +struct @\placeholder{insert-return-type}@ { Iterator position; bool inserted; @@ -1482,8 +1480,8 @@ \end{codeblock} \pnum -The name \tcode{\placeholder{INSERT_RETURN_TYPE}} is exposition only. -\tcode{\placeholder{INSERT_RETURN_TYPE}} has the template parameters, +The name \tcode{\placeholder{insert-return-type}} is exposition only. +\tcode{\placeholder{insert-return-type}} has the template parameters, data members, and special members specified above. It has no base classes or members other than those specified. @@ -1642,16 +1640,19 @@ & & \chdr{pre-/post-condition} & \\ \capsep \endhead +\indexordmem{key_type}% \tcode{X::key_type} & \tcode{Key} & & compile time \\ \rowsep +\indexordmem{mapped_type}% \tcode{X::mapped_type} (\tcode{map} and \tcode{multimap} only) & \tcode{T} & & compile time \\ \rowsep +\indexordmem{value_type}% \tcode{X::value_type} (\tcode{set} and \tcode{multiset} only) & \tcode{Key} & \requires\ \tcode{value_type} is \oldconcept{Erasable} from \tcode{X} & @@ -1662,11 +1663,13 @@ \requires\ \tcode{value_type} is \oldconcept{Erasable} from \tcode{X} & compile time \\ \rowsep +\indexordmem{key_compare}% \tcode{X::key_compare} & \tcode{Compare} & \requires\ \tcode{key_compare} is \oldconcept{CopyConstructible}. & compile time \\ \rowsep +\indexordmem{value_compare}% \tcode{X::value_compare} & a binary predicate type & is the same as \tcode{key_compare} for \tcode{set} and @@ -1674,13 +1677,18 @@ first component (i.e., \tcode{Key}) for \tcode{map} and \tcode{multimap}. & compile time \\ \rowsep +\indexordmem{node_type}% \tcode{X::node_type} & - a specialization of a \tcode{\placeholder{node_handle}} + a specialization of a \tcode{\placeholder{node-handle}} class template, such that the public nested types are the same types as the corresponding types in \tcode{X}. & see~\ref{container.node} & compile time \\ \rowsep +\indexlibrary{\idxcode{set}!constructor}% +\indexlibrary{\idxcode{map}!constructor}% +\indexlibrary{\idxcode{multiset}!constructor}% +\indexlibrary{\idxcode{multimap}!constructor}% \tcode{X(c)}\br \tcode{X u(c);} & & @@ -1732,16 +1740,19 @@ linear if \range{il.begin()}{il.end()} is sorted with \tcode{value_comp()} \\ \rowsep +\indexordmem{key_comp}% \tcode{b.key_comp()} & \tcode{X::key_compare} & returns the comparison object out of which \tcode{b} was constructed. & constant \\ \rowsep +\indexordmem{value_comp}% \tcode{b.value_comp()} & \tcode{X::value_compare} & returns an object of \tcode{value_compare} constructed out of the comparison object & constant \\ \rowsep +\indexordmem{emplace}% \tcode{a_uniq.\brk{}emplace(\brk{}args)} & \tcode{pair<\brk{}iterator, bool>} & \requires\ \tcode{value_type} shall be \oldconcept{EmplaceConstructible} into \tcode{X} from \tcode{args}.\br @@ -1764,6 +1775,7 @@ \tcode{t} is inserted at the end of that range. & logarithmic \\ \rowsep +\indexordmem{emplace_hint}% \tcode{a.emplace_\-hint(\brk{}p, args)} & \tcode{iterator} & equivalent to \tcode{a.emplace(} \tcode{std::forward<\brk{}Args\brk{}>(\brk{}args)...)}. @@ -1774,6 +1786,7 @@ logarithmic in general, but amortized constant if the element is inserted right before \tcode{p} \\ \rowsep +\indexordmem{insert}% \tcode{a_uniq.\brk{}insert(\brk{}t)} & \tcode{pair<\brk{}iterator, bool>} & \requires\ If \tcode{t} is a non-const rvalue, \tcode{value_type} shall be @@ -1870,6 +1883,7 @@ logarithmic in general, but amortized constant if the element is inserted right before \tcode{p}. \\ \rowsep +\indexordmem{extract}% \tcode{a.\brk{}extract(\brk{}k)} & \tcode{node_type} & removes the first element in the container with key equivalent to \tcode{k}. @@ -1883,6 +1897,7 @@ Returns a \tcode{node_type} owning that element. & amortized constant \\ \rowsep +\indexordmem{merge}% \tcode{a.merge(a2)} & \tcode{void} & \requires \tcode{a.get_allocator() == a2.get_allocator()}.\br @@ -1897,6 +1912,7 @@ \throws{} Nothing unless the comparison object throws. & $N \log(\tcode{a.size()+} N)$, where $N$ has the value \tcode{a2.size()}. \\ \rowsep +\indexordmem{erase}% \tcode{a.erase(k)} & \tcode{size_type} & erases all elements in the container with key equivalent to @@ -1925,12 +1941,14 @@ exists, \tcode{a.end()} is returned. & $\log(\tcode{a.size()}) + N$, where $N$ has the value \tcode{distance(q1, q2)}. \\ \rowsep +\indexordmem{clear}% \tcode{a.clear()} & \tcode{void} & \tcode{a.erase(a.begin(),a.end())}\br \postconditions \tcode{a.empty()} returns \tcode{true}. & linear in \tcode{a.size()}. \\ \rowsep +\indexordmem{find}% \tcode{b.find(k)} & \tcode{iterator}; \tcode{const_iterator} for constant \tcode{b}. & returns an iterator pointing to an element with the key equivalent @@ -1945,6 +1963,7 @@ is not found & logarithmic \\ \rowsep +\indexordmem{count}% \tcode{b.count(k)} & \tcode{size_type} & returns the number of elements with key equivalent to \tcode{k} & @@ -1970,6 +1989,7 @@ equivalent to \tcode{a_tran.find(ke) != a_tran.end()} & logarithmic \\ \rowsep +\indexordmem{lower_bound}% \tcode{b.lower_bound(k)} & \tcode{iterator}; \tcode{const_iterator} for constant \tcode{b}. & returns an iterator pointing to the first element with @@ -1985,6 +2005,7 @@ or \tcode{a_tran.end()} if such an element is not found. & logarithmic \\ \rowsep +\indexordmem{upper_bound}% \tcode{b.upper_bound(k)} & \tcode{iterator}; \tcode{const_iterator} for constant \tcode{b}. & returns an iterator pointing to the first element with @@ -2000,6 +2021,7 @@ or \tcode{a_tran.end()} if such an element is not found. & logarithmic \\ \rowsep +\indexordmem{equal_range}% \tcode{b.equal_range(k)} & \tcode{pair<\brk{}iterator, iterator>}; \tcode{pair<\brk{}const_iterator, const_iterator>} for constant \tcode{b}. & @@ -2278,11 +2300,13 @@ & compile time \\ \rowsep +\indexunordmem{mapped_type}% \tcode{X::mapped_type} (\tcode{unordered_map} and \tcode{unordered_multimap} only) & \tcode{T} & & compile time \\ \rowsep +\indexunordmem{value_type}% \tcode{X::value_type} (\tcode{unordered_set} and \tcode{unordered_multiset} only) & \tcode{Key} & \requires\ \tcode{value_type} is \oldconcept{Erasable} from \tcode{X} & @@ -2334,12 +2358,16 @@ % \indexunordmem{node_type}% \tcode{X::node_type} & - a specialization of a \tcode{\placeholder{node_handle}} + a specialization of a \tcode{\placeholder{node-handle}} class template, such that the public nested types are the same types as the corresponding types in \tcode{X}. & see~\ref{container.node} & compile time \\ \rowsep % +\indexlibrary{\idxcode{unordered_set}!constructor}% +\indexlibrary{\idxcode{unordered_map}!constructor}% +\indexlibrary{\idxcode{unordered_multiset}!constructor}% +\indexlibrary{\idxcode{unordered_multimap}!constructor}% \tcode{X(n, hf, eq)}\br \tcode{X a(n, hf, eq);} & \tcode{X} & \effects\ Constructs an empty container with at least \tcode{n} buckets, @@ -2485,6 +2513,7 @@ \\ \rowsep % +\indexunordmem{emplace}% \tcode{a_uniq.} \tcode{emplace(args)} & \tcode{pair} & \requires\ \tcode{value_type} shall be \oldconcept{EmplaceConstructible} into \tcode{X} from \tcode{args}.\br @@ -2507,6 +2536,7 @@ Average case \bigoh{1}, worst case \bigoh{\tcode{a_eq.}\br\tcode{size()}}. \\ \rowsep +\indexunordmem{emplace_hint}% \tcode{a.emplace_hint(p, args)} & \tcode{iterator} & \requires\ \tcode{value_type} shall be \oldconcept{EmplaceConstructible} into \tcode{X} from \tcode{args}.\br @@ -2612,6 +2642,7 @@ \postconditions \tcode{nh} is empty if insertion succeeds, unchanged if insertion fails. & Average case \bigoh{1}, worst case \bigoh{\tcode{a.size()}}. \\ \rowsep % +\indexunordmem{extract}% \tcode{a.extract(k)} & \tcode{node_type} & Removes an element in the container with key equivalent to \tcode{k}. @@ -2625,6 +2656,7 @@ Returns a \tcode{node_type} owning that element. & Average case \bigoh{1}, worst case \bigoh{\tcode{a.size()}}. \\ \rowsep % +\indexunordmem{merge}% \tcode{a.merge(a2)} & \tcode{void} & \requires \tcode{a.get_allocator() == a2.get_allocator()}.\br @@ -2641,6 +2673,7 @@ Average case \bigoh{N}, where $N$ is \tcode{a2.size()}. Worst case \bigoh{N\tcode{*a.size()}\br\tcode{+} N}. \\ \rowsep % +\indexunordmem{erase}% \tcode{a.erase(k)} & \tcode{size_type} & Erases all elements with key equivalent to \tcode{k}. Returns @@ -2649,7 +2682,6 @@ \bigoh{\tcode{a.size()}}. \\ \rowsep % -\indexunordmem{erase}% \tcode{a.erase(q)} & \tcode{iterator} & Erases the element pointed to by \tcode{q}. Returns the @@ -3253,7 +3285,7 @@ \indextext{requirements!container}% The conditions for an aggregate\iref{dcl.init.aggr} shall be met. Class \tcode{array} relies on the implicitly-declared special -member functions~(\ref{class.ctor}, \ref{class.dtor}, and \ref{class.copy.ctor}) to +member functions~(\ref{class.default.ctor}, \ref{class.dtor}, and \ref{class.copy.ctor}) to conform to the container requirements table in~\ref{container.requirements}. In addition to the requirements specified in the container requirements table, the implicit move constructor and move assignment operator for \tcode{array} @@ -4171,7 +4203,6 @@ \throws Nothing. \end{itemdescr} -\indexlibrarymember{erased}{forward_list}% \begin{itemdecl} iterator erase_after(const_iterator position, const_iterator last); \end{itemdecl} @@ -6014,7 +6045,7 @@ using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; using node_type = @\unspec@; - using insert_return_type = @\placeholdernc{INSERT_RETURN_TYPE}@; + using insert_return_type = @\placeholdernc{insert-return-type}@; class value_compare { friend class map; @@ -6076,10 +6107,10 @@ size_type max_size() const noexcept; // \ref{map.access}, element access - T& operator[](const key_type& x); - T& operator[](key_type&& x); - T& at(const key_type& x); - const T& at(const key_type& x) const; + mapped_type& operator[](const key_type& x); + mapped_type& operator[](key_type&& x); + mapped_type& at(const key_type& x); + const mapped_type& at(const key_type& x) const; // \ref{map.modifiers}, modifiers template pair emplace(Args&&... args); @@ -6246,7 +6277,7 @@ \indexlibrary{\idxcode{operator[]}!\idxcode{map}}% \begin{itemdecl} -T& operator[](const key_type& x); +mapped_type& operator[](const key_type& x); \end{itemdecl} \begin{itemdescr} @@ -6257,7 +6288,7 @@ \indexlibrary{\idxcode{operator[]}!\idxcode{map}}% \begin{itemdecl} -T& operator[](key_type&& x); +mapped_type& operator[](key_type&& x); \end{itemdecl} \begin{itemdescr} @@ -6268,8 +6299,8 @@ \indexlibrary{\idxcode{at}!\idxcode{map}}% \begin{itemdecl} -T& at(const key_type& x); -const T& at(const key_type& x) const; +mapped_type& at(const key_type& x); +const mapped_type& at(const key_type& x) const; \end{itemdecl} \begin{itemdescr} @@ -6829,7 +6860,7 @@ using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; using node_type = @\unspec@; - using insert_return_type = @\placeholdernc{INSERT_RETURN_TYPE}@; + using insert_return_type = @\placeholdernc{insert-return-type}@; // \ref{set.cons}, construct/copy/destroy set() : set(Compare()) { } @@ -7469,7 +7500,7 @@ using local_iterator = @\impdefx{type of \tcode{unordered_map::local_iterator}}@; // see \ref{container.requirements} using const_local_iterator = @\impdefx{type of \tcode{unordered_map::const_local_iterator}}@; // see \ref{container.requirements} using node_type = @\unspec@; - using insert_return_type = @\placeholdernc{INSERT_RETURN_TYPE}@; + using insert_return_type = @\placeholdernc{insert-return-type}@; // \ref{unord.map.cnstr}, construct/copy/destroy unordered_map(); @@ -8344,7 +8375,7 @@ using local_iterator = @\impdefx{type of \tcode{unordered_set::local_iterator}}@; // see \ref{container.requirements} using const_local_iterator = @\impdefx{type of \tcode{unordered_set::const_local_iterator}}@; // see \ref{container.requirements} using node_type = @\unspec@; - using insert_return_type = @\placeholdernc{INSERT_RETURN_TYPE}@; + using insert_return_type = @\placeholdernc{insert-return-type}@; // \ref{unord.set.cnstr}, construct/copy/destroy unordered_set(); @@ -9806,13 +9837,6 @@ A \tcode{span} is a view over a contiguous sequence of objects, the storage of which is owned by some other object. -\pnum -\tcode{ElementType} is required to be a complete object type that is not an abstract class type. - -\pnum -If \tcode{Extent} is negative and not equal to \tcode{dynamic_extent}, -the program is ill-formed. - \pnum The iterator types \tcode{span::iterator} and \tcode{span::const_iterator} are random access iterators\iref{random.access.iterators}, @@ -9916,6 +9940,14 @@ } \end{codeblock} +\pnum +\tcode{ElementType} is required to be +a complete object type that is not an abstract class type. + +\pnum +If \tcode{Extent} is negative and not equal to \tcode{dynamic_extent}, +the program is ill-formed. + \rSec3[span.cons]{Constructors, copy, and assignment} \indexlibrary{\idxcode{span}!constructor}% @@ -10415,7 +10447,7 @@ \indexlibrary{\idxcode{as_bytes}}% \begin{itemdecl} -template +template span(sizeof(ElementType)) * Extent> diff --git a/source/declarations.tex b/source/declarations.tex index 5708b855cf4..1717ebebd63 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -230,8 +230,7 @@ \pnum A \grammarterm{nodeclspec-function-declaration} shall declare a -constructor, destructor, or conversion function.\footnote{The -``implicit int'' rule of C is no longer supported.} +constructor, destructor, or conversion function. \begin{note} A \grammarterm{nodeclspec-function-declaration} can only be used in a \grammarterm{template-declaration}\iref{temp}, @@ -991,7 +990,7 @@ \indextext{inline function}% A function declaration~(\ref{dcl.fct}, \ref{class.mfct}, \ref{class.friend}) with an \tcode{inline} specifier declares an -\defnx{inline function}{function!inline}. The inline specifier indicates to +\defnadj{inline}{function}. The inline specifier indicates to the implementation that inline substitution of the function body at the point of call is to be preferred to the usual function call mechanism. An implementation is not required to perform this inline substitution at @@ -1001,7 +1000,7 @@ \pnum A variable declaration with an \tcode{inline} specifier declares an -\defnx{inline variable}{variable!inline}. +\defnadj{inline}{variable}. \pnum A function defined within a class definition is an inline function. @@ -3719,7 +3718,7 @@ outside of the class definition are added to the set of default arguments provided by the member function declaration in the class definition; -the program is ill-formed if a default constructor\iref{class.ctor}, +the program is ill-formed if a default constructor\iref{class.default.ctor}, copy or move constructor\iref{class.copy.ctor}, or copy or move assignment operator\iref{class.copy.assign} is so declared. @@ -4094,7 +4093,7 @@ if \tcode{T} is a (possibly cv-qualified) class type\iref{class} with -either no default constructor\iref{class.ctor} or a default +either no default constructor\iref{class.default.ctor} or a default constructor that is user-provided or deleted, then the object is default-initialized; \item @@ -4329,10 +4328,11 @@ ambiguous, the initialization is ill-formed. \item Otherwise (i.e., for the remaining copy-initialization cases), -user-defined conversion sequences that can convert from the +user-defined conversions that can convert from the source type to the destination type or (when a conversion function -is used) to a derived class thereof are enumerated as described in~\ref{over.match.copy}, and the best one is chosen through overload -resolution\iref{over.match}. If the conversion cannot be done or +is used) to a derived class thereof are enumerated as described in~\ref{over.match.copy}, +and the best one is chosen through overload resolution\iref{over.match}. +If the conversion cannot be done or is ambiguous, the initialization is ill-formed. The function selected is called with the initializer expression as its argument; if the function is a constructor, the call is a prvalue @@ -4670,7 +4670,7 @@ \tcode{\{\}} shall not be used as the \grammarterm{initializer-clause} for an array of unknown bound.\footnote{The syntax provides for empty -\grammarterm{initializer-list}{s}, +initializer lists, but nonetheless \Cpp{} does not have zero length arrays.} \begin{note} A default member initializer does not determine the bound for a member @@ -5796,7 +5796,7 @@ \pnum In the \grammarterm{function-body}, a -\defnx{function-local predefined variable}{variable!function-local predefined} denotes a block-scope object of static +\defnadj{function-local predefined}{variable} denotes a block-scope object of static storage duration that is implicitly defined (see~\ref{basic.scope.block}). \pnum @@ -6225,13 +6225,12 @@ \pnum \indextext{constant!enumeration}% -\indextext{enumeration}% The enumeration type declared with an \grammarterm{enum-key} -of only \tcode{enum} is an \defnx{unscoped enumeration}{enumeration!unscoped}, +of only \tcode{enum} is an \defnadj{unscoped}{enumeration}, and its \grammarterm{enumerator}{s} are \defnx{unscoped enumerators}{enumerator!unscoped}. The \grammarterm{enum-key}{s} \tcode{enum class} and \tcode{enum struct} are semantically equivalent; an enumeration -type declared with one of these is a \defnx{scoped enumeration}{enumeration!scoped}, +type declared with one of these is a \defnadj{scoped}{enumeration}, and its \grammarterm{enumerator}{s} are \defnx{scoped enumerators}{enumerator!scoped}. The optional \grammarterm{identifier} shall not be omitted in the declaration of a scoped enumeration. The \grammarterm{type-specifier-seq} of an \grammarterm{enum-base} @@ -6590,7 +6589,7 @@ \pnum If the optional initial \tcode{inline} keyword appears in a \grammarterm{namespace-definition} for a particular namespace, that namespace is -declared to be an \defnx{inline namespace}{namespace!inline}. The \tcode{inline} keyword may be +declared to be an \defnadj{inline}{namespace}. The \tcode{inline} keyword may be used on a \grammarterm{namespace-definition} that extends a namespace only if it was previously used on the \grammarterm{namespace-definition} that initially declared the \grammarterm{namespace-name} for that namespace. @@ -8550,7 +8549,7 @@ the source location of the statement to which the assertion is applied. \pnum -If a user-provided violation handler exits by throwing an exception +If a violation handler exits by throwing an exception and a contract is violated on a call to a function with a non-throwing exception specification, then the behavior is as if the exception escaped the function body. diff --git a/source/expressions.tex b/source/expressions.tex index bfe65b4683b..c77168fcf54 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -43,7 +43,7 @@ \pnum Subclause \ref{expr.compound} defines the effects of operators when applied to types for which they have not been overloaded. Operator overloading shall not -modify the rules for the \defnx{built-in operators}{operators!built-in}, +modify the rules for the \defnadj{built-in}{operators}, that is, for operators applied to types for which they are defined by this Standard. However, these built-in operators participate in overload resolution, and as part of that process user-defined conversions will be @@ -69,6 +69,53 @@ adjustable by a library function. \end{note} +\pnum +\indextext{operator!precedence of}% +\indextext{expression!order of evaluation of}% +\begin{note} +The implementation may regroup operators according to +the usual mathematical rules only +where the operators really are associative or commutative.\footnote{Overloaded +operators are never assumed to be associative or commutative.} +For example, in the following fragment +\begin{codeblock} +int a, b; +@\commentellip@ +a = a + 32760 + b + 5; +\end{codeblock} +the expression statement behaves exactly the same as +\begin{codeblock} +a = (((a + 32760) + b) + 5); +\end{codeblock} +due to the associativity and precedence of these operators. Thus, the +result of the sum \tcode{(a + 32760)} is next added to \tcode{b}, and +that result is then added to 5 which results in the value assigned to +\tcode{a}. On a machine in which overflows produce an exception and in +which the range of values representable by an \tcode{int} is +\crange{-32768}{+32767}, the implementation cannot rewrite this +expression as +\begin{codeblock} +a = ((a + b) + 32765); +\end{codeblock} +since if the values for \tcode{a} and \tcode{b} were, respectively, +-32754 and -15, the sum \tcode{a + b} would produce an exception while +the original expression would not; nor can the expression be rewritten +either as +\begin{codeblock} +a = ((a + 32765) + b); +\end{codeblock} +or +\begin{codeblock} +a = (a + (b + 32765)); +\end{codeblock} +since the values for \tcode{a} and \tcode{b} might have been, +respectively, 4 and -8 or -17 and 12. However on a machine in which +overflows do not produce an exception and in which the results of +overflows are reversible, the above expression statement can be +rewritten by the implementation in any of the above ways because the +same result will occur. +\end{note} + \pnum The values of the floating operands and the results of floating expressions may be represented in greater precision and range than that @@ -169,14 +216,14 @@ is sometimes said to have or name the value \placeholder{V}. The \defn{result object} of a prvalue is the object initialized by the prvalue; -a prvalue -that is used to compute the value of an operand of an operator or +a non-discarded prvalue +that is used to compute the value of an operand of a built-in operator or that has type \cv{}~\tcode{void} has no result object. \begin{note} Except when the prvalue is the operand of a \grammarterm{decltype-specifier}, a prvalue of class or array type always has a result object. -For a discarded prvalue, a temporary object is materialized; see \ref{expr.prop}. +For a discarded prvalue, a temporary object is materialized; see \ref{expr.context}. \end{note} The \defnx{result}{result!glvalue} of a glvalue is the entity denoted by the expression. @@ -234,31 +281,21 @@ \end{note} \pnum -If a program attempts to access the stored value of an object through a glvalue -of other than one of the following types the behavior is -undefined:\footnote{The intent of this list is to specify those circumstances in which an -object may or may not be aliased.} +If a program attempts to access the stored value of an object of type \tcode{T} +through a glvalue whose dynamic type is not one of the following types, +the behavior is undefined:\footnote{The intent of this list is +to specify those circumstances in which an object may or may not be aliased.} \begin{itemize} -\item the dynamic type of the object, - -\item a cv-qualified version of the dynamic type of the object, +\item \cv{} \tcode{T} -\item a type similar (as defined in~\ref{conv.qual}) to the dynamic type -of the object, +\item a type similar (as defined in~\ref{conv.qual}) to \tcode{T}, -\item a type that is the signed or unsigned type corresponding to the -dynamic type of the object, - -\item a type that is the signed or unsigned type corresponding to a -cv-qualified version of the dynamic type of the object, +\item a type that is the signed or unsigned type corresponding to \cv{} \tcode{T}, \item an aggregate or union type that includes one of the aforementioned types among its elements or non-static data members (including, recursively, an element or non-static data member of a subaggregate or contained union), -\item a type that is a (possibly cv-qualified) base class type of the dynamic type of -the object, - \item a \tcode{char}, \tcode{unsigned char}, or \tcode{std::byte} type. \end{itemize} @@ -282,7 +319,7 @@ the expression is adjusted to \tcode{T} prior to any further analysis. \pnum -The \defnx{cv-combined type}{type!cv-combined} of two types \tcode{T1} and \tcode{T2} +The \defnadj{cv-combined}{type} of two types \tcode{T1} and \tcode{T2} is a type \tcode{T3} similar to \tcode{T1} whose cv-qualification signature\iref{conv.qual} is: \begin{itemize} @@ -1253,7 +1290,7 @@ when using a template name\iref{temp.names} and during overload resolution\iref{over}, and they are compared -during the the partial ordering of constraints\iref{temp.constr.order}. +during the partial ordering of constraints\iref{temp.constr.order}. \end{note} \pnum @@ -1542,9 +1579,9 @@ \begin{itemize} \item the size and/or alignment of the closure type, -\item whether the closure type is trivially copyable\iref{class}, or +\item whether the closure type is trivially copyable\iref{class.prop}, or -\item whether the closure type is a standard-layout class\iref{class}. +\item whether the closure type is a standard-layout class\iref{class.prop}. \end{itemize} An implementation shall not add members of rvalue reference type to the closure @@ -2828,10 +2865,10 @@ of the object expression is called; such a call is referred to as a \defnx{virtual function call}{function!virtual function call}. \begin{note} -The dynamic type is the type of the object referred to by the -current value of the object expression. \ref{class.cdtor}~describes the -behavior of virtual function calls when the object expression -refers to +The dynamic type is the type of the most derived object referred to by the +current value of the object expression\iref{defns.dynamic.type}. +\ref{class.cdtor}~describes the behavior of virtual function calls +when the object expression refers to an object under construction or destruction. \end{note} @@ -3701,10 +3738,10 @@ containing the original member, the resulting pointer to member points to the original member. Otherwise, the behavior is undefined. \begin{note} -Although class \tcode{B} need not contain the original member, the -dynamic type of the object with which indirection through the pointer -to member is performed must contain the original member; -see~\ref{expr.mptr.oper}. +Although class \tcode{B} need not contain the original member, +the dynamic type of the object expression +appearing in a pointer-to-member operation +must contain the original member; see~\ref{expr.mptr.oper}. \end{note} \pnum @@ -4319,7 +4356,7 @@ \indextext{\idxcode{new}}% The \grammarterm{new-expression} attempts to create an object of the \grammarterm{type-id}\iref{dcl.name} or \grammarterm{new-type-id} to which -it is applied. The type of that object is the \defnx{allocated type}{type!allocated}. +it is applied. The type of that object is the \defnadj{allocated}{type}. \indextext{type!incomplete}% This type shall be a complete object type, but not an abstract class type or array @@ -4369,19 +4406,6 @@ braced-init-list \end{bnf} -\indextext{storage duration!dynamic}% -Entities created by a \grammarterm{new-expression} have dynamic storage -duration\iref{basic.stc.dynamic}. -\begin{note} -\indextext{\idxcode{new}!scoping and}% -The lifetime of such an entity is not necessarily restricted to the -scope in which it is created. -\end{note} -If the entity is a non-array object, the result of the \grammarterm{new-expression} -is a pointer to the object created. If it is an array, the result of the -\grammarterm{new-expression} is a pointer to the initial element of -the array. - \pnum If a placeholder type\iref{dcl.spec.auto} appears in the \grammarterm{type-specifier-seq} of a \grammarterm{new-type-id} or @@ -4455,6 +4479,18 @@ \end{example} \end{note} +\pnum +\indextext{storage duration!dynamic}% +Objects created by a \grammarterm{new-expression} have dynamic storage +duration\iref{basic.stc.dynamic}. +\begin{note} +\indextext{\idxcode{new}!scoping and}% +The lifetime of such an object is not necessarily restricted to the +scope in which it is created. +\end{note} +When the allocated object is not an array, the result of the \grammarterm{new-expression} +is a pointer to the object created. + \pnum \indextext{array!\idxcode{new}}% When the allocated object is an array (that is, the @@ -4896,6 +4932,8 @@ type by calling the above-mentioned conversion function, and the converted operand is used in place of the original operand for the remainder of this subclause. +The lvalue formed by indirection of the operand is said to refer +to the object to be deleted. In a single-object delete expression, the value of the operand of \tcode{delete} may be a null pointer value, a pointer to a non-array object created by a previous \grammarterm{new-expression}, @@ -4924,15 +4962,17 @@ \pnum \indextext{\idxcode{delete}!undefined}% -In a single-object delete expression, if the static type of the object to be -deleted is different from its dynamic type +In a single-object delete expression, if the static type of the lvalue +that refers to the object to be deleted is different from its dynamic type and the selected deallocation function (see below) is not a destroying operator delete, -the static type shall be a base -class of the dynamic type of the object to be deleted and the static type shall -have a virtual destructor or the behavior is undefined. In an array delete -expression, if the dynamic type of the object to be deleted differs from its -static type, the behavior is undefined. +the static type shall be +a base class of the dynamic type of the object to be deleted +and the static type shall have a virtual destructor +or the behavior is undefined. +In an array delete expression, if the dynamic type of the lvalue +that refers to the first element of the object to be deleted +differs from its static type, the behavior is undefined. \pnum The \grammarterm{cast-expression} in a \grammarterm{delete-expression} shall @@ -5438,9 +5478,13 @@ \pnum \indextext{arithmetic!pointer}% -When an expression that has integral type is added to or subtracted from -a pointer, the result has the type of the pointer operand. -If the expression \tcode{P} points to element $\mathtt{x[}i\mathtt{]}$ +When an expression \tcode{J} that has integral type +is added to or subtracted from an expression \tcode{P} of pointer type, +the result has the type of \tcode{P}. +\begin{itemize} +\item If \tcode{P} evaluates to a null pointer value and +\tcode{J} evaluates to 0, the result is a null pointer value. +\item Otherwise, if \tcode{P} points to element $\mathtt{x[}i\mathtt{]}$ of an array object \tcode{x} with $n$ elements,% \footnote{An object that is not an array element is considered to belong to a single-element array for this purpose; see~\ref{expr.unary.op}. @@ -5450,12 +5494,12 @@ the expressions \tcode{P + J} and \tcode{J + P} (where \tcode{J} has the value $j$) point to the (possibly-hypothetical) element -$\mathtt{x[}i + j\mathtt{]}$ if $0 \le i + j \le n$; -otherwise, the behavior is undefined. -Likewise, the expression \tcode{P - J} +$\mathtt{x[}i + j\mathtt{]}$ if $0 \le i + j \le n$ +and the expression \tcode{P - J} points to the (possibly-hypothetical) element -$\mathtt{x[}i - j\mathtt{]}$ if $0 \le i - j \le n$; -otherwise, the behavior is undefined. +$\mathtt{x[}i - j\mathtt{]}$ if $0 \le i - j \le n$. +\item Otherwise, the behavior is undefined. +\end{itemize} \pnum \indextext{\idxcode{ptrdiff_t}!implementation-defined type of}% @@ -5463,26 +5507,26 @@ \indextext{\idxcode{ptrdiff_t}}% \indexhdr{cstddef}% \indextext{comparison!undefined pointer}% -When two pointers to elements of the same array object are subtracted, +When two pointer expressions \tcode{P} and \tcode{Q} are subtracted, the type of the result is an \impldef{type of \tcode{ptrdiff_t}} signed integral type; this type shall be the same type that is defined as \tcode{std::ptrdiff_t} in the \tcode{} header\iref{support.types}. -If the expressions \tcode{P} and \tcode{Q} -point to, respectively, -elements -$\mathtt{x[}i\mathtt{]}$ -and -$\mathtt{x[}j\mathtt{]}$ +\begin{itemize} +\item If \tcode{P} and \tcode{Q} both evaluate to null pointer values, +the result is 0. +\item Otherwise, if \tcode{P} and \tcode{Q} point to, respectively, +elements $\mathtt{x[}i\mathtt{]}$ and $\mathtt{x[}j\mathtt{]}$ of the same array object \tcode{x}, -the expression \tcode{P - Q} has the value $i - j$; -otherwise, the behavior is undefined. +the expression \tcode{P - Q} has the value $i - j$. +\item Otherwise, the behavior is undefined. \begin{note} If the value $i - j$ is not in the range of representable values of type \tcode{std::ptrdiff_t}, the behavior is undefined. \end{note} +\end{itemize} \pnum For addition or subtraction, if the expressions \tcode{P} or \tcode{Q} have @@ -5492,13 +5536,6 @@ pointer arithmetic when the array contains objects of a derived class type. \end{note} -\pnum -If the value 0 is added to or subtracted from a null pointer value, -the result is a null pointer value. -If two null pointer values are subtracted, -the result compares equal to the value 0 -converted to the type \tcode{std::ptrdiff_t}. - \rSec2[expr.shift]{Shift operators} \pnum @@ -6446,8 +6483,7 @@ \end{bnf} \pnum -An expression \tcode{e} is a -\defnx{core constant expression}{expression!core constant} +An expression \tcode{e} is a \defnadj{core constant}{expression} unless the evaluation of \tcode{e}, following the rules of the abstract machine\iref{intro.execution}, would evaluate one of the following expressions: @@ -6676,7 +6712,7 @@ \end{example} \pnum -An \defnx{integral constant expression}{expression!integral constant} +An \defnadj{integral constant}{expression} is an expression of integral or unscoped enumeration type, implicitly converted to a prvalue, where the converted expression is a core constant expression. \begin{note} @@ -6708,7 +6744,7 @@ \end{example} \pnum -A \defnx{converted constant expression}{expression!converted constant} +A \defnadj{converted constant}{expression} of type \tcode{T} is an expression, implicitly converted to type \tcode{T}, where the converted expression is a constant expression and the @@ -6744,7 +6780,7 @@ the conversion sequence contains only the conversions above. \pnum -A \defnx{constant expression}{expression!constant} is either +A \defnadj{constant}{expression} is either a glvalue core constant expression that refers to an entity that is a permitted result of a constant expression (as defined below), or a prvalue core constant expression whose value diff --git a/source/intro.tex b/source/intro.tex index d1564c0661e..d8152872307 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -551,51 +551,6 @@ \begin{note} More stringent correspondences between abstract and actual semantics may be defined by each implementation. \end{note} -\pnum -\indextext{operator!precedence of}% -\indextext{expression!order of evaluation of}% -\begin{note} Operators can be regrouped according to the usual -mathematical rules only where the operators really are associative or -commutative.\footnote{Overloaded operators are never assumed to be associative or -commutative. } -For example, in the following fragment -\begin{codeblock} -int a, b; -@\commentellip@ -a = a + 32760 + b + 5; -\end{codeblock} -the expression statement behaves exactly the same as -\begin{codeblock} -a = (((a + 32760) + b) + 5); -\end{codeblock} -due to the associativity and precedence of these operators. Thus, the -result of the sum \tcode{(a + 32760)} is next added to \tcode{b}, and -that result is then added to 5 which results in the value assigned to -\tcode{a}. On a machine in which overflows produce an exception and in -which the range of values representable by an \tcode{int} is -\crange{-32768}{+32767}, the implementation cannot rewrite this -expression as -\begin{codeblock} -a = ((a + b) + 32765); -\end{codeblock} -since if the values for \tcode{a} and \tcode{b} were, respectively, --32754 and -15, the sum \tcode{a + b} would produce an exception while -the original expression would not; nor can the expression be rewritten -either as -\begin{codeblock} -a = ((a + 32765) + b); -\end{codeblock} -or -\begin{codeblock} -a = (a + (b + 32765)); -\end{codeblock} -since the values for \tcode{a} and \tcode{b} might have been, -respectively, 4 and -8 or -17 and 12. However on a machine in which -overflows do not produce an exception and in which the results of -overflows are reversible, the above expression statement can be -rewritten by the implementation in any of the above ways because the -same result will occur. \end{note} - \rSec1[intro.structure]{Structure of this document} \pnum diff --git a/source/iostreams.tex b/source/iostreams.tex index 2bebcfeb3ae..08761d5f780 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -11009,9 +11009,6 @@ \end{codeblock} \pnum -\tcode{\textit{trivial-clock}} is an \impldef{type of filesystem trivial clock} type -that satisfies the \oldconcept{TrivialClock} requirements\iref{time.clock.req} -and that is capable of representing and measuring file time values. Implementations should ensure that the resolution and range of \tcode{file_time_type} reflect the operating system dependent resolution and range of file time values. @@ -15009,7 +15006,7 @@ candidate entities reside on the same device at the same location. \begin{note} On POSIX platforms, this is - determined as if by the values of the POSIX \tcode{stat} structure, + determined as if by the values of the POSIX \tcode{stat} class, obtained as if by \tcode{stat()} for the two paths, having equal \tcode{st_dev} values and equal \tcode{st_ino} values. \end{note} @@ -15076,7 +15073,7 @@ \item If \tcode{is_regular_file(p)}, the size in bytes of the file \tcode{p} resolves to, determined as if by the value of the POSIX \tcode{stat} - structure member \tcode{st_size} obtained as if by POSIX \tcode{stat()}. + class member \tcode{st_size} obtained as if by POSIX \tcode{stat()}. \item Otherwise, the result is \impldef{result of \tcode{filesystem::file_size}}. \end{itemize} @@ -15404,7 +15401,7 @@ \begin{itemdescr} \pnum \returns The time of last data modification of \tcode{p}, - determined as if by the value of the POSIX \tcode{stat} structure member \tcode{st_mtime} + determined as if by the value of the POSIX \tcode{stat} class member \tcode{st_mtime} obtained as if by POSIX \tcode{stat()}. The signature with argument \tcode{ec} returns \tcode{file_time_type::min()} if an error occurs. diff --git a/source/iterators.tex b/source/iterators.tex index 2d86d12ff4c..b92af7ed13a 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -19,10 +19,12 @@ as summarized in \tref{iterators.lib.summary}. \begin{libsumtab}{Iterators library summary}{tab:iterators.lib.summary} -\ref{iterator.requirements} & Requirements & \\ \rowsep -\ref{iterator.primitives} & Iterator primitives & \tcode{} \\ -\ref{predef.iterators} & Predefined iterators & \\ -\ref{stream.iterators} & Stream iterators & \\ +\ref{iterator.requirements} & Requirements & \\ \rowsep +\ref{iterator.primitives} & Iterator primitives & \tcode{} \\ +\ref{predef.iterators} & Iterator adaptors & \\ +\ref{stream.iterators} & Stream iterators & \\ +\ref{iterator.range} & Range access & \\ +\ref{iterator.container} & Container and view access & \\ \end{libsumtab} diff --git a/source/lex.tex b/source/lex.tex index 78ea6c21d25..a6e35a66337 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -1126,7 +1126,7 @@ execution character set. An ordinary character literal that contains more than one \grammarterm{c-char} is a \indextext{multicharacter literal|see{literal, multicharacter}}% -\defnx{multicharacter literal}{literal!multicharacter}. +\defnadj{multicharacter}{literal}. A multicharacter literal, or an ordinary character literal containing a single \grammarterm{c-char} not representable in the execution character set, is conditionally-supported, has type \tcode{int}, @@ -1354,8 +1354,8 @@ The integer and fraction parts both consist of a sequence of decimal (base ten) digits if there is no prefix, or hexadecimal (base sixteen) digits if the prefix is \tcode{0x} or \tcode{0X}. -The floating literal is a \defnx{decimal floating literal}{literal!decimal floating} in the former case and -a \defnx{hexadecimal floating literal}{literal!hexadecimal floating} in the latter case. +The floating literal is a \defnadj{decimal floating}{literal} in the former case and +a \defnadj{hexadecimal floating}{literal} in the latter case. Optional separating single quotes in a \grammarterm{digit-sequence} or \grammarterm{hexadecimal-digit-sequence} are ignored when determining its value. @@ -1655,7 +1655,7 @@ \tcode{char16_t} string literal may yield a surrogate pair. \indextext{string!\idxcode{sizeof}}% In a narrow string literal, a \grammarterm{universal-character-name} may map to more -than one \tcode{char} element due to \defnx{multibyte encoding}{encoding!multibyte}. The +than one \tcode{char} element due to \defnadj{multibyte}{encoding}. The size of a \tcode{char32_t} or wide string literal is the total number of escape sequences, \grammarterm{universal-character-name}{s}, and other characters, plus one for the terminating \tcode{U'\textbackslash 0'} or diff --git a/source/lib-intro.tex b/source/lib-intro.tex index 600ee4026ab..97c96f01f2e 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -28,11 +28,12 @@ \ref{diagnostics} & & Diagnostics library \\ \ref{utilities} & & General utilities library \\ \ref{strings} & & Strings library \\ -\ref{localization} & & Localization library \\ \ref{containers} & & Containers library \\ \ref{iterators} & & Iterators library \\ \ref{algorithms} & & Algorithms library \\ \ref{numerics} & & Numerics library \\ +\ref{time} & & Time library \\ +\ref{localization} & & Localization library \\ \ref{input.output} & & Input/output library \\ \ref{re} & & Regular expressions library \\ \ref{atomics} & & Atomic operations library \\ diff --git a/source/numerics.tex b/source/numerics.tex index 24773dae2a5..dc15325e367 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -1381,13 +1381,13 @@ constexpr To bit_cast(const From& from) noexcept; // \ref{bit.pow.two}, integral powers of 2 - template + template constexpr bool ispow2(T x) noexcept; - template + template constexpr T ceil2(T x) noexcept; - template + template constexpr T floor2(T x) noexcept; - template + template constexpr T log2p1(T x) noexcept; } \end{codeblock} @@ -1435,7 +1435,7 @@ \indexlibrary{\idxcode{ispow2}}% \begin{itemdecl} -template +template constexpr bool ispow2(T x) noexcept; \end{itemdecl} @@ -1453,7 +1453,7 @@ \indexlibrary{\idxcode{ceil2}}% \begin{itemdecl} -template +template constexpr T ceil2(T x) noexcept; \end{itemdecl} @@ -1473,7 +1473,7 @@ \indexlibrary{\idxcode{floor2}}% \begin{itemdecl} -template +template constexpr T floor2(T x) noexcept; \end{itemdecl} @@ -1492,7 +1492,7 @@ \indexlibrary{\idxcode{log2p1}}% \begin{itemdecl} -template +template constexpr T log2p1(T x) noexcept; \end{itemdecl} @@ -4096,7 +4096,7 @@ \pnum\effects Constructs a \tcode{seed_seq} object by the following algorithm: \begin{codeblock} -for( InputIterator s = begin; s != end; ++s) +for (InputIterator s = begin; s != end; ++s) v.push_back((*s)@$\bmod 2^{32}$@); \end{codeblock}% \end{itemdescr} diff --git a/source/overloading.tex b/source/overloading.tex index c4cc3c6eaf0..107716f9a86 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -1949,7 +1949,7 @@ \indextext{implicit conversion sequence|see{conversion sequence, implicit}} \pnum -An \defnx{implicit conversion sequence}{conversion sequence!implicit} +An \defnadj{implicit}{conversion sequence} is a sequence of conversions used to convert an argument in a function call to the type of the corresponding parameter of the function being called. @@ -2082,7 +2082,7 @@ convert the argument to the parameter type, the implicit conversion sequence associated with the parameter is defined to be the unique conversion sequence designated the -\defnx{ambiguous conversion sequence}{conversion sequence!ambiguous}. +\defnadj{ambiguous}{conversion sequence}. For the purpose of ranking implicit conversion sequences as described in~\ref{over.ics.rank}, the ambiguous conversion sequence is treated as a user-defined conversion sequence that is indistinguishable from any @@ -2515,13 +2515,13 @@ \pnum This subclause defines a partial ordering of implicit conversion sequences based on the relationships -\defnx{better conversion sequence}{conversion sequence!better} +\defnadj{better}{conversion sequence} and -\defnx{better conversion}{conversion!better}. +\defnadj{better}{conversion}. If an implicit conversion sequence S1 is defined by these rules to be a better conversion sequence than S2, then it is also the case that S2 is a -\defnx{worse conversion sequence}{conversion sequence!worse} +\defnadj{worse}{conversion sequence} than S1. If conversion sequence S1 is neither better than nor worse than conversion sequence S2, S1 and S2 are said to diff --git a/source/regex.tex b/source/regex.tex index 677dc2e1eca..68c09c45194 100644 --- a/source/regex.tex +++ b/source/regex.tex @@ -673,7 +673,7 @@ Specifies that no sub-expressions shall be considered to be marked, so that when a regular expression is matched against a character container sequence, no sub-expression matches shall be -stored in the supplied \tcode{match_results} structure. +stored in the supplied \tcode{match_results} object. \indexlibrary{\idxcode{syntax_option_type}!\idxcode{nosubs}}% \\ \rowsep % diff --git a/source/statements.tex b/source/statements.tex index 55f5236f8b5..372adf43234 100644 --- a/source/statements.tex +++ b/source/statements.tex @@ -366,9 +366,9 @@ \pnum When the \tcode{switch} statement is executed, its condition is -evaluated and compared with each case constant. +evaluated. \indextext{label!\idxcode{case}}% -If one of the case constants is equal to the value of the condition, +If one of the case constants has the same value as the condition, control is passed to the statement following the matched case label. If no case constant matches the condition, and if there is a \indextext{label!\idxcode{default}}% diff --git a/source/strings.tex b/source/strings.tex index fa0b6a7fbbb..397af559541 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -4794,9 +4794,6 @@ User-defined types should define their own implicit conversions to \tcode{std::basic_string_view} in order to interoperate with these functions. \end{note} -\pnum -The complexity of \tcode{basic_string_view} member functions is \bigoh{1} unless otherwise specified. - \rSec2[string.view.synop]{Header \tcode{} synopsis} \indexhdr{string_view}% @@ -4995,6 +4992,10 @@ The type \tcode{iterator} satisfies the constexpr iterator requirements\iref{iterator.requirements.general}. +\pnum +The complexity of \tcode{basic_string_view} member functions is \bigoh{1} +unless otherwise specified. + \rSec3[string.view.cons]{Construction and assignment} \indexlibrary{\idxcode{basic_string_view}!constructor}% diff --git a/source/support.tex b/source/support.tex index 052c0975077..1563b0a7948 100644 --- a/source/support.tex +++ b/source/support.tex @@ -299,7 +299,7 @@ accepts a restricted set of \tcode{\placeholder{type}} arguments in this document. Use of the \tcode{offsetof} macro with a \tcode{\placeholder{type}} -other than a standard-layout class\iref{class} +other than a standard-layout class\iref{class.prop} is conditionally-supported.\footnote{Note that \tcode{offsetof} is required to work as specified even if unary \tcode{operator\&} @@ -4859,7 +4859,7 @@ if \tcode{a == b} is \tcode{true}, returns \tcode{partial_ordering::equivalent}; \item -otherwise, if \tcode{a < b is true}, +otherwise, if \tcode{a < b} is \tcode{true}, returns \tcode{partial_ordering::less}; \item otherwise, returns \tcode{partial_ordering::greater}. diff --git a/source/templates.tex b/source/templates.tex index 6437e308aa9..51940745a6a 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -111,11 +111,11 @@ template using pauli = hermitian_matrix; template - constexpr pauli sigma1 = { { 0, 1 }, { 1, 0 } }; + constexpr static pauli sigma1 = { { 0, 1 }, { 1, 0 } }; template - constexpr pauli sigma2 = { { 0, -1i }, { 1i, 0 } }; + constexpr static pauli sigma2 = { { 0, -1i }, { 1i, 0 } }; template - constexpr pauli sigma3 = { { 1, 0 }, { 0, -1 } }; + constexpr static pauli sigma3 = { { 1, 0 }, { 0, -1 } }; }; \end{codeblock} \end{example} @@ -415,9 +415,8 @@ it is an lvalue and has type \tcode{const T}\iref{expr.prim.id.unqual}. \end{note} \begin{example} - \begin{codeblock} -struct A { auto operator<=>(A, A) = default; }; +struct A { friend auto operator<=>(const A&, const A&) = default; }; template void f() { i++; // error: change of template-parameter value @@ -434,7 +433,7 @@ \pnum A non-type \grammarterm{template-parameter} -shall not be declared to have floating-point, class, or void type. +shall not be declared to have floating-point or void type. \begin{example} \begin{codeblock} @@ -1377,7 +1376,7 @@ const char p[] = "Vivisectionist"; X y; // OK -class A { +struct A { constexpr A(const char*) {} auto operator<=>(A, A) = default; }; @@ -1933,7 +1932,7 @@ \end{example}% } of $P$, $P_i$ subsumes every conjunctive clause $Q_j$ -in the conjuctive normal form\footnote{ +in the conjunctive normal form\footnote{ A constraint is in conjunctive normal form when it is a conjunction of clauses where each clause is a disjunction of atomic constraints. \begin{example} @@ -6110,7 +6109,7 @@ When \tcode{S} is instantiated, both constructors are part of the specialization. Their constraints are not satisfied, and they suppress the implicit declaration of a default constructor for -\tcode{S}\iref{class.ctor}, so there is no viable constructor +\tcode{S}\iref{class.default.ctor}, so there is no viable constructor for \tcode{s1}. \end{example} \begin{example} diff --git a/source/threads.tex b/source/threads.tex index 2d710a1eaaf..f4cf99412ce 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -399,7 +399,7 @@ does not represent threads of execution. \pnum -\tcode{thread::id} is a trivially copyable class\iref{class}. +\tcode{thread::id} is a trivially copyable class\iref{class.prop}. The library may reuse the value of a \tcode{thread::id} of a terminated thread that can no longer be joined. \pnum @@ -1063,7 +1063,7 @@ \pnum The class \tcode{mutex} shall satisfy all of the mutex requirements\iref{thread.mutex.requirements}. It shall be a standard-layout -class\iref{class}. +class\iref{class.prop}. \pnum \begin{note} A program may deadlock if the thread that owns a \tcode{mutex} object calls @@ -1107,7 +1107,7 @@ \pnum The class \tcode{recursive_mutex} shall satisfy all of the mutex requirements\iref{thread.mutex.requirements}. It shall be a standard-layout -class\iref{class}. +class\iref{class.prop}. \pnum A thread that owns a \tcode{recursive_mutex} object may acquire additional levels of @@ -1250,7 +1250,7 @@ \pnum The class \tcode{timed_mutex} shall satisfy all of the timed mutex requirements\iref{thread.timedmutex.requirements}. It shall be a standard-layout -class\iref{class}. +class\iref{class.prop}. \pnum The behavior of a program is undefined if: @@ -1301,7 +1301,7 @@ \pnum The class \tcode{recursive_timed_mutex} shall satisfy all of the timed mutex requirements\iref{thread.timedmutex.requirements}. It shall be a standard-layout -class\iref{class}. +class\iref{class.prop}. \pnum A thread that owns a \tcode{recursive_timed_mutex} object may acquire additional @@ -1467,7 +1467,7 @@ \pnum The class \tcode{shared_mutex} shall satisfy all of the shared mutex requirements\iref{thread.sharedmutex.requirements}. -It shall be a standard-layout class\iref{class}. +It shall be a standard-layout class\iref{class.prop}. \pnum The behavior of a program is undefined if: @@ -1607,7 +1607,7 @@ \pnum The class \tcode{shared_timed_mutex} shall satisfy all of the shared timed mutex requirements\iref{thread.sharedtimedmutex.requirements}. -It shall be a standard-layout class\iref{class}. +It shall be a standard-layout class\iref{class.prop}. \pnum The behavior of a program is undefined if: @@ -2982,7 +2982,7 @@ \end{codeblock} \pnum -The class \tcode{condition_variable} shall be a standard-layout class\iref{class}. +The class \tcode{condition_variable} shall be a standard-layout class\iref{class.prop}. \indexlibrary{\idxcode{condition_variable}!constructor}% \begin{itemdecl} diff --git a/source/time.tex b/source/time.tex index c2bc33d5010..db718f90340 100644 --- a/source/time.tex +++ b/source/time.tex @@ -5775,9 +5775,9 @@ \begin{example} \begin{codeblock} constexpr auto mwd - = February/Tueday[3]; // \tcode{mwd} is the third Tuesday of February of an as yet unspecified year + = February/Tuesday[3]; // \tcode{mwd} is the third Tuesday of February of an as yet unspecified year static_assert(mwd.month() == February); -static_assert(mwd.weekday_indexed() == Tueday[3]); +static_assert(mwd.weekday_indexed() == Tuesday[3]); \end{codeblock} \end{example} @@ -5882,9 +5882,9 @@ \begin{example} \begin{codeblock} constexpr auto mwd - = February/Tueday[last]; // \tcode{mwd} is the last Tuesday of February of an as yet unspecified year + = February/Tuesday[last]; // \tcode{mwd} is the last Tuesday of February of an as yet unspecified year static_assert(mwd.month() == February); -static_assert(mwd.weekday_last() == Tueday[last]); +static_assert(mwd.weekday_last() == Tuesday[last]); \end{codeblock} \end{example} @@ -9273,7 +9273,7 @@ \end{codeblock} \pnum -A \tcode{sys_info} structure can be obtained +A \tcode{sys_info} object can be obtained from the combination of a \tcode{time_zone} and either a \tcode{sys_time} or \tcode{local_time}. It can also be obtained from a \tcode{zoned_time}, @@ -9283,7 +9283,7 @@ \begin{note} This type provides a low-level interface to time zone information. Typical conversions from \tcode{sys_time} to \tcode{local_time} -will use this structure implicitly, not explicitly. +will use this class implicitly, not explicitly. \end{note} \pnum @@ -9367,7 +9367,7 @@ \begin{note} This type provides a low-level interface to time zone information. Typical conversions from \tcode{local_time} to \tcode{sys_time} -will use this structure implicitly, not explicitly. +will use this class implicitly, not explicitly. \end{note} \pnum diff --git a/source/utilities.tex b/source/utilities.tex index f94a9f7a111..d37a5210682 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -964,7 +964,7 @@ \end{itemdecl} \pnum -The \tcode{struct} \tcode{piecewise_construct_t} is an empty structure type +The \tcode{struct} \tcode{piecewise_construct_t} is an empty class type used as a unique type to disambiguate constructor and function overloading. Specifically, \tcode{pair} has a constructor with \tcode{piecewise_construct_t} as the first argument, immediately followed by two \tcode{tuple}\iref{tuple} arguments used @@ -1729,14 +1729,14 @@ Given the exposition-only function: \begin{codeblock} template -constexpr decltype(auto) - apply_impl(F&& f, Tuple&& t, index_sequence) { // exposition only +constexpr decltype(auto) @\placeholdernc{apply-impl}@(F&& f, Tuple&& t, index_sequence) { + // \expos return @\placeholdernc{INVOKE}@(std::forward(f), std::get(std::forward(t))...); // see \ref{func.require} } \end{codeblock} Equivalent to: \begin{codeblock} -return apply_impl(std::forward(f), std::forward(t), +return @\placeholdernc{apply-impl}@(std::forward(f), std::forward(t), make_index_sequence>>{}); \end{codeblock} \end{itemdescr} @@ -1753,13 +1753,13 @@ Given the exposition-only function: \begin{codeblock} template -constexpr T make_from_tuple_impl(Tuple&& t, index_sequence) { // exposition only +constexpr T @\placeholdernc{make-from-tuple-impl}@(Tuple&& t, index_sequence) { // exposition only return T(get(std::forward(t))...); } \end{codeblock} Equivalent to: \begin{codeblock} -return make_from_tuple_impl( +return @\placeholdernc{make-from-tuple-impl}@( forward(t), make_index_sequence>>{}); \end{codeblock} @@ -3108,7 +3108,7 @@ \end{itemdecl} \pnum -The struct \tcode{nullopt_t} is an empty structure type used as a unique type to indicate the state of not containing a value for \tcode{optional} objects. +The struct \tcode{nullopt_t} is an empty class type used as a unique type to indicate the state of not containing a value for \tcode{optional} objects. In particular, \tcode{optional} has a constructor with \tcode{nullopt_t} as a single argument; this indicates that an optional object not containing a value shall be constructed. @@ -7122,7 +7122,7 @@ \end{itemdecl} \pnum -The \tcode{allocator_arg_t} struct is an empty structure type used as a unique type to +The \tcode{allocator_arg_t} struct is an empty class type used as a unique type to disambiguate constructor and function overloading. Specifically, several types (see \tcode{tuple}~\ref{tuple}) have constructors with \tcode{allocator_arg_t} as the first argument, immediately followed by an argument of a type that satisfies the @@ -8216,39 +8216,11 @@ \indexlibrary{\idxcode{unique_ptr}!constructor}% \begin{itemdecl} -unique_ptr(pointer p, @\seebelow@ d1) noexcept; -unique_ptr(pointer p, @\seebelow@ d2) noexcept; +unique_ptr(pointer p, const D& d) noexcept; +unique_ptr(pointer p, remove_reference_t&& d) noexcept; \end{itemdecl} \begin{itemdescr} -\pnum -The signature of these constructors depends upon whether \tcode{D} -is a reference type. If \tcode{D} is a non-reference type -\tcode{A}, then the signatures are: - -\begin{codeblock} -unique_ptr(pointer p, const A& d) noexcept; -unique_ptr(pointer p, A&& d) noexcept; -\end{codeblock} - -\pnum -If \tcode{D} is an lvalue reference type \tcode{A\&}, -then the signatures are: - -\begin{codeblock} -unique_ptr(pointer p, A& d) noexcept; -unique_ptr(pointer p, A&& d) = delete; -\end{codeblock} - -\pnum -If \tcode{D} is an lvalue reference type \tcode{const A\&}, -then the signatures are: - -\begin{codeblock} -unique_ptr(pointer p, const A& d) noexcept; -unique_ptr(pointer p, const A&& d) = delete; -\end{codeblock} - \pnum \requires For the first constructor, if \tcode{D} is not a reference type, \tcode{D} shall satisfy the \oldconcept{CopyConstructible} requirements and @@ -8263,7 +8235,9 @@ from \tcode{std::forward(d)}. \pnum -\remarks These constructors shall not participate in overload resolution +\remarks If \tcode{D} is a reference type, +the second constructor is defined as deleted. +These constructors shall not participate in overload resolution unless \tcode{is_constructible_v} is \tcode{true}. \pnum @@ -11183,6 +11157,7 @@ static constexpr size_t max_align = alignof(max_align_t); // \expos public: + memory_resource() = default; memory_resource(const memory_resource&) = default; virtual ~memory_resource(); @@ -13137,10 +13112,10 @@ parenthesized comma-separated list of zero or more argument types. \pnum -A \defn{callable type} is a function object type\iref{function.objects} or a pointer to member. +A \defnadj{callable}{type} is a function object type\iref{function.objects} or a pointer to member. \pnum -A \defn{callable object} is an object of a callable type. +A \defnadj{callable}{object} is an object of a callable type. \pnum A \defnx{call wrapper type}{call wrapper!type} is a type that holds a callable object @@ -14195,18 +14170,18 @@ \begin{itemdescr} \pnum \effects -Equivalent to: \tcode{return \placeholder{call_wrapper}(std::forward(f));} -where \tcode{\placeholder{call_wrapper}} is an exposition only class defined as follows: +Equivalent to: \tcode{return \placeholder{call-wrapper}(std::forward(f));} +where \tcode{\placeholder{call-wrapper}} is an exposition only class defined as follows: \begin{codeblock} -class @\placeholder{call_wrapper}@ { +class @\placeholder{call-wrapper}@ { using FD = decay_t; FD fd; - explicit @\placeholder{call_wrapper}@(F&& f); + explicit @\placeholder{call-wrapper}@(F&& f); public: - @\placeholder{call_wrapper}@(@\placeholder{call_wrapper}@&&) = default; - @\placeholder{call_wrapper}@(const @\placeholder{call_wrapper}@&) = default; + @\placeholder{call-wrapper}@(@\placeholder{call-wrapper}@&&) = default; + @\placeholder{call-wrapper}@(const @\placeholder{call-wrapper}@&) = default; template auto operator()(Args&&...) & @@ -14228,7 +14203,7 @@ \end{itemdescr} \begin{itemdecl} -explicit @\placeholdernc{call_wrapper}@(F&& f); +explicit @\placeholdernc{call-wrapper}@(F&& f); \end{itemdecl} \begin{itemdescr} diff --git a/source/xrefdelta.tex b/source/xrefdelta.tex index fb5e04f958d..01d5f6e0908 100644 --- a/source/xrefdelta.tex +++ b/source/xrefdelta.tex @@ -155,6 +155,18 @@ \movedxref{class.copy}{class.mem} +% Top-level clause renumbering caused some Annex C subclauses to vanish, too. +\movedxref{diff.conv}{diff.expr} +\movedxref{diff.special}{diff.class} +\movedxref{diff.cpp03.conv}{diff.cpp03.expr} +\movedxref{diff.cpp03.dcl.decl}{diff.cpp03.dcl.dcl} +\movedxref{diff.cpp03.special}{diff.cpp03.class} +\movedxref{diff.cpp11.dcl.decl}{diff.cpp11.dcl.dcl} +\movedxref{diff.cpp14.decl}{diff.cpp14.dcl.dcl} +\movedxref{diff.cpp14.special}{diff.cpp14.class} +\movedxref{diff.cpp17.dcl.decl}{diff.cpp17.dcl.dcl} +\movedxref{diff.cpp17.special}{diff.cpp17.class} + % Deprecated features. %\deprxref{old.label} (if moved to depr.old.label, otherwise use \movedxref)