diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4135d1d0f2..1bd460753c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,22 +11,45 @@ defaults: jobs: run-checks: - name: Run checks - runs-on: ubuntu-22.04 + name: Run checks on ${{matrix.cfg.name}} + runs-on: ${{matrix.cfg.os}} + + strategy: + matrix: + cfg: + - { name: 'Linux', os: 'ubuntu-22.04' } + - { name: 'MacOS', os: 'macos-12' } steps: - name: checkout uses: actions/checkout@v2 + - name: install GNU tools + if: matrix.cfg.os == 'macos-12' + run: | + brew install gnu-sed + echo "/usr/local/opt/gnu-sed/libexec/gnubin" >> ${GITHUB_PATH} + - name: check-source.sh run: ../tools/check-source.sh - name: update-apt-cache + if: matrix.cfg.os == 'ubuntu-22.04' run: sudo apt-get update - - name: install + - name: install (Linux) + if: matrix.cfg.os == 'ubuntu-22.04' run: sudo apt-get install latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended lmodern + - name: install (MacOS, Part 1/2) + if: matrix.cfg.os == 'macos-12' + run: | + brew install basictex + eval "$(/usr/libexec/path_helper)" + echo "PATH=${PATH}" >> ${GITHUB_ENV} + sudo tlmgr update --self + sudo tlmgr install latexmk isodate substr relsize ulem fixme rsfs extract layouts enumitem l3packages l3kernel imakeidx splitindex xstring + - name: make run: make quiet @@ -34,6 +57,7 @@ jobs: run: ../tools/check-output.sh - name: upload PDF + if: matrix.cfg.os == 'ubuntu-22.04' uses: actions/upload-artifact@v2 with: name: draft-snapshot diff --git a/README.rst b/README.rst index f8d179c44e..0bef62ee71 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,7 @@ Install the `MacTeX distribution `_. If you are on a slow network, you'll want to get the `BasicTeX package `_ instead, then run the following command to install the other packages that the draft requires: - sudo tlmgr install latexmk isodate substr relsize ulem fixme rsfs extract layouts enumitem l3packages l3kernel imakeidx splitindex + sudo tlmgr install latexmk isodate substr relsize ulem fixme rsfs extract layouts enumitem l3packages l3kernel imakeidx splitindex xstring --------------------------------------- Getting Started on Debian-based Systems diff --git a/papers/n4929.html b/papers/n4929.html new file mode 100644 index 0000000000..9d0ae5c6b6 --- /dev/null +++ b/papers/n4929.html @@ -0,0 +1,1017 @@ + + + + + +N4929 + + +

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

+ +

Date: 2022-12-18

+ +

Thomas Köppe (editor, Google DeepMind)
+Jens Maurer (co-editor)
+Dawn Perchik (co-editor, Bright Side Computing, LLC)
+Richard Smith (co-editor, Google Inc)

+ +

Email: cxxeditor@gmail.com

+ +

Acknowledgements

+ +

Thanks to all those who have submitted editorial +issues +and to those who have provided pull requests with fixes. +Thank you also to Dan Raviv and Robert Leahy for drafting motion applications, +and special thanks to Johel Ernesto Guerrero Peña for providing in-depth review +of many of the draft motion applications.

+ +

New papers

+ + + +

National body comments on the Committee Draft

+ +

N4919 is the C++23 Committee Draft. It received 137 comments from national bodies. +The working group's responses to the issues so far is noted below.

+ +

Editorial comments

+ +

The following 11 national body comments are editorial in nature, and fixes for +them have been applied.

+ + + +

Non-editorial comments

+ + + +

Motions incorporated into working draft

+ +

Notes

+ + + +

Core working group polls

+ +

CWG poll 1: Accept as Defect Reports all issues except 2635 and 2602 in P2709R0 (Core Language Working Group "ready" Issues for the November, 2022 meeting) and apply their proposed resolutions to the C++ Working Paper.

+ +

CWG poll 2: Accept as a Defect Report issue 2635 (Constrained structured bindings) in P2709R0 (Core Language Working Group "ready" Issues for the November, 2022 meeting) and apply its proposed resolution to the C++ Working Paper.

+ +

CWG poll 3: Accept as Defect Reports all issues except 2615, 2639, 2640, 2652, 2653, 2654, and 2538 in P2710R0 (Core Language Working Group NB comment resolutions for the November, 2022 meeting) and apply their proposed resolution to the C++ Working Paper, resolving the NB comments as indicated.

+ +

CWG poll 4: Apply the proposed resolutions of issues 2615, 2639, 2640, 2652, and 2653 in P2710R0 (Core Language Working Group NB comment resolutions for the November, 2022 meeting) to the C++ Working Paper, resolving the NB comments as indicated.

+ +

CWG poll 5: Accept as a Defect Report issue 2654 (Un-deprecation of compound volatile assignments) in P2710R0 (Core Language Working Group NB comment resolutions for the November, 2022 meeting) and apply its proposed resolution to the C++ Working Paper, resolving NB comment US 16-045.

+ +

CWG poll 6: Accept as a Defect Report issue 2538 (Can standard attributes be syntactically ignored?) in P2710R0 (Core Language Working Group NB comment resolutions for the November, 2022 meeting) and apply its proposed resolution to the C++ Working Paper, resolving NB comment GB-055.

+ +

CWG poll 7: Apply the changes in P2589R1 (static operator[]) to the C++ Working Paper, resolving NB comment CA-065.

+ +

CWG poll 8: Accept as a Defect Report and apply the changes in P2647R1 (Permitting static constexpr variables in constexpr functions) to the C++ Working Paper, resolving NB comment GB-048.

+ +

CWG poll 9: Accept as a Defect Report and apply the changes in P2564R3 (consteval needs to propagate up) to the C++ Working Paper, resolving NB comment DE-046.

+ +

CWG poll 10: Accept as a Defect Report and apply the changes in P2706R0 (Redundant specification for defaulted functions) to the C++ Working Paper, resolving NB comment US 26-061.

+ +

CWG poll 11: Accept as a Defect Report and apply the changes in P2615R1 (Meaningful exports) to the C++ Working Paper, resolving NB comment GB-059.

+ +

CWG poll 12: Apply the changes in P2718R0 (Wording for P2644R1 Fix for Range-based for Loop) to the C++ Working Paper, resolving NB comment DE-038.

+ +

Library working group polls

+ +

Polls 1–6 do not concern the C++ Working Paper.

+ +

LWG poll 7: Apply the changes for all Ready and Tentatively Ready issues in P2703R0 (C++ Standard Library Ready Issues to be moved in Kona, Nov. 2022) to the C++ working paper.

+ +

LWG poll 8: Apply the changes for all Immediate issues in P2704R0 (C++ Standard Library Immediate Issues to be moved in Kona, Nov. 2022) to the C++ working paper.

+ +

LWG poll 9: Apply the changes in P2602R2 (Poison Pills are Too Toxic) to the C++ working paper. This addresses ballot comment US 49-111.

+ +

LWG poll 10: Apply the changes in P2167R3 (Improved Proposed Wording for LWG 2114 (contextually convertible to bool)) to the C++ working paper. This addresses ballot comment US 32-073.

+ +

LWG poll 11: Apply the changes in P2539R4 (Should the output of std::print to a terminal be synchronized with the underlying stream?) to the C++ working paper. This addresses ballot comment US 58-123 (and duplicates US 59-124 and FR-001-019).

+ +

LWG poll 12: Apply the changes in P1264R2 (Revising the wording of stream input operations) to the C++ working paper. This partially addresses ballot comment FR-018-004.

+ +

LWG poll 13: Apply the changes in P2505R5 (Monadic Functions for std::expected) to the C++ working paper. This addresses ballot comments GB-093, US 36-091, US 35-092, and FR-011-009.

+ +

LWG poll 14: Apply the changes in P2696R0 (Introduce Cpp17Swappable as additional convenience requirements) to the C++ working paper.

+ +

Noteworthy editorial changes

+ + + +

Minor editorial changes

+ +

A log of editorial fixes made to the working draft since N4917 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 7772de4408db8122431169156ea230803cb6bf56
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Sep 6 19:47:21 2022 +0100
+
+    [headers] Reflow table after header additions
+
+commit 3231e8115e93a24806694c36f1eb2d709fe78f4f
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sun Jun 12 15:49:22 2022 +0200
+
+    [basic.align] Recommend alignment-specifier instead of deprecated library facility
+
+commit 37d46b0d41d014febacd9ffe684eb0cf11a5c364
+Author: Chuanqi Xu <yedeng.yd@linux.alibaba.com>
+Date:   Tue Jun 7 16:19:08 2022 +0800
+
+    [module.reach] Remove redundant module implementation unit declaration
+
+commit 4e2297b8d2543062edf347ec13341a8356f59605
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Fri Sep 9 04:12:51 2022 +0800
+
+    [thread.stoptoken.syn] "class template", not just "class"; fix spacing (#5799)
+
+commit 20452e91b30d0a299a03d937f443a81537dc03f2
+Author: xmh0511 <970252187@qq.com>
+Date:   Fri Sep 9 04:54:01 2022 +0800
+
+    [basic.def.odr] A variable is "named by" an expression (#5534)
+
+    The previous wording, a variable "whose name appears
+    as [an] expression", is less precise and not well-defined.
+
+commit 7260f30c74eaf670b3f3d33a7571f6c055930cd7
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Jan 21 23:27:34 2022 +0100
+
+    [basic.life] Add cross-reference for union member lifetime
+
+commit ba51a5375fa3099e4a85594f2e67d48bc11ec448
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Mon Mar 20 11:58:33 2017 +0000
+
+    [rand.req.seedseq] Rephrase in terms of const types not values
+
+commit 88e574edc674e85911ea1a5b4e87c07457d97bf1
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Mon Mar 20 12:23:12 2017 +0000
+
+    [container.requirements] Rephrase in terms of const types not values
+
+commit 547987d9d203bb7f1f18297ca438ccb18d8fe612
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Wed Sep 14 14:39:16 2022 +0800
+
+    [range.chunk.view.input, range.slide.view] Remove unused name in the deduction guide
+
+commit c774ac4a072efd41e478d72ad57a3dae8b0946ff
+Author: Mathias Stearn <redbeard0531@gmail.com>
+Date:   Fri Sep 16 17:46:10 2022 +0200
+
+    [basic.life] Change "complete const object" to "const, complete object" (#5818)
+
+    "Complete object" is a defined term (https://eel.is/c++draft/basic#def:complete_object).
+    Putting "const" in the middle of that leaves it ambiguous whether we are referring to
+    a const-qualified "complete object", or to a complete const object with some other meaning
+    of "complete" (such as "with a complete type").
+
+commit 787ea7683982ed58b1a8bf7bbfb7c77f8d227dce
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Sep 16 21:24:15 2022 +0200
+
+    [diagnostics] Remove 'shall', use 'recommended practice'
+
+commit 9a005c04b91ffa9b92e6a57a03419091f365bc9b
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Sep 16 21:57:46 2022 +0200
+
+    [func.bind.isplace] Add cross-reference to [func.bind.place]
+
+commit 7bd72a7671d9bee0eed11578e325460bcf7fa5a1
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Sep 16 22:09:23 2022 +0200
+
+    [vector.bool.pspc] Index vector<bool>::reference
+
+commit f68d6428f27d5cd722e713262d8986489484ae02
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Sep 16 22:18:36 2022 +0200
+
+    [over.best.ics.general] Split long paragraph
+
+commit 1383e97e21d6d10ac210344d66ab715cfc0f747a
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Thu Sep 15 15:38:58 2022 +0100
+
+    [ranges.syn] Make get overloads freestanding
+
+    These were moved to the synopsis after the P1642 changes to mark nearly
+    everything in the synopsis freestanding, so they were not marked.
+
+commit c70087afe980f9ec339f088babde575e04e185d7
+Author: languagelawyer <38548419+languagelawyer@users.noreply.github.com>
+Date:   Sat Sep 17 02:29:45 2022 +0500
+
+    [expr.add] Move note, add example (#4778)
+
+    The original note wasn't quite in the right place.
+    It is moved and made more concrete.
+
+    In the original place of the note we now put
+    a more immediately relevant example.
+
+commit 6000c29e5b9547bf457f4461fd538670144ad88c
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sat Sep 17 10:05:19 2022 +0200
+
+    [format.string.std] Clarify location of 0x prefix for pointers
+
+commit 718873b512d0687143bbfa00e18edfb0a8b164ce
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sat Sep 17 08:56:36 2022 +0200
+
+    [expr.prim.lambda.capture] Cross-reference [basic.def.odr] for 'odr-usable'
+
+commit 6a98fd8c1f9ea79961b78f731637ba9fe9d52218
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sat Sep 17 09:05:57 2022 +0200
+
+    [thread.thread.this] Clarify this_thread::get_id
+
+commit 90c4ba5624a655af5c5d8b11c1137d552f3e0a60
+Author: Casey Carter <Casey@Carter.net>
+Date:   Sun Sep 18 14:55:55 2022 -0700
+
+    [headers] Order `<type_traits>` before `<typeindex>` in the header table
+
+    Fixes #5853.
+
+commit 16f92154ce99a5fef26c53c464e8b14ad5b78d79
+Author: A. Jiang <de34@live.cn>
+Date:   Tue Sep 20 05:37:31 2022 +0800
+
+    [c.math.hypot3] Fix mis-transcribed parameter type (#5852)
+
+    The paper P1467R9 says that the third parameter of `hypot` should be
+    `_floating-point-type_`, but it was erroneously transcribed as `double`.
+
+commit db26a63222f10cec871656958b3e296e529df67e
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Wed Sep 21 22:18:51 2022 +0100
+
+    [support, etc.] New subclause "Arithmetic types". (#5851)
+
+    The new subclause contains both "integer types" (<cstdint>)
+    and "extended floating-point types" (<stdfloat>).
+
+    Previously, the newly added <stdfloat> synopsis was somewhat
+    disconnected and out of context.
+
+    This change removes the stable labels [cstdint] and [cstdint.general].
+
+commit d462173b5afdc8506d85e5395f2be19311895f2d
+Author: Casey Carter <Casey@Carter.net>
+Date:   Mon Sep 19 20:42:44 2022 -0700
+
+    [mdspan.extents.cons] Correct spelling of "dynamic-extents"
+
+commit 14a10ef0948f4709cd1114c489b8e4b919ba7cbc
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Thu Sep 22 05:20:44 2022 +0800
+
+    [unord.general, container.adaptors.general] Fix list of exposition-only alias templates (#5840)
+
+commit aab149233f76df37979d777ffd2b3151c52d48a9
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Thu Sep 22 10:51:46 2022 +0100
+
+    [template.bitset] reorder synopsis and member descriptions
+
+    Group shifts together and use same order for synopsis and detailed
+    descriptions.
+
+    Also remove the unnecessary "for b[i];" comments explaining what
+    operator[] does, and add a comment introducing the group containing
+    count(), size() etc.
+
+commit 63e4a76f780c925a13efeb06955252d7c37ed4ef
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Thu Sep 22 09:30:14 2022 +0800
+
+    [range.as.const.overview] Remove unnecessary ranges namespace qualification
+
+commit 179436adbe60c277fa6512352ee27e26f192bf2b
+Author: Alisdair Meredith <alisdairm@me.com>
+Date:   Fri Sep 23 12:45:09 2022 -0400
+
+    [utility.arg.requirements] Present identifiers as itemization (#5856)
+
+    Lists providing the key for names used throughout a subclause are difficult
+    to follow when buried as a single sentence in a paragraph. This change updates
+    the key to tables 29-36 in [utility.arg.requirements] to a bulleted list
+    following the examples set elsewhere.
+
+    Each key is now consistently introduced with the word "denotes", following
+    the precedent set by similar bullet lists.
+
+    It is not at all coincidental that this also resolves pagination issues
+    at the end of the page, so that the floating tables to not float into the
+    middle of a sentence in the following section.
+
+commit 24d54e30506a62ef41cf4bd0132fbdba45bb6dda
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Tue Sep 27 11:56:32 2022 +0100
+
+    [futures.task.members] Add missing explicit to packaged_task ctor
+
+commit 842424bd228b79876437a1a9393f20f00033476a
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Wed Sep 28 16:39:59 2022 +0800
+
+    [futures.task.members] Correct capitalization
+
+commit d3ddc0906638bb30b5a3ce0f4033148e9a8ed1ff
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Thu Sep 29 15:49:06 2022 +0800
+
+    [container.rev.reqmts] Correct capitalization
+
+commit a7f17181ef5b59ad728b421a83975209406fa037
+Author: Daniel Krügler <daniel.kruegler@gmail.com>
+Date:   Mon Oct 3 17:59:20 2022 +0200
+
+    [sequence.reqmts] Use "lvalues of type T are swappable" (#5878)
+
+commit dd6c7f4012489325bdd65a40cd121b3d25008b0e
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Tue Oct 4 04:41:26 2022 +0800
+
+    [associative.reqmts.general] Fix typo in namespace name (#5881)
+
+commit 42c7b3fb3a3cb11bc1af418cfdd395ecf314aa43
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Oct 4 13:08:17 2022 +0100
+
+    [intro.defs] Update hyperlink according to SC22 requirements
+
+commit 05019b35890b79374fac180a9a9ff9e7cf8d7595
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Oct 4 15:19:01 2022 +0100
+
+    Foreword placeholder
+
+commit b0fab58d4f2b12defdaf7c3ddfb2ddcd1f30e1b5
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Wed Oct 5 11:27:23 2022 +0100
+
+    [temp.local] Fix typo in "inject-class-name" (#5889)
+
+commit f6c5d4512d4b32d63d66669555ab976b315d439c
+Author: mordante <koraq@xs4all.nl>
+Date:   Mon Oct 10 17:50:51 2022 +0200
+
+    [format.string.escaped] Fix example of invalid code unit (#5890)
+
+    Example 5 should only have one invalid code unit. The second code unit is a valid code point.
+
+    This issue was already in the paper P2286R8 "Formatting Ranges".
+
+commit 5f26c516a659cdf3f0ea007cf6c90c690cccc3b6
+Author: Eelis van der Weegen <eelis@eelis.net>
+Date:   Tue Oct 11 04:36:08 2022 +0200
+
+    [bibliography] Remove stray closing parenthesis.
+
+commit 6c51392a3d1c3c928ef1c20c19e8efe6efed7dc1
+Author: Corentin Jabot <corentinjabot@gmail.com>
+Date:   Wed Oct 19 22:29:09 2022 +0200
+
+    [intro.defs] Move the definition of "multibyte character" to library
+
+    This address the US-2 NB comment as per the direction voted on
+    by SG-16.
+
+    No use of "multibyte character" remains before [multibyte.strings].
+
+commit 33e56641d63c5993d288082cf264a733464ff75c
+Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
+Date:   Tue Oct 25 17:48:03 2022 -0400
+
+    [stack.syn, queue.syn] Add xref comments to class synopses (#5913)
+
+commit 90aa7729b9a926622581354284ecf294a56e410b
+Author: Will Hawkins <8715530+hawkinsw@users.noreply.github.com>
+Date:   Tue Nov 1 04:37:52 2022 -0400
+
+    [range.dangling] Replace "tag type" with just "type" (#5922)
+
+    The extra word "tag" was not adding any value and was potentially,
+    confusing; e.g. the "dangling" type is not like, say, an iterator tag
+    that would be used for overload resolution.
+
+commit fd998c52af2dc6b9c73098fdbd5a22444a358448
+Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
+Date:   Tue Nov 1 10:45:53 2022 -0400
+
+    [flat.set] [flat.multiset] Use value_type, not key_type
+
+    For consistency with the other `set`, `unordered_set` containers.
+    `key_type` is a synonym for `value_type`, and there's no reason
+    the flat containers need to depart from existing practice here.
+
+commit 48ecaaec300de4a8176c116408cac915142166ce
+Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
+Date:   Mon Nov 7 14:02:40 2022 -0500
+
+    [flat.multiset.modifiers] Fix typo in "multiset" (#5927)
+
+commit 45d9a5ba5aee1e3c4da8938e12376b36a7147d63
+Author: Eric41293 <eric41293@comcast.net>
+Date:   Mon Nov 7 11:11:58 2022 -0800
+
+    [climits.syn] Correct note about types of macros (#5926)
+
+    This note was added apparently as a response to LWG 416. However, there may have been a misunderstanding of the C standard, and in fact only the macros for `{signed,unsigned,} char` and `{signed,unsigned} int` have a different type.
+
+commit f41cd00273e6ee7ff1a29446b21f230c28bf1a9f
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Mon Nov 7 20:59:54 2022 +0000
+
+    [time.clock.system.nonmembers, time.zone.zonedtime.nonmembers] Add <charT> to STATICALLY-WIDEN (#5934)
+
+commit ef7d0e234722d2ef8b4ec069b6f929dc083d8dc7
+Author: Ed Catmur <edward.catmur@mavensecurities.com>
+Date:   Tue Sep 20 18:12:45 2022 +0100
+
+    [meta, thread] Add or amend references to func.{require,invoke}
+
+commit 0d5c9b9310b2f6c6c4259665e1e680936babdc3d
+Author: Eric41293 <eric41293@comcast.net>
+Date:   Mon Nov 7 15:54:55 2022 -0800
+
+    [meta.type.synop] Capitalize NTTP name (#5921)
+
+commit 0959b5c200a6f2b543e2d656850917b8d788767c
+Author: Hui <65944694+huixie90@users.noreply.github.com>
+Date:   Tue Nov 8 00:49:15 2022 +0000
+
+    [range.drop.while.overview] Use string_view rather than string literal (#5897)
+
+    The string literal would have been treated as a `const char*`, which is not a range.
+
+commit 720c3ae24a68fda02a6372eda13ec3f9c6a1a39b
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Tue Nov 8 02:01:34 2022 +0000
+
+    [time.format] Use basic_ostringstream<charT> instead of ostringstream (#5932)
+
+commit 8739d316f2a55c633963b26b748681ff16498887
+Author: Marc Mutz <94039187+marcmutz@users.noreply.github.com>
+Date:   Tue Nov 8 03:05:45 2022 +0100
+
+    [meta.const.eval] Add is_constant_evaluated to index of library names (#5898)
+
+    Previously, only its feature-test macro was listed there.
+
+commit 4c442cf93f03a44ec1f6a93875043a3aca7c5b9b
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date:   Mon Nov 7 23:38:36 2022 -0400
+
+    [class.union.general] Attach example to its note (#5882)
+
+commit 65c494b9a4a5a4fab500733441c04e50a787d318
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Tue Nov 8 15:51:21 2022 +0800
+
+    [mdspan.extents.expo] Remove redundant "// exposition only" (#5907)
+
+commit b766881dda1d0201d98710b11efda3491a84b4f2
+Author: languagelawyer <38548419+languagelawyer@users.noreply.github.com>
+Date:   Tue Nov 8 13:15:07 2022 +0500
+
+    [dcl.init.list] Specify the type of the prvalue (#5919)
+
+commit 6e035b52e28e95211a39ffb552851499432b2c6e
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date:   Tue Nov 8 15:30:29 2022 -0400
+
+    [ratio.ratio] Use symbol "sgn" for the signum function (#5925)
+
+commit 89269f8e548b993b239f2c0f5ecc071ee7f54c9a
+Author: Blackteahamburger <blackteahamburger@outlook.com>
+Date:   Wed Nov 9 04:12:59 2022 +0800
+
+    [dcl.link] Add missing restriction to language linkage application (#5892)
+
+    A language linkage specification should only apply to entities that do in fact have language linkage.
+
+commit ea77b2fa83ddac0c52c1b505ff666328a2a8f558
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Wed Nov 9 00:34:26 2022 +0100
+
+    [temp.deduct.general] Fix typo in comment in example
+
+commit 0c196ec375993000547e8913abb4c4ce703144cb
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Nov 10 15:32:56 2022 +0100
+
+    [temp.deduct.conv] Remove misleading paragraph break
+
+commit 0cd0c33f648d1304160e6dcb1856affd71b3ebbb
+Author: Casey Carter <Casey@Carter.net>
+Date:   Fri Nov 11 18:35:53 2022 -0800
+
+    [mdspan.extents.cons] "constexpr" should precede "explicit"
+
+    In library function declarations, the `constexpr` specifier always precedes the `explicit` specifier per our standing style guide.
+
+commit 608c152dbae69d335d7238cdd5d178e048e2a1fd
+Author: Casey Carter <Casey@Carter.net>
+Date:   Mon Nov 14 10:48:18 2022 -0800
+
+    [vector.bool.pspc] Replace `constexpr static` with `static constexpr`
+
+    As preferred by our style guide.
+
+commit d829eac310981e688a15b28622a2f048d23eed65
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Thu Nov 10 07:43:32 2022 +0000
+
+    [class.inhctor.init] Fix explanation of "error:" in example
+
+    The correct explanation is that classes `B1` and `D1` do not have
+    default constructors, not that they have deleted default constructors.
+
+    Fixes NB CA 062 (C++23 CD).
+
+commit 6a1c5050c21ac26fcb2b5b187a0de867713568dc
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Nov 8 23:35:00 2022 +0000
+
+    [diff.cpp20.library] Add missing new headers
+
+    Fixes NB FR 008 (C++23 CD).
+
+commit b2fa70faa783827cd38b819409e94da2523333f2
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Wed Nov 9 18:50:56 2022 +0000
+
+    [views] Subclauses for contiguous and multidimensional access
+
+    This organises the material for <span> and <mdspan> into separate
+    subclauses, rather than having all constituent parts being siblings in
+    the same subclause. Even though we now have some subclauses six levels
+    deep, this seems like an improvement. As a drive-by, this allows us to
+    move a subclause on a non-member span helper function up one level,
+    where it is more appropriate.
+
+    Fixes NB FR 027 (C++23 CD).
+
+commit e0bab4b7f2d8afe5d3939aa49fe6de4fd5e638c6
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Thu Nov 10 02:16:11 2022 +0000
+
+    [concepts index] Describe exposition-only concepts
+
+    Fixes NB GB 136 (C++23 CD).
+
+commit 9512e41e30cf24a8e93e8c8568ff1b5c14398cc6
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Fri Nov 11 19:31:11 2022 +0000
+
+    [general, library index] Describe exposition-only entities
+
+    Partially fixes NB GB 137 (C++23 CD).
+
+commit 0783dde32073b02b369c7c3893f4f496a83e3658
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Fri Nov 11 19:33:33 2022 +0000
+
+    [func.wrap.move.ctor] Move private expos member to general index
+
+    The private, exposition-only data member is not useful in the library
+    index. However, there seems no reason to not show it in the general
+    index, so we move the index entry from the library index to the
+    general index.
+
+    Partially fixes NB GB 137 (C++23 CD).
+
+commit 3e825f144f2aa8668c9a1a94066b43799e08a6e7
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Nov 8 21:31:30 2022 +0000
+
+    [basic.scope.scope] Fix indentation in example
+
+    Fixes NB US 034 (C++23 CD).
+
+commit 92de5996625efcb070f99681acd2e39efc206ee2
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Nov 8 23:24:35 2022 +0000
+
+    [unord.req.general] Fix garbled end of sentence
+
+    This was an editorial mistake introduced by the transformation of the
+    requirement tables into regular paragraphs.
+
+    Fixes NB US 100 (C++23 CD).
+
+commit 24e046896029a11f2cb78fd6db21482fb0d4be66
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Nov 8 21:02:31 2022 +0000
+
+    [coro.generator.promise] Use "equivalent to `throw`, ..."
+
+    Our style guide says that "equivalent to <expression>" is the
+    appropriate style for an expression of type `void`, which is the case
+    for `throw`. This avoids the awkward situation of having "equivalent
+    to: `throws;`" appear in the middle of a paragraph without proper
+    terminal punctuation.
+
+    Fixes NB US 119 (C++23 CD).
+
+commit 3f47d2565f26a9144e8076641ee55bf7be79f896
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Nov 8 21:27:56 2022 +0000
+
+    [coro.generator.promise] Remove unused name "x"
+
+    Fixes NB US 120 (C++23 CD).
+
+commit fb0df97e7d7c2c75bbdf7164c33b0796024ff6d3
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Thu Nov 17 08:44:05 2022 +0000
+
+    [atomics] Replace integral and floating-point placeholders (#5939)
+
+    Fixes NB GB 129 (C++23 CD).
+
+commit 0bb57d5ebffa7170fbc80724f55a6ac2a82f2e83
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Fri Nov 25 14:56:24 2022 +0800
+
+    [format.arg] Add std:: for forward
+
+commit c88fb46327d87d78d571b7e1076e1916eaf7e310
+Author: Dawn Perchik <dawn@brightsidecomputing.com>
+Date:   Tue Nov 15 07:46:41 2022 -0800
+
+    [expr.unary.op] Say "the ~ operator" consistently, remove "unary"
+
+    We are currently using the term "unary complement operator" to refer
+    to the "~" operator without ever giving it that name. This change
+    removes the use of that undefined term.
+
+commit bef02b89464fe6f4be3926d62defc92986ae4532
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Nov 22 16:28:42 2022 +0000
+
+    [expr.unary.op] Notes naming unary ops as {ones',two's} complement
+
+    The terms "one's complement" and "two's complement" are well-known,
+    and it is useful to associate them with these operators.
+
+commit 020a312b2aa513a992e488d82db55fd0cd4fa025
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Wed Nov 16 17:48:12 2022 +0000
+
+    [fs.rec.dir.itr.nonmembers] "for" is a keyword in "range-based for"
+
+commit cee095e75a97fb88a7053e360b3bc06d36a6b687
+Author: Alisdair Meredith <alisdairm@me.com>
+Date:   Fri Dec 16 06:51:26 2022 +0700
+
+    [depr.conversions.string] remove redundent respecification (#6004)
+
+    There are several typedef names defined precisely in the deprecated code conversion
+    facets classes that are redundantly respecified in text. Nowhere else in the library
+    does this; any specified typedef names are _see below_ definitions, not repeats of
+    the class definition. Needless redundancy is always a risk of divergence, however
+    small, so remove the respecification in text form.
+
+commit 1bb52db31be002f04ea5977f9900ba4174c7155e
+Author: Anoop Rana <93918384+ranaanoop@users.noreply.github.com>
+Date:   Fri Dec 16 05:23:57 2022 +0530
+
+    [concepts.object] Change "built-in" to "fundamental" types (#6012)
+
+commit ce1cc3b011099b6228b18dad937911c6ea67d309
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date:   Sun Dec 11 17:03:41 2022 -0400
+
+    [expr.const] Remove redundant "ill-formed" in "error" comment
+
+commit 5d43f0137776fa112d0ffd6ba0e34df34a4cb820
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Tue Dec 13 12:52:00 2022 +0000
+
+    [time.zone.leap.members] update note about leap seconds
+
+commit fd20d4ea9f3ea8653b17169aad61eec843b71718
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Wed Nov 23 14:45:43 2022 +0000
+
+    [time.zone.zonedtime.overview] Rename parameters to match later definitions
+
+commit 137728f0830824c6058648a846376eec80e5cab3
+Author: Michael Florian Hava <mfh@live.at>
+Date:   Fri Dec 16 02:10:55 2022 +0100
+
+    [coro.generator.promise] Fix template parameters (#6009)
+
+    Some of the template parameters of `yield_value` were inconsistent,
+    and the synopsis contained an outright typo. This change uses `R2`
+    consistently since the parameter is a reference.
+
+commit 5d6099c3df78922ee5b5f1d1c42a5c762d246df0
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Thu Dec 15 23:31:26 2022 +0000
+
+    [formatter.requirements] Remove one level of list nesting
+
+commit 9e41a1c27de2f676badacbe0c1aac783063b7cd6
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Wed Nov 16 19:43:58 2022 +0000
+
+    [time.clock.req] Make list item end with comma, not full stop.
+
+    Also reformat the itemization source to be more edit-friendly.
+
+commit 5ef31f3fc1531d9e6e923cb57bf6e5ecec59ed4e
+Author: languagelawyer <language.lawyer@gmail.com>
+Date:   Thu Jun 25 10:54:17 2020 +0300
+
+    [expr.unary.op] Fix usage of "result"
+
+commit 8c60752c7eb28e1ff1cc9e088d7836957356f559
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Tue Apr 26 10:18:11 2022 +0100
+
+    [optional.ctor], [expected.object.ctor] Add converts-from-any-cvref
+
+commit 405b46f50ce6c7458e94db7b4528fc267e2b67c3
+Author: Hewill Kang <67143766+hewillk@users.noreply.github.com>
+Date:   Sat Dec 17 00:14:51 2022 +0800
+
+    [mdspan.mdspan.overview] Add default template arguments for mdspan (#6018)
+
+    We usually restate the default template arguments in the class synopsis,
+    so that the information is in one place and one does not need to also refer
+    to the header synopsis.
+
+commit ae88bb581d32f1939987c0a834fe3f6011a9d003
+Author: frederick-vs-ja <de34@live.cn>
+Date:   Fri Dec 16 21:25:31 2022 +0800
+
+    [range.repeat] Change `W`/`WArgs` to `T`/`TArgs`
+
+commit 0a1f1e147c75ce9220de3488103ca880b6b8e49f
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Fri Dec 16 17:19:08 2022 +0000
+
+    [concept.copyconstructible] Avoid "possibly \tcode{const}"
+
+    A small rewrite avoids the phrase "possibly \tcode{const}",
+    which we would like to remove entirely in favour of just
+    "possibly const".
+
+commit f058decdf9c7dea0461f723df72f5093f5e92b11
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Fri Dec 16 17:31:47 2022 +0000
+
+    Replace "possibly \tcode{const}" with "possibly const"
+
+    The "const" here is not syntax, but just normal text.
+    This is similar to "inline" and "public", which have
+    previously been cleaned up similarly.
+
+commit 9ac55553459e15c84db6d8072c93787d41ef7ccf
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Jun 4 00:29:30 2021 +0200
+
+    [lib] Drop 'inline' from 'inline constexpr' variable templates.
+
+    Since CWG2387, constexpr variable templates have external linkage.
+
+ + diff --git a/papers/n4929.md b/papers/n4929.md new file mode 100644 index 0000000000..36adf1e8d4 --- /dev/null +++ b/papers/n4929.md @@ -0,0 +1,868 @@ +# N4929 Editors' Report -- Programming Languages -- C++ + +Date: 2022-12-18 + +Thomas Köppe (editor, Google DeepMind) +Jens Maurer (co-editor) +Dawn Perchik (co-editor, Bright Side Computing, LLC) +Richard Smith (co-editor, Google Inc) + +Email: `cxxeditor@gmail.com` + +## 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. +Thank you also to Dan Raviv and Robert Leahy for drafting motion applications, +and special thanks to Johel Ernesto Guerrero Peña for providing in-depth review +of many of the draft motion applications. + +## New papers + + * [N4928](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4928.pdf) is the + current working draft for C++23. It replaces + [N4917](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4917.pdf). + * N4929 is this Editors' Report. + +## National body comments on the Committee Draft + +N4919 is the C++23 Committee Draft. It received 137 comments from national bodies. +The working group's responses to the issues so far is noted below. + +### Editorial comments + +The following 11 national body comments are editorial in nature, and fixes for +them have been applied. + + * **FR 008:** Accepted; fixed by 6a1c5050c21ac26fcb2b5b187a0de867713568dc. + * **FR 027:** Accepted; fixed by b2fa70faa783827cd38b819409e94da2523333f2. + New subclauses "contiguous access" and "mulitidimensional access" have been added + to organize the content for `span` and `mdspan`. + * **US 029:** Accepted with modifications; fixed by 6c51392a3d1c3c928ef1c20c19e8efe6efed7dc1. + This issue had already been fixed editorially prior to the NB comments. + * **US 034:** Accepted; fixed by 3e825f144f2aa8668c9a1a94066b43799e08a6e7. + * **CA 062:** Accepted with modifications; fixed by d829eac310981e688a15b28622a2f048d23eed65. + A second erroneous comment with the same problem has also been corrected in the same way. + * **US 100:** Accepted; fixed by 92de5996625efcb070f99681acd2e39efc206ee2. + * **US 119:** Accepted with modifications; fixed by 24e046896029a11f2cb78fd6db21482fb0d4be66. + We removed the colon after "equivalent to" and the semicolon after "throw", + and connected the next sentence with a comma. + * **US 120:** Accepted; fixed by 3f47d2565f26a9144e8076641ee55bf7be79f896. + * **GB 129:** Accepted with modifications; fixed by fb0df97e7d7c2c75bbdf7164c33b0796024ff6d3. + Reviewed by LWG and considered editorial. + * **GB 136:** Accepted; fixed by e0bab4b7f2d8afe5d3939aa49fe6de4fd5e638c6. + * **GB 137:** Accepted; fixed by 9512e41e30cf24a8e93e8c8568ff1b5c14398cc6 and 0783dde32073b02b369c7c3893f4f496a83e3658. + +### Non-editorial comments + +* **FR 004:** Partially fixed by [P1264R2](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1264r2.pdf) (LWG poll 12). +* **FR 005:** Fixed by [CWG2631](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2631) (CWG poll 4). +* **FR 009:** Duplicate of GB 093 +* **FR 019:** Duplicate of US 123 +* **US 028:** Fixed by [CWG2640](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2640) (CWG poll 4). +* **US 030:** Fixed by [CWG2639](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2639) (CWG poll 4). +* **US 033:** Fixed by [CWG2242](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2242) (CWG poll 3). +* **DE 038:** Fixed by [P2718R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2718r0.html) (CWG poll 12). +* **US 039:** Fixed by [CWG2643](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2643) (CWG poll 3). +* **US 042:** Fixed by [CWG2644](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2644) (CWG poll 3). +* **US 044:** Fixed by [CWG2645](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2645) (CWG poll 3). +* **US 045:** Fixed by [CWG2654](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2654) (CWG poll 5). +* **US 045:** Fixed by [CWG2654](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2654) (CWG poll 5). +* **DE 046:** Fixed by [P2564R3](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2564r3.html) (CWG poll 9). +* **US 047:** Fixed by [CWG2647](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2647) (CWG poll 3). +* **GB 048:** Fixed by [P2647R1](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2647r1.html) (CWG poll 8). +* **GB 051:** Fixed by [CWG2653](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2653) (CWG poll 4). +* **US 052:** Fixed by [CWG2646](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2646) (CWG poll 3). +* **CA 054:** Fixed by [CWG2621](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2621) (CWG poll 3). +* **GB 055:** Fixed by [CWG2538](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2538) (CWG poll 6). +* **GB 059:** Fixed by [P2615R1](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2615r1.html) (CWG poll 11). +* **US 061:** Fixed by [P2706R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2706r0.html) (CWG poll 10). +* **CA 063:** Fixed by [CWG2648](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2648) (CWG poll 3). +* **CA 064:** Fixed by [CWG2649](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2649) (CWG poll 3). +* **CA 065:** Fixed by [P2589R1](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2589r1.pdf) (CWG poll 7). +* **US 068:** Fixed by [CWG2650](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2650) (CWG poll 3). +* **US 069:** Fixed by [CWG2651](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2651) (CWG poll 3). +* **GB 070:** Fixed by [CWG2615](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2615) (CWG poll 4). +* **US 071:** Fixed by [CWG2652](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2652) (CWG poll 4). +* **US 073:** Fixed by [P2167R3](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2167r3.html) (LWG poll 10). +* **GB 074:** Fixed by [LWG3818](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3818) (LWG poll 8). +* **GB 075:** Fixed by [LWG3753](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3753) (LWG poll 8). +* **GB 085:** Fixed by [LWG3814](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3814) (LWG poll 8). +* **GB 090:** Fixed by [LWG3823](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3823) (LWG poll 8). +* **US 091:** Duplicate of GB 093 +* **US 092:** Duplicate of GB 093 +* **GB 093:** Fixed by [P2505R5](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2505r5.html) (LWG poll 13). +* **GB 095:** Fixed by [LWG3824](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3824) (LWG poll 8). +* **GB 101:** Fixed by [LWG3817](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3817) (LWG poll 8). +* **US 103:** Fixed by [LWG3816](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3816) (LWG poll 8). +* **US 109:** Partially fixed by [LWG3717](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3717) + and [LWG3737](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3737) (LWG poll 8). +* **GB 110:** Fixed by [LWG3814](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3814) (LWG poll 8). +* **US 111:** Fixed by [P2602R2](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2602r2.html) (LWG poll 9). +* **US 118:** Fixed by [LWG3826](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3826) (LWG poll 8). +* **US 123:** Fixed by [P2539R4](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2539r4.html) (LWG poll 11). +* **US 124:** Duplicate of US 123 +* **US 125:** Fixed by [LWG3822](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3822) (LWG poll 8). +* **GB 130:** Partially fixed by [LWG3814](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html#3814) (LWG poll 8). +* **US 132:** Fixed by [CWG2636](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2636) (CWG poll 3). + +## Motions incorporated into working draft + +### Notes + + * CWG issue 2602 was withdrawn from the motions. Even though it is part of + [P2709R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2709r0.html), + it has not been applied. + * CWG issue 2642 (in + [P2710R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2642), + polled in CWG poll 3) was discovered to be incorrect after the WG21 meeting; + CWG has requested that the issue not be applied and reverted to the working + group for further discussion. It has not been applied. + +### Core working group polls + +CWG poll 1: Accept as Defect Reports all issues except 2635 and 2602 in [P2709R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2709r0.html) (Core Language Working Group "ready" Issues for the November, 2022 meeting) and apply their proposed resolutions to the C++ Working Paper. + +CWG poll 2: Accept as a Defect Report issue 2635 (Constrained structured bindings) in [P2709R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2709r0.html) (Core Language Working Group "ready" Issues for the November, 2022 meeting) and apply its proposed resolution to the C++ Working Paper. + +CWG poll 3: Accept as Defect Reports all issues except 2615, 2639, 2640, 2652, 2653, 2654, and 2538 in [P2710R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html) (Core Language Working Group NB comment resolutions for the November, 2022 meeting) and apply their proposed resolution to the C++ Working Paper, resolving the NB comments as indicated. + +CWG poll 4: Apply the proposed resolutions of issues 2615, 2639, 2640, 2652, and 2653 in [P2710R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html) (Core Language Working Group NB comment resolutions for the November, 2022 meeting) to the C++ Working Paper, resolving the NB comments as indicated. + +CWG poll 5: Accept as a Defect Report issue 2654 (Un-deprecation of compound volatile assignments) in [P2710R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html) (Core Language Working Group NB comment resolutions for the November, 2022 meeting) and apply its proposed resolution to the C++ Working Paper, resolving NB comment US 16-045. + +CWG poll 6: Accept as a Defect Report issue 2538 (Can standard attributes be syntactically ignored?) in [P2710R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html) (Core Language Working Group NB comment resolutions for the November, 2022 meeting) and apply its proposed resolution to the C++ Working Paper, resolving NB comment GB-055. + +CWG poll 7: Apply the changes in [P2589R1](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2589r1.pdf) (`static operator[]`) to the C++ Working Paper, resolving NB comment CA-065. + +CWG poll 8: Accept as a Defect Report and apply the changes in [P2647R1](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2647r1.html) (Permitting static constexpr variables in constexpr functions) to the C++ Working Paper, resolving NB comment GB-048. + +CWG poll 9: Accept as a Defect Report and apply the changes in [P2564R3](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2564r3.html) (`consteval` needs to propagate up) to the C++ Working Paper, resolving NB comment DE-046. + +CWG poll 10: Accept as a Defect Report and apply the changes in [P2706R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2706r0.html) (Redundant specification for defaulted functions) to the C++ Working Paper, resolving NB comment US 26-061. + +CWG poll 11: Accept as a Defect Report and apply the changes in [P2615R1](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2615r1.html) (Meaningful exports) to the C++ Working Paper, resolving NB comment GB-059. + +CWG poll 12: Apply the changes in [P2718R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2718r0.html) (Wording for P2644R1 Fix for Range-based `for` Loop) to the C++ Working Paper, resolving NB comment DE-038. + +### Library working group polls + +Polls 1–6 do not concern the C++ Working Paper. + +LWG poll 7: Apply the changes for all Ready and Tentatively Ready issues in [P2703R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2703r0.html) (C++ Standard Library Ready Issues to be moved in Kona, Nov. 2022) to the C++ working paper. + +LWG poll 8: Apply the changes for all Immediate issues in [P2704R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2704r0.html) (C++ Standard Library Immediate Issues to be moved in Kona, Nov. 2022) to the C++ working paper. + +LWG poll 9: Apply the changes in [P2602R2](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2602r2.html) (Poison Pills are Too Toxic) to the C++ working paper. This addresses ballot comment US 49-111. + +LWG poll 10: Apply the changes in [P2167R3](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2167r3.html) (Improved Proposed Wording for LWG 2114 (contextually convertible to `bool`)) to the C++ working paper. This addresses ballot comment US 32-073. + +LWG poll 11: Apply the changes in [P2539R4](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2539r4.html) (Should the output of `std::print` to a terminal be synchronized with the underlying stream?) to the C++ working paper. This addresses ballot comment US 58-123 (and duplicates US 59-124 and FR-001-019). + +LWG poll 12: Apply the changes in [P1264R2](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1264r2.pdf) (Revising the wording of stream input operations) to the C++ working paper. This partially addresses ballot comment FR-018-004. + +LWG poll 13: Apply the changes in [P2505R5](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2505r5.html) (Monadic Functions for `std::expected`) to the C++ working paper. This addresses ballot comments GB-093, US 36-091, US 35-092, and FR-011-009. + +LWG poll 14: Apply the changes in [P2696R0](http://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2696r0.html) (Introduce _Cpp17Swappable_ as additional convenience requirements) to the C++ working paper. + +### Noteworthy editorial changes + +* There were no noteworthy changes to the wording of the approved papers. +* A new subclause "Arithmetic types" was added. The new subclause contains + both "integer types" (``) and the new "extended floating-point + types" (``). Previously, the newly added `` synopsis + was somewhat disconnected and out of context. + +### Minor editorial changes + +A log of editorial fixes made to the working draft since N4917 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/n4917...n4928). + + commit 7772de4408db8122431169156ea230803cb6bf56 + Author: Thomas Köppe + Date: Tue Sep 6 19:47:21 2022 +0100 + + [headers] Reflow table after header additions + + commit 3231e8115e93a24806694c36f1eb2d709fe78f4f + Author: Jens Maurer + Date: Sun Jun 12 15:49:22 2022 +0200 + + [basic.align] Recommend alignment-specifier instead of deprecated library facility + + commit 37d46b0d41d014febacd9ffe684eb0cf11a5c364 + Author: Chuanqi Xu + Date: Tue Jun 7 16:19:08 2022 +0800 + + [module.reach] Remove redundant module implementation unit declaration + + commit 4e2297b8d2543062edf347ec13341a8356f59605 + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Fri Sep 9 04:12:51 2022 +0800 + + [thread.stoptoken.syn] "class template", not just "class"; fix spacing (#5799) + + commit 20452e91b30d0a299a03d937f443a81537dc03f2 + Author: xmh0511 <970252187@qq.com> + Date: Fri Sep 9 04:54:01 2022 +0800 + + [basic.def.odr] A variable is "named by" an expression (#5534) + + The previous wording, a variable "whose name appears + as [an] expression", is less precise and not well-defined. + + commit 7260f30c74eaf670b3f3d33a7571f6c055930cd7 + Author: Jens Maurer + Date: Fri Jan 21 23:27:34 2022 +0100 + + [basic.life] Add cross-reference for union member lifetime + + commit ba51a5375fa3099e4a85594f2e67d48bc11ec448 + Author: Jonathan Wakely + Date: Mon Mar 20 11:58:33 2017 +0000 + + [rand.req.seedseq] Rephrase in terms of const types not values + + commit 88e574edc674e85911ea1a5b4e87c07457d97bf1 + Author: Jonathan Wakely + Date: Mon Mar 20 12:23:12 2017 +0000 + + [container.requirements] Rephrase in terms of const types not values + + commit 547987d9d203bb7f1f18297ca438ccb18d8fe612 + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Wed Sep 14 14:39:16 2022 +0800 + + [range.chunk.view.input, range.slide.view] Remove unused name in the deduction guide + + commit c774ac4a072efd41e478d72ad57a3dae8b0946ff + Author: Mathias Stearn + Date: Fri Sep 16 17:46:10 2022 +0200 + + [basic.life] Change "complete const object" to "const, complete object" (#5818) + + "Complete object" is a defined term (https://eel.is/c++draft/basic#def:complete_object). + Putting "const" in the middle of that leaves it ambiguous whether we are referring to + a const-qualified "complete object", or to a complete const object with some other meaning + of "complete" (such as "with a complete type"). + + commit 787ea7683982ed58b1a8bf7bbfb7c77f8d227dce + Author: Jens Maurer + Date: Fri Sep 16 21:24:15 2022 +0200 + + [diagnostics] Remove 'shall', use 'recommended practice' + + commit 9a005c04b91ffa9b92e6a57a03419091f365bc9b + Author: Jens Maurer + Date: Fri Sep 16 21:57:46 2022 +0200 + + [func.bind.isplace] Add cross-reference to [func.bind.place] + + commit 7bd72a7671d9bee0eed11578e325460bcf7fa5a1 + Author: Jens Maurer + Date: Fri Sep 16 22:09:23 2022 +0200 + + [vector.bool.pspc] Index vector::reference + + commit f68d6428f27d5cd722e713262d8986489484ae02 + Author: Jens Maurer + Date: Fri Sep 16 22:18:36 2022 +0200 + + [over.best.ics.general] Split long paragraph + + commit 1383e97e21d6d10ac210344d66ab715cfc0f747a + Author: Jonathan Wakely + Date: Thu Sep 15 15:38:58 2022 +0100 + + [ranges.syn] Make get overloads freestanding + + These were moved to the synopsis after the P1642 changes to mark nearly + everything in the synopsis freestanding, so they were not marked. + + commit c70087afe980f9ec339f088babde575e04e185d7 + Author: languagelawyer <38548419+languagelawyer@users.noreply.github.com> + Date: Sat Sep 17 02:29:45 2022 +0500 + + [expr.add] Move note, add example (#4778) + + The original note wasn't quite in the right place. + It is moved and made more concrete. + + In the original place of the note we now put + a more immediately relevant example. + + commit 6000c29e5b9547bf457f4461fd538670144ad88c + Author: Jens Maurer + Date: Sat Sep 17 10:05:19 2022 +0200 + + [format.string.std] Clarify location of 0x prefix for pointers + + commit 718873b512d0687143bbfa00e18edfb0a8b164ce + Author: Jens Maurer + Date: Sat Sep 17 08:56:36 2022 +0200 + + [expr.prim.lambda.capture] Cross-reference [basic.def.odr] for 'odr-usable' + + commit 6a98fd8c1f9ea79961b78f731637ba9fe9d52218 + Author: Jens Maurer + Date: Sat Sep 17 09:05:57 2022 +0200 + + [thread.thread.this] Clarify this_thread::get_id + + commit 90c4ba5624a655af5c5d8b11c1137d552f3e0a60 + Author: Casey Carter + Date: Sun Sep 18 14:55:55 2022 -0700 + + [headers] Order `` before `` in the header table + + Fixes #5853. + + commit 16f92154ce99a5fef26c53c464e8b14ad5b78d79 + Author: A. Jiang + Date: Tue Sep 20 05:37:31 2022 +0800 + + [c.math.hypot3] Fix mis-transcribed parameter type (#5852) + + The paper P1467R9 says that the third parameter of `hypot` should be + `_floating-point-type_`, but it was erroneously transcribed as `double`. + + commit db26a63222f10cec871656958b3e296e529df67e + Author: Thomas Köppe + Date: Wed Sep 21 22:18:51 2022 +0100 + + [support, etc.] New subclause "Arithmetic types". (#5851) + + The new subclause contains both "integer types" () + and "extended floating-point types" (). + + Previously, the newly added synopsis was somewhat + disconnected and out of context. + + This change removes the stable labels [cstdint] and [cstdint.general]. + + commit d462173b5afdc8506d85e5395f2be19311895f2d + Author: Casey Carter + Date: Mon Sep 19 20:42:44 2022 -0700 + + [mdspan.extents.cons] Correct spelling of "dynamic-extents" + + commit 14a10ef0948f4709cd1114c489b8e4b919ba7cbc + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Thu Sep 22 05:20:44 2022 +0800 + + [unord.general, container.adaptors.general] Fix list of exposition-only alias templates (#5840) + + commit aab149233f76df37979d777ffd2b3151c52d48a9 + Author: Jonathan Wakely + Date: Thu Sep 22 10:51:46 2022 +0100 + + [template.bitset] reorder synopsis and member descriptions + + Group shifts together and use same order for synopsis and detailed + descriptions. + + Also remove the unnecessary "for b[i];" comments explaining what + operator[] does, and add a comment introducing the group containing + count(), size() etc. + + commit 63e4a76f780c925a13efeb06955252d7c37ed4ef + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Thu Sep 22 09:30:14 2022 +0800 + + [range.as.const.overview] Remove unnecessary ranges namespace qualification + + commit 179436adbe60c277fa6512352ee27e26f192bf2b + Author: Alisdair Meredith + Date: Fri Sep 23 12:45:09 2022 -0400 + + [utility.arg.requirements] Present identifiers as itemization (#5856) + + Lists providing the key for names used throughout a subclause are difficult + to follow when buried as a single sentence in a paragraph. This change updates + the key to tables 29-36 in [utility.arg.requirements] to a bulleted list + following the examples set elsewhere. + + Each key is now consistently introduced with the word "denotes", following + the precedent set by similar bullet lists. + + It is not at all coincidental that this also resolves pagination issues + at the end of the page, so that the floating tables to not float into the + middle of a sentence in the following section. + + commit 24d54e30506a62ef41cf4bd0132fbdba45bb6dda + Author: Jonathan Wakely + Date: Tue Sep 27 11:56:32 2022 +0100 + + [futures.task.members] Add missing explicit to packaged_task ctor + + commit 842424bd228b79876437a1a9393f20f00033476a + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Wed Sep 28 16:39:59 2022 +0800 + + [futures.task.members] Correct capitalization + + commit d3ddc0906638bb30b5a3ce0f4033148e9a8ed1ff + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Thu Sep 29 15:49:06 2022 +0800 + + [container.rev.reqmts] Correct capitalization + + commit a7f17181ef5b59ad728b421a83975209406fa037 + Author: Daniel Krügler + Date: Mon Oct 3 17:59:20 2022 +0200 + + [sequence.reqmts] Use "lvalues of type T are swappable" (#5878) + + commit dd6c7f4012489325bdd65a40cd121b3d25008b0e + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Tue Oct 4 04:41:26 2022 +0800 + + [associative.reqmts.general] Fix typo in namespace name (#5881) + + commit 42c7b3fb3a3cb11bc1af418cfdd395ecf314aa43 + Author: Thomas Köppe + Date: Tue Oct 4 13:08:17 2022 +0100 + + [intro.defs] Update hyperlink according to SC22 requirements + + commit 05019b35890b79374fac180a9a9ff9e7cf8d7595 + Author: Thomas Köppe + Date: Tue Oct 4 15:19:01 2022 +0100 + + Foreword placeholder + + commit b0fab58d4f2b12defdaf7c3ddfb2ddcd1f30e1b5 + Author: Jonathan Wakely + Date: Wed Oct 5 11:27:23 2022 +0100 + + [temp.local] Fix typo in "inject-class-name" (#5889) + + commit f6c5d4512d4b32d63d66669555ab976b315d439c + Author: mordante + Date: Mon Oct 10 17:50:51 2022 +0200 + + [format.string.escaped] Fix example of invalid code unit (#5890) + + Example 5 should only have one invalid code unit. The second code unit is a valid code point. + + This issue was already in the paper P2286R8 "Formatting Ranges". + + commit 5f26c516a659cdf3f0ea007cf6c90c690cccc3b6 + Author: Eelis van der Weegen + Date: Tue Oct 11 04:36:08 2022 +0200 + + [bibliography] Remove stray closing parenthesis. + + commit 6c51392a3d1c3c928ef1c20c19e8efe6efed7dc1 + Author: Corentin Jabot + Date: Wed Oct 19 22:29:09 2022 +0200 + + [intro.defs] Move the definition of "multibyte character" to library + + This address the US-2 NB comment as per the direction voted on + by SG-16. + + No use of "multibyte character" remains before [multibyte.strings]. + + commit 33e56641d63c5993d288082cf264a733464ff75c + Author: Arthur O'Dwyer + Date: Tue Oct 25 17:48:03 2022 -0400 + + [stack.syn, queue.syn] Add xref comments to class synopses (#5913) + + commit 90aa7729b9a926622581354284ecf294a56e410b + Author: Will Hawkins <8715530+hawkinsw@users.noreply.github.com> + Date: Tue Nov 1 04:37:52 2022 -0400 + + [range.dangling] Replace "tag type" with just "type" (#5922) + + The extra word "tag" was not adding any value and was potentially, + confusing; e.g. the "dangling" type is not like, say, an iterator tag + that would be used for overload resolution. + + commit fd998c52af2dc6b9c73098fdbd5a22444a358448 + Author: Arthur O'Dwyer + Date: Tue Nov 1 10:45:53 2022 -0400 + + [flat.set] [flat.multiset] Use value_type, not key_type + + For consistency with the other `set`, `unordered_set` containers. + `key_type` is a synonym for `value_type`, and there's no reason + the flat containers need to depart from existing practice here. + + commit 48ecaaec300de4a8176c116408cac915142166ce + Author: Arthur O'Dwyer + Date: Mon Nov 7 14:02:40 2022 -0500 + + [flat.multiset.modifiers] Fix typo in "multiset" (#5927) + + commit 45d9a5ba5aee1e3c4da8938e12376b36a7147d63 + Author: Eric41293 + Date: Mon Nov 7 11:11:58 2022 -0800 + + [climits.syn] Correct note about types of macros (#5926) + + This note was added apparently as a response to LWG 416. However, there may have been a misunderstanding of the C standard, and in fact only the macros for `{signed,unsigned,} char` and `{signed,unsigned} int` have a different type. + + commit f41cd00273e6ee7ff1a29446b21f230c28bf1a9f + Author: Jonathan Wakely + Date: Mon Nov 7 20:59:54 2022 +0000 + + [time.clock.system.nonmembers, time.zone.zonedtime.nonmembers] Add to STATICALLY-WIDEN (#5934) + + commit ef7d0e234722d2ef8b4ec069b6f929dc083d8dc7 + Author: Ed Catmur + Date: Tue Sep 20 18:12:45 2022 +0100 + + [meta, thread] Add or amend references to func.{require,invoke} + + commit 0d5c9b9310b2f6c6c4259665e1e680936babdc3d + Author: Eric41293 + Date: Mon Nov 7 15:54:55 2022 -0800 + + [meta.type.synop] Capitalize NTTP name (#5921) + + commit 0959b5c200a6f2b543e2d656850917b8d788767c + Author: Hui <65944694+huixie90@users.noreply.github.com> + Date: Tue Nov 8 00:49:15 2022 +0000 + + [range.drop.while.overview] Use string_view rather than string literal (#5897) + + The string literal would have been treated as a `const char*`, which is not a range. + + commit 720c3ae24a68fda02a6372eda13ec3f9c6a1a39b + Author: Jonathan Wakely + Date: Tue Nov 8 02:01:34 2022 +0000 + + [time.format] Use basic_ostringstream instead of ostringstream (#5932) + + commit 8739d316f2a55c633963b26b748681ff16498887 + Author: Marc Mutz <94039187+marcmutz@users.noreply.github.com> + Date: Tue Nov 8 03:05:45 2022 +0100 + + [meta.const.eval] Add is_constant_evaluated to index of library names (#5898) + + Previously, only its feature-test macro was listed there. + + commit 4c442cf93f03a44ec1f6a93875043a3aca7c5b9b + Author: Johel Ernesto Guerrero Peña + Date: Mon Nov 7 23:38:36 2022 -0400 + + [class.union.general] Attach example to its note (#5882) + + commit 65c494b9a4a5a4fab500733441c04e50a787d318 + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Tue Nov 8 15:51:21 2022 +0800 + + [mdspan.extents.expo] Remove redundant "// exposition only" (#5907) + + commit b766881dda1d0201d98710b11efda3491a84b4f2 + Author: languagelawyer <38548419+languagelawyer@users.noreply.github.com> + Date: Tue Nov 8 13:15:07 2022 +0500 + + [dcl.init.list] Specify the type of the prvalue (#5919) + + commit 6e035b52e28e95211a39ffb552851499432b2c6e + Author: Johel Ernesto Guerrero Peña + Date: Tue Nov 8 15:30:29 2022 -0400 + + [ratio.ratio] Use symbol "sgn" for the signum function (#5925) + + commit 89269f8e548b993b239f2c0f5ecc071ee7f54c9a + Author: Blackteahamburger + Date: Wed Nov 9 04:12:59 2022 +0800 + + [dcl.link] Add missing restriction to language linkage application (#5892) + + A language linkage specification should only apply to entities that do in fact have language linkage. + + commit ea77b2fa83ddac0c52c1b505ff666328a2a8f558 + Author: Jens Maurer + Date: Wed Nov 9 00:34:26 2022 +0100 + + [temp.deduct.general] Fix typo in comment in example + + commit 0c196ec375993000547e8913abb4c4ce703144cb + Author: Jens Maurer + Date: Thu Nov 10 15:32:56 2022 +0100 + + [temp.deduct.conv] Remove misleading paragraph break + + commit 0cd0c33f648d1304160e6dcb1856affd71b3ebbb + Author: Casey Carter + Date: Fri Nov 11 18:35:53 2022 -0800 + + [mdspan.extents.cons] "constexpr" should precede "explicit" + + In library function declarations, the `constexpr` specifier always precedes the `explicit` specifier per our standing style guide. + + commit 608c152dbae69d335d7238cdd5d178e048e2a1fd + Author: Casey Carter + Date: Mon Nov 14 10:48:18 2022 -0800 + + [vector.bool.pspc] Replace `constexpr static` with `static constexpr` + + As preferred by our style guide. + + commit d829eac310981e688a15b28622a2f048d23eed65 + Author: Thomas Köppe + Date: Thu Nov 10 07:43:32 2022 +0000 + + [class.inhctor.init] Fix explanation of "error:" in example + + The correct explanation is that classes `B1` and `D1` do not have + default constructors, not that they have deleted default constructors. + + Fixes NB CA 062 (C++23 CD). + + commit 6a1c5050c21ac26fcb2b5b187a0de867713568dc + Author: Thomas Köppe + Date: Tue Nov 8 23:35:00 2022 +0000 + + [diff.cpp20.library] Add missing new headers + + Fixes NB FR 008 (C++23 CD). + + commit b2fa70faa783827cd38b819409e94da2523333f2 + Author: Thomas Köppe + Date: Wed Nov 9 18:50:56 2022 +0000 + + [views] Subclauses for contiguous and multidimensional access + + This organises the material for and into separate + subclauses, rather than having all constituent parts being siblings in + the same subclause. Even though we now have some subclauses six levels + deep, this seems like an improvement. As a drive-by, this allows us to + move a subclause on a non-member span helper function up one level, + where it is more appropriate. + + Fixes NB FR 027 (C++23 CD). + + commit e0bab4b7f2d8afe5d3939aa49fe6de4fd5e638c6 + Author: Thomas Köppe + Date: Thu Nov 10 02:16:11 2022 +0000 + + [concepts index] Describe exposition-only concepts + + Fixes NB GB 136 (C++23 CD). + + commit 9512e41e30cf24a8e93e8c8568ff1b5c14398cc6 + Author: Thomas Köppe + Date: Fri Nov 11 19:31:11 2022 +0000 + + [general, library index] Describe exposition-only entities + + Partially fixes NB GB 137 (C++23 CD). + + commit 0783dde32073b02b369c7c3893f4f496a83e3658 + Author: Thomas Köppe + Date: Fri Nov 11 19:33:33 2022 +0000 + + [func.wrap.move.ctor] Move private expos member to general index + + The private, exposition-only data member is not useful in the library + index. However, there seems no reason to not show it in the general + index, so we move the index entry from the library index to the + general index. + + Partially fixes NB GB 137 (C++23 CD). + + commit 3e825f144f2aa8668c9a1a94066b43799e08a6e7 + Author: Thomas Köppe + Date: Tue Nov 8 21:31:30 2022 +0000 + + [basic.scope.scope] Fix indentation in example + + Fixes NB US 034 (C++23 CD). + + commit 92de5996625efcb070f99681acd2e39efc206ee2 + Author: Thomas Köppe + Date: Tue Nov 8 23:24:35 2022 +0000 + + [unord.req.general] Fix garbled end of sentence + + This was an editorial mistake introduced by the transformation of the + requirement tables into regular paragraphs. + + Fixes NB US 100 (C++23 CD). + + commit 24e046896029a11f2cb78fd6db21482fb0d4be66 + Author: Thomas Köppe + Date: Tue Nov 8 21:02:31 2022 +0000 + + [coro.generator.promise] Use "equivalent to `throw`, ..." + + Our style guide says that "equivalent to " is the + appropriate style for an expression of type `void`, which is the case + for `throw`. This avoids the awkward situation of having "equivalent + to: `throws;`" appear in the middle of a paragraph without proper + terminal punctuation. + + Fixes NB US 119 (C++23 CD). + + commit 3f47d2565f26a9144e8076641ee55bf7be79f896 + Author: Thomas Köppe + Date: Tue Nov 8 21:27:56 2022 +0000 + + [coro.generator.promise] Remove unused name "x" + + Fixes NB US 120 (C++23 CD). + + commit fb0df97e7d7c2c75bbdf7164c33b0796024ff6d3 + Author: Jonathan Wakely + Date: Thu Nov 17 08:44:05 2022 +0000 + + [atomics] Replace integral and floating-point placeholders (#5939) + + Fixes NB GB 129 (C++23 CD). + + commit 0bb57d5ebffa7170fbc80724f55a6ac2a82f2e83 + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Fri Nov 25 14:56:24 2022 +0800 + + [format.arg] Add std:: for forward + + commit c88fb46327d87d78d571b7e1076e1916eaf7e310 + Author: Dawn Perchik + Date: Tue Nov 15 07:46:41 2022 -0800 + + [expr.unary.op] Say "the ~ operator" consistently, remove "unary" + + We are currently using the term "unary complement operator" to refer + to the "~" operator without ever giving it that name. This change + removes the use of that undefined term. + + commit bef02b89464fe6f4be3926d62defc92986ae4532 + Author: Thomas Köppe + Date: Tue Nov 22 16:28:42 2022 +0000 + + [expr.unary.op] Notes naming unary ops as {ones',two's} complement + + The terms "one's complement" and "two's complement" are well-known, + and it is useful to associate them with these operators. + + commit 020a312b2aa513a992e488d82db55fd0cd4fa025 + Author: Thomas Köppe + Date: Wed Nov 16 17:48:12 2022 +0000 + + [fs.rec.dir.itr.nonmembers] "for" is a keyword in "range-based for" + + commit cee095e75a97fb88a7053e360b3bc06d36a6b687 + Author: Alisdair Meredith + Date: Fri Dec 16 06:51:26 2022 +0700 + + [depr.conversions.string] remove redundent respecification (#6004) + + There are several typedef names defined precisely in the deprecated code conversion + facets classes that are redundantly respecified in text. Nowhere else in the library + does this; any specified typedef names are _see below_ definitions, not repeats of + the class definition. Needless redundancy is always a risk of divergence, however + small, so remove the respecification in text form. + + commit 1bb52db31be002f04ea5977f9900ba4174c7155e + Author: Anoop Rana <93918384+ranaanoop@users.noreply.github.com> + Date: Fri Dec 16 05:23:57 2022 +0530 + + [concepts.object] Change "built-in" to "fundamental" types (#6012) + + commit ce1cc3b011099b6228b18dad937911c6ea67d309 + Author: Johel Ernesto Guerrero Peña + Date: Sun Dec 11 17:03:41 2022 -0400 + + [expr.const] Remove redundant "ill-formed" in "error" comment + + commit 5d43f0137776fa112d0ffd6ba0e34df34a4cb820 + Author: Jonathan Wakely + Date: Tue Dec 13 12:52:00 2022 +0000 + + [time.zone.leap.members] update note about leap seconds + + commit fd20d4ea9f3ea8653b17169aad61eec843b71718 + Author: Jonathan Wakely + Date: Wed Nov 23 14:45:43 2022 +0000 + + [time.zone.zonedtime.overview] Rename parameters to match later definitions + + commit 137728f0830824c6058648a846376eec80e5cab3 + Author: Michael Florian Hava + Date: Fri Dec 16 02:10:55 2022 +0100 + + [coro.generator.promise] Fix template parameters (#6009) + + Some of the template parameters of `yield_value` were inconsistent, + and the synopsis contained an outright typo. This change uses `R2` + consistently since the parameter is a reference. + + commit 5d6099c3df78922ee5b5f1d1c42a5c762d246df0 + Author: Thomas Köppe + Date: Thu Dec 15 23:31:26 2022 +0000 + + [formatter.requirements] Remove one level of list nesting + + commit 9e41a1c27de2f676badacbe0c1aac783063b7cd6 + Author: Thomas Köppe + Date: Wed Nov 16 19:43:58 2022 +0000 + + [time.clock.req] Make list item end with comma, not full stop. + + Also reformat the itemization source to be more edit-friendly. + + commit 5ef31f3fc1531d9e6e923cb57bf6e5ecec59ed4e + Author: languagelawyer + Date: Thu Jun 25 10:54:17 2020 +0300 + + [expr.unary.op] Fix usage of "result" + + commit 8c60752c7eb28e1ff1cc9e088d7836957356f559 + Author: Jonathan Wakely + Date: Tue Apr 26 10:18:11 2022 +0100 + + [optional.ctor], [expected.object.ctor] Add converts-from-any-cvref + + commit 405b46f50ce6c7458e94db7b4528fc267e2b67c3 + Author: Hewill Kang <67143766+hewillk@users.noreply.github.com> + Date: Sat Dec 17 00:14:51 2022 +0800 + + [mdspan.mdspan.overview] Add default template arguments for mdspan (#6018) + + We usually restate the default template arguments in the class synopsis, + so that the information is in one place and one does not need to also refer + to the header synopsis. + + commit ae88bb581d32f1939987c0a834fe3f6011a9d003 + Author: frederick-vs-ja + Date: Fri Dec 16 21:25:31 2022 +0800 + + [range.repeat] Change `W`/`WArgs` to `T`/`TArgs` + + commit 0a1f1e147c75ce9220de3488103ca880b6b8e49f + Author: Thomas Köppe + Date: Fri Dec 16 17:19:08 2022 +0000 + + [concept.copyconstructible] Avoid "possibly \tcode{const}" + + A small rewrite avoids the phrase "possibly \tcode{const}", + which we would like to remove entirely in favour of just + "possibly const". + + commit f058decdf9c7dea0461f723df72f5093f5e92b11 + Author: Thomas Köppe + Date: Fri Dec 16 17:31:47 2022 +0000 + + Replace "possibly \tcode{const}" with "possibly const" + + The "const" here is not syntax, but just normal text. + This is similar to "inline" and "public", which have + previously been cleaned up similarly. + + commit 9ac55553459e15c84db6d8072c93787d41ef7ccf + Author: Jens Maurer + Date: Fri Jun 4 00:29:30 2021 +0200 + + [lib] Drop 'inline' from 'inline constexpr' variable templates. + + Since CWG2387, constexpr variable templates have external linkage. diff --git a/papers/wd-index.md b/papers/wd-index.md index 5d6a4f75a1..abd18efdb3 100644 --- a/papers/wd-index.md +++ b/papers/wd-index.md @@ -41,4 +41,5 @@ * [N4892](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/n4892.pdf) 2021-06 C++ Working Draft * [N4901](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/n4901.pdf) 2021-10 C++ Working Draft * [N4910](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf) 2022-03 C++ Working Draft - * [N4910](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4917.pdf) 2022-07 C++ Working Draft + * [N4917](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4917.pdf) 2022-07 C++ Working Draft + * [N4928](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4928.pdf) 2022-11 C++ Working Draft diff --git a/source/algorithms.tex b/source/algorithms.tex index 1a4d627698..61a5eb3713 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -151,14 +151,14 @@ whenever an algorithm expects a function object\iref{function.objects} that, when applied to the result of dereferencing the corresponding iterator, returns a value testable as \tcode{true}. -In other words, -if an algorithm takes \tcode{Predicate pred} as its argument and +If an algorithm takes \tcode{Predicate pred} as its argument and \tcode{first} as its iterator argument with value type \tcode{T}, -it should work correctly in the construct -\tcode{pred(*first)} contextually converted to \tcode{bool}\iref{conv}. +the expression \tcode{pred(*first)} shall be well-formed and +the type \tcode{decltype(pred(*first))} shall model +\exposconcept{boolean-testable}\iref{concept.booleantestable}. The function object \tcode{pred} shall not apply any non-constant function -through the dereferenced iterator. -Given a glvalue \tcode{u} of type (possibly \keyword{const}) \tcode{T} +through its argument. +Given a glvalue \tcode{u} of type (possibly const) \tcode{T} that designates the same object as \tcode{*first}, \tcode{pred(u)} shall be a valid expression that is equal to \tcode{pred(*first)}. @@ -170,22 +170,24 @@ to dereferencing an iterator and type \tcode{T} when \tcode{T} is part of the signature, returns a value testable as \tcode{true}. -In other words, -if an algorithm takes \tcode{BinaryPredicate binary_pred} as its argument and +If an algorithm takes \tcode{BinaryPredicate binary_pred} as its argument and \tcode{first1} and \tcode{first2} as its iterator arguments with respective value types \tcode{T1} and \tcode{T2}, -it should work correctly in the construct -\tcode{binary_pred(*first1, *first2)} contextually converted to \tcode{bool}\iref{conv}. +the expression \tcode{binary_pred(*first1, *first2)} shall be well-formed and +the type \tcode{decltype(binary_pred(*first1, *first2))} shall model +\exposconcept{boolean-testable}. Unless otherwise specified, \tcode{BinaryPredicate} always takes the first iterator's \tcode{value_type} as its first argument, that is, in those cases when \tcode{T value} -is part of the signature, it should work correctly in the construct -\tcode{binary_pred(*first1, value)} contextually converted to \tcode{bool}\iref{conv}. +is part of the signature, +the expression \tcode{binary_pred(*first1, value)} shall be well-formed and +the type \tcode{decltype(binary_pred(*first1, value))} shall model +\exposconcept{boolean-testable}. \tcode{binary_pred} shall not apply any non-constant function -through the dereferenced iterators. -Given a glvalue \tcode{u} of type (possibly \keyword{const}) \tcode{T1} +through any of its arguments. +Given a glvalue \tcode{u} of type (possibly const) \tcode{T1} that designates the same object as \tcode{*first1}, and -a glvalue \tcode{v} of type (possibly \keyword{const}) \tcode{T2} +a glvalue \tcode{v} of type (possibly const) \tcode{T2} that designates the same object as \tcode{*first2}, \tcode{binary_pred(u, *first2)}, \tcode{binary_pred(*first1, v)}, and @@ -1108,7 +1110,7 @@ class Proj1 = identity, class Proj2 = identity, @\libconcept{indirect_equivalence_relation}@, Proj1>, projected, Proj2>> - Pred = ranges::equal_to> + Pred = ranges::equal_to> constexpr bool is_permutation(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -1267,15 +1269,15 @@ constexpr auto fold_left_first(R&& r, F f); template<@\libconcept{bidirectional_iterator}@ I, @\libconcept{sentinel_for}@ S, class T, - @\exposconcept{indirectly-binary-right-foldable}@ F> + @\exposconcept{indirectly-binary-right-foldable}@ F> constexpr auto fold_right(I first, S last, T init, F f); template<@\libconcept{bidirectional_range}@ R, class T, - @\exposconcept{indirectly-binary-right-foldable}@> F> + @\exposconcept{indirectly-binary-right-foldable}@> F> constexpr auto fold_right(R&& r, T init, F f); template<@\libconcept{bidirectional_iterator}@ I, @\libconcept{sentinel_for}@ S, - @\exposconcept{indirectly-binary-right-foldable}@, I> F> + @\exposconcept{indirectly-binary-right-foldable}@, I> F> requires @\libconcept{constructible_from}@, iter_reference_t> constexpr auto fold_right_last(I first, S last, F f); @@ -1290,7 +1292,7 @@ using fold_left_first_with_iter_result = in_value_result; template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@ S, class T, - @\exposconcept{indirectly-binary-left-foldable}@ F> + @\exposconcept{indirectly-binary-left-foldable}@ F> constexpr @\seebelow@ fold_left_with_iter(I first, S last, T init, F f); template<@\libconcept{input_range}@ R, class T, @\exposconcept{indirectly-binary-left-foldable}@> F> @@ -6293,7 +6295,7 @@ \effects Equivalent to: \begin{codeblock} -return ranges::rotate_copy(ranges::begin(r), middle, ranges::end(r), result); +return ranges::rotate_copy(ranges::begin(r), middle, ranges::end(r), std::move(result)); \end{codeblock} \end{itemdescr} @@ -6569,7 +6571,7 @@ named \tcode{BinaryPredicate}~\iref{algorithms.requirements}. The return value of the function call operation applied to an object of type \tcode{Compare}, -when contextually converted to \tcode{bool}\iref{conv}, +when converted to \tcode{bool}, yields \tcode{true} if the first argument of the call is less than the second, and \tcode{false} otherwise. @@ -11127,7 +11129,7 @@ \effects Equivalent to: \begin{codeblock} -auto t = uninitialized_copy(counted_iterator(ifirst, n), +auto t = uninitialized_copy(counted_iterator(std::move(ifirst), n), default_sentinel, ofirst, olast); return {std::move(t.in).base(), t.out}; \end{codeblock} @@ -11237,7 +11239,7 @@ \effects Equivalent to: \begin{codeblock} -auto t = uninitialized_move(counted_iterator(ifirst, n), +auto t = uninitialized_move(counted_iterator(std::move(ifirst), n), default_sentinel, ofirst, olast); return {std::move(t.in).base(), t.out}; \end{codeblock} @@ -11448,7 +11450,7 @@ \effects Equivalent to: \begin{codeblock} -return destroy(counted_iterator(first, n), default_sentinel).base(); +return destroy(counted_iterator(std::move(first), n), default_sentinel).base(); \end{codeblock} \end{itemdescr} diff --git a/source/back.tex b/source/back.tex index dda5569dc8..40954fd628 100644 --- a/source/back.tex +++ b/source/back.tex @@ -21,12 +21,12 @@ \chapter{Bibliography} \item %%% Format for the following entry is based on that specified at %%% http://www.iec.ch/standardsdev/resources/draftingpublications/directives/principles/referencing.htm - The Unicode Consortium. Unicode Standard Annex, UAX \#29, + The Unicode Consortium. Unicode Standard Annex, \UAX{29}, \doccite{Unicode Text Segmentation} [online]. Edited by Mark Davis. Revision 35; issued for Unicode 12.0.0. 2019-02-15 [viewed 2020-02-23]. Available from: \url{http://www.unicode.org/reports/tr29/tr29-35.html} \item - The Unicode Consortium. Unicode Standard Annex, UAX \#31, + The Unicode Consortium. Unicode Standard Annex, \UAX{31}, \doccite{Unicode Identifier and Pattern Syntax} [online]. Edited by Mark Davis. Revision 33; issued for Unicode 13.0.0. 2020-02-13 [viewed 2021-06-08]. @@ -51,7 +51,7 @@ \chapter{Bibliography} \item P.J. Plauger, \doccite{The Draft Standard \Cpp{} Library}. - Prentice-Hall, ISBN 0-13-117003-1, copyright \copyright 1995 P.J. Plauger) + Prentice-Hall, ISBN 0-13-117003-1, copyright \copyright 1995 P.J. Plauger \end{itemize} The arithmetic specification described in ISO/IEC 10967-1:2012 is @@ -87,6 +87,7 @@ \chapter{Bibliography} \clearpage \renewcommand{\leftmark}{\indexname} +\renewcommand{\preindexhook}{Constructions whose name appears in \exposid{monospaced italics} are for exposition only.\\} { \raggedright \printindex[generalindex] @@ -110,7 +111,7 @@ \chapter{Bibliography} } \clearpage -\renewcommand{\preindexhook}{} +\renewcommand{\preindexhook}{Constructions whose name appears in \exposid{italics} are for exposition only.\\} { \raggedright \printindex[libraryindex] @@ -119,7 +120,8 @@ \chapter{Bibliography} \clearpage \renewcommand{\preindexhook}{The bold page number for each entry is the page where the concept is defined. -Other page numbers refer to pages where the concept is mentioned in the general text.\\} +Other page numbers refer to pages where the concept is mentioned in the general text. +Concepts whose name appears in \exposid{italics} are for exposition only.\\} { \raggedright \printindex[conceptindex] diff --git a/source/basic.tex b/source/basic.tex index f32e82975f..bd155ed606 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -48,7 +48,7 @@ Every name is introduced by a \defn{declaration}, which is a \begin{itemize} \item -\grammarterm{declaration}, +\grammarterm{name-declaration}, \grammarterm{block-declaration}, or \grammarterm{member-declaration}\iref{dcl.pre,class.mem}, \item @@ -440,7 +440,7 @@ \label{term.odr.use}% A variable is named by an expression if the expression is an \grammarterm{id-expression} that denotes it. -A variable \tcode{x} whose name appears as a +A variable \tcode{x} that is named by a potentially-evaluated expression $E$ is \defnx{odr-used}{odr-use} by $E$ unless \begin{itemize} @@ -675,6 +675,11 @@ \item In each such definition, corresponding entities shall have the same language linkage. +\item In each such definition, +const objects with static or thread storage duration +shall be constant-initialized if +the object is constant-initialized in any such definition. + \item In each such definition, the overloaded operators referred to, the implicit calls to conversion functions, constructors, operator new functions and operator delete functions, shall refer to the same @@ -882,6 +887,7 @@ \item their object parameters have the same type. \end{itemize} +\indextext{template!function!corresponding object parameter}% Two non-static member function templates have \defnadjx{corresponding}{object parameters}{object parameter} if: \begin{itemize} @@ -894,6 +900,14 @@ \item the types of their object parameters are equivalent. \end{itemize} +\indextext{template!function!corresponding signature}% +Two function templates have +\defnadjx{corresponding}{signatures}{signature} if +their \grammarterm{template-parameter-list}{s} +have the same length, +their corresponding \grammarterm{template-parameter}{s} are equivalent, +they have equivalent non-object-parameter-type-lists and return types (if any), and, +if both are non-static members, they have corresponding object parameters. \pnum Two declarations \defn{correspond} @@ -925,13 +939,9 @@ if both are non-static members, they have corresponding object parameters, or \item -both declare function templates with equivalent -non-object-parameter-type-lists, -return types (if any), -\grammarterm{template-head}s, and -trailing \grammarterm{requires-clause}s (if any), and, -if both are non-static members, -they have corresponding object parameters. +both declare function templates with corresponding signatures and equivalent +\grammarterm{template-head}s and +trailing \grammarterm{requires-clause}s (if any). \end{itemize} \end{itemize} \begin{note} @@ -939,7 +949,7 @@ \begin{example} \begin{codeblock} struct A { -friend void f(); // \#1 + friend void f(); // \#1 }; struct B { friend void f() {} // corresponds to, and defines, \#1 @@ -1743,10 +1753,6 @@ if it precedes $P$ and inhabits either $S$ or the scope of a namespace nominated by a \grammarterm{using-directive} that is active in $S$ at $P$. -\begin{note} -A \grammarterm{using-directive} is exported if and only if -it appears in a header unit. -\end{note} \pnum An \term{unqualified search} in a scope $S$ from a program point $P$ @@ -3358,7 +3364,8 @@ except that if the object is a union member or subobject thereof, its lifetime only begins if that union member is the initialized member in the union\iref{dcl.init.aggr,class.base.init}, -or as described in \ref{class.union} and \ref{class.copy.ctor}, +or as described in +\ref{class.union}, \ref{class.copy.ctor}, and \ref{class.copy.assign}, and except as described in \ref{allocator.members}. The lifetime of an object \placeholder{o} of type \tcode{T} ends when: \begin{itemize} @@ -3425,8 +3432,7 @@ program has undefined behavior if: \begin{itemize} \item - the object will be or was of a class type with a non-trivial destructor - and the pointer is used as the operand of a \grammarterm{delete-expression}, + the pointer is used as the operand of a \grammarterm{delete-expression}, \item the pointer is used to access a non-static data member or call a non-static member function of the object, or @@ -3515,7 +3521,7 @@ \item $o_1$ and $o_2$ are of the same type (ignoring the top-level cv-qualifiers), and -\item $o_1$ is not a complete const object, and +\item $o_1$ is not a const, complete object, and \item neither $o_1$ nor $o_2$ is a potentially-overlapping subobject\iref{intro.object}, and @@ -3586,7 +3592,7 @@ \end{example} \pnum -Creating a new object within the storage that a const complete +Creating a new object within the storage that a const, complete object with static, thread, or automatic storage duration occupies, or within the storage that such a const object used to occupy before its lifetime ended, results in undefined behavior. @@ -4156,8 +4162,9 @@ \pnum \begin{note} The runtime pointer alignment function\iref{ptr.align} -can be used to obtain an aligned pointer within a buffer; the aligned-storage templates -in the library\iref{meta.trans.other} can be used to obtain aligned storage. +can be used to obtain an aligned pointer within a buffer; +an \grammarterm{alignment-specifier}\iref{dcl.align} +can be used to align storage explicitly. \end{note} \pnum @@ -4310,7 +4317,7 @@ \pnum \indextext{initializer!temporary and declarator}% \indextext{temporary!order of destruction of}% -There are three contexts in which temporaries are destroyed at a different +There are four contexts in which temporaries are destroyed at a different point than the end of the full-expression. The first context is when a default constructor is called to initialize an element of an array with no corresponding initializer\iref{dcl.init}. @@ -4431,14 +4438,24 @@ \end{itemize} \pnum -The destruction of a temporary whose lifetime is not extended by being -bound to a reference is sequenced before the destruction of every +The fourth context is when a temporary object other than a function parameter object +is created in the \grammarterm{for-range-initializer} of a range-based \keyword{for} statement. +If such a temporary object would otherwise be destroyed +at the end of the \grammarterm{for-range-initializer} full-expression, +the object persists for the lifetime of the reference +initialized by the \grammarterm{for-range-initializer}. + +\pnum +The destruction of a temporary whose lifetime is not extended +beyond the full-expression in which it was created +is sequenced before the destruction of every temporary which is constructed earlier in the same full-expression. -If the lifetime of two or more temporaries to which references are bound ends -at the same point, +If the lifetime of two or more temporaries +with lifetimes extending beyond the full-expressions in which they were created +ends at the same point, these temporaries are destroyed at that point in the reverse order of the completion of their construction. -In addition, the destruction of temporaries bound to references shall +In addition, the destruction of such temporaries shall take into account the ordering of destruction of objects with static, thread, or automatic storage duration\iref{basic.stc.static,basic.stc.thread,basic.stc.auto}; that is, if @@ -4655,9 +4672,14 @@ can be an array of unknown bound and therefore be incomplete at one point in a translation unit and complete later on; the array types at those two points (``array of unknown bound of \tcode{T}'' and ``array of -\tcode{N} \tcode{T}'') are different types. The type of a pointer to array of -unknown bound, or of a type defined by a \keyword{typedef} declaration to -be an array of unknown bound, cannot be completed. +\tcode{N} \tcode{T}'') are different types. +\begin{note} +The type of a pointer or reference to array of unknown bound +permanently points to or refers to an incomplete type. +An array of unknown bound named by a \keyword{typedef} declaration +permanently refers to an incomplete type. +In either case, the array type cannot be completed. +\end{note} \begin{example} \indextext{type!example of incomplete}% \begin{codeblock} @@ -4740,15 +4762,20 @@ has all of the following properties: \begin{itemize} \item it has a constexpr destructor\iref{dcl.constexpr}, -\item it is either a closure type\iref{expr.prim.lambda.closure}, -an aggregate type\iref{dcl.init.aggr}, or -has at least one constexpr constructor or constructor template +\item all of its non-static non-variant data members and base classes are of non-volatile literal types, and +\item it +\begin{itemize} +\item is a closure type\iref{expr.prim.lambda.closure}, +\item is an aggregate union type that has either +no variant members or +at least one variant member of non-volatile literal type, +\item is a non-union aggregate type for which +each of its anonymous union members +satisfies the above requirements for an aggregate union type, or +\item has at least one constexpr constructor or constructor template (possibly inherited\iref{namespace.udecl} from a base class) -that is not a copy or move constructor, -\item if it is a union, at least one of its non-static data members is -of non-volatile literal type, and -\item if it is not a union, all of its non-static data members and base classes are -of non-volatile literal types. +that is not a copy or move constructor. +\end{itemize} \end{itemize} \end{itemize} \begin{note} @@ -5569,6 +5596,10 @@ \item The constituent expression of an expression is that expression. \item +The constituent expression of a conversion is +the corresponding implicit function call, if any, or +the converted expression otherwise. +\item The constituent expressions of a \grammarterm{braced-init-list} or of a (possibly parenthesized) \grammarterm{expression-list} are the constituent expressions of the elements of the respective list. @@ -5616,6 +5647,15 @@ Expressions appearing in the \grammarterm{compound-statement} of a \grammarterm{lambda-expression} are not subexpressions of the \grammarterm{lambda-expression}. \end{note} +The \defnadjx{potentially-evaluated}{subexpressions}{subexpression} of +an expression, conversion, or \grammarterm{initializer} $E$ are +\begin{itemize} +\item +the constituent expressions of $E$ and +\item +the subexpressions thereof that +are not subexpressions of a nested unevaluated operand\iref{term.unevaluated.operand}. +\end{itemize} \pnum A \defn{full-expression} is diff --git a/source/classes.tex b/source/classes.tex index 18b57e45fa..e13097d465 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -305,7 +305,7 @@ A class \tcode{S} is an \defnadj{implicit-lifetime}{class} if \begin{itemize} \item -it is an aggregate or +it is an aggregate whose destructor is not user-provided or \item it has at least one trivial eligible constructor and a trivial, non-deleted destructor. @@ -605,10 +605,9 @@ \end{note} \pnum -A class is considered a completely-defined object -type\iref{term.incomplete.type} (or complete type) at the closing \tcode{\}} of -the \grammarterm{class-specifier}. -The class is regarded as complete within its complete-class contexts; +A class is regarded as complete +where its definition is reachable and +within its complete-class contexts; otherwise it is regarded as incomplete within its own class \grammarterm{member-specification}. @@ -660,6 +659,11 @@ shall not directly or indirectly cause the implicit definition of a defaulted default constructor for the enclosing class or the exception specification of that constructor. +An immediate invocation\iref{expr.const} that +is a potentially-evaluated subexpression\iref{intro.execution} +of a default member initializer +is neither evaluated nor checked for whether it +is a constant expression at the point where the subexpression appears. \pnum A member shall not be declared with the \keyword{extern} @@ -785,13 +789,21 @@ 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 +such entity in each of the structs, such that +\begin{itemize} +\item +corresponding entities have layout-compatible types\iref{basic.types}, +\item +corresponding entities have the same alignment requirements\iref{basic.align}, +\item either both entities are declared with the \tcode{no_unique_address} attribute\iref{dcl.attr.nouniqueaddr} -or neither is, -and either both entities are bit-fields with the same width +or neither is, and +\item +either both entities are bit-fields with the same width or neither is a bit-field. +\end{itemize} \begin{example} \begin{codeblock} struct A { int a; char b; }; @@ -1028,8 +1040,7 @@ The implementation will implicitly declare these member functions for some class types when the program does not explicitly declare them. The implementation will implicitly define them -if they are odr-used\iref{term.odr.use} or -needed for constant evaluation\iref{expr.const}. +as needed\iref{dcl.fct.def.default}. \end{note} An implicitly-declared special member function is declared at the closing \tcode{\}} of the \grammarterm{class-specifier}. @@ -1291,15 +1302,7 @@ \defnx{non-trivial}{constructor!default!non-trivial}. \pnum -A default constructor -that is defaulted and not defined as deleted -is -\defnx{implicitly defined}{constructor!implicitly defined} -when it is odr-used\iref{term.odr.use} -to initialize an object of its class type\iref{intro.object}, -when it is needed for constant evaluation\iref{expr.const}, or -when it is explicitly defaulted after its first declaration. -The implicitly-defined default constructor performs the set of +An implicitly-defined\iref{dcl.fct.def.default} default constructor performs the set of initializations of the class that would be performed by a user-written default constructor for that class with no \grammarterm{ctor-initializer}\iref{class.base.init} and an empty @@ -1590,20 +1593,11 @@ \defnx{non-trivial}{constructor!copy!nontrivial}. \pnum -\indextext{constructor!copy!implicitly defined}% -\indextext{constructor!move!implicitly defined}% -A copy/move constructor -that is defaulted and not defined as deleted -is -\term{implicitly defined} -when it is odr-used\iref{term.odr.use}, -when it is needed for constant evaluation\iref{expr.const}, or -when it is explicitly defaulted after its first declaration. \begin{note} The copy/move constructor is implicitly defined even if the implementation elided its odr-use\iref{term.odr.use,class.temporary}. \end{note} -If the implicitly-defined constructor would satisfy the requirements of a +If an implicitly-defined\iref{dcl.fct.def.default} constructor would satisfy the requirements of a constexpr function\iref{dcl.constexpr}, the implicitly-defined constructor is \keyword{constexpr}. @@ -1893,18 +1887,7 @@ \defnx{non-trivial}{assignment operator!copy!non-trivial}. \pnum -\indextext{assignment operator!copy!implicitly defined}% -\indextext{assignment operator!move!implicitly defined}% -A copy/move assignment operator for a class \tcode{X} -that is defaulted and not defined as deleted -is -\term{implicitly defined} -when it is odr-used\iref{term.odr.use} -(e.g., when it is selected by overload resolution -to assign to an object of its class type), -when it is needed for constant evaluation\iref{expr.const}, or -when it is explicitly defaulted after its first declaration. -The implicitly-defined copy/move assignment operator is \keyword{constexpr}. +An implicitly-defined\iref{dcl.fct.def.default} copy/move assignment operator is \keyword{constexpr}. \pnum Before the defaulted copy/move assignment operator for a class is @@ -2114,14 +2097,6 @@ A defaulted destructor is a constexpr destructor if it satisfies the requirements for a constexpr function\iref{dcl.constexpr}. -\pnum -A destructor -that is defaulted and not defined as deleted -is -\defnx{implicitly defined}{destructor!implicitly defined} -when it is odr-used\iref{term.odr.use} -or when it is explicitly defaulted after its first declaration. - \pnum Before a defaulted destructor for a class is implicitly defined, all the non-user-provided @@ -3150,12 +3125,8 @@ or destructor\iref{class.dtor}, the corresponding member function of the union must be user-provided or it will be implicitly deleted\iref{dcl.fct.def.delete} for the union. -\end{note} - -\pnum \begin{example} Consider the following union: - \begin{codeblock} union U { int i; @@ -3163,7 +3134,6 @@ std::string s; }; \end{codeblock} - Since \tcode{std::string}\iref{string.classes} declares non-trivial versions of all of the special member functions, \tcode{U} will have an implicitly deleted default constructor, copy/move constructor, @@ -3171,6 +3141,7 @@ To use \tcode{U}, some or all of these member functions must be user-provided. \end{example} +\end{note} \pnum When the left operand of an assignment operator @@ -5879,7 +5850,7 @@ D1 d(2, 3, 4); // OK, \tcode{B1} is initialized by calling \tcode{B1(2, 3, 4)}, // then \tcode{d.x} is default-initialized (no initialization is performed), // then \tcode{d.y} is initialized by calling \tcode{get()} - D1 e; // error: \tcode{D1} has a deleted default constructor + D1 e; // error: \tcode{D1} has no default constructor } struct D2 : B2 { @@ -5887,7 +5858,7 @@ B1 b; }; -D2 f(1.0); // error: \tcode{B1} has a deleted default constructor +D2 f(1.0); // error: \tcode{B1} has no default constructor struct W { W(int); }; struct X : virtual W { using W::W; X() = delete; }; @@ -6427,12 +6398,7 @@ where the implicit object parameter (if any) is considered to be the first parameter. \end{itemize} -A comparison operator function for class \tcode{C} that -is defaulted on its first declaration and -is not defined as deleted is -\defnx{implicitly defined}{operator!comparison!implicitly defined} -when it is odr-used or needed for constant evaluation. -Name lookups in the defaulted definition +Name lookups in the implicit definition\iref{dcl.fct.def.default} of a comparison operator function are performed from a context equivalent to its \grammarterm{function-body}. diff --git a/source/compatibility.tex b/source/compatibility.tex index 21cd9c51eb..fbf61627fb 100644 --- a/source/compatibility.tex +++ b/source/compatibility.tex @@ -16,7 +16,7 @@ \diffref{lex.name} \change Previously valid identifiers containing characters -not present in UAX \#44 properties XID_Start or XID_Continue, or +not present in \UAX{44} properties XID_Start or XID_Continue, or not in Normalization Form C, are now rejected. \rationale Prevent confusing characters in identifiers. @@ -69,6 +69,29 @@ // now equivalent to \tcode{arr.operator[](1, 2)} or ill-formed \end{codeblock} +\rSec2[diff.cpp20.stmt]{\ref{stmt.stmt}: statements} + +\diffref{stmt.ranged} +\change +The lifetime of temporary objects in the \grammarterm{for-range-initializer} +is extended until the end of the loop\iref{class.temporary}. +\rationale +Improve usability of the range-based \keyword{for} statement. +\effect +Destructors of some temporary objects are invoked later. +For example: +\begin{codeblock} +void f() { + std::vector v = { 42, 17, 13 }; + std::mutex m; + + for (int x : + static_cast(std::lock_guard(m)), v) { // lock released in \CppXX + std::lock_guard guard(m); // OK in \CppXX, now deadlocks + } +} +\end{codeblock} + \rSec2[diff.cpp20.dcl]{\ref{dcl.dcl}: declarations} \diffref{dcl.init.string} @@ -128,9 +151,13 @@ \effect The following \Cpp{} headers are new: \libheaderref{expected}, -\libheaderref{stdatomic.h}, -\libheaderref{spanstream}, and -\libheaderref{stacktrace}. +\libheaderrefx{flat_map}{flat.map.syn}, +\libheaderrefx{flat_set}{flat.set.syn}, +\libheaderref{generator}, +\libheaderref{print}, +\libheaderref{spanstream}, +\libheaderref{stacktrace}, and +\libheaderref{stdatomic.h}. Valid \CppXX{} code that \tcode{\#include}{s} headers with these names may be invalid in this revision of \Cpp{}. @@ -653,6 +680,31 @@ } \end{codeblock} +\diffref{over.match.oper} +\change +Overload resolution may change for equality operators\iref{expr.eq}. +\rationale +Support calling \tcode{operator==} with reversed order of arguments. +\effect +Valid \CppXVII{} code that uses equality operators with conversion functions +may be ill-formed or have different semantics in this revision of \Cpp{}. +For example: +\begin{codeblock} +struct A { + operator int() const { return 10; } +}; + +bool operator==(A, int); // \#1 +// \#2 is built-in candidate: \tcode{bool operator==(int, int);} +bool b = 10 == A(); // calls \#1 with reversed order of arguments; previously selected \#2 + +struct B { + bool operator==(const B&); // member function with no cv-qualifier +}; +B b1; +bool eq = (b1 == b1); // ambiguous; previously well-formed +\end{codeblock} + \rSec2[diff.cpp17.temp]{\ref{temp}: templates} \diffref{temp.names} diff --git a/source/concepts.tex b/source/concepts.tex index 801cb8ec57..0508cb542b 100644 --- a/source/concepts.tex +++ b/source/concepts.tex @@ -620,6 +620,11 @@ exchange the values denoted by \tcode{E1} and \tcode{E2}, the program is ill-formed, no diagnostic required. + \begin{note} + This precludes calling unconstrained program-defined overloads of + \tcode{swap}. When the deleted overload is viable, program-defined overloads + need to be more specialized\iref{temp.func.order} to be selected. + \end{note} \item Otherwise, if \tcode{E1} and \tcode{E2} @@ -770,7 +775,7 @@ \begin{itemdecl} template - inline constexpr bool @\exposid{is-default-initializable}@ = @\seebelow@; // \expos + constexpr bool @\exposid{is-default-initializable}@ = @\seebelow@; // \expos template concept @\deflibconcept{default_initializable}@ = @\libconcept{constructible_from}@ && @@ -828,7 +833,7 @@ \begin{itemdescr} \pnum If \tcode{T} is an object type, then let \tcode{v} be an lvalue of type -(possibly \keyword{const}) \tcode{T} or an rvalue of type \tcode{const T}. +\tcode{T} or \tcode{\keyword{const} T} or an rvalue of type \tcode{\keyword{const} T}. \tcode{T} models \libconcept{copy_constructible} only if \begin{itemize} @@ -1200,14 +1205,14 @@ \pnum \begin{note} The \libconcept{semiregular} concept is modeled by types that behave similarly -to built-in types like \tcode{int}, except that they need not +to fundamental types like \tcode{int}, except that they need not be comparable with \tcode{==}. \end{note} \pnum \begin{note} The \libconcept{regular} concept is modeled by types that behave similarly to -built-in types like \tcode{int} and that are comparable with +fundamental types like \tcode{int} and that are comparable with \tcode{==}. \end{note} \end{itemdescr} diff --git a/source/config.tex b/source/config.tex index f5acf7b1e1..0f2a0d13ee 100644 --- a/source/config.tex +++ b/source/config.tex @@ -1,8 +1,8 @@ %!TEX root = std.tex %%-------------------------------------------------- %% Version numbers -\newcommand{\docno}{N4917} -\newcommand{\prevdocno}{N4910} +\newcommand{\docno}{N4928} +\newcommand{\prevdocno}{N4917} \newcommand{\cppver}{202002L} %% Release date diff --git a/source/containers.tex b/source/containers.tex index 7d02506cbe..7a15185cc8 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -79,13 +79,18 @@ \item \tcode{X} denotes a container class containing objects of type \tcode{T}, \item -\tcode{a} and \tcode{b} denote values of type \tcode{X}, +\tcode{a} denotes a value of type \tcode{X}, +\item +\tcode{b} and \tcode{c} denote values of type (possibly const) \tcode{X}, \item \tcode{i} and \tcode{j} denote values of type (possibly const) \tcode{X::iterator}, \item \tcode{u} denotes an identifier, \item -\tcode{r} denotes a non-const value of type \tcode{X}, and +\tcode{v} denotes an lvalue of type (possibly const) \tcode{X} or +an rvalue of type \tcode{const X}, +\item +\tcode{s} and \tcode{t} denote non-const lvalues of type \tcode{X}, and \item \tcode{rv} denotes a non-const rvalue of type \tcode{X}. \end{itemize} @@ -94,7 +99,7 @@ % Local command to index names as members of all containers. \newcommand{\indexcont}[1]{% -\indexlibrarymisc{#1}{containers}% +\indexlibrarymisc{\idxcode{#1}}{containers}% \indexlibrarymemberx{array}{#1}% \indexlibrarymemberx{deque}{#1}% \indexlibrarymemberx{forward_list}{#1}% @@ -219,8 +224,8 @@ \end{itemdescr} \begin{itemdecl} -X u(a); -X u = a; +X u(v); +X u = v; \end{itemdecl} \begin{itemdescr} @@ -230,7 +235,7 @@ \pnum \ensures -\tcode{u == a} +\tcode{u == v}. \pnum \complexity @@ -252,8 +257,27 @@ Linear for \tcode{array} and constant for all other standard containers. \end{itemdescr} +\indexcont{operator=}% \begin{itemdecl} -a = rv +t = v; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\result +\tcode{X\&}. + +\pnum +\ensures +\tcode{t == v}. + +\pnum +\complexity +Linear. +\end{itemdescr} + +\begin{itemdecl} +t = rv \end{itemdecl} \begin{itemdescr} @@ -263,12 +287,12 @@ \pnum \effects -All existing elements of \tcode{a} are either move assigned to or destroyed. +All existing elements of \tcode{t} are either move assigned to or destroyed. \pnum \ensures -If \tcode{a} and \tcode{rv} do not refer to the same object, -\tcode{a} is equal to the value that \tcode{rv} had before this assignment. +If \tcode{t} and \tcode{rv} do not refer to the same object, +\tcode{t} is equal to the value that \tcode{rv} had before this assignment. \pnum \complexity @@ -282,7 +306,7 @@ \begin{itemdescr} \pnum \result -\keyword{void} +\keyword{void}. \pnum \effects @@ -295,14 +319,14 @@ \indexcont{begin}% \begin{itemdecl} -a.begin() +b.begin() \end{itemdecl} \begin{itemdescr} \pnum \result \tcode{iterator}; -\tcode{const_iterator} for constant \tcode{a}. +\tcode{const_iterator} for constant \tcode{b}. \pnum \returns @@ -315,14 +339,14 @@ \indexcont{end}% \begin{itemdecl} -a.end() +b.end() \end{itemdecl} \begin{itemdescr} \pnum \result \tcode{iterator}; -\tcode{const_iterator} for constant \tcode{a}. +\tcode{const_iterator} for constant \tcode{b}. \pnum \returns @@ -335,7 +359,7 @@ \indexcont{cbegin}% \begin{itemdecl} -a.cbegin() +b.cbegin() \end{itemdecl} \begin{itemdescr} @@ -345,7 +369,7 @@ \pnum \returns -\tcode{const_cast(a).begin()} +\tcode{const_cast(b).begin()} \pnum \complexity @@ -354,7 +378,7 @@ \indexcont{cend}% \begin{itemdecl} -a.cend() +b.cend() \end{itemdecl} \begin{itemdescr} @@ -364,7 +388,7 @@ \pnum \returns -\tcode{const_cast(a).end()} +\tcode{const_cast(b).end()} \pnum \complexity @@ -391,7 +415,7 @@ \indexcont{operator==}% \begin{itemdecl} -a == b +c == b \end{itemdecl} \begin{itemdescr} @@ -401,11 +425,11 @@ \pnum \result -Convertible to \tcode{bool}. +\tcode{bool}. \pnum \returns -\tcode{equal(a.begin(), a.end(), b.begin(), b.end())} +\tcode{equal(c.begin(), c.end(), b.begin(), b.end())} \begin{note} The algorithm \tcode{equal} is defined in \ref{alg.equal}. @@ -413,7 +437,7 @@ \pnum \complexity -Constant if \tcode{a.size() != b.size()}, linear otherwise. +Constant if \tcode{c.size() != b.size()}, linear otherwise. \pnum \remarks @@ -422,28 +446,28 @@ \indexcont{operator"!=}% \begin{itemdecl} -a != b +c != b \end{itemdecl} \begin{itemdescr} \pnum \effects -Equivalent to \tcode{!(a == b)}. +Equivalent to \tcode{!(c == b)}. \end{itemdescr} \indexcont{swap}% \begin{itemdecl} -a.swap(b) +t.swap(s) \end{itemdecl} \begin{itemdescr} \pnum \result -\keyword{void} +\keyword{void}. \pnum \effects -Exchanges the contents of \tcode{a} and \tcode{b}. +Exchanges the contents of \tcode{t} and \tcode{s}. \pnum \complexity @@ -451,37 +475,18 @@ \end{itemdescr} \begin{itemdecl} -swap(a, b) +swap(t, s) \end{itemdecl} \begin{itemdescr} \pnum \effects -Equivalent to \tcode{a.swap(b)}. -\end{itemdescr} - -\indexcont{operator=}% -\begin{itemdecl} -r = a -\end{itemdecl} - -\begin{itemdescr} -\pnum -\result -\tcode{X\&}. - -\pnum -\ensures -\tcode{r == a}. - -\pnum -\complexity -Linear. +Equivalent to \tcode{t.swap(s)}. \end{itemdescr} \indexcont{size}% \begin{itemdecl} -a.size() +c.size() \end{itemdecl} \begin{itemdescr} @@ -491,7 +496,7 @@ \pnum \returns -\tcode{distance(a.begin(), a.end())}, +\tcode{distance(c.begin(), c.end())}, i.e. the number of elements in the container. \pnum @@ -506,7 +511,7 @@ \indexcont{max_size}% \begin{itemdecl} -a.max_size() +c.max_size() \end{itemdecl} \begin{itemdescr} @@ -525,17 +530,17 @@ \indexcont{empty}% \begin{itemdecl} -a.empty() +c.empty() \end{itemdecl} \begin{itemdescr} \pnum \result -Convertible to \tcode{bool}. +\tcode{bool}. \pnum \returns -\tcode{a.begin() == a.end()} +\tcode{c.begin() == c.end()} \pnum \complexity @@ -543,7 +548,7 @@ \pnum \remarks -If the container is empty, then \tcode{a.empty()} is true. +If the container is empty, then \tcode{c.empty()} is \tcode{true}. \end{itemdescr} \pnum @@ -607,13 +612,13 @@ container type other than \tcode{array}, shall exchange the values of \tcode{a} and \tcode{b} without invoking any move, copy, or swap operations on the individual container elements. -Lvalues of any \tcode{Compare}, \tcode{Pred}, or \tcode{Hash} types -belonging to \tcode{a} and \tcode{b} shall be swappable +Any \tcode{Compare}, \tcode{Pred}, or \tcode{Hash} types +belonging to \tcode{a} and \tcode{b} shall meet the \oldconcept{Swappable} requirements and shall be exchanged by calling \tcode{swap} as described in~\ref{swappable.requirements}. If \tcode{allocator_traits::propagate_on_container_swap::value} is \tcode{true}, then -lvalues of type \tcode{allocator_type} shall be swappable and +\tcode{allocator_type} shall meet the \oldconcept{Swap\-pable} requirements and the allocators of \tcode{a} and \tcode{b} shall also be exchanged by calling \tcode{swap} as described in~\ref{swappable.requirements}. Otherwise, the allocators shall not be swapped, and the behavior is @@ -627,7 +632,7 @@ % Local command to index names as members of all containers. \renewcommand{\indexcont}[1]{% -\indexlibrarymisc{#1}{reversible containers}% +\indexlibrarymisc{\idxcode{#1}}{reversible containers}% \indexlibrarymemberx{array}{#1}% \indexlibrarymemberx{deque}{#1}% \indexlibrarymemberx{list}{#1}% @@ -761,18 +766,18 @@ \begin{itemize} \item -if an exception is thrown by an +If an exception is thrown by an \tcode{insert()} or \tcode{emplace()} function while inserting a single element, that function has no effects. \item -if an exception is thrown by a +If an exception is thrown by a \tcode{push_back()}, \tcode{push_front()}, \tcode{emplace_back()}, or \tcode{emplace_front()} function, that function has no effects. \item -no +No \tcode{erase()}, \tcode{clear()}, \tcode{pop_back()} @@ -780,14 +785,14 @@ \tcode{pop_front()} function throws an exception. \item -no copy constructor or assignment operator of a returned iterator +No copy constructor or assignment operator of a returned iterator throws an exception. \item -no +No \tcode{swap()} function throws an exception. \item -no +No \tcode{swap()} function invalidates any references, pointers, or iterators referring to the elements @@ -866,7 +871,7 @@ and an \tcode{allocator_type} identical to \tcode{allocator_traits::rebind_alloc} and given an lvalue \tcode{m} of type \tcode{A}, a pointer \tcode{p} of type \tcode{T*}, -an expression \tcode{v} of type (possibly \keyword{const}) \tcode{T}, +an expression \tcode{v} of type \tcode{T} or \tcode{const T}, and an rvalue \tcode{rv} of type \tcode{T}, the following terms are defined. If \tcode{X} is not allocator-aware or is a specialization of \tcode{basic_string}, @@ -976,7 +981,7 @@ % Local command to index names as members of all containers. \renewcommand{\indexcont}[1]{% -\indexlibrarymisc{#1}{allocator-aware containers}% +\indexlibrarymisc{\idxcode{#1}}{allocator-aware containers}% \indexlibrarymemberx{deque}{#1}% \indexlibrarymemberx{forward_list}{#1}% \indexlibrarymemberx{list}{#1}% @@ -1312,7 +1317,7 @@ % Local command to index names as members of all containers. \renewcommand{\indexcont}[1]{% -\indexlibrarymisc{#1}{sequence containers}% +\indexlibrarymisc{\idxcode{#1}}{sequence containers}% \indexlibrarymemberx{deque}{#1}% \indexlibrarymemberx{forward_list}{#1}% \indexlibrarymemberx{list}{#1}% @@ -1545,9 +1550,10 @@ For \tcode{vector} and \tcode{deque}, \tcode{T} is also \oldconcept{MoveInsertable} into \tcode{X}, +and \tcode{T} meets the \oldconcept{MoveConstructible}, \oldconcept{MoveAssignable}, and -swappable\iref{swappable.requirements}. +\oldconcept{Swappable}\iref{swappable.requirements} requirements. Neither \tcode{i} nor \tcode{j} are iterators into \tcode{a}. \pnum @@ -1579,9 +1585,10 @@ For \tcode{vector} and \tcode{deque}, \tcode{T} is also \oldconcept{MoveInsertable} into \tcode{X}, +and \tcode{T} meets the \oldconcept{MoveConstructible}, -\oldconcept{MoveAssignable}, and -swappable\iref{swappable.requirements}. +\oldconcept{Move\-Assignable}, and +\oldconcept{Swappable}\iref{swappable.requirements} requirements. \tcode{rg} and \tcode{a} do not overlap. \pnum @@ -1821,7 +1828,8 @@ \pnum The following operations are provided for some types of sequence containers but not others. -An implementation shall implement them so as to take amortized constant time. +Operations other than \tcode{prepend_range} and \tcode{append_range} +are implemented so as to take amortized constant time. \begin{itemdecl} a.front() @@ -2615,7 +2623,7 @@ \tcode{a2} denotes a value of a type with nodes compatible with type \tcode{X} (\tref{container.node.compat}), \item -\tcode{b} denotes a possibly \keyword{const} value of type \tcode{X}, +\tcode{b} denotes a value or type \tcode{X} or \tcode{const X}, \item \tcode{u} denotes the name of a variable being declared, \item @@ -2625,9 +2633,9 @@ \tcode{a_eq} denotes a value of type \tcode{X} when \tcode{X} supports multiple keys, \item -\tcode{a_tran} denotes a possibly \keyword{const} value of type \tcode{X} +\tcode{a_tran} denotes a value of type \tcode{X} or \tcode{const X} when the \grammarterm{qualified-id} -\tcode{X::key_compare::is_transpa\-rent} is valid +\tcode{X::key_compare::is_transparent} is valid and denotes a type\iref{temp.deduct}, \item \tcode{i} and \tcode{j} @@ -2654,7 +2662,7 @@ \item \tcode{k} denotes a value of type \tcode{X::key_type}, and \item -\tcode{c} denotes a possibly \keyword{const} value of type \tcode{X::key_compare}; +\tcode{c} denotes a value of type \tcode{X::key_compare} or \tcode{const X::key_compare}; \item \tcode{kl} is a value such that \tcode{a} is partitioned\iref{alg.sorting} with respect to \tcode{c(x, kl)}, @@ -2906,7 +2914,7 @@ \expects \tcode{value_type} is \oldconcept{EmplaceConstructible} into \tcode{X} -from \tcode{*range::begin(rg)}. +from \tcode{*ranges::begin(rg)}. \pnum \effects @@ -4114,7 +4122,7 @@ \tcode{a2} denotes a value of a type with nodes compatible with type \tcode{X} (\tref{container.node.compat}), \item -\tcode{b} denotes a possibly const value of type \tcode{X}, +\tcode{b} denotes a value of type \tcode{X} or \tcode{const X}, \item \tcode{a_uniq} denotes a value of type \tcode{X} when \tcode{X} supports unique keys, @@ -4122,7 +4130,7 @@ \tcode{a_eq} denotes a value of type \tcode{X} when \tcode{X} supports equivalent keys, \item -\tcode{a_tran} denotes a possibly const value of type \tcode{X} +\tcode{a_tran} denotes a value of type \tcode{X} or \tcode{const X} when the \grammarterm{qualified-id}s \tcode{X::key_equal::is_transparent} and \tcode{X::hasher::is_transparent} @@ -4151,9 +4159,9 @@ \item \tcode{k} denotes a value of type \tcode{key_type}, \item -\tcode{hf} denotes a possibly const value of type \tcode{hasher}, +\tcode{hf} denotes a value of type \tcode{hasher} or \tcode{const hasher}, \item -\tcode{eq} denotes a possibly const value of type \tcode{key_equal}, +\tcode{eq} denotes a value of type \tcode{key_equal} or \tcode{const key_equal}, \item \tcode{ke} is a value such that \begin{itemize} @@ -4177,7 +4185,7 @@ \item \tcode{z} denotes a value of type \tcode{float}, and \item -\tcode{nh} denotes a non-const rvalue of type \tcode{X::node_type}. +\tcode{nh} denotes an rvalue of type \tcode{X::node_type}. \end{itemize} \pnum @@ -4796,7 +4804,7 @@ \pnum \effects Inserts a \tcode{value_type} object \tcode{t} -constructed with \tcode{std::forward(args)...} and +constructed with \tcode{std::forward(args)...}. \pnum \returns @@ -6110,7 +6118,7 @@ class vector; template - inline constexpr bool @\exposid{is-vector-bool-reference}@ = @\seebelow@; // \expos + constexpr bool @\exposid{is-vector-bool-reference}@ = @\seebelow@; // \expos // hash support template struct hash; @@ -7267,12 +7275,33 @@ \indexlibrarymember{insert_after}{forward_list}% \begin{itemdecl} iterator insert_after(const_iterator position, const T& x); +\end{itemdecl} + +\begin{itemdescr} +\pnum +\expects +\tcode{T} is \oldconcept{CopyInsertable} into \tcode{forward_list}. +\tcode{position} is \tcode{before_begin()} or is a dereferenceable +iterator in the range \range{begin()}{end()}. + +\pnum +\effects +Inserts a copy of \tcode{x} after \tcode{position}. + +\pnum +\returns +An iterator pointing to the copy of \tcode{x}. +\end{itemdescr} + +\indexlibrarymember{insert_after}{forward_list}% +\begin{itemdecl} iterator insert_after(const_iterator position, T&& x); \end{itemdecl} \begin{itemdescr} \pnum \expects +\tcode{T} is \oldconcept{MoveInsertable} into \tcode{forward_list}. \tcode{position} is \tcode{before_begin()} or is a dereferenceable iterator in the range \range{begin()}{end()}. @@ -7293,6 +7322,7 @@ \begin{itemdescr} \pnum \expects +\tcode{T} is \oldconcept{CopyInsertable} into \tcode{forward_list}. \tcode{position} is \tcode{before_begin()} or is a dereferenceable iterator in the range \range{begin()}{end()}. @@ -7302,7 +7332,8 @@ \pnum \returns -An iterator pointing to the last inserted copy of \tcode{x} or \tcode{position} if \tcode{n == 0}. +An iterator pointing to the last inserted copy of \tcode{x}, or +\tcode{position} if \tcode{n == 0} is \tcode{true}. \end{itemdescr} \indexlibrarymember{insert_after}{forward_list}% @@ -7314,6 +7345,8 @@ \begin{itemdescr} \pnum \expects +\tcode{T} is \oldconcept{EmplaceConstructible} into \tcode{forward_list} +from \tcode{*first}. \tcode{position} is \tcode{before_begin()} or is a dereferenceable iterator in the range \range{begin()}{end()}. Neither \tcode{first} nor \tcode{last} are iterators in \tcode{*this}. @@ -7324,7 +7357,8 @@ \pnum \returns -An iterator pointing to the last inserted element or \tcode{position} if \tcode{first == last}. +An iterator pointing to the last inserted element, or +\tcode{position} if \tcode{first == last} is \tcode{true}. \end{itemdescr} \indexlibrarymember{insert_range_after}{forward_list}% @@ -7336,7 +7370,9 @@ \begin{itemdescr} \pnum \expects -\tcode{position} is \tcode{before_begin()} or +\tcode{T} is \oldconcept{EmplaceConstructible} into \tcode{forward_list} +from \tcode{*ranges::begin(rg)}. +\tcode{posi\-tion} is \tcode{before_begin()} or is a dereferenceable iterator in the range \range{begin()}{end()}. \tcode{rg} and \tcode{*this} do not overlap. @@ -7358,11 +7394,7 @@ \begin{itemdescr} \pnum \effects -\tcode{insert_after(position, il.begin(), il.end())}. - -\pnum -\returns -An iterator pointing to the last inserted element or \tcode{position} if \tcode{il} is empty. +Equivalent to: \tcode{return insert_after(position, il.begin(), il.end());} \end{itemdescr} @@ -7375,13 +7407,15 @@ \begin{itemdescr} \pnum \expects +\tcode{T} is \oldconcept{EmplaceConstructible} into \tcode{forward_list} +from \tcode{std::forward(\linebreak args)...}. \tcode{position} is \tcode{before_begin()} or is a dereferenceable iterator in the range \range{begin()}{end()}. \pnum \effects -Inserts an object of type \tcode{value_type} constructed with -\tcode{value_type(std::forward(\brk{}args)...)} after \tcode{position}. +Inserts an object of type \tcode{value_type} direct-non-list-initialized with +\tcode{std::forward(\linebreak args)...} after \tcode{position}. \pnum \returns @@ -9146,9 +9180,10 @@ using const_reverse_iterator = std::reverse_iterator; // bit reference - class reference { + class @\libmember{reference}{vector}@ { friend class vector; constexpr reference() noexcept; + public: constexpr reference(const reference&) = default; constexpr ~reference(); @@ -9160,8 +9195,8 @@ }; // construct/copy/destroy - constexpr vector() : vector(Allocator()) { } - constexpr explicit vector(const Allocator&); + constexpr vector() noexcept(noexcept(Allocator())) : vector(Allocator()) { } + constexpr explicit vector(const Allocator&) noexcept; constexpr explicit vector(size_type n, const Allocator& = Allocator()); constexpr vector(size_type n, const bool& value, const Allocator& = Allocator()); template @@ -9169,13 +9204,15 @@ template<@\exposconcept{container-compatible-range}@ R> constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator()); constexpr vector(const vector& x); - constexpr vector(vector&& x); + constexpr vector(vector&& x) noexcept; constexpr vector(const vector&, const type_identity_t&); constexpr vector(vector&&, const type_identity_t&); constexpr vector(initializer_list, const Allocator& = Allocator()); constexpr ~vector(); constexpr vector& operator=(const vector& x); - constexpr vector& operator=(vector&& x); + constexpr vector& operator=(vector&& x) + noexcept(allocator_traits::propagate_on_container_move_assignment::value || + allocator_traits::is_always_equal::value); constexpr vector& operator=(initializer_list); template constexpr void assign(InputIterator first, InputIterator last); @@ -9237,8 +9274,10 @@ constexpr iterator erase(const_iterator position); constexpr iterator erase(const_iterator first, const_iterator last); - constexpr void swap(vector&); - constexpr static void swap(reference x, reference y) noexcept; + constexpr void swap(vector&) + noexcept(allocator_traits::propagate_on_container_swap::value || + allocator_traits::is_always_equal::value); + static constexpr void swap(reference x, reference y) noexcept; constexpr void flip() noexcept; // flips all bits constexpr void clear() noexcept; }; @@ -9279,7 +9318,7 @@ \indexlibrarymember{swap}{vector}% \begin{itemdecl} -constexpr static void swap(reference x, reference y) noexcept; +static constexpr void swap(reference x, reference y) noexcept; \end{itemdecl} \begin{itemdescr} @@ -9304,10 +9343,10 @@ The specialization is enabled\iref{unord.hash}. \end{itemdescr} -\indexlibraryglobal{\exposid{is-vector-bool-reference}}% +\indexlibrary{is-vector-bool-reference@\exposid{is-vector-bool-reference}}% \begin{itemdecl} template - inline constexpr bool @\exposid{is-vector-bool-reference}@ = @\seebelow@; + constexpr bool @\exposid{is-vector-bool-reference}@ = @\seebelow@; \end{itemdecl} \begin{itemdescr} @@ -9604,6 +9643,7 @@ protected: Compare comp; value_compare(Compare c) : comp(c) {} + public: bool operator()(const value_type& x, const value_type& y) const { return comp(x.first, y.first); @@ -10186,6 +10226,7 @@ protected: Compare comp; value_compare(Compare c) : comp(c) { } + public: bool operator()(const value_type& x, const value_type& y) const { return comp(x.first, y.first); @@ -11105,8 +11146,10 @@ \pnum The exposition-only alias templates -\exposid{iter\--value\--type}, \exposid{iter\--key\--type}, -\exposid{iter\--mapped\--type}, and \exposid{iter\--to\--alloc\--type} +\exposid{iter-value-type}, \exposid{iter-key-type}, +\exposid{iter-mapped-type}, \exposid{iter-to\--alloc-type}, +\exposid{range-key-type}, \exposid{range-mapped-type}, +and \exposid{range-to-alloc-type} defined in \ref{associative.general} may appear in deduction guides for unordered containers. \rSec2[unord.map.syn]{Header \tcode{} synopsis} @@ -13141,22 +13184,11 @@ \pnum The exposition-only alias template \exposid{iter-value-type} defined in \ref{sequences.general} and -the exposition-only alias templates \exposid{iter-key-type} and \exposid{iter-mapped-type} +the exposition-only alias templates \exposid{iter-key-type}, \exposid{iter-mapped-type}, +\exposid{range-key-type}, and \exposid{range-mapped-type} defined in \ref{associative.general} may appear in deduction guides for container adaptors. -\pnum -The following exposition-only alias templates may appear in deduction guides -for container adaptors: -\begin{codeblock} -template - using @\exposid{cont-key-type}@ = // \expos - remove_const_t; -template - using @\exposid{cont-mapped-type}@ = // \expos - typename Container::value_type::second_type; -\end{codeblock} - \rSec2[queue.syn]{Header \tcode{} synopsis} \indexheader{queue} @@ -13165,6 +13197,7 @@ #include // see \ref{initializer.list.syn} namespace std { + // \ref{queue}, class template \tcode{queue} template> class queue; template @@ -13188,6 +13221,7 @@ template struct uses_allocator, Alloc>; + // \ref{priority.queue}, class template \tcode{priority_queue} template, class Compare = less> class priority_queue; @@ -13208,6 +13242,7 @@ #include // see \ref{initializer.list.syn} namespace std { + // \ref{stack}, class template \tcode{stack} template> class stack; template @@ -13285,6 +13320,7 @@ \indexheader{flat_set}% \begin{codeblock} +#include // see \ref{compare.syn} #include // see \ref{initializer.list.syn} namespace std { @@ -14616,10 +14652,12 @@ \end{note} \pnum -Any sequence container\iref{sequence.reqmts} \tcode{C} -supporting \oldconcept{RandomAccessIterator} can be used -to instantiate \tcode{flat_map}, -as long as invocations of +Any type \tcode{C} +that meets the sequence container requirements\iref{sequence.reqmts} +can be used to instantiate \tcode{flat_map}, +as long as +\tcode{C::iterator} meets the \oldconcept{RandomAccessIterator} requirements and +invocations of member functions \tcode{C::size} and \tcode{C::max_size} do not exit via an exception. In particular, \tcode{vector}\iref{vector} and \tcode{deque}\iref{deque} can be used. @@ -14674,6 +14712,7 @@ private: key_compare comp; // \expos value_compare(key_compare c) : comp(c) { } // \expos + public: bool operator()(const_reference x, const_reference y) const { return comp(x.first, y.first); @@ -15758,10 +15797,12 @@ \end{note} \pnum -Any sequence container\iref{sequence.reqmts} \tcode{C} -supporting \oldconcept{RandomAccessIterator} can be used to -instantiate \tcode{flat_multimap}, -as long as invocations of +Any type \tcode{C} +that meets the sequence container requirements\iref{sequence.reqmts} +can be used to instantiate \tcode{flat_multimap}, +as long as +\tcode{C::iterator} meets the \oldconcept{RandomAccessIterator} requirements and +invocations of member functions \tcode{C::size} and \tcode{C::max_size} do not exit via an exception. In particular, \tcode{vector}\iref{vector} and \tcode{deque}\iref{deque} can be used. @@ -15814,6 +15855,7 @@ private: key_compare comp; // \expos value_compare(key_compare c) : comp(c) { } // \expos + public: bool operator()(const_reference x, const_reference y) const { return comp(x.first, y.first); @@ -16396,23 +16438,23 @@ template flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Allocator& a); - flat_set(initializer_list il, const key_compare& comp = key_compare()) + flat_set(initializer_list il, const key_compare& comp = key_compare()) : flat_set(il.begin(), il.end(), comp) { } template - flat_set(initializer_list il, const key_compare& comp, const Allocator& a); + flat_set(initializer_list il, const key_compare& comp, const Allocator& a); template - flat_set(initializer_list il, const Allocator& a); + flat_set(initializer_list il, const Allocator& a); - flat_set(sorted_unique_t s, initializer_list il, + flat_set(sorted_unique_t s, initializer_list il, const key_compare& comp = key_compare()) : flat_set(s, il.begin(), il.end(), comp) { } template - flat_set(sorted_unique_t, initializer_list il, + flat_set(sorted_unique_t, initializer_list il, const key_compare& comp, const Allocator& a); template - flat_set(sorted_unique_t, initializer_list il, const Allocator& a); + flat_set(sorted_unique_t, initializer_list il, const Allocator& a); - flat_set& operator=(initializer_list); + flat_set& operator=(initializer_list); // iterators iterator begin() noexcept; @@ -16458,9 +16500,9 @@ template<@\exposconcept{container-compatible-range}@ R> void insert_range(R&& rg); - void insert(initializer_list il) + void insert(initializer_list il) { insert(il.begin(), il.end()); } - void insert(sorted_unique_t s, initializer_list il) + void insert(sorted_unique_t s, initializer_list il) { insert(s, il.begin(), il.end()); } container_type extract() &&; @@ -16637,14 +16679,14 @@ template flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Allocator& a); template - flat_set(initializer_list il, const key_compare& comp, const Allocator& a); + flat_set(initializer_list il, const key_compare& comp, const Allocator& a); template - flat_set(initializer_list il, const Allocator& a); + flat_set(initializer_list il, const Allocator& a); template - flat_set(sorted_unique_t, initializer_list il, + flat_set(sorted_unique_t, initializer_list il, const key_compare& comp, const Allocator& a); template - flat_set(sorted_unique_t, initializer_list il, const Allocator& a); + flat_set(sorted_unique_t, initializer_list il, const Allocator& a); \end{itemdecl} \begin{itemdescr} @@ -16783,7 +16825,7 @@ \effects Equivalent to: \begin{codeblock} -ranges::swap(compare, y.compare); +ranges::swap(@\exposid{compare}@, y.@\exposid{compare}@); ranges::swap(@\exposid{c}@, y.@\exposid{c}@); \end{codeblock} \end{itemdescr} @@ -16998,23 +17040,24 @@ flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, const Allocator& a); - flat_multiset(initializer_list il, const key_compare& comp = key_compare()) + flat_multiset(initializer_list il, const key_compare& comp = key_compare()) : flat_multiset(il.begin(), il.end(), comp) { } template - flat_multiset(initializer_list il, const key_compare& comp, const Allocator& a); + flat_multiset(initializer_list il, const key_compare& comp, + const Allocator& a); template - flat_multiset(initializer_list il, const Allocator& a); + flat_multiset(initializer_list il, const Allocator& a); - flat_multiset(sorted_equivalent_t s, initializer_list il, + flat_multiset(sorted_equivalent_t s, initializer_list il, const key_compare& comp = key_compare()) : flat_multiset(s, il.begin(), il.end(), comp) { } template - flat_multiset(sorted_equivalent_t, initializer_list il, + flat_multiset(sorted_equivalent_t, initializer_list il, const key_compare& comp, const Allocator& a); template - flat_multiset(sorted_equivalent_t, initializer_list il, const Allocator& a); + flat_multiset(sorted_equivalent_t, initializer_list il, const Allocator& a); - flat_multiset& operator=(initializer_list); + flat_multiset& operator=(initializer_list); // iterators iterator begin() noexcept; @@ -17058,9 +17101,9 @@ template<@\exposconcept{container-compatible-range}@ R> void insert_range(R&& rg); - void insert(initializer_list il) + void insert(initializer_list il) { insert(il.begin(), il.end()); } - void insert(sorted_equivalent_t s, initializer_list il) + void insert(sorted_equivalent_t s, initializer_list il) { insert(s, il.begin(), il.end()); } container_type extract() &&; @@ -17237,14 +17280,14 @@ template flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, const Allocator& a); template - flat_multiset(initializer_list il, const key_compare& comp, const Allocator& a); + flat_multiset(initializer_list il, const key_compare& comp, const Allocator& a); template - flat_multiset(initializer_list il, const Allocator& a); + flat_multiset(initializer_list il, const Allocator& a); template - flat_multiset(sorted_equivalent_t, initializer_list il, + flat_multiset(sorted_equivalent_t, initializer_list il, const key_compare& comp, const Allocator& a); template - flat_multiset(sorted_equivalent_t, initializer_list il, const Allocator& a); + flat_multiset(sorted_equivalent_t, initializer_list il, const Allocator& a); \end{itemdecl} \begin{itemdescr} @@ -17269,11 +17312,11 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_constructible_v} is \tcode{true}. +\tcode{is_constructible_v} is \tcode{true}. \pnum \effects -First, initializes an object \tcode{t} of type \tcode{key_type} +First, initializes an object \tcode{t} of type \tcode{value_type} with \tcode{std::forward(args)...}, then inserts \tcode{t} as if by: \begin{codeblock} @@ -17286,7 +17329,7 @@ An iterator that points to the inserted element. \end{itemdescr} -\indexlibrarymember{insert}{flat_mulitset}% +\indexlibrarymember{insert}{flat_multiset}% \begin{itemdecl} template void insert(InputIterator first, InputIterator last); @@ -17462,7 +17505,9 @@ The header \libheader{mdspan} defines the class template \tcode{mdspan} and other facilities for interacting with these multidimensional views. -\rSec2[span.syn]{Header \tcode{} synopsis}% +\rSec2[views.contiguous]{Contiguous access} + +\rSec3[span.syn]{Header \tcode{} synopsis}% \indexheader{span}% \begin{codeblock} @@ -17475,9 +17520,9 @@ class span; template - inline constexpr bool ranges::enable_view> = true; + constexpr bool ranges::enable_view> = true; template - inline constexpr bool ranges::enable_borrowed_range> = true; + constexpr bool ranges::enable_borrowed_range> = true; // \ref{span.objectrep}, views of object representation template @@ -17490,9 +17535,9 @@ } \end{codeblock} -\rSec2[views.span]{Class template \tcode{span}} +\rSec3[views.span]{Class template \tcode{span}} -\rSec3[span.overview]{Overview} +\rSec4[span.overview]{Overview} \pnum \indexlibraryglobal{span}% @@ -17580,8 +17625,8 @@ constexpr const_reverse_iterator crend() const noexcept { return rend(); } private: - pointer data_; // \expos - size_type size_; // \expos + pointer @\exposid{data_}@; // \expos + size_type @\exposid{size_}@; // \expos }; template @@ -17605,7 +17650,7 @@ \tcode{ElementType} is required to be a complete object type that is not an abstract class type. -\rSec3[span.cons]{Constructors, copy, and assignment} +\rSec4[span.cons]{Constructors, copy, and assignment} \indexlibraryctor{span}% \begin{itemdecl} @@ -17654,8 +17699,8 @@ \pnum \effects -Initializes \tcode{data_} with \tcode{to_address(first)} and -\tcode{size_} with \tcode{count}. +Initializes \tcode{\exposid{data_}} with \tcode{to_address(first)} and +\tcode{\exposid{size_}} with \tcode{count}. \pnum \throws @@ -17697,8 +17742,8 @@ \pnum \effects -Initializes \tcode{data_} with \tcode{to_address(first)} and -\tcode{size_} with \tcode{last - first}. +Initializes \tcode{\exposid{data_}} with \tcode{to_address(first)} and +\tcode{\exposid{size_}} with \tcode{last - first}. \pnum \throws @@ -17775,8 +17820,8 @@ \pnum \effects -Initializes \tcode{data_} with \tcode{ranges::data(r)} and -\tcode{size_} with \tcode{ranges::size(r)}. +Initializes \tcode{\exposid{data_}} with \tcode{ranges::data(r)} and +\tcode{\exposid{size_}} with \tcode{ranges::size(r)}. \pnum \throws @@ -17845,7 +17890,7 @@ \tcode{size() == other.size() \&\& data() == other.data()}. \end{itemdescr} -\rSec3[span.deduct]{Deduction guides} +\rSec4[span.deduct]{Deduction guides} \indexlibrary{\idxcode{span}!deduction guide}% \begin{itemdecl} @@ -17871,7 +17916,7 @@ \tcode{R} satisfies \tcode{ranges::\libconcept{contiguous_range}}. \end{itemdescr} -\rSec3[span.sub]{Subviews} +\rSec4[span.sub]{Subviews} \indexlibrarymember{span}{first}% \begin{itemdecl} @@ -18004,7 +18049,7 @@ \end{codeblock} \end{itemdescr} -\rSec3[span.obs]{Observers} +\rSec4[span.obs]{Observers} \indexlibrarymember{span}{size}% \begin{itemdecl} @@ -18014,7 +18059,7 @@ \begin{itemdescr} \pnum \effects -Equivalent to: \tcode{return size_;} +Equivalent to: \tcode{return \exposid{size_};} \end{itemdescr} \indexlibrarymember{span}{size_bytes}% @@ -18039,7 +18084,7 @@ Equivalent to: \tcode{return size() == 0;} \end{itemdescr} -\rSec3[span.elem]{Element access} +\rSec4[span.elem]{Element access} \indexlibrary{\idxcode{operator[]}!\idxcode{span}}% \begin{itemdecl} @@ -18094,10 +18139,10 @@ \begin{itemdescr} \pnum \effects -Equivalent to: \tcode{return data_;} +Equivalent to: \tcode{return \exposid{data_};} \end{itemdescr} -\rSec3[span.iterators]{Iterator support} +\rSec4[span.iterators]{Iterator support} \indexlibrarymember{iterator}{span}% \begin{itemdecl} @@ -18167,7 +18212,6 @@ Equivalent to: \tcode{return reverse_iterator(begin());} \end{itemdescr} - \rSec3[span.objectrep]{Views of object representation} \indexlibraryglobal{as_bytes}% @@ -18202,36 +18246,9 @@ where \tcode{R} is the return type. \end{itemdescr} -\rSec2[mdspan.syn]{Header \tcode{} synopsis} +\rSec2[views.multidim]{Multidimensional access} -\indexheader{mdspan}% -\begin{codeblock} -namespace std { - // \ref{mdspan.extents}, class template \tcode{extents} - template - class extents; - - // \ref{mdspan.extents.dextents}, alias template \tcode{dextents} - template - using dextents = @\seebelow@; - - // \ref{mdspan.layout}, layout mapping - struct layout_left; - struct layout_right; - struct layout_stride; - - // \ref{mdspan.accessor.default}, class template \tcode{default_accessor} - template - class default_accessor; - - // \ref{mdspan.mdspan}, class template \tcode{mdspan} - template> - class mdspan; -} -\end{codeblock} - -\rSec2[mdspan.overview]{Overview} +\rSec3[mdspan.overview]{Overview} \pnum A \defnadj{multidimensional}{index space} is @@ -18262,9 +18279,38 @@ in the interval $[L_i, U_i)$ of $S$. \end{itemize} -\rSec2[mdspan.extents]{Class template \tcode{extents}} +\rSec3[mdspan.syn]{Header \tcode{} synopsis} + +\indexheader{mdspan}% +\begin{codeblock} +namespace std { + // \ref{mdspan.extents}, class template \tcode{extents} + template + class extents; + + // \ref{mdspan.extents.dextents}, alias template \tcode{dextents} + template + using dextents = @\seebelow@; + + // \ref{mdspan.layout}, layout mapping + struct layout_left; + struct layout_right; + struct layout_stride; -\rSec3[mdspan.extents.overview]{Overview} + // \ref{mdspan.accessor.default}, class template \tcode{default_accessor} + template + class default_accessor; + + // \ref{mdspan.mdspan}, class template \tcode{mdspan} + template> + class mdspan; +} +\end{codeblock} + +\rSec3[mdspan.extents]{Class template \tcode{extents}} + +\rSec4[mdspan.extents.overview]{Overview} The class template \tcode{extents} represents a multidimensional index space of rank equal to \tcode{sizeof...(Extents)}. @@ -18350,10 +18396,10 @@ The $r^\text{th}$ interval of the multidimensional index space represented by an \tcode{extents} object is $[0, D_r)$. -\rSec3[mdspan.extents.expo]{Exposition-only helpers} +\rSec4[mdspan.extents.expo]{Exposition-only helpers} \begin{itemdecl} -static constexpr rank_type @\exposid{dynamic-index}@(rank_type i) noexcept; // \expos +static constexpr rank_type @\exposid{dynamic-index}@(rank_type i) noexcept; \end{itemdecl} \begin{itemdescr} @@ -18367,7 +18413,7 @@ \end{itemdescr} \begin{itemdecl} -static constexpr rank_type @\exposid{dynamic-index-inv}@(rank_type i) noexcept; // \expos +static constexpr rank_type @\exposid{dynamic-index-inv}@(rank_type i) noexcept; \end{itemdecl} \begin{itemdescr} @@ -18382,7 +18428,7 @@ \end{itemdescr} \begin{itemdecl} -constexpr size_t @\exposid{fwd-prod-of-extents}@(rank_type i) const noexcept; // \expos +constexpr size_t @\exposid{fwd-prod-of-extents}@(rank_type i) const noexcept; \end{itemdecl} \begin{itemdescr} @@ -18398,7 +18444,7 @@ \end{itemdescr} \begin{itemdecl} -constexpr size_t @\exposid{rev-prod-of-extents}@(rank_type i) const noexcept; // \expos +constexpr size_t @\exposid{rev-prod-of-extents}@(rank_type i) const noexcept; \end{itemdecl} \begin{itemdescr} @@ -18416,7 +18462,7 @@ \begin{itemdecl} template - static constexpr auto @\exposid{index-cast}@(OtherIndexType&& i) noexcept; // \expos + static constexpr auto @\exposid{index-cast}@(OtherIndexType&& i) noexcept; \end{itemdecl} \begin{itemdescr} @@ -18438,7 +18484,7 @@ \end{note} \end{itemdescr} -\rSec3[mdspan.extents.cons]{Constructors} +\rSec4[mdspan.extents.cons]{Constructors} \indexlibraryctor{extents}% \begin{itemdecl} @@ -18490,7 +18536,7 @@ \indexlibraryctor{extents}% \begin{itemdecl} template - explicit constexpr extents(OtherIndexTypes... exts) noexcept; + constexpr explicit extents(OtherIndexTypes... exts) noexcept; \end{itemdecl} \begin{itemdescr} @@ -18583,11 +18629,11 @@ \item If \tcode{N} equals \tcode{dynamic_rank()}, for all $d$ in the range $[0, \tcode{rank_dynamic()})$, -direct-non-list-initializes \tcode{\exposidnc{dynamic-extent}[$d$]} +direct-non-list-initializes \tcode{\exposidnc{dynamic-extents}[$d$]} with \tcode{as_const(exts[$d$])}. \item Otherwise, for all $d$ in the range $[0, \tcode{rank_dynamic()})$, -direct-non-list-initializes \exposidnc{dynamic-ex\-tent}\tcode{[$d$]} +direct-non-list-initializes \exposidnc{dynamic-ex\-tents}\tcode{[$d$]} with \tcode{as_const(exts[\exposidnc{dynamic-index-inv}($d$)])}. \end{itemize} \end{itemdescr} @@ -18608,7 +18654,7 @@ The deduced type is \tcode{dextents}. \end{itemdescr} -\rSec3[mdspan.extents.obs]{Observers of the multidimensional index space} +\rSec4[mdspan.extents.obs]{Observers of the multidimensional index space} \indexlibrarymember{static_extent}{extents}% \begin{itemdecl} @@ -18640,7 +18686,7 @@ $D_\tcode{i}$. \end{itemdescr} -\rSec3[mdspan.extents.cmp]{Comparison operators} +\rSec4[mdspan.extents.cmp]{Comparison operators} \indexlibrarymember{operator==}{extents}% \begin{itemdecl} @@ -18658,7 +18704,7 @@ otherwise \tcode{false}. \end{itemdescr} -\rSec3[mdspan.extents.dextents]{Alias template \tcode{dextents}} +\rSec4[mdspan.extents.dextents]{Alias template \tcode{dextents}} \indexlibraryglobal{dextents}% \begin{itemdecl} @@ -18674,9 +18720,9 @@ \tcode{E::index_type} denotes \tcode{IndexType}. \end{itemdescr} -\rSec2[mdspan.layout]{Layout mapping} +\rSec3[mdspan.layout]{Layout mapping} -\rSec3[mdspan.layout.general]{General} +\rSec4[mdspan.layout.general]{General} \pnum In subclauses \ref{mdspan.layout.reqmts} and \ref{mdspan.layout.policy.reqmts}: @@ -18714,7 +18760,7 @@ is_same_v, Mapping>; \end{codeblock} -\rSec3[mdspan.layout.reqmts]{Requirements} +\rSec4[mdspan.layout.reqmts]{Requirements} \pnum A type \tcode{M} meets the \defn{layout mapping} requirements if @@ -18979,7 +19025,7 @@ \end{note} \end{itemdescr} -\rSec3[mdspan.layout.policy.reqmts]{Layout mapping policy requirements} +\rSec4[mdspan.layout.policy.reqmts]{Layout mapping policy requirements} \pnum A type \tcode{MP} meets the \defn{layout mapping policy} requirements @@ -18990,7 +19036,7 @@ denotes the type \tcode{MP} and the \grammarterm{qualified-id} \tcode{X::extents_type} denotes \tcode{E}. -\rSec3[mdspan.layout.policy.overview]{Layout mapping policies} +\rSec4[mdspan.layout.policy.overview]{Layout mapping policies} \begin{codeblock} namespace std { @@ -19013,9 +19059,9 @@ Each of \tcode{layout_left}, \tcode{layout_right}, and \tcode{layout_stride} meets the layout mapping policy requirements and is a trivial type. -\rSec3[mdspan.layout.left]{Class template \tcode{layout_left::mapping}} +\rSec4[mdspan.layout.left]{Class template \tcode{layout_left::mapping}} -\rSec4[mdspan.layout.left.overview]{Overview} +\rSec5[mdspan.layout.left.overview]{Overview} \pnum \tcode{layout_left} provides a layout mapping @@ -19084,7 +19130,7 @@ \tcode{layout_left::mapping} is a trivially copyable type that models \libconcept{regular} for each \tcode{E}. -\rSec4[mdspan.layout.left.cons]{Constructors} +\rSec5[mdspan.layout.left.cons]{Constructors} \indexlibraryctor{layout_left::mapping}% \begin{itemdecl} @@ -19181,7 +19227,7 @@ Direct-non-list-initializes \exposid{extents_} with \tcode{other.extents()}. \end{itemdescr} -\rSec4[mdspan.layout.left.obs]{Observers} +\rSec5[mdspan.layout.left.obs]{Observers} \indexlibrarymember{required_span_size}{layout_left::mapping}% \begin{itemdecl} @@ -19265,9 +19311,9 @@ Equivalent to: \tcode{return x.extents() == y.extents();} \end{itemdescr} -\rSec3[mdspan.layout.right]{Class template \tcode{layout_right::mapping}} +\rSec4[mdspan.layout.right]{Class template \tcode{layout_right::mapping}} -\rSec4[mdspan.layout.right.overview]{Overview} +\rSec5[mdspan.layout.right.overview]{Overview} \pnum \tcode{layout_right} provides a layout mapping @@ -19336,7 +19382,7 @@ \tcode{layout_right::mapping} is a trivially copyable type that models \libconcept{regular} for each \tcode{E}. -\rSec4[mdspan.layout.right.cons]{Constructors} +\rSec5[mdspan.layout.right.cons]{Constructors} \indexlibraryctor{layout_right::mapping}% \begin{itemdecl} @@ -19433,7 +19479,7 @@ Direct-non-list-initializes \exposid{extents_} with \tcode{other.extents()}. \end{itemdescr} -\rSec4[mdspan.layout.right.obs]{Observers} +\rSec5[mdspan.layout.right.obs]{Observers} \indexlibrarymember{required_span_size}{layout_right::mapping}% \begin{itemdecl} @@ -19517,9 +19563,9 @@ Equivalent to: \tcode{return x.extents() == y.extents();} \end{itemdescr} -\rSec3[mdspan.layout.stride]{Class template \tcode{layout_stride::mapping}} +\rSec4[mdspan.layout.stride]{Class template \tcode{layout_stride::mapping}} -\rSec4[mdspan.layout.stride.overview]{Overview} +\rSec5[mdspan.layout.stride.overview]{Overview} \pnum \tcode{layout_stride} provides a layout mapping @@ -19590,7 +19636,7 @@ \tcode{layout_stride::mapping} is a trivially copyable type that models \libconcept{regular} for each \tcode{E}. -\rSec4[mdspan.layout.stride.expo]{Exposition-only helpers} +\rSec5[mdspan.layout.stride.expo]{Exposition-only helpers} \pnum Let \tcode{\exposid{REQUIRED-SPAN-SIZE}(e, strides)} be: @@ -19651,7 +19697,7 @@ have a return type of \tcode{bool}. \end{note} -\rSec4[mdspan.layout.stride.cons]{Constructors} +\rSec5[mdspan.layout.stride.cons]{Constructors} \indexlibraryctor{layout_stride::mapping}% \begin{itemdecl} @@ -19754,7 +19800,7 @@ \end{codeblock} \end{itemdescr} -\rSec4[mdspan.layout.stride.obs]{Observers} +\rSec5[mdspan.layout.stride.obs]{Observers} \indexlibrarymember{required_span_size}{layout_stride::mapping}% \begin{itemdecl} @@ -19857,9 +19903,9 @@ Otherwise, \tcode{false}. \end{itemdescr} -\rSec2[mdspan.accessor]{Accessor policy} +\rSec3[mdspan.accessor]{Accessor policy} -\rSec3[mdspan.accessor.general]{General} +\rSec4[mdspan.accessor.general]{General} \pnum An \defn{accessor policy} defines types and operations by which @@ -19889,7 +19935,7 @@ \tcode{n}, \tcode{i}, and \tcode{j} each denote values of type \tcode{size_t}. \end{itemize} -\rSec3[mdspan.accessor.reqmts]{Requirements} +\rSec4[mdspan.accessor.reqmts]{Requirements} \pnum A type \tcode{A} meets the accessor policy requirements if @@ -20018,9 +20064,9 @@ The expression is equality-preserving. \end{itemdescr} -\rSec3[mdspan.accessor.default]{Class template \tcode{default_accessor}} +\rSec4[mdspan.accessor.default]{Class template \tcode{default_accessor}} -\rSec4[mdspan.accessor.default.overview]{Overview} +\rSec5[mdspan.accessor.default.overview]{Overview} \begin{codeblock} namespace std { @@ -20057,7 +20103,7 @@ an object of type \tcode{default_accessor} if and only if \range{p}{p + $n$} is a valid range. -\rSec4[mdspan.accessor.default.members]{Members} +\rSec5[mdspan.accessor.default.members]{Members} \indexlibraryctor{default_accessor}% \begin{itemdecl} @@ -20094,16 +20140,17 @@ Equivalent to: \tcode{return p + i;} \end{itemdescr} -\rSec2[mdspan.mdspan]{Class template \tcode{mdspan}} +\rSec3[mdspan.mdspan]{Class template \tcode{mdspan}} -\rSec3[mdspan.mdspan.overview]{Overview} +\rSec4[mdspan.mdspan.overview]{Overview} \pnum \tcode{mdspan} is a view of a multidimensional array of elements. \begin{codeblock} namespace std { - template + template> class mdspan { public: using extents_type = Extents; @@ -20265,7 +20312,7 @@ its \tcode{accessor_type}, \tcode{mapping_type}, and \tcode{data_handle_type} are trivially copyable types. -\rSec3[mdspan.mdspan.cons]{Constructors} +\rSec4[mdspan.mdspan.cons]{Constructors} \indexlibraryctor{mdspan}% \begin{itemdecl} @@ -20536,7 +20583,7 @@ \end{codeblock} \end{itemdescr} -\rSec3[mdspan.mdspan.members]{Members} +\rSec4[mdspan.mdspan.members]{Members} \indexlibrarymember{operator[]}{mdspan}% \begin{itemdecl} diff --git a/source/declarations.tex b/source/declarations.tex index 52b5847d64..a63c317a72 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -19,14 +19,17 @@ \begin{bnf} \nontermdef{declaration}\br + name-declaration\br + special-declaration +\end{bnf} + +\begin{bnf} +\nontermdef{name-declaration}\br block-declaration\br nodeclspec-function-declaration\br function-definition\br template-declaration\br deduction-guide\br - explicit-instantiation\br - explicit-specialization\br - export-declaration\br linkage-specification\br namespace-definition\br empty-declaration\br @@ -34,6 +37,13 @@ module-import-declaration \end{bnf} +\begin{bnf} +\nontermdef{special-declaration}\br + explicit-instantiation\br + explicit-specialization\br + export-declaration +\end{bnf} + \begin{bnf} \nontermdef{block-declaration}\br simple-declaration\br @@ -172,11 +182,19 @@ \pnum A \grammarterm{simple-declaration} with an \grammarterm{identifier-list} is called a \defn{structured binding declaration}\iref{dcl.struct.bind}. -If the \grammarterm{decl-specifier-seq} contains -any \grammarterm{decl-specifier} other than -\keyword{static}, \keyword{thread_local}, \keyword{auto}\iref{dcl.spec.auto}, or -\grammarterm{cv-qualifier}{s}, -the program is ill-formed. +Each \grammarterm{decl-specifier} in the \grammarterm{decl-specifier-seq} +shall be +\tcode{static}, +\tcode{thread_local}, +\tcode{auto}\iref{dcl.spec.auto}, or +a \grammarterm{cv-qualifier}. +\begin{example} +\begin{codeblock} +template concept C = true; +C auto [x, y] = std::pair{1, 2}; // error: constrained \grammarterm{placeholder-type-specifier} + // not permitted for structured bindings +\end{codeblock} +\end{example} The \grammarterm{initializer} shall be of the form ``\tcode{=} \grammarterm{assignment-expression}'', of the form ``\tcode{\{} \grammarterm{assignment-expression} \tcode{\}}'', @@ -759,8 +777,10 @@ used in the declaration of a function declares that function to be a \defnx{constexpr function}{specifier!\idxcode{constexpr}!function}. +\begin{note} A function or constructor declared with the \keyword{consteval} specifier -is called an \defnadj{immediate}{function}. +is an immediate function\iref{expr.const}. +\end{note} A destructor, an allocation function, or a deallocation function shall not be declared with the \keyword{consteval} specifier. @@ -1348,11 +1368,6 @@ class-key \opt{attribute-specifier-seq} \opt{nested-name-specifier} identifier\br class-key simple-template-id\br class-key nested-name-specifier \opt{\keyword{template}} simple-template-id\br - elaborated-enum-specifier -\end{bnf} - -\begin{bnf} -\nontermdef{elaborated-enum-specifier}\br \keyword{enum} \opt{nested-name-specifier} identifier \end{bnf} @@ -2323,12 +2338,16 @@ \pnum The ambiguity arising from the similarity between a function-style cast and a declaration mentioned in~\ref{stmt.ambig} can also occur in the context of a declaration. -In that context, the choice is between a function declaration with -a redundant set of parentheses around a parameter name and an object declaration -with a function-style cast as the initializer. +In that context, the choice is between +an object declaration +with a function-style cast as the initializer and +a declaration involving a function declarator +with a redundant set of parentheses around a parameter name. Just as for the ambiguities mentioned in~\ref{stmt.ambig}, -the resolution is to consider any construct that could possibly -be a declaration a declaration. +the resolution is to consider any construct, +such as the potential parameter declaration, +that could possibly be a declaration +to be a declaration. \begin{note} A declaration can be explicitly disambiguated by adding parentheses around the argument. @@ -3380,9 +3399,9 @@ \begin{bnf} \nontermdef{parameter-declaration}\br \opt{attribute-specifier-seq} \opt{\keyword{this}} decl-specifier-seq declarator\br - \opt{attribute-specifier-seq} \opt{\keyword{this}} decl-specifier-seq declarator \terminal{=} initializer-clause\br + \opt{attribute-specifier-seq} decl-specifier-seq declarator \terminal{=} initializer-clause\br \opt{attribute-specifier-seq} \opt{\keyword{this}} decl-specifier-seq \opt{abstract-declarator}\br - \opt{attribute-specifier-seq} \opt{\keyword{this}} decl-specifier-seq \opt{abstract-declarator} \terminal{=} initializer-clause + \opt{attribute-specifier-seq} decl-specifier-seq \opt{abstract-declarator} \terminal{=} initializer-clause \end{bnf} The optional \grammarterm{attribute-specifier-seq} in a \grammarterm{parameter-declaration} @@ -3997,7 +4016,12 @@ copy-initialization semantics\iref{dcl.init}. The names in the default argument are looked up, and the semantic constraints are checked, -at the point where the default argument appears. +at the point where the default argument appears, except that +an immediate invocation\iref{expr.const} that +is a potentially-evaluated subexpression\iref{intro.execution} of +the \grammarterm{initializer-clause} in a \grammarterm{parameter-declaration} is +neither evaluated +nor checked for whether it is a constant expression at that point. Name lookup and checking of semantic constraints for default arguments of templated functions are performed as described in~\ref{temp.inst}. \begin{example} @@ -4455,7 +4479,8 @@ as well as in argument passing, function return, throwing an exception\iref{except.throw}, handling an exception\iref{except.handle}, -and aggregate member initialization\iref{dcl.init.aggr}, +and aggregate member initialization other than by a +\grammarterm{designated-initializer-clause}\iref{dcl.init.aggr}, is called \defn{copy-initialization}. \begin{note} @@ -4548,7 +4573,7 @@ is the same class as the class of the destination, the initializer expression is used to initialize the destination object. \begin{example} -\tcode{T x = T(T(T()));} calls the \tcode{T} default constructor to initialize \tcode{x}. +\tcode{T x = T(T(T()));} value-initializes \tcode{x}. \end{example} \item Otherwise, if the initialization is direct-initialization, @@ -4676,10 +4701,26 @@ \end{note} \end{itemize} +\pnum +An immediate invocation\iref{expr.const} that is not evaluated where +it appears\iref{dcl.fct.default,class.mem.general} +is evaluated and checked for whether it is +a constant expression at the point where +the enclosing \grammarterm{initializer} is used in +a function call, a constructor definition, or an aggregate initialization. + \pnum An \grammarterm{initializer-clause} followed by an ellipsis is a pack expansion\iref{temp.variadic}. +\pnum +Initialization includes +the evaluation of all subexpressions of +each \grammarterm{initializer-clause} of +the initializer (possibly nested within \grammarterm{braced-init-list}{s}) and +the creation of any temporary objects for +function arguments or return values\iref{class.temporary}. + \pnum If the initializer is a parenthesized \grammarterm{expression-list}, the expressions are evaluated in the order @@ -4736,9 +4777,9 @@ \item no private or protected direct non-static data members\iref{class.access}, \item -no virtual functions\iref{class.virtual}, and +no private or protected direct base classes\iref{class.access.base}, and \item -no virtual, private, or protected base classes\iref{class.mi}. +no virtual functions\iref{class.virtual} or virtual base classes\iref{class.mi}. \end{itemize} \begin{note} Aggregate initialization does not allow accessing @@ -4790,7 +4831,7 @@ the initializer list is a brace-enclosed \grammarterm{designated-initializer-list}, the element is initialized by the -\grammarterm{designated-initializer-list} \tcode{\{ }\placeholder{D}\tcode{ \}}, +\grammarterm{braced-init-list} \tcode{\{ }\placeholder{D}\tcode{ \}}, where \placeholder{D} is the \grammarterm{designated-initializer-clause} naming a member of the anonymous union member. There shall be only one such \grammarterm{designated-initializer-clause}. @@ -4818,6 +4859,11 @@ a narrowing conversion\iref{dcl.init.list} is required to convert the expression, the program is ill-formed. \begin{note} +If the initialization is by \grammarterm{designated-initializer-clause}, +its form determines whether copy-initialization or direct-initialization +is performed. +\end{note} +\begin{note} If an initializer is itself an initializer list, the element is list-initialized, which will result in a recursive application of the rules in this subclause if the element is an aggregate. @@ -5809,11 +5855,11 @@ \end{example} \item Otherwise, if \tcode{T} is a reference type, a prvalue is generated. -The prvalue initializes its result object by copy-list-initialization. +The prvalue initializes its result object by copy-list-initialization from the initializer list. The prvalue is then used to direct-initialize the reference. -The type of the temporary is the type referenced by \tcode{T}, +The type of the prvalue is the type referenced by \tcode{T}, unless \tcode{T} is ``reference to array of unknown bound of \tcode{U}'', -in which case the type of the temporary is +in which case the type of the prvalue is the type of \tcode{x} in the declaration \tcode{U x[] $H$}, where $H$ is the initializer list. \begin{note} @@ -5975,8 +6021,18 @@ original type, or \item from an integer type or unscoped enumeration type to an integer type that cannot -represent all the values of the original type, except where the source is a constant +represent all the values of the original type, except where +\begin{itemize} +\item +the source is a bit-field whose width $w$ is less than that of its type +(or, for an enumeration type, its underlying type) and +the target type can represent all the values +of a hypothetical extended integer type +with width $w$ and with the same signedness as the original type or +\item +the source is a constant expression whose value after integral promotions will fit into the target type, or +\end{itemize} \item from a pointer type or a pointer-to-member type to \tcode{bool}. \end{itemize} @@ -6156,35 +6212,33 @@ \pnum An explicitly defaulted special member function $\tcode{F}_1$ -with type $\tcode{T}_1$ is allowed to differ from the corresponding special member function $\tcode{F}_2$ -with type $\tcode{T}_2$ that would have been implicitly declared, as follows: \begin{itemize} \item - $\tcode{T}_1$ and $\tcode{T}_2$ may have differing \grammarterm{ref-qualifier}{s}; + $\tcode{F}_1$ and $\tcode{F}_2$ may have differing \grammarterm{ref-qualifier}{s}; \item if $\tcode{F}_2$ has an implicit object parameter of type ``reference to \tcode{C}'', $\tcode{F}_1$ may be an explicit object member function whose explicit object parameter is of type ``reference to \tcode{C}'', - in which case $\tcode{T}_1$ would differ from $\tcode{T}_2$ - in that $\tcode{T}_1$ has an additional parameter; + in which case the type of $\tcode{F}_1$ would differ from the type of $\tcode{F}_2$ + in that the type of $\tcode{F}_1$ has an additional parameter; \item - $\tcode{T}_1$ and $\tcode{T}_2$ may have differing exception specifications; and + $\tcode{F}_1$ and $\tcode{F}_2$ may have differing exception specifications; and \item if $\tcode{F}_2$ has a non-object parameter of type \tcode{const C\&}, the corresponding non-object parameter of $\tcode{F}_1$ may be of type \tcode{C\&}. \end{itemize} -If $\tcode{T}_1$ differs from $\tcode{T}_2$ in a way +If the type of $\tcode{F}_1$ differs from the type of $\tcode{F}_2$ in a way other than as allowed by the preceding rules, then: \begin{itemize} \item if $\tcode{F}_1$ is an assignment operator, and - the return type of $\tcode{T}_1$ differs from - the return type of $\tcode{T}_2$ or + the return type of $\tcode{F}_1$ differs from + the return type of $\tcode{F}_2$ or $\tcode{F}_1${'s} non-object parameter type is not a reference, the program is ill-formed; \item @@ -6231,7 +6285,7 @@ Explicitly-defaulted functions and implicitly-declared functions are collectively called \defn{defaulted} functions, and the implementation shall provide implicit definitions -for them\iref{class.ctor,class.dtor,class.copy.ctor,class.copy.assign}, +for them\iref{class.ctor,class.dtor,class.copy.ctor,class.copy.assign} as described below, including possibly defining them as deleted. A defaulted prospective destructor\iref{class.dtor} that is not a destructor is defined as deleted. @@ -6243,8 +6297,12 @@ \defn{user-provided} if it is user-declared and not explicitly defaulted or deleted on its first declaration. A user-provided explicitly-defaulted function (i.e., explicitly defaulted after its first declaration) -is defined at the point where it is explicitly defaulted; if such a function is implicitly +is implicitly defined at the point where it is explicitly defaulted; if such a function is implicitly defined as deleted, the program is ill-formed. +A non-user-provided defaulted function +(i.e. implicitly declared or explicitly defaulted in the class) +that is not defined as deleted is implicitly defined when it is odr-used\iref{basic.def.odr} +or needed for constant evaluation\iref{expr.const}. \begin{note} Declaring a function as defaulted after its first declaration can provide efficient execution and concise @@ -6448,19 +6506,20 @@ where \begin{itemize} \item +\indextext{coroutine!await expression}% the \grammarterm{await-expression} containing the call to \tcode{initial_suspend} -is the \defn{initial suspend point}, and +is the \defnadj{initial}{await expression}, and \item the \grammarterm{await-expression} containing the call to \tcode{final_suspend} -is the \defn{final suspend point}, and +is the \defnadj{final}{await expression}, and \item \placeholder{initial-await-resume-called} is initially \tcode{false} and is set to \tcode{true} immediately before the evaluation of the \placeholder{await-resume} expression\iref{expr.await} -of the initial suspend point, and +of the initial await expression, and \item \placeholder{promise-type} denotes the promise type, and \item @@ -6476,7 +6535,19 @@ constructor is found\iref{over.match.viable}, then \placeholder{promise-constructor-arguments} is \tcode{($\tcode{q}_1$, $\dotsc$, $\tcode{q}_n$)}, otherwise -\placeholder{promise-constructor-arguments} is empty. +\placeholder{promise-constructor-arguments} is empty, and +\item +a coroutine is suspended at the \defnadj{initial}{suspend point} if +it is suspended at the initial await expression, and +\item +a coroutine is suspended at a \defnadj{final}{suspend point} if +it is suspended +\begin{itemize} +\item +at a final await expression or +\item +due to an exception exiting from \tcode{unhandled_exception()}. +\end{itemize} \end{itemize} \pnum @@ -6504,7 +6575,7 @@ a resumption member function\iref{coroutine.handle.resumption} of a coroutine handle\iref{coroutine.handle} that refers to the coroutine. -The function that invoked a resumption member function is +The evaluation that invoked a resumption member function is called the \defnx{resumer}{coroutine!resumer}. Invoking a resumption member function for a coroutine that is not suspended results in undefined behavior. @@ -6642,7 +6713,8 @@ \pnum If the evaluation of the expression \tcode{\exposid{promise}.unhandled_exception()} exits via an exception, -the coroutine is considered suspended at the final suspend point. +the coroutine is considered suspended at the final suspend point +and the exception propagates to the caller or resumer. \pnum The expression \keyword{co_await} \tcode{\exposid{promise}.final_suspend()} @@ -7027,6 +7099,15 @@ this range. \end{footnote} +\pnum +An enumeration has +the same size, +value representation, and +alignment requirements\iref{basic.align} +as its underlying type. +Furthermore, each value of an enumeration has the same representation +as the corresponding value of the underlying type. + \pnum Two enumeration types are \defnx{layout-compatible enumerations}{layout-compatible!enumeration} if they have the same underlying type. @@ -7102,13 +7183,23 @@ \begin{bnf} \nontermdef{using-enum-declaration}\br - \terminal{using} elaborated-enum-specifier \terminal{;} + \keyword{using} \keyword{enum} using-enum-declarator \terminal{;} +\end{bnf} + +\begin{bnf} +\nontermdef{using-enum-declarator}\br + \opt{nested-name-specifier} identifier\br + \opt{nested-name-specifier} simple-template-id \end{bnf} \pnum -The \grammarterm{elaborated-enum-specifier} -shall not name a dependent type -and the type shall have a reachable \grammarterm{enum-specifier}. +A \grammarterm{using-enum-declarator} +names the set of declarations found by +lookup\iref{basic.lookup.unqual,basic.lookup.qual} +for the \grammarterm{using-enum-declarator}. +The \grammarterm{using-enum-declarator} +shall designate a non-dependent type +with a reachable \grammarterm{enum-specifier}. \pnum A \grammarterm{using-enum-declaration} @@ -8070,7 +8161,7 @@ \begin{bnf} \nontermdef{linkage-specification}\br \keyword{extern} string-literal \terminal{\{} \opt{declaration-seq} \terminal{\}}\br - \keyword{extern} string-literal declaration + \keyword{extern} string-literal name-declaration \end{bnf} The \grammarterm{string-literal} indicates the required language linkage. @@ -8104,9 +8195,6 @@ \end{example} \pnum -A \grammarterm{module-import-declaration} -shall not be directly contained in -a \grammarterm{linkage-specification}. A \grammarterm{module-import-declaration} appearing in a linkage specification with other than \Cpp{} language linkage is conditionally-supported with @@ -8124,7 +8212,7 @@ In a \grammarterm{linkage-specification}, the specified language linkage applies to the function types of all function declarators and -to all functions and variables. +to all functions and variables whose names have external linkage. \begin{example} \begin{codeblock} extern "C" // \tcode{f1} and its function type have C language linkage; @@ -8408,9 +8496,15 @@ For an \grammarterm{attribute-token} (including an \grammarterm{attribute-scoped-token}) not specified in this document, the -behavior is \impldef{behavior of non-standard attributes}. -Any \grammarterm{attribute-token} that is not recognized by the implementation +behavior is \impldef{behavior of non-standard attributes}; +any such \grammarterm{attribute-token} that is not recognized by the implementation is ignored. +\begin{note} +A program is ill-formed if it contains an \grammarterm{attribute} +specified in \ref{dcl.attr} that violates +the rules specifying to which entity or statement the attribute can apply or +the syntax rules for the attribute's \grammarterm{attribute-argument-clause}, if any. +\end{note} An \grammarterm{attribute-token} is reserved for future standardization if \begin{itemize} \item it is not an \grammarterm{attribute-scoped-token} and @@ -8691,7 +8785,8 @@ a function, a namespace, an enumeration, -an enumerator, or +an enumerator, +a concept, or a template specialization. \pnum diff --git a/source/diagnostics.tex b/source/diagnostics.tex index bb70eb8ff3..f1648bcb2d 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -493,7 +493,7 @@ \begin{note} The intent is to remain in close alignment with the POSIX standard. \end{note} -A separate \tcode{errno} value shall be provided for each thread. +A separate \tcode{errno} value is provided for each thread. \rSec2[cerrno.syn]{Header \tcode{} synopsis} @@ -674,8 +674,10 @@ the operating system or other low-level application program interfaces. \pnum -Components described in \ref{syserr} shall not change the value of +Components described in \ref{syserr} do not change the value of \tcode{errno}\iref{errno}. + +\recommended Implementations should leave the error states provided by other libraries unchanged. @@ -814,14 +816,14 @@ // \ref{syserr}, system error support template - inline constexpr bool is_error_code_enum_v = is_error_code_enum::value; + constexpr bool is_error_code_enum_v = is_error_code_enum::value; template - inline constexpr bool is_error_condition_enum_v = is_error_condition_enum::value; + constexpr bool is_error_condition_enum_v = is_error_condition_enum::value; } \end{codeblock} \pnum -The value of each \tcode{enum errc} constant shall be the same as +The value of each \tcode{enum errc} enumerator is the same as the value of the \libheader{cerrno} macro shown in the above synopsis. Whether or not the \libheader{system_error} implementation exposes the \libheader{cerrno} macros is unspecified. @@ -1120,8 +1122,9 @@ \begin{itemdescr} \pnum -\ensures -\tcode{val_ == 0} and \tcode{cat_ == \&system_category()}. +\effects +Initializes \tcode{val_} with \tcode{0} +and \tcode{cat_} with \tcode{\&system_category()}. \end{itemdescr} \indexlibraryctor{error_code}% @@ -1131,8 +1134,9 @@ \begin{itemdescr} \pnum -\ensures -\tcode{val_ == val} and \tcode{cat_ == \&cat}. +\effects +Initializes \tcode{val_} with \tcode{val} +and \tcode{cat_} with \tcode{\&cat}. \end{itemdescr} \indexlibraryctor{error_code}% @@ -1147,8 +1151,12 @@ \tcode{is_error_code_enum_v} is \tcode{true}. \pnum -\ensures -\tcode{*this == make_error_code(e)}. +\effects +Equivalent to: +\begin{codeblock} +error_code ec = make_error_code(e); +assign(ec.value(), ec.category()); +\end{codeblock} \end{itemdescr} \rSec3[syserr.errcode.modifiers]{Modifiers} @@ -1176,8 +1184,12 @@ \tcode{is_error_code_enum_v} is \tcode{true}. \pnum -\ensures -\tcode{*this == make_error_code(e)}. +\effects +Equivalent to: +\begin{codeblock} +error_code ec = make_error_code(e); +assign(ec.value(), ec.category()); +\end{codeblock} \pnum \returns @@ -1330,8 +1342,9 @@ \begin{itemdescr} \pnum -\ensures -\tcode{val_ == 0} and \tcode{cat_ == \&generic_category()}. +\effects +Initializes \tcode{val_} with \tcode{0} +and \tcode{cat_} with \tcode{\&generic_category()}. \end{itemdescr} \indexlibraryctor{error_condition}% @@ -1341,8 +1354,9 @@ \begin{itemdescr} \pnum -\ensures -\tcode{val_ == val} and \tcode{cat_ == \&cat}. +\effects +Initializes \tcode{val_} with \tcode{val} +and \tcode{cat_} with \tcode{\&cat}. \end{itemdescr} \indexlibraryctor{error_condition}% @@ -1357,8 +1371,12 @@ \tcode{is_error_condition_enum_v} is \tcode{true}. \pnum -\ensures -\tcode{*this == make_error_condition(e)}. +\effects +Equivalent to: +\begin{codeblock} +error_condition ec = make_error_condition(e); +assign(ec.value(), ec.category()); +\end{codeblock} \end{itemdescr} @@ -1387,8 +1405,12 @@ \tcode{is_error_condition_enum_v} is \tcode{true}. \pnum -\ensures -\tcode{*this == make_error_condition(e)}. +\effects +Equivalent to: +\begin{codeblock} +error_condition ec = make_error_condition(e); +assign(ec.value(), ec.category()); +\end{codeblock} \pnum \returns @@ -1730,13 +1752,9 @@ template string to_string(const basic_stacktrace& st); - template - basic_ostream& - operator<<(basic_ostream& os, const stacktrace_entry& f); - - template - basic_ostream& - operator<<(basic_ostream& os, const basic_stacktrace& st); + ostream& operator<<(ostream& os, const stacktrace_entry& f); + template + ostream& operator<<(ostream& os, const basic_stacktrace& st); namespace pmr { using stacktrace = basic_stacktrace>; @@ -2369,9 +2387,7 @@ \indexlibrarymember{operator<<}{stacktrace_entry}% \begin{itemdecl} -template -basic_ostream& - operator<<(basic_ostream& os, const stacktrace_entry& f); +ostream& operator<<(ostream& os, const stacktrace_entry& f); \end{itemdecl} \begin{itemdescr} @@ -2382,9 +2398,8 @@ \indexlibrarymember{operator<<}{basic_stacktrace}% \begin{itemdecl} -template -basic_ostream& - operator<<(basic_ostream& os, const basic_stacktrace& st); +template + ostream& operator<<(ostream& os, const basic_stacktrace& st); \end{itemdecl} \begin{itemdescr} diff --git a/source/exceptions.tex b/source/exceptions.tex index 15b2896a22..f7ce5ae44c 100644 --- a/source/exceptions.tex +++ b/source/exceptions.tex @@ -405,22 +405,51 @@ \end{example} \pnum -If the initialization or destruction of an object +If the initialization of an object other than by delegating constructor is terminated by an exception, the destructor is invoked for -each of the object's direct subobjects -and, for a complete object, virtual base class subobjects, -whose initialization has completed\iref{dcl.init} -and whose destructor has not yet begun execution, -except that in the case of destruction, the variant members of a -union-like class are not destroyed. +each of the object's subobjects +that were known to be initialized by the object's initialization and +whose initialization has completed\iref{dcl.init}. \begin{note} If such an object has a reference member that extends the lifetime of a temporary object, this ends the lifetime of the reference member, so the lifetime of the temporary object is effectively not extended. \end{note} +\indextext{subobject!initialized, known to be}% +A subobject is \defn{known to be initialized} +if its initialization is specified +\begin{itemize} +\item in \ref{class.base.init} for initialization by constructor, +\item in \ref{class.copy.ctor} for initialization by defaulted copy/move constructor, +\item in \ref{class.inhctor.init} for initialization by inherited constructor, +\item in \ref{dcl.init.aggr} for aggregate initialization, +\item in \ref{expr.prim.lambda.capture} for the initialization of +the closure object when evaluating a \grammarterm{lambda-expression}, +\item in \ref{dcl.init.general} for +default-initialization, value-initialization, or direct-initialization +of an array. +\end{itemize} +\begin{note} +This includes virtual base class subobjects +if the initialization +is for a complete object, and +can include variant members +that were nominated explicitly by +a \grammarterm{mem-initializer} or \grammarterm{designated-initializer-clause} or +that have a default member initializer. +\end{note} +If the destructor of an object is terminated by an exception, +each destructor invocation +that would be performed after executing the body of the destructor\iref{class.dtor} and +that has not yet begun execution +is performed. +\begin{note} +This includes virtual base class subobjects if +the destructor was invoked for a complete object. +\end{note} The subobjects are destroyed in the reverse order of the completion of their construction. Such destruction is sequenced before entering a handler of the \grammarterm{function-try-block} of the constructor or destructor, diff --git a/source/expressions.tex b/source/expressions.tex index ec05f026da..67edaeebf1 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -1372,15 +1372,6 @@ \end{example} \end{itemize} -\pnum -A potentially-evaluated \grammarterm{id-expression} -that denotes an immediate function\iref{dcl.constexpr} -shall appear only -\begin{itemize} -\item as a subexpression of an immediate invocation, or -\item in an immediate function context\iref{expr.const}. -\end{itemize} - \pnum For an \grammarterm{id-expression} that denotes an overload set, overload resolution is performed @@ -2358,7 +2349,7 @@ return x+2; }(); // Updates \tcode{::x} to 6, and initializes \tcode{y} to 7. -auto z = [a = 42](int a) { return 1; }; // error: parameter and local variable have the same name +auto z = [a = 42](int a) { return 1; }; // error: parameter and conceptual local variable have the same name auto counter = [i=0]() mutable -> decltype(i) { // OK, returns \tcode{int} return i++; }; @@ -2391,7 +2382,7 @@ \end{itemize} If an expression potentially references a local entity -within a scope in which it is odr-usable, +within a scope in which it is odr-usable\iref{basic.def.odr}, and the expression would be potentially evaluated if the effect of any enclosing \keyword{typeid} expressions\iref{expr.typeid} were ignored, the entity is said to be \defnx{implicitly captured}{capture!implicit} @@ -3592,7 +3583,12 @@ \pnum If \tcode{E2} is declared to have type ``reference to \tcode{T}'', then -\tcode{E1.E2} is an lvalue; the type of \tcode{E1.E2} is \tcode{T}. +\tcode{E1.E2} is an lvalue of type \tcode{T}. +If \tcode{E2} is a static data member, +\tcode{E1.E2} designates the object or function to which +the reference is bound, +otherwise \tcode{E1.E2} designates the object or function to which +the corresponding reference member of \tcode{E1} is bound. Otherwise, one of the following rules applies. \begin{itemize} @@ -3640,8 +3636,8 @@ ill-formed. \item If \tcode{E2} is a member enumerator and the type of \tcode{E2} -is \tcode{T}, the expression \tcode{E1.E2} is a prvalue. The type of -\tcode{E1.E2} is \tcode{T}. +is \tcode{T}, the expression \tcode{E1.E2} is a prvalue of type \tcode{T} +whose value is the value of the enumerator. \end{itemize} \pnum @@ -4552,13 +4548,12 @@ \pnum \indextext{expression!unary operator}% \indextext{operator!unary}% -The unary \tcode{*} operator performs \defn{indirection}: +The unary \tcode{*} operator performs \defn{indirection}. \indextext{dereferencing|see{indirection}}% -the expression to which it is applied shall be a pointer to an object -type, or a pointer to a function type and the result is an lvalue -referring to the object or function to which the expression points. If -the type of the expression is ``pointer to \tcode{T}'', the type of the -result is ``\tcode{T}''. +Its operand shall be a prvalue of type ``pointer to \tcode{T}'', +where \tcode{T} is an object or function type. +The operator yields an lvalue of type \tcode{T} +denoting the object or function to which the operand points. \begin{note} \indextext{type!incomplete}% Indirection through a pointer to an incomplete type (other than @@ -4568,7 +4563,7 @@ \end{note} \pnum -The result of each of the following unary operators is a prvalue. +Each of the following unary operators yields a prvalue. \pnum \indextext{name!address of cv-qualified}% @@ -4657,6 +4652,10 @@ of an unsigned quantity is computed by subtracting its value from $2^n$, where $n$ is the number of bits in the promoted operand. The type of the result is the type of the promoted operand. +\begin{note} +The result is the two's complement of the operand +(where operand and result are considered as unsigned). +\end{note} \pnum \indextext{operator!logical negation}% @@ -4667,15 +4666,25 @@ The type of the result is \keyword{bool}. \pnum -\indextext{signed integer representation!ones' complement}% \indextext{operator!ones' complement}% -The operand of \tcode{\~{}} shall have integral or unscoped enumeration type; the -result is the ones' complement of its operand. Integral promotions are -performed. The type of the result is the type of the promoted operand. +The operand of the \tcode{\~{}} operator shall have integral or unscoped enumeration type. +Integral promotions are performed. +The type of the result is the type of the promoted operand. +% FIXME: [basic.fundamental]/p5 uses $x_i$; [expr] uses $\tcode{x}_i$. +Given the coefficients $\tcode{x}_i$ +of the base-2 representation\iref{basic.fundamental} +of the promoted operand \tcode{x}, +the coefficient $\tcode{r}_i$ +of the base-2 representation of the result \tcode{r} +is 1 if $\tcode{x}_i$ is 0, and 0 otherwise. +\begin{note} +The result is the ones' complement of the operand +(where operand and result are considered as unsigned). +\end{note} There is an ambiguity in the grammar when \tcode{\~{}} is followed by a \grammarterm{type-name} or \grammarterm{decltype-specifier}. -The ambiguity is resolved by treating \tcode{\~{}} as the unary complement +The ambiguity is resolved by treating \tcode{\~{}} as the operator rather than as the start of an \grammarterm{unqualified-id} naming a destructor. \begin{note} @@ -4762,9 +4771,10 @@ of the enclosing coroutine and \tcode{P} is the type of that object. \item Unless -the \grammarterm{await-expression} was implicitly produced by a -\grammarterm{yield-expression}\iref{expr.yield}, an initial suspend point, -or a final suspend point\iref{dcl.fct.def.coroutine}, +the \grammarterm{await-expression} was implicitly produced by +a \grammarterm{yield-expression}\iref{expr.yield}, +an initial await expression, +or a final await expression\iref{dcl.fct.def.coroutine}, a search is performed for the name \tcode{await_transform} in the scope of \tcode{P} \iref{class.member.lookup}. If this search is performed and finds at least one declaration, @@ -4855,6 +4865,10 @@ rethrown\iref{except.throw}. Otherwise, control flow returns to the current coroutine caller or resumer\iref{dcl.fct.def.coroutine} without exiting any scopes\iref{stmt.jump}. +\indextext{coroutine!suspend point}% +The point in the coroutine +immediately prior to control returning to its caller or resumer +is a coroutine \defn{suspend point}. \item If the result of \placeholder{await-ready} is \keyword{true}, @@ -5245,7 +5259,7 @@ If the \grammarterm{expression} is erroneous after converting to \tcode{std::size_t}: \begin{itemize} \item -if the \grammarterm{expression} is a core constant expression, +if the \grammarterm{expression} is a potentially-evaluated core constant expression, the program is ill-formed; \item otherwise, an allocation function is not called; instead @@ -5697,7 +5711,8 @@ \indextext{array!\idxcode{delete}}% In an array delete expression, the value of the operand of \keyword{delete} may be a null pointer value or a pointer value that resulted from -a previous array \grammarterm{new-expression}. +a previous array \grammarterm{new-expression} whose +allocation function was not a non-allocating form\iref{new.delete.placement}. \begin{footnote} For nonzero-length arrays, this is the same as a pointer to the first @@ -6234,6 +6249,11 @@ $i - j$ of \tcode{x} if $0 \le i - j \le n$. \item Otherwise, the behavior is undefined. \end{itemize} +\begin{note} +Adding a value other than $0$ or $1$ +to a pointer to a base class subobject, a member subobject, +or a complete object results in undefined behavior. +\end{note} \pnum \indextext{\idxcode{ptrdiff_t}!implementation-defined type of}% @@ -6265,10 +6285,14 @@ For addition or subtraction, if the expressions \tcode{P} or \tcode{Q} have type ``pointer to \cv{}~\tcode{T}'', where \tcode{T} and the array element type are not similar\iref{conv.qual}, the behavior is undefined. -\begin{note} -In particular, a pointer to a base class cannot be used for -pointer arithmetic when the array contains objects of a derived class type. -\end{note} +\begin{example} +\begin{codeblock} +int arr[5] = {1, 2, 3, 4, 5}; +unsigned int *p = reinterpret_cast(arr + 1); +unsigned int k = *p; // OK, value of \tcode{k} is $2$\iref{conv.lval} +unsigned int *q = p + 1; // undefined behavior: \tcode{p} points to an \tcode{int}, not an \tcode{unsigned int} object +\end{codeblock} +\end{example} \rSec2[expr.shift]{Shift operators} @@ -6720,7 +6744,7 @@ \end{bnf} \pnum -The \tcode{\^} operator groups left-to-right. +The \tcode{\caret} operator groups left-to-right. The operands shall be of integral or unscoped enumeration type. The usual arithmetic conversions\iref{expr.arith.conv} are performed. Given the coefficients $\tcode{x}_i$ and $\tcode{y}_i$ @@ -7165,10 +7189,9 @@ The behavior of an expression of the form \tcode{E1 \placeholder{op}= E2} is equivalent to \tcode{E1 = E1 \placeholder{op} E2} except that \tcode{E1} is evaluated only once. -Such expressions are deprecated -if \tcode{E1} has volatile-qualified type -and \placeholder{op} is not one of the bitwise operators -\tcode{|}, \tcode{\&}, \tcode{\^}; see~\ref{depr.volatile.type}. +\begin{note} +The object designated by \tcode{E1} is accessed twice. +\end{note} For \tcode{+=} and \tcode{-=}, \tcode{E1} shall either have arithmetic type or be a pointer to a possibly cv-qualified completely-defined object type. In all other @@ -7300,7 +7323,7 @@ \pnum A variable is \defn{potentially-constant} if it is constexpr or -it has reference or const-qualified integral or enumeration type. +it has reference or non-volatile const-qualified integral or enumeration type. \pnum A constant-initialized potentially-constant variable $V$ is @@ -7342,7 +7365,18 @@ a control flow that passes through a declaration of a variable with static\iref{basic.stc.static} or -thread\iref{basic.stc.thread} storage duration; +thread\iref{basic.stc.thread} storage duration, +unless that variable is usable in constant expressions; +\begin{example} +\begin{codeblock} +constexpr char test() { + static const int x = 5; + static constexpr char c[] = "Hello World"; + return *(c + x); +} +static_assert(' ' == test()); +\end{codeblock} +\end{example} \item an invocation of a non-constexpr function; @@ -7582,21 +7616,17 @@ \pnum For the purposes of determining whether an expression $E$ is a core constant expression, -the evaluation of a call to a member function of \tcode{std::allocator} +the evaluation of the body of a member function of \tcode{std::allocator} as defined in \ref{allocator.members}, where \tcode{T} is a literal type, -does not disqualify $E$ from being a core constant expression, -even if the actual evaluation of such a call -would otherwise fail the requirements for a core constant expression. -Similarly, the evaluation of a call to +is ignored. +Similarly, the evaluation of the body of \tcode{std::construct_at} or -\tcode{std::ranges::construct_at}\iref{specialized.construct} -does not disqualify $E$ -from being a core constant expression unless -the first argument, of type \tcode{T*}, does not point +\tcode{std::ranges::construct_at} +is considered to include only +the underlying constructor call +if the first argument (of type \tcode{T*}) points to storage allocated with \tcode{std::allocator} or -to an object whose lifetime began within the evaluation of $E$, or -the evaluation of the underlying constructor call -disqualifies $E$ from being a core constant expression. +to an object whose lifetime began within the evaluation of $E$. \pnum During the evaluation of an expression $E$ as a core constant expression, @@ -7821,16 +7851,124 @@ \begin{itemize} \item its innermost enclosing non-block scope is -a function parameter scope of an immediate function, or +a function parameter scope of an immediate function, +\item +it is a subexpression of a manifestly constant-evaluated expression +or conversion, or \item its enclosing statement is enclosed\iref{stmt.pre} by the \grammarterm{compound-statement} of a consteval if statement\iref{stmt.if}. \end{itemize} -An expression or conversion is an \defn{immediate invocation} +An invocation is an \defn{immediate invocation} if it is a potentially-evaluated explicit or implicit invocation of an immediate function and is not in an immediate function context. -An immediate invocation shall be a constant expression. +An aggregate initialization is an immediate invocation +if it evaluates a default member initializer +that has a subexpression that is an immediate-escalating expression. + +\pnum +\indexdefn{expression!immediate-escalating}% +\indexdefn{conversion!immediate-escalating}% +\indexdefn{immediate-escalating!expression|see{expression, immediate-escalating}}% +\indexdefn{immediate-escalating!conversion|see{conversion, immediate-escalating}}% +An expression or conversion is \defn{immediate-escalating} +if it is not initially in an immediate function context +and it is either +\begin{itemize} +\item +a potentially-evaluated \grammarterm{id-expression} +that denotes an immediate function +that is not a subexpression of an immediate invocation, or +\item +an immediate invocation that is not a constant expression +and is not a subexpression of an immediate invocation. +\end{itemize} + +\pnum +\indexdefn{immediate-escalating!function|see{function, immediate-escalating}}% +An \defnx{immediate-escalating}{function!immediate-escalating} function is +\begin{itemize} +\item +the call operator of a lambda that is not declared +with the \keyword{consteval} specifier, +\item +a defaulted special member function +that is not declared with the \keyword{consteval} specifier, or +\item +a function that results from the instantiation +of a templated entity defined with the \keyword{constexpr} specifier. +\end{itemize} +An immediate-escalating expression shall appear only +in an immediate-escalating function. + +\pnum +An \defnadj{immediate}{function} is a function or constructor that is +\begin{itemize} +\item +declared with the \keyword{consteval} specifier, or +\item +an immediate-escalating function \tcode{\placeholder{F}} +whose function body contains an immediate-escalating expression \tcode{\placeholder{E}} +such that \tcode{\placeholder{E}}'s innermost enclosing non-block scope +is \tcode{\placeholder{F}}'s function parameter scope. +\end{itemize} +\begin{example} +\begin{codeblock} +consteval int id(int i) { return i; } +constexpr char id(char c) { return c; } + +template +constexpr int f(T t) { + return t + id(t); +} + +auto a = &f; // OK, \tcode{f} is not an immediate function +auto b = &f; // error: \tcode{f} is an immediate function + +static_assert(f(3) == 6); // OK + +template +constexpr int g(T t) { // \tcode{g} is not an immediate function + return t + id(42); // because \tcode{id(42)} is already a constant +} + +template +constexpr bool is_not(T t, F f) { + return not f(t); +} + +consteval bool is_even(int i) { return i % 2 == 0; } + +static_assert(is_not(5, is_even)); // OK + +int x = 0; + +template +constexpr T h(T t = id(x)) { // \tcode{h} is not an immediate function + return t; +} + +template +constexpr T hh() { // \tcode{hh} is an immediate function + return h(); +} + +int i = hh(); // error: \tcode{hh()} is an immediate-escalating expression + // outside of an immediate-escalating function + +struct A { + int x; + int y = id(x); +}; + +template +constexpr int k(int) { // \tcode{k} is not an immediate function because \tcode{A(42)} is a + return A(42).y; // constant expression and thus not immediate-escalating +} +\end{codeblock} +\end{example} + \pnum An expression or conversion is \defn{manifestly constant-evaluated} @@ -7901,8 +8039,7 @@ or \item -a subexpression of one of the above -that is not a subexpression of a nested unevaluated operand\iref{term.unevaluated.operand}. +a potentially-evaluated subexpression\iref{intro.execution} of one of the above. \end{itemize} \indextext{function!needed for constant evaluation}% @@ -7916,9 +8053,7 @@ that is potentially constant evaluated, or \item -a variable named by a potentially constant evaluated expression -that is either a constexpr variable or -is of non-volatile const-qualified integral type or of reference type. +a potentially-constant variable named by a potentially constant evaluated expression. \end{itemize} \indextext{expression|)} diff --git a/source/front.tex b/source/front.tex index ef9189eb80..5396b6397d 100644 --- a/source/front.tex +++ b/source/front.tex @@ -28,3 +28,5 @@ \let\index\oindex \setcounter{tocdepth}{5} + +\input{preface} diff --git a/source/future.tex b/source/future.tex index 093dba383e..65a3c4ac6c 100644 --- a/source/future.tex +++ b/source/future.tex @@ -104,9 +104,7 @@ brachiosaur = neck; // OK tail = brachiosaur; // OK tail = brachiosaur = neck; // deprecated -brachiosaur += neck; // deprecated -brachiosaur = brachiosaur + neck; // OK -brachiosaur |= neck; // OK, bitwise compound expression +brachiosaur += neck; // OK \end{codeblock} \end{example} @@ -1370,7 +1368,7 @@ \begin{codeblock} namespace std { template struct is_pod; - template inline constexpr bool is_pod_v = is_pod::value; + template constexpr bool is_pod_v = is_pod::value; template // \seebelow struct aligned_storage; template // \seebelow @@ -2135,6 +2133,10 @@ \end{example} \indexlibraryglobal{wstring_convert}% +\indexlibrarymember{byte_string}{wstring_convert}% +\indexlibrarymember{int_type}{wstring_convert}% +\indexlibrarymember{state_type}{wstring_convert}% +\indexlibrarymember{wide_string}{wstring_convert}% \begin{codeblock} namespace std { template, ByteAlloc>; -\end{itemdecl} - -\begin{itemdescr} -\pnum -The type shall be a synonym for \tcode{basic_string, ByteAlloc>}. -\end{itemdescr} - \indexlibrarymember{converted}{wstring_convert}% \begin{itemdecl} size_t converted() const noexcept; @@ -2263,16 +2255,6 @@ Otherwise, the member function throws an object of class \tcode{range_error}. \end{itemdescr} -\indexlibrarymember{int_type}{wstring_convert}% -\begin{itemdecl} -using int_type = typename wide_string::traits_type::int_type; -\end{itemdecl} - -\begin{itemdescr} -\pnum -The type shall be a synonym for \tcode{wide_string::traits_type::int_type}. -\end{itemdescr} - \indexlibrarymember{state}{wstring_convert}% \begin{itemdecl} state_type state() const; @@ -2284,16 +2266,6 @@ \tcode{cvtstate}. \end{itemdescr} -\indexlibrarymember{state_type}{wstring_convert}% -\begin{itemdecl} -using state_type = typename Codecvt::state_type; -\end{itemdecl} - -\begin{itemdescr} -\pnum -The type shall be a synonym for \tcode{Codecvt::state_type}. -\end{itemdescr} - \indexlibrarymember{to_bytes}{wstring_convert}% \begin{itemdecl} byte_string to_bytes(Elem wchar); @@ -2331,17 +2303,6 @@ Otherwise, the member function shall throw an object of class \tcode{range_error}. \end{itemdescr} -\indexlibrarymember{wide_string}{wstring_convert}% -\begin{itemdecl} -using wide_string = basic_string, WideAlloc>; -\end{itemdecl} - -\begin{itemdescr} -\pnum -The type shall be a synonym for \tcode{basic_string, WideAlloc>}. -\end{itemdescr} - \indexlibraryctor{wstring_convert}% \begin{itemdecl} explicit wstring_convert(Codecvt* pcvt); @@ -2392,6 +2353,7 @@ without affecting any streams or locales. \indexlibraryglobal{wbuffer_convert}% +\indexlibrarymember{state_type}{wbuffer_convert}% \begin{codeblock} namespace std { template> @@ -2478,16 +2440,6 @@ The previous value of \tcode{bufptr}. \end{itemdescr} -\indexlibrarymember{state_type}{wbuffer_convert}% -\begin{itemdecl} -using state_type = typename Codecvt::state_type; -\end{itemdecl} - -\begin{itemdescr} -\pnum -The type shall be a synonym for \tcode{Codecvt::state_type}. -\end{itemdescr} - \indexlibraryctor{wbuffer_convert}% \begin{itemdecl} explicit wbuffer_convert( diff --git a/source/intro.tex b/source/intro.tex index cce294040a..e14bda23af 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -76,7 +76,7 @@ Standard Ecma-262, third edition, 1999. \item The Unicode Consortium. -Unicode Standard Annex, UAX \#44, \doccite{Unicode Character Database}. +Unicode Standard Annex, \UAX{44}, \doccite{Unicode Character Database}. Edited by Ken Whistler and Lauren\c{t}iu Iancu. Available from: \url{http://www.unicode.org/reports/tr44/} \item @@ -127,7 +127,7 @@ at the following addresses: \begin{itemize} \item ISO Online browsing platform: available at \url{https://www.iso.org/obp} -\item IEC Electropedia: available at \url{http://www.electropedia.org} +\item IEC Electropedia: available at \url{https://www.electropedia.org/} \end{itemize} \pnum @@ -422,11 +422,6 @@ \indexdefn{construction!move}% direct-initialization of an object of some type with an rvalue of the same type -\indexdefn{character!multibyte}% -\definition{multibyte character}{defns.multibyte} -sequence of one or more bytes representing -the code unit sequence for an encoded character of the execution character set - \indexdefn{library call!non-constant}% \definition{non-constant library call}{defns.nonconst.libcall} invocation of a library function that, diff --git a/source/iostreams.tex b/source/iostreams.tex index 851476a378..c6851793ab 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -1116,6 +1116,7 @@ Init(const Init&) = default; ~Init(); Init& operator=(const Init&) = default; + private: static int init_cnt; // \expos }; @@ -1636,6 +1637,7 @@ // \ref{fpos.members}, members stateT state() const; void state(stateT); + private: stateT st; // \expos }; @@ -1700,7 +1702,7 @@ of type \tcode{P} or \tcode{const P}, \item \tcode{pl} and \tcode{ql} refer to modifiable lvalues of type \tcode{P}, \item \tcode{O} refers to type \tcode{streamoff}, and -\item \tcode{o} refers to a value +\item \tcode{o} and \tcode{o2} refer to values of type \tcode{streamoff} or \tcode{const streamoff}. \end{itemize} @@ -1725,7 +1727,7 @@ & & \effects Value-initializes the state object. \br - \ensures \tcode{p == P(o)} \\ \rowsep + \ensures \tcode{p == P(o)} is \tcode{true}. \\ \rowsep \tcode{P()} & \tcode{P} & \tcode{P(0)} & @@ -1738,8 +1740,20 @@ \tcode{streamoff} & converts to \tcode{offset} & \tcode{P(O(p)) == p} \\ \rowsep +\tcode{p == q} & + \tcode{bool} & + & + \remarks For any two values \tcode{o} and \tcode{o2}, + if \tcode{p} is obtained + from \tcode{o} converted to \tcode{P} or + from a copy of such \tcode{P} value and + if \tcode{q} is obtained + from \tcode{o2} converted to \tcode{P} or + from a copy of such \tcode{P} value, + then \tcode{p == q} is \tcode{true} + only if \tcode{o == o2} is \tcode{true}. \\ \rowsep \tcode{p != q} & - convertible to \tcode{bool} & + \tcode{bool} & \tcode{!(p == q)} & \\ \rowsep \tcode{p + o} & \tcode{P} & @@ -1846,7 +1860,6 @@ void move(basic_ios&& rhs); void swap(basic_ios& rhs) noexcept; void set_rdbuf(basic_streambuf* sb); - }; } \end{codeblock} @@ -4380,32 +4393,6 @@ They may use other public members of \tcode{istream}. -\pnum -If -\tcode{rdbuf()->sbumpc()} -or -\tcode{rdbuf()->sgetc()} -returns -\tcode{traits::eof()}, -then the input function, except as explicitly noted otherwise, completes its actions and does -\tcode{setstate(eofbit)}, -which may throw -\tcode{ios_base::failure}\iref{iostate.flags}, before returning. - -\pnum -If one of these called functions throws an exception, then unless explicitly noted otherwise, -the input function sets -\tcode{badbit} -in the error state. -If -\tcode{badbit} -is set in -\tcode{exceptions()}, -the input function -rethrows the exception without completing its actions, otherwise -it does not throw anything and proceeds as if the called function had returned -a failure indication. - \rSec4[istream.cons]{Constructors} \indexlibraryctor{basic_istream}% @@ -4491,6 +4478,7 @@ template class basic_istream::sentry { bool ok_; // \expos + public: explicit sentry(basic_istream& is, bool noskipws = false); ~sentry(); @@ -4636,7 +4624,10 @@ \rSec4[istream.formatted.reqmts]{Common requirements} \pnum -Each formatted input function begins execution by constructing an object of class +Each formatted input function begins execution by constructing +an object of type \tcode{ios_base::iostate}, termed the local error state, and +initializing it to \tcode{ios_base::goodbit}. +It then creates an object of class \tcode{sentry} with the \tcode{noskipws} @@ -4650,20 +4641,22 @@ \tcode{bool}, the function endeavors to obtain the requested input. +Otherwise, +if the \tcode{sentry} constructor exits by throwing an exception or +if the \tcode{sentry} object produces \tcode{false} +when converted to a value of type \tcode{bool}, +the function returns without attempting to obtain any input. +If \tcode{rdbuf()->sbumpc()} or \tcode{rdbuf()->sgetc()} +returns \tcode{traits::eof()}, then +\tcode{ios_base::eofbit} is set in the local error state and +the input function stops trying to obtain the requested input. If an exception is thrown during input then -\tcode{ios_base::badbit} -is turned on -\begin{footnote} -This is done without causing an -\tcode{ios_base::failure} -to be thrown. -\end{footnote} -in -\tcode{*this}'s -error state. -If -\tcode{(exceptions()\&badbit) != 0} -then the exception is rethrown. +\tcode{ios_base::badbit} is set in the local error state, +\tcode{*this}'s error state is set to the local error state, and +the exception is rethrown if \tcode{(exceptions() \& badbit) != 0}. +After extraction is done, the input function calls \tcode{setstate}, which +sets \tcode{*this}'s error state to the local error state, and +may throw an exception. In any case, the formatted input function destroys the \tcode{sentry} object. @@ -4694,12 +4687,11 @@ \tcode{num_get<>}\iref{locale.num.get} object to perform parsing the input stream data. These extractors behave as formatted input functions (as described in~\ref{istream.formatted.reqmts}). After a \tcode{sentry} object is constructed, the -conversion occurs as if performed by the following code fragment: +conversion occurs as if performed by the following code fragment, +where \tcode{state} represents the input function's local error state: \begin{codeblock} using numget = num_get>; -iostate err = iostate::goodbit; -use_facet(loc).get(*this, 0, *this, err, val); -setstate(err); +use_facet(loc).get(*this, 0, *this, state, val); \end{codeblock} In the above fragment, \tcode{loc} @@ -4732,18 +4724,16 @@ (using the same notation as for the preceding code fragment): \begin{codeblock} using numget = num_get>; -iostate err = ios_base::goodbit; long lval; -use_facet(loc).get(*this, 0, *this, err, lval); +use_facet(loc).get(*this, 0, *this, state, lval); if (lval < numeric_limits::min()) { - err |= ios_base::failbit; + state |= ios_base::failbit; val = numeric_limits::min(); } else if (numeric_limits::max() < lval) { - err |= ios_base::failbit; + state |= ios_base::failbit; val = numeric_limits::max(); } else val = static_cast(lval); -setstate(err); \end{codeblock} \end{itemdescr} @@ -4758,18 +4748,16 @@ (using the same notation as for the preceding code fragment): \begin{codeblock} using numget = num_get>; -iostate err = ios_base::goodbit; long lval; -use_facet(loc).get(*this, 0, *this, err, lval); +use_facet(loc).get(*this, 0, *this, state, lval); if (lval < numeric_limits::min()) { - err |= ios_base::failbit; + state |= ios_base::failbit; val = numeric_limits::min(); } else if (numeric_limits::max() < lval) { - err |= ios_base::failbit; + state |= ios_base::failbit; val = numeric_limits::max(); } else val = static_cast(lval); -setstate(err); \end{codeblock} \end{itemdescr} @@ -4807,19 +4795,17 @@ (using the same notation as for the preceding code fragment): \begin{codeblock} using numget = num_get>; -iostate err = ios_base::goodbit; FP fval; -use_facet(loc).get(*this, 0, *this, err, fval); +use_facet(loc).get(*this, 0, *this, state, fval); if (fval < -numeric_limits<@\placeholder{extended-floating-point-type}@>::max()) { - err |= ios_base::failbit; + state |= ios_base::failbit; val = -numeric_limits<@\placeholder{extended-floating-point-type}@>::max(); } else if (numeric_limits<@\placeholder{extended-floating-point-type}@>::max() < fval) { - err |= ios_base::failbit; + state |= ios_base::failbit; val = numeric_limits<@\placeholder{extended-floating-point-type}@>::max(); } else { val = static_cast<@\placeholder{extended-floating-point-type}@>(fval); } -setstate(err); \end{codeblock} \begin{note} When the extended floating-point type has @@ -4943,10 +4929,9 @@ \tcode{width(0)}. \pnum -If the function extracted no characters, it calls -\tcode{setstate(failbit)}, -which may throw -\tcode{ios_base::\brk{}failure}\iref{iostate.flags}. +If the function extracted no characters, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \pnum \returns @@ -4968,12 +4953,10 @@ \effects Behaves like a formatted input member (as described in~\ref{istream.formatted.reqmts}) of \tcode{in}. -After a -\tcode{sentry} -object is constructed -a character is extracted from \tcode{in}, if one is available, and stored in \tcode{c}. -Otherwise, the function calls -\tcode{in.setstate(fail\-bit)}. +A character is extracted from \tcode{in}, if one is available, and stored in \tcode{c}. +Otherwise, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \pnum \returns @@ -5009,18 +4992,9 @@ \end{itemize} \pnum -If the function inserts no characters, it calls -\tcode{setstate(failbit)}, -which may throw -\tcode{ios_base::\brk{}failure}\iref{iostate.flags}. -If it inserted no characters because it caught -an exception thrown while extracting characters from -\tcode{*this} -and -\tcode{failbit} -is set in -\tcode{exceptions()}\iref{iostate.flags}, -then the caught exception is rethrown. +If the function inserts no characters, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \pnum \returns @@ -5030,7 +5004,10 @@ \rSec3[istream.unformatted]{Unformatted input functions} \pnum -Each unformatted input function begins execution by constructing an object of class +Each unformatted input function begins execution by constructing +an object of type \tcode{ios_base::iostate}, termed the local error state, and +initializing it to \tcode{ios_base::goodbit}. +It then creates an object of class \tcode{sentry} with the default argument \tcode{noskipws} @@ -5045,7 +5022,7 @@ the function endeavors to obtain the requested input. Otherwise, if the \tcode{sentry} constructor exits by throwing an exception or if -the \tcode{sentry} object returns \tcode{false}, when converted to a value of type +the \tcode{sentry} object produces \tcode{false}, when converted to a value of type \tcode{bool}, the function returns without attempting to obtain any input. In either case the number of extracted characters is set to 0; @@ -5053,27 +5030,20 @@ an argument shall also store a null character (using \tcode{charT()}) in the first location of the array. +If \tcode{rdbuf()->sbumpc()} or \tcode{rdbuf()->sgetc()} +returns \tcode{traits::eof()}, then +\tcode{ios_base::eofbit} is set in the local error state and +the input function stops trying to obtain the requested input. If an exception is thrown during input then -\tcode{ios_base::badbit} -is turned on -\begin{footnote} -This is done without causing an -\tcode{ios_base::failure} -to be thrown. -\end{footnote} -in -\tcode{*this}'s -error state. -(Exceptions thrown from -\tcode{basic_ios<>::clear()} -are not caught or rethrown.) -If -\tcode{(exceptions()\&badbit) != 0} -then the exception is rethrown. -It also counts the number of characters extracted. -If no exception has been thrown it ends -by storing the count in a member object -and returning the value specified. +\tcode{ios_base::badbit} is set in the local error state, +\tcode{*this}'s error state is set to the local error state, and +the exception is rethrown if \tcode{(exceptions() \& badbit) != 0}. +If no exception has been thrown it +stores the number of characters extracted +in a member object. +After extraction is done, the input function calls \tcode{setstate}, which +sets \tcode{*this}'s error state to the local error state, and +may throw an exception. In any event the \tcode{sentry} object @@ -5111,10 +5081,9 @@ (as described above). After constructing a \tcode{sentry} object, extracts a character \tcode{c}, if one is available. -Otherwise, the function calls -\tcode{setstate(failbit)}, -which may throw -\tcode{ios_base::failure}\iref{iostate.flags}. +Otherwise, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \pnum \returns @@ -5142,10 +5111,9 @@ and \tcode{unsigned char}. \end{footnote} -Otherwise, the function calls -\tcode{setstate(failbit)} -(which may throw -\tcode{ios_base::failure}\iref{iostate.flags}). +Otherwise, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \pnum \returns @@ -5178,9 +5146,7 @@ \tcode{n} is less than one or \tcode{n - 1} characters are stored; \item -end-of-file occurs on the input sequence -(in which case the function calls -\tcode{setstate(eofbit)}); +end-of-file occurs on the input sequence; \item \tcode{traits::eq(c, delim)} for the next available input @@ -5189,10 +5155,9 @@ \end{itemize} \pnum -If the function stores no characters, it calls -\tcode{setstate(failbit)} -(which may throw -\tcode{ios_base::\brk{}failure}\iref{iostate.flags}). +If the function stores no characters, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. In any case, if \tcode{n} is greater than zero it then stores a null character into the next successive location of the array. @@ -5248,10 +5213,9 @@ \end{itemize} \pnum -If the function inserts no characters, it calls -\tcode{setstate(failbit)}, -which may throw -\tcode{ios_base::\brk{}failure}\iref{iostate.flags}. +If the function inserts no characters, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \pnum \returns @@ -5297,9 +5261,7 @@ Characters are extracted and stored until one of the following occurs: \begin{enumerate} \item -end-of-file occurs on the input sequence -(in which case the function calls -\tcode{setstate(eofbit)}); +end-of-file occurs on the input sequence; \item \tcode{traits::eq(c, delim)} for the next available input @@ -5329,10 +5291,9 @@ \end{footnote} \pnum -If the function extracts no characters, it calls -\tcode{setstate(failbit)} -(which may throw -\tcode{ios_base::\brk{}failure}\iref{iostate.flags}). +If the function extracts no characters, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \begin{footnote} This implies an empty input line will not cause @@ -6185,6 +6146,7 @@ template class basic_ostream::sentry { bool ok_; // \expos + public: explicit sentry(basic_ostream& os); ~sentry(); @@ -6358,7 +6320,7 @@ which can throw an exception. If an exception is thrown during output, then \tcode{ios_base::badbit} -is turned on +is set \begin{footnote} This is done without causing an \tcode{ios_base::failure} @@ -6872,6 +6834,8 @@ \indextext{undefined}% the behavior is undefined and implementations are encouraged to diagnose it. +If the native Unicode API is used, +the function flushes \tcode{os} before writing \tcode{out}. Otherwise (if \tcode{os} is not such a stream or the function is \tcode{vprint_nonunicode}), inserts the character sequence @@ -6904,7 +6868,7 @@ to generate the requested output. If an exception is thrown during output, then \tcode{ios_base::badbit} -is turned on +is set \begin{footnote} This is done without causing an \tcode{ios_base::failure} @@ -7798,6 +7762,8 @@ the behavior is undefined and implementations are encouraged to diagnose it. Otherwise writes \tcode{out} to \tcode{stream} unchanged. +If the native Unicode API is used, +the function flushes \tcode{stream} before writing \tcode{out}. \begin{note} On POSIX and Windows, \tcode{stream} referring to a terminal means that, respectively, @@ -9803,6 +9769,7 @@ ios_base::openmode which = ios_base::in | ios_base::out) override; pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override; + private: ios_base::openmode @\exposid{mode}@; // \expos std::span @\exposid{buf}@; // \expos @@ -10309,6 +10276,7 @@ std::span span() const noexcept; void span(std::span s) noexcept; + private: basic_spanbuf sb; // \expos }; @@ -10447,6 +10415,7 @@ std::span span() const noexcept; void span(std::span s) noexcept; + private: basic_spanbuf sb; // \expos }; @@ -11450,6 +11419,7 @@ void open(const string& s, ios_base::openmode mode = ios_base::in); void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in); void close(); + private: basic_filebuf sb; // \expos }; @@ -11695,6 +11665,7 @@ void open(const string& s, ios_base::openmode mode = ios_base::out); void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out); void close(); + private: basic_filebuf sb; // \expos }; @@ -13696,7 +13667,7 @@ \tcode{basic_string} or \tcode{basic_string_view}, or \item the \grammarterm{qualified-id} \tcode{iterator_traits>::value_type} is valid and -denotes a possibly \keyword{const} encoded character type\iref{temp.deduct}. +denotes a possibly const encoded character type\iref{temp.deduct}. \end{itemize} \pnum @@ -16596,7 +16567,7 @@ \pnum These functions enable use of \tcode{recursive_directory_iterator} -with range-based for statements. +with range-based \keyword{for} statements. \indexlibrarymember{begin}{recursive_directory_iterator}% \begin{itemdecl} @@ -18316,12 +18287,6 @@ \pnum \throws As specified in~\ref{fs.err.report}. - -\pnum -\remarks -Implementations should - avoid unnecessary normalization such as - when \tcode{canonical} has already been called on the entirety of \tcode{p}. \end{itemdescr} \rSec1[c.files]{C library files} diff --git a/source/iterators.tex b/source/iterators.tex index cf6b9b8374..01768a7257 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -59,7 +59,7 @@ template requires is_object_v struct iterator_traits; // freestanding template<@\exposconcept{dereferenceable}@ T> - using iter_reference_t = decltype(*declval()); // freestanding + using @\libglobal{iter_reference_t}@ = decltype(*declval()); // freestanding namespace ranges { // \ref{iterator.cust}, customization point objects @@ -76,7 +76,7 @@ requires requires(T& t) { { ranges::iter_move(t) } -> @\exposconcept{can-reference}@; } - using iter_rvalue_reference_t // freestanding + using @\libglobal{iter_rvalue_reference_t}@ // freestanding = decltype(ranges::iter_move(declval())); // \ref{iterator.concepts}, iterator concepts @@ -85,7 +85,7 @@ concept indirectly_readable = @\seebelow@; // freestanding template<@\libconcept{indirectly_readable}@ T> - using iter_common_reference_t = // freestanding + using @\libglobal{iter_common_reference_t}@ = // freestanding common_reference_t, iter_value_t&>; // \ref{iterator.concept.writable}, concept \libconcept{indirectly_writable} @@ -110,7 +110,7 @@ // \ref{iterator.concept.sizedsentinel}, concept \libconcept{sized_sentinel_for} template - inline constexpr bool disable_sized_sentinel_for = false; // freestanding + constexpr bool disable_sized_sentinel_for = false; // freestanding template concept sized_sentinel_for = @\seebelow@; // freestanding @@ -161,7 +161,7 @@ template requires (@\libconcept{indirectly_readable}@ && ...) && @\libconcept{invocable}@...> - using indirect_result_t = invoke_result_t...>; // freestanding + using @\libglobal{indirect_result_t}@ = invoke_result_t...>; // freestanding // \ref{projected}, projected template<@\libconcept{indirectly_readable}@ I, @\libconcept{indirectly_regular_unary_invocable}@ Proj> @@ -317,7 +317,7 @@ template requires (!@\libconcept{sized_sentinel_for}@) - inline constexpr bool disable_sized_sentinel_for, // freestanding + constexpr bool disable_sized_sentinel_for, // freestanding reverse_iterator> = true; // \ref{insert.iterators}, insert iterators @@ -342,7 +342,7 @@ concept @\exposconcept{constant-iterator}@ = @\seebelow@; // \expos template<@\libconcept{input_iterator}@ I> using const_iterator = @\seebelow@; // freestanding - template + template<@\libconcept{semiregular}@ S> using const_sentinel = @\seebelow@; // freestanding // \ref{const.iterators.iterator}, class template \tcode{basic_const_iterator} @@ -363,10 +363,10 @@ }; template<@\libconcept{input_iterator}@ I> - constexpr const_iterator make_const_iterator(I it) { return it; } // freestanding + constexpr const_iterator @\libglobal{make_const_iterator}@(I it) { return it; } // freestanding - template - constexpr const_sentinel make_const_sentinel(S s) { return s; } // freestanding + template<@\libconcept{semiregular}@ S> + constexpr const_sentinel @\libglobal{make_const_sentinel}@(S s) { return s; } // freestanding // \ref{move.iterators}, move iterators and sentinels template class move_iterator; // freestanding @@ -402,6 +402,11 @@ template constexpr move_iterator make_move_iterator(Iterator i); // freestanding + template + requires (!@\libconcept{sized_sentinel_for}@) + constexpr bool disable_sized_sentinel_for, // freestanding + move_iterator> = true; + template<@\libconcept{semiregular}@ S> class move_sentinel; // freestanding // \ref{iterators.common}, common iterators @@ -941,7 +946,7 @@ template concept @\defexposconcept{cpp17-forward-iterator}@ = @\exposconcept{cpp17-input-iterator}@ && @\libconcept{constructible_from}@ && - is_lvalue_reference_v> && + is_reference_v> && @\libconcept{same_as}@>, typename indirectly_readable_traits::value_type> && requires(I i) { @@ -1128,12 +1133,8 @@ \item \tcode{iter_move(E)}, if \tcode{E} has class or enumeration type and \tcode{iter_move(E)} is a well-formed expression when treated as an unevaluated operand, -with overload resolution performed in a context -that does not include a declaration of \tcode{ranges::iter_move} -but does include the declaration -\begin{codeblock} -void iter_move(); -\end{codeblock} +where the meaning of \tcode{iter_move} is established as-if by performing +argument-dependent lookup only\iref{basic.lookup.argdep}. \item Otherwise, if the expression \tcode{*E} is well-formed: \begin{itemize} @@ -1198,6 +1199,11 @@ If the function selected by overload resolution does not exchange the values denoted by \tcode{E1} and \tcode{E2}, the program is ill-formed, no diagnostic required. +\begin{note} +This precludes calling unconstrained \tcode{std::iter_swap}. When the deleted +overload is viable, program-defined overloads need to be more +specialized\iref{temp.func.order} to be selected. +\end{note} \item Otherwise, if the types of \tcode{E1} and \tcode{E2} each model \libconcept{indirectly_readable}, and if the reference types of \tcode{E1} and \tcode{E2} @@ -1360,10 +1366,10 @@ \begin{codeblock} template - inline constexpr bool @\exposid{is-integer-like}@ = @\seebelow@; @\itcorr[-2]@ // \expos + constexpr bool @\exposid{is-integer-like}@ = @\seebelow@; @\itcorr[-2]@ // \expos template - inline constexpr bool @\exposid{is-signed-integer-like}@ = @\seebelow@; @\itcorr[-2]@ // \expos + constexpr bool @\exposid{is-signed-integer-like}@ = @\seebelow@; @\itcorr[-2]@ // \expos template concept @\deflibconcept{weakly_incrementable}@ = @@ -1694,7 +1700,7 @@ \indexlibraryglobal{disable_sized_sentinel_for}% \begin{itemdecl} template - inline constexpr bool disable_sized_sentinel_for = false; + constexpr bool disable_sized_sentinel_for = false; \end{itemdecl} \begin{itemdescr} @@ -2005,9 +2011,8 @@ \pnum A type \tcode{X} meets the \defnoldconcept{Iterator} requirements if: \begin{itemize} -\item \tcode{X} meets the \oldconcept{CopyConstructible}, \oldconcept{CopyAssignable}, and -\oldconcept{Destructible} requirements\iref{utility.arg.requirements} and lvalues -of type \tcode{X} are swappable\iref{swappable.requirements}, and +\item \tcode{X} meets the \oldconcept{CopyConstructible}, \oldconcept{CopyAssignable}, \oldconcept{Swappable}, and +\oldconcept{Destructible} requirements\iref{utility.arg.requirements,swappable.requirements}, and \item \tcode{iterator_traits::difference_type} is a signed integer type or \keyword{void}, and @@ -2089,7 +2094,7 @@ & & \chdr{semantics} & \rhdr{pre-/post-condition} \\ \capsep \endhead \tcode{a != b} & - contextually convertible to \tcode{bool} & + \tcode{decltype(a != b)} models \exposconceptx{boolean-test\-able}{boolean-testable} & \tcode{!(a == b)} & \expects \orange{a}{b} is in the domain of \tcode{==}. \\ \rowsep @@ -2377,25 +2382,21 @@ \tcode{*(a + n)} & \\ \rowsep \tcode{a < b} & - contextually - convertible to \tcode{bool} & + \tcode{decltype(a < b)} models \exposconceptx{boolean-test\-able}{boolean-testable} & \effects Equivalent to: \tcode{return b - a > 0;} & \tcode{<} is a total ordering relation \\ \rowsep \tcode{a > b} & - contextually - convertible to \tcode{bool} & + \tcode{decltype(a > b)} models \exposconceptx{boolean-test\-able}{boolean-testable} & \tcode{b < a} & \tcode{>} is a total ordering relation opposite to \tcode{<}. \\ \rowsep \tcode{a >= b} & - contextually - convertible to \tcode{bool} & + \tcode{decltype(a >= b)} models \exposconceptx{boolean-test\-able}{boolean-testable} & \tcode{!(a < b)} & \\ \rowsep \tcode{a <= b} & - contextually - convertible to \tcode{bool}. & + \tcode{decltype(a <= b)} models \exposconceptx{boolean-test\-able}{boolean-testable} & \tcode{!(a > b)} & \\ \end{libreqtab4b} @@ -4175,7 +4176,7 @@ \begin{itemdecl} template<@\libconcept{indirectly_readable}@ It> - using iter_const_reference_t = + using @\libglobal{iter_const_reference_t}@ = common_reference_t&&, iter_reference_t>; template @@ -4194,7 +4195,7 @@ \end{itemdescr} \begin{itemdecl} -template +template<@\libconcept{semiregular}@ S> using @\libglobal{const_sentinel}@ = @\seebelow@; \end{itemdecl} @@ -5279,6 +5280,7 @@ constexpr move_sentinel& operator=(const move_sentinel& s); constexpr S base() const; + private: S last; // \expos }; @@ -6466,7 +6468,7 @@ constexpr istream_iterator(); constexpr istream_iterator(default_sentinel_t); istream_iterator(istream_type& s); - istream_iterator(const istream_iterator& x) = default; + constexpr istream_iterator(const istream_iterator& x) noexcept(@\seebelow@); ~istream_iterator() = default; istream_iterator& operator=(const istream_iterator&) = default; @@ -6529,18 +6531,22 @@ \indexlibraryctor{istream_iterator}% \begin{itemdecl} -istream_iterator(const istream_iterator& x) = default; +constexpr istream_iterator(const istream_iterator& x) noexcept(@\seebelow@); \end{itemdecl} \begin{itemdescr} \pnum -\ensures -\tcode{in_stream == x.in_stream} is \tcode{true}. +\effects +Initializes \tcode{in_stream} with \tcode{x.in_stream} and +initializes \tcode{value} with \tcode{x.value}. \pnum \remarks -If \tcode{is_trivially_copy_constructible_v} is \tcode{true}, -then this constructor is trivial. +An invocation of this constructor may be used in a core constant expression +if and only if the initialization of \tcode{value} from \tcode{x.value} +is a constant subexpression\iref{defns.const.subexpr}. +The exception specification is equivalent to +\tcode{is_nothrow_copy_constructible_v}. \end{itemdescr} \indexlibrarydtor{istream_iterator}% diff --git a/source/lex.tex b/source/lex.tex index 0f33bfda64..0439a0de01 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -66,7 +66,6 @@ \begin{enumerate} \item \indextext{character!source file}% -\indextext{character set!basic source}% An implementation shall support input files that are a sequence of UTF-8 code units (UTF-8 files). It may also support @@ -83,12 +82,18 @@ then it shall be a well-formed UTF-8 code unit sequence and it is decoded to produce a sequence of UCS scalar values that constitutes the sequence of elements of the translation character set. +In the resulting sequence, +each pair of characters in the input sequence consisting of +\unicode{000d}{carriage return} followed by \unicode{000a}{line feed}, +as well as each +\unicode{000d}{carriage return} not immediately followed by a \unicode{000a}{line feed}, +is replaced by a single new-line character. For any other kind of input file supported by the implementation, characters are mapped, in an \impldef{mapping physical source file characters to translation character set} manner, -to a sequence of translation character set elements\iref{lex.charset} -(introducing new-line characters for end-of-line indicators). +to a sequence of translation character set elements\iref{lex.charset}, +representing end-of-line indicators as new-line characters. \item \indextext{line splicing}% @@ -309,10 +314,7 @@ \begin{bnf} \nontermdef{n-char} \textnormal{one of}\br - \terminal{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}\br - \terminal{0 1 2 3 4 5 6 7 8 9}\br - \textnormal{\unicode{002d}{hyphen-minus}}\br - \textnormal{\unicode{0020}{space}} + \textnormal{any member of the translation character set except the \unicode{007d}{right curly bracket} or new-line character} \end{bnf} \begin{bnf} @@ -912,7 +914,7 @@ \indextext{name!length of}% \indextext{name}% The character classes XID_Start and XID_Continue -are Derived Core Properties as described by UAX \#44. +are Derived Core Properties as described by \UAX{44}. \begin{footnote} On systems in which linkers cannot accept extended characters, an encoding of the \grammarterm{universal-character-name} can be used in @@ -1174,6 +1176,10 @@ pointer-literal\br user-defined-literal \end{bnf} +\begin{note} +When appearing as an \grammarterm{expression}, +a literal has a type and a value category\iref{expr.prim.literal}. +\end{note} \rSec2[lex.icon]{Integer literals} @@ -1326,7 +1332,6 @@ the first type in the list in \tref{lex.icon.type} corresponding to its optional \grammarterm{integer-suffix} in which its value can be represented. -An \grammarterm{integer-literal} is a prvalue. \begin{floattable}{Types of \grammarterm{integer-literal}s}{lex.icon.type}{l|l|l} \topline @@ -2070,7 +2075,6 @@ \end{note} \pnum -\indextext{\idxcode{0}|seealso{zero, null}}% \indextext{\idxcode{0}!string terminator}% \indextext{\idxcode{0}!null character|see {character, null}}% String literal objects are initialized with @@ -2161,7 +2165,7 @@ \pnum \indextext{Boolean literal}% The Boolean literals are the keywords \tcode{false} and \tcode{true}. -Such literals are prvalues and have type \tcode{bool}. +Such literals have type \tcode{bool}. \rSec2[lex.nullptr]{Pointer literals} @@ -2172,7 +2176,7 @@ \end{bnf} \pnum -The pointer literal is the keyword \keyword{nullptr}. It is a prvalue of type +The pointer literal is the keyword \keyword{nullptr}. It has type \tcode{std::nullptr_t}. \begin{note} \tcode{std::nullptr_t} is a distinct type that is neither a pointer type nor a pointer-to-member type; diff --git a/source/lib-intro.tex b/source/lib-intro.tex index 590670d176..266d411852 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -478,13 +478,14 @@ implementation-defined types\iref{type.descriptions}, and member functions\iref{functions.within.classes}. -\rSec3[expos.only.func]{Exposition-only functions} +\rSec3[expos.only.entity]{Exposition-only entities, etc.} \pnum -Several function templates +Several entities and \grammarterm{typedef-name}{s} defined in \ref{\firstlibchapter} through \ref{\lastlibchapter} and \ref{depr} are only defined for the purpose of exposition. -The declaration of such a function is followed by a comment ending in \expos. +The declaration of such an entity or \grammarterm{typedef-name} +is followed by a comment ending in \expos. \pnum The following are defined for exposition only @@ -546,22 +547,6 @@ \indextext{types!implementation-defined}% They are based on other types, but with added constraints. -\rSec4[expos.only.types]{Exposition-only types} - -\pnum -Several types defined in \ref{\firstlibchapter} through \ref{\lastlibchapter} -and \ref{depr} are defined for the purpose of exposition. -The declaration of such a type is followed by a comment ending in \expos. -\begin{example} -\begin{codeblock} -namespace std { - extern "C" using @\placeholdernc{some-handler}@ = int(int, void*, double); // \expos -} -\end{codeblock} -The type placeholder \tcode{\placeholder{some-handler}} can now be used to specify a function -that takes a callback parameter with C language linkage. -\end{example} - \rSec4[enumerated.types]{Enumerated types} \pnum @@ -790,6 +775,12 @@ \rSec5[multibyte.strings]{Multibyte strings} +\pnum +A \defnx{multibyte character}{character!multibyte} is +a sequence of one or more bytes representing the +code unit sequence for an encoded character of the +execution character set. + \indextext{string!null-terminated multibyte|see{\ntmbs{}}}% \pnum A \defnx{null-terminated multibyte string}{NTMBS@\ntmbs{}}, @@ -854,21 +845,6 @@ Each customization point object type constrains its return type to model a particular concept. -\pnum -\begin{note} -Many of the customization point objects in the library evaluate function call -expressions with an unqualified name which results in a call to a -program-defined function found by argument dependent name -lookup\iref{basic.lookup.argdep}. To preclude such an expression resulting in a -call to unconstrained functions with the same name in namespace \tcode{std}, -customization point objects specify that lookup for these expressions is -performed in a context that includes deleted overloads matching the signatures -of overloads defined in namespace \tcode{std}. When the deleted overloads are -viable, program-defined overloads need to be more specialized\iref{temp.func.order} -or more constrained\iref{temp.constr.order} to be used by a customization point -object. -\end{note} - \rSec3[functions.within.classes]{Functions within classes} \pnum @@ -908,32 +884,63 @@ \pnum An implementation may use any technique that provides equivalent observable behavior. -\rSec3[freestanding.entity]{Freestanding entities} +\rSec3[freestanding.item]{Freestanding items} \pnum -\indextext{entity!freestanding|see{freestanding entity}}% -A \defn{freestanding entity} is a declaration or macro definition -that is present in a freestanding implementation and a hosted implementation. +\indextext{item!freestanding|see{freestanding item}}% +A \defn{freestanding item} is +a declaration, entity, \grammarterm{typedef-name}, or macro +that is required to be present in +a freestanding implementation and a hosted implementation. \pnum Unless otherwise specified, -the requirements on freestanding entities on a freestanding implementation -are the same as the corresponding requirements in a hosted implementation. +the requirements on freestanding items for a freestanding implementation +are the same as the corresponding requirements for a hosted implementation, +except that not all of the members of the namespaces are required to be present. +\begin{note} +This implies that freestanding item enumerations have the same enumerators on +freestanding implementations and hosted implementations. +Furthermore, class types have the same members and +class templates have the same deduction guides +on freestanding implementations and hosted implementations. +\end{note} + +\pnum +\indextext{declaration!freestanding item}% +A declaration in a header synopsis is a freestanding item if +\begin{itemize} +\item it is followed by a comment that includes \textit{freestanding}, or +\item the header synopsis begins with a comment that includes \textit{all freestanding}. +\end{itemize} + +\pnum +\indextext{entity!freestanding item}% +\indextext{\idxgram{typedef-name}!freestanding item}% +An entity or \grammarterm{typedef-name} is a freestanding item if it is: +\begin{itemize} +\item introduced by a declaration that is a freestanding item, +\item an enclosing namespace of a freestanding item, +\item a friend of a freestanding item, +\item denoted by a \grammarterm{typedef-name} that is a freestanding item, or +\item denoted by an alias template that is a freestanding item. +\end{itemize} + +\pnum +\indextext{macro!freestanding item}% +A macro is a freestanding item if it is defined in a header synopsis and +\begin{itemize} +\item the definition is followed by a comment that includes \textit{freestanding}, or +\item the header synopsis begins with a comment that includes \textit{all freestanding}. +\end{itemize} \pnum -In a header synopsis, entities followed with a comment -that includes \textit{freestanding} are freestanding entities. \begin{example} \begin{codeblock} #define NULL @\seebelow@ // freestanding \end{codeblock} \end{example} -\pnum -If a header synopsis begins with a comment -that includes \textit{all freestanding}, -then all of the declarations and macro definitions in the header synopsis -are freestanding entities. \begin{example} \begin{codeblock} // all freestanding @@ -941,19 +948,6 @@ \end{codeblock} \end{example} -\pnum -Deduction guides for freestanding entity class templates are freestanding entities. - -\pnum -Enclosing namespaces of freestanding entities are freestanding entities. - -\pnum -Friends of freestanding entities are freestanding entities. - -\pnum -Entities denoted by freestanding entity \grammarterm{typedef-name}{s} and -freestanding entity alias templates are freestanding entities. - \rSec1[requirements]{Library-wide requirements} \rSec2[requirements.general]{General} @@ -1018,8 +1012,9 @@ \end{footnote} \pnum -Whenever an unqualified name other than \tcode{swap} is used -in the specification of a declaration \tcode{D} +Whenever an unqualified name other than +\tcode{swap}, \tcode{make_error_code}, or \tcode{make_error_condition} +is used in the specification of a declaration \tcode{D} in \ref{\firstlibchapter} through \ref{\lastlibchapter} or \ref{depr}, its meaning is established as-if by performing unqualified name lookup\iref{basic.lookup.unqual} @@ -1040,6 +1035,10 @@ The meaning of the unqualified name \tcode{swap} is established in an overload resolution context for swappable values\iref{swappable.requirements}. +The meanings of the unqualified names +\tcode{make_error_code} and \tcode{make_error_condition} are established +as-if by performing argument-dependent lookup\iref{basic.lookup.argdep}. + \rSec3[headers]{Headers} @@ -1079,8 +1078,8 @@ \tcode{} \\ \tcode{} \\ \tcode{} \\ -\columnbreak \tcode{} \\ +\columnbreak \tcode{} \\ \tcode{} \\ \tcode{} \\ @@ -1103,8 +1102,8 @@ \tcode{} \\ \tcode{} \\ \tcode{} \\ -\tcode{} \\ \columnbreak +\tcode{} \\ \tcode{} \\ \tcode{} \\ \tcode{} \\ @@ -1138,9 +1137,9 @@ \tcode{} \\ \tcode{} \\ \tcode{} \\ +\tcode{} \\ \tcode{} \\ \tcode{} \\ -\tcode{} \\ \tcode{} \\ \tcode{} \\ \tcode{} \\ @@ -1385,7 +1384,9 @@ additionally exports declarations in the global namespace corresponding to the declarations in namespace \tcode{std} that are provided by -the \Cpp{} headers for C library facilities~(\tref{headers.cpp.c}). +the \Cpp{} headers for C library facilities~(\tref{headers.cpp.c}), +except the explicitly excluded declarations +described in \ref{support.c.headers.other}. \pnum It is unspecified to which module a declaration in the standard library @@ -1441,7 +1442,7 @@ \ref{support.types} & Types & \tcode{} \\ \rowsep \ref{support.limits} & Implementation properties & \tcode{}, \tcode{}, \tcode{}, \tcode{} \\ \rowsep -\ref{cstdint} & Integer types & \tcode{} \\ \rowsep +\ref{cstdint.syn} & Integer types & \tcode{} \\ \rowsep \ref{support.start.term} & Start and termination & \tcode{} \\ \rowsep \ref{support.dynamic} & Dynamic memory management & \tcode{} \\ \rowsep \ref{support.rtti} & Type identification & \tcode{} \\ \rowsep @@ -1467,7 +1468,7 @@ \pnum For each of the headers listed in \tref{headers.cpp.fs}, a freestanding implementation provides at least -the freestanding entities\iref{freestanding.entity} declared in the header. +the freestanding items\iref{freestanding.item} declared in the header. \indextext{implementation!freestanding|)}% \pnum @@ -1590,16 +1591,25 @@ The template definitions in the \Cpp{} standard library refer to various named requirements whose details are set out in Tables~\ref{tab:cpp17.equalitycomparable}--\ref{tab:cpp17.destructible}. -In these tables, \tcode{T} is an object or reference type to be -supplied by a \Cpp{} program instantiating a template; +In these tables, +\begin{itemize} +\item +\tcode{T} denotes an object or reference type to be +supplied by a \Cpp{} program instantiating a template, +\item \tcode{a}, \tcode{b}, and -\tcode{c} are values of type (possibly \keyword{const}) \tcode{T}; -\tcode{s} and \tcode{t} are modifiable lvalues of type \tcode{T}; -\tcode{u} denotes an identifier; -\tcode{rv} is an rvalue of type \tcode{T}; -and \tcode{v} is an lvalue of type (possibly \keyword{const}) \tcode{T} or an rvalue of -type \tcode{const T}. +\tcode{c} denote values of type (possibly const) \tcode{T}, +\item +\tcode{s} and \tcode{t} denote modifiable lvalues of type \tcode{T}, +\item +\tcode{u} denotes an identifier, +\item +\tcode{rv} denotes an rvalue of type \tcode{T}, and +\item +\tcode{v} denotes an lvalue of type (possibly const) \tcode{T} or an +rvalue of type \tcode{const T}. +\end{itemize} \pnum In general, a default constructor is not required. Certain container class @@ -1612,7 +1622,7 @@ \topline \hdstyle{Expression} & \hdstyle{Return type} & \rhdr{Requirement} \\ \capsep \tcode{a == b} & -convertible to \tcode{bool} & +\tcode{decltype(a == b)} models \exposconceptx{boolean-testa\-ble}{boolean-testable} & \tcode{==} is an equivalence relation, that is, it has the following properties: \begin{itemize} @@ -1630,7 +1640,7 @@ \topline \hdstyle{Expression} & \hdstyle{Return type} & \hdstyle{Requirement} \\ \capsep \tcode{a < b} & -convertible to \tcode{bool} & +\tcode{decltype(a < b)} models \exposconceptx{boolean-testa\-ble}{boolean-testable} & \tcode{<} is a strict weak ordering relation\iref{alg.sorting} \\ \end{oldconcepttable} @@ -1756,6 +1766,10 @@ An rvalue or lvalue \tcode{t} is \defn{swappable} if and only if \tcode{t} is swappable with any rvalue or lvalue, respectively, of type \tcode{T}. +\pnum +A type \tcode{X} meets the \oldconcept{Swappable} requirements +if lvalues of type \tcode{X} are swappable. + \pnum A type \tcode{X} meeting any of the iterator requirements\iref{iterator.requirements} meets the \oldconcept{ValueSwappable} requirements if, @@ -1779,7 +1793,7 @@ // for rvalues and lvalues } -// Preconditions: lvalues of \tcode{T} are swappable. +// Preconditions: \tcode{T} meets the \oldconcept{Swappable} requirements. template void lv_swap(T& t1, T& t2) { using std::swap; @@ -1818,9 +1832,7 @@ \begin{itemize} \item \tcode{P} meets the \oldconcept{EqualityComparable}, \oldconcept{DefaultConstructible}, \oldconcept{CopyConstructible}, \oldconcept{\-Copy\-Assign\-able}, -and \oldconcept{Destructible} requirements, - -\item lvalues of type \tcode{P} are swappable\iref{swappable.requirements}, +\oldconcept{Swappable}, and \oldconcept{Destructible} requirements, \item the expressions shown in \tref{cpp17.nullablepointer} are valid and have the indicated semantics, and @@ -1849,11 +1861,11 @@ \pnum In \tref{cpp17.nullablepointer}, \tcode{u} denotes an identifier, \tcode{t} denotes a non-\keyword{const} lvalue of type \tcode{P}, \tcode{a} and \tcode{b} -denote values of type (possibly \keyword{const}) \tcode{P}, and \tcode{np} denotes -a value of type (possibly \keyword{const}) \tcode{std::nullptr_t}. +denote values of type (possibly const) \tcode{P}, and \tcode{np} denotes +a value of type (possibly const) \tcode{std::nullptr_t}. \begin{oldconcepttable}{NullablePointer}{}{cpp17.nullablepointer} -{lll} +{lx{2in}l} \topline \lhdr{Expression} & \chdr{Return type} & \rhdr{Operational semantics} \\ \capsep \tcode{P u(np);}\br & @@ -1872,17 +1884,17 @@ \ensures \tcode{t == nullptr} \\ \rowsep \tcode{a != b} & - contextually convertible to \tcode{bool} & + \tcode{decltype(a != b)} models \exposconcept{boolean-testable} & \tcode{!(a == b)} \\ \rowsep \tcode{a == np} & - contextually convertible to \tcode{bool} & + \tcode{decltype(a == np)} and \tcode{decltype(np == a)} each model \exposconcept{boolean-testable} & \tcode{a == P()} \\ \tcode{np == a} & & \\ \rowsep \tcode{a != np} & - contextually convertible to \tcode{bool} & + \tcode{decltype(a != np)} and \tcode{decltype(np != a)} each model \exposconcept{boolean-testable} & \tcode{!(a == np)} \\ \tcode{np != a} & & @@ -1903,9 +1915,9 @@ \pnum Given \tcode{Key} is an argument type for function objects of type \tcode{H}, in -\tref{cpp17.hash} \tcode{h} is a value of type (possibly \keyword{const}) \tcode{H}, +\tref{cpp17.hash} \tcode{h} is a value of type (possibly const) \tcode{H}, \tcode{u} is an lvalue of type \tcode{Key}, and \tcode{k} is a value of a type convertible to -(possibly \keyword{const}) \tcode{Key}. +(possibly const) \tcode{Key}. \begin{oldconcepttable}{Hash}{}{cpp17.hash} {llp{.55\hsize}} @@ -1986,7 +1998,7 @@ \item \tcode{y} denotes a value of type \tcode{XX::const_void_pointer} obtained by conversion from a result value of \tcode{YY::allocate}, or else -a value of type (possibly \tcode{const}) \tcode{std::nullptr_t}, +a value of type (possibly const) \tcode{std::nullptr_t}, \item \tcode{n} denotes a value of type \tcode{XX::size_type}, \item @@ -2027,11 +2039,11 @@ \begin{itemdescr} \pnum \mandates -\tcode{X::pointer} is convertible to \tcode{X::const_pointer}. +\tcode{XX::pointer} is convertible to \tcode{XX::const_pointer}. \pnum \remarks -Default: \tcode{pointer_traits::rebind} +Default: \tcode{pointer_traits::rebind} \end{itemdescr} \begin{itemdecl} @@ -2042,13 +2054,13 @@ \begin{itemdescr} \pnum \mandates -\tcode{X::pointer} is convertible to \tcode{X::void_pointer}. -\tcode{X::void_pointer} and \tcode{Y::void_pointer} are the same type. +\tcode{XX::pointer} is convertible to \tcode{XX::void_pointer}. +\tcode{XX::void_pointer} and \tcode{YY::void_pointer} are the same type. \pnum \remarks Default: -\tcode{pointer_traits::rebind} +\tcode{pointer_traits::rebind} \end{itemdescr} \begin{itemdecl} @@ -2059,15 +2071,15 @@ \begin{itemdescr} \pnum \mandates -\tcode{X::pointer}, \tcode{X::const_pointer}, and \tcode{X::void_pointer} -are convertible to \tcode{X::const_void_pointer}. -\tcode{X::const_void_pointer} and \tcode{Y::const_void_pointer} +\tcode{XX::pointer}, \tcode{XX::const_pointer}, and \tcode{XX::void_pointer} +are convertible to \tcode{XX::const_void_pointer}. +\tcode{XX::const_void_pointer} and \tcode{YY::const_void_pointer} are the same type. \pnum \remarks Default: -\tcode{pointer_traits::rebind} +\tcode{pointer_traits::rebind} \end{itemdescr} \begin{itemdecl} @@ -2093,7 +2105,7 @@ \pnum \remarks Default: -\tcode{make_unsigned_t} +\tcode{make_unsigned_t} \end{itemdescr} \begin{itemdecl} @@ -2109,7 +2121,7 @@ \pnum \remarks Default: -\tcode{pointer_traits::difference_type} +\tcode{pointer_traits::difference_type} \end{itemdescr} \begin{itemdecl} @@ -2124,7 +2136,7 @@ \pnum \ensures For all \tcode{U} (including \tcode{T}), -\tcode{Y::template rebind::other} is \tcode{X}. +\tcode{YY::rebind_alloc} is \tcode{X}. \pnum \remarks @@ -2210,41 +2222,41 @@ \end{itemdescr} \begin{itemdecl} -static_cast(w) +static_cast(w) \end{itemdecl} \begin{itemdescr} \pnum \result -\tcode{X::pointer} +\tcode{XX::pointer} \pnum \ensures -\tcode{static_cast(w) == p}. +\tcode{static_cast(w) == p}. \end{itemdescr} \begin{itemdecl} -static_cast(x) +static_cast(x) \end{itemdecl} \begin{itemdescr} \pnum \result -\tcode{X::const_pointer} +\tcode{XX::const_pointer} \pnum \ensures -\tcode{static_cast(x) == q}. +\tcode{static_cast(x) == q}. \end{itemdescr} \begin{itemdecl} -pointer_traits::pointer_to(r) +pointer_traits::pointer_to(r) \end{itemdecl} \begin{itemdescr} \pnum \result -\tcode{X::pointer} +\tcode{XX::pointer} \pnum \ensures @@ -2258,7 +2270,7 @@ \begin{itemdescr} \pnum \result -\tcode{X::pointer} +\tcode{XX::pointer} \pnum \effects @@ -2296,7 +2308,7 @@ \begin{itemdescr} \pnum \result -\tcode{X::pointer} +\tcode{XX::pointer} \pnum \effects @@ -2315,11 +2327,11 @@ \begin{itemdescr} \pnum \result -\tcode{allocation_result} +\tcode{allocation_result} \pnum \returns -\tcode{allocation_result\{ptr, count\}} +\tcode{allocation_result\{ptr, count\}} where \tcode{ptr} is memory allocated for an array of \tcode{count} \tcode{T} and such an object is created but array elements are not constructed, such that $\tcode{count} \geq \tcode{n}$. @@ -2377,11 +2389,11 @@ \begin{itemdescr} \pnum \result -\tcode{X::size_type} +\tcode{XX::size_type} \pnum \returns -The largest value that can meaningfully be passed to \tcode{X::allocate()}. +The largest value \tcode{n} that can meaningfully be passed to \tcode{a.allocate(n)}. \pnum \remarks @@ -2438,7 +2450,7 @@ \pnum \returns -\tcode{a == Y::rebind::other(b)}. +\tcode{a == YY::rebind_alloc(b)}. \end{itemdescr} \begin{itemdecl} @@ -2626,7 +2638,7 @@ \tcode{true_type} only if an allocator of type \tcode{X} should be swapped when the client container is swapped; if so, -lvalues of type \tcode{X} shall be swappable\iref{swappable.requirements} and +\tcode{X} shall meet the \oldconcept{Swappable} requirements\iref{swappable.requirements} and the \tcode{swap} operation shall not throw exceptions. \pnum @@ -2646,7 +2658,7 @@ \pnum \returns \tcode{true_type} only if the expression \tcode{a1 == a2} is guaranteed -to be \tcode{true} for any two (possibly \tcode{const}) values +to be \tcode{true} for any two (possibly const) values \tcode{a1}, \tcode{a2} of type \tcode{X}. \pnum @@ -2657,43 +2669,43 @@ \pnum An allocator type \tcode{X} shall meet the \oldconcept{CopyConstructible} requirements (\tref{cpp17.copyconstructible}). -The \tcode{X::pointer}, \tcode{X::const_pointer}, \tcode{X::void_pointer}, and -\tcode{X::const_void_pointer} types shall meet the +The \tcode{XX::pointer}, \tcode{XX::const_pointer}, \tcode{XX::void_pointer}, and +\tcode{XX::const_void_pointer} types shall meet the \oldconcept{Nullable\-Pointer} requirements (\tref{cpp17.nullablepointer}). No constructor, comparison operator function, copy operation, move operation, or swap operation on -these pointer types shall exit via an exception. \tcode{X::pointer} and \tcode{X::const_pointer} shall also +these pointer types shall exit via an exception. \tcode{XX::pointer} and \tcode{XX::const_pointer} shall also meet the requirements for a \oldconcept{RandomAccessIterator}\iref{random.access.iterators} and -the additional requirement that, when \tcode{a} and \tcode{(a + n)} are +the additional requirement that, when \tcode{p} and \tcode{(p + n)} are dereferenceable pointer values for some integral value \tcode{n}, \begin{codeblock} -addressof(*(a + n)) == addressof(*a) + n +addressof(*(p + n)) == addressof(*p) + n \end{codeblock} is \tcode{true}. \pnum Let \tcode{x1} and \tcode{x2} denote objects of (possibly different) types -\tcode{X::void_pointer}, \tcode{X::const_void_pointer}, \tcode{X::pointer}, -or \tcode{X::const_pointer}. Then, \tcode{x1} and \tcode{x2} are +\tcode{XX::void_pointer}, \tcode{XX::const_void_pointer}, \tcode{XX::pointer}, +or \tcode{XX::const_pointer}. Then, \tcode{x1} and \tcode{x2} are \defn{equivalently-valued} pointer values, if and only if both \tcode{x1} and \tcode{x2} can be explicitly converted to the two corresponding objects \tcode{px1} and \tcode{px2} -of type \tcode{X::const_pointer}, using a sequence of \keyword{static_cast}s +of type \tcode{XX::const_pointer}, using a sequence of \keyword{static_cast}s using only these four types, and the expression \tcode{px1 == px2} evaluates to \tcode{true}. \pnum -Let \tcode{w1} and \tcode{w2} denote objects of type \tcode{X::void_pointer}. +Let \tcode{w1} and \tcode{w2} denote objects of type \tcode{XX::void_pointer}. Then for the expressions \begin{codeblock} w1 == w2 w1 != w2 \end{codeblock} either or both objects may be replaced by an equivalently-valued object of type -\tcode{X::const_void_pointer} with no change in semantics. +\tcode{XX::const_void_pointer} with no change in semantics. \pnum -Let \tcode{p1} and \tcode{p2} denote objects of type \tcode{X::pointer}. +Let \tcode{p1} and \tcode{p2} denote objects of type \tcode{XX::pointer}. Then for the expressions \begin{codeblock} p1 == p2 @@ -2705,7 +2717,7 @@ p1 - p2 \end{codeblock} either or both objects may be replaced by an equivalently-valued object of type -\tcode{X::const_pointer} with no change in semantics. +\tcode{XX::const_pointer} with no change in semantics. \pnum An allocator may constrain the types on which it can be instantiated and the @@ -2803,6 +2815,10 @@ if it declares an explicit or partial specialization of any standard library variable template, except where explicitly permitted by the specification of that variable template. +\begin{note} +The requirements on an explicit or partial specialization +are stated by each variable template that grants such permission. +\end{note} \pnum The behavior of a \Cpp{} program is undefined if it declares diff --git a/source/limits.tex b/source/limits.tex index e3b86f6ca1..b3188315c4 100644 --- a/source/limits.tex +++ b/source/limits.tex @@ -25,10 +25,12 @@ \item% Nesting levels of conditional inclusion\iref{cpp.cond} [256]. \item% -Pointer\iref{dcl.ptr}, array\iref{dcl.array}, and function\iref{dcl.fct} declarators -(in any combination) -modifying a class, arithmetic, -or incomplete type in a declaration [256]. +Pointer\iref{dcl.ptr}, +pointer-to-member\iref{dcl.mptr}, +array\iref{dcl.array}, and +function\iref{dcl.fct} +declarators (in any combination) +modifying a type in a declaration [256]. \item% Nesting levels of parenthesized expressions\iref{expr.prim.paren} within a full-expression [256]. \item% diff --git a/source/macros.tex b/source/macros.tex index 295267bf98..2bf9d28192 100644 --- a/source/macros.tex +++ b/source/macros.tex @@ -191,15 +191,17 @@ \newcommand{\idxxname}[1]{__#1@\xname{#1}} % library index entries -\newcommand{\indexlibrarymisc}[2]{\indexlibrary{\idxcode{#1}!#2}} \newcommand{\indexlibraryglobal}[1]{\indexlibrary{\idxcode{#1}}} -\newcommand{\indexlibraryctor}[1]{\indexlibrarymisc{#1}{constructor}} -\newcommand{\indexlibrarydtor}[1]{\indexlibrarymisc{#1}{destructor}} +\newcommand{\indexlibrarymisc}[2]{\indexlibrary{#1!#2}} +\newcommand{\indexlibraryctor} [1]{\indexlibrarymisc{\idxcode{#1}}{constructor}} +\newcommand{\indexlibrarydtor} [1]{\indexlibrarymisc{\idxcode{#1}}{destructor}} +\newcommand{\indexlibraryzombie}[1]{\indexlibrarymisc{\idxcode{#1}}{zombie}} % class member library index -\newcommand{\indexlibrarymemberx}[2]{\indexlibrarymisc{#1}{\idxcode{#2}}} -\newcommand{\indexlibrarymember}[2]{\indexlibrarymemberx{#1}{#2}\indexlibrarymemberx{#2}{#1}} -\newcommand{\indexlibraryzombie}[1]{\indexlibrarymisc{#1}{zombie}} +\newcommand{\indexlibraryboth}[2]{\indexlibrarymisc{#1}{#2}\indexlibrarymisc{#2}{#1}} +\newcommand{\indexlibrarymember}[2]{\indexlibraryboth{\idxcode{#1}}{\idxcode{#2}}} +\newcommand{\indexlibrarymemberexpos}[2]{\indexlibraryboth{\idxcode{#1}}{#2@\exposid{#2}}} +\newcommand{\indexlibrarymemberx}[2]{\indexlibrarymisc{\idxcode{#1}}{\idxcode{#2}}} \newcommand{\libglobal}[1]{\indexlibraryglobal{#1}#1} \newcommand{\libmember}[2]{\indexlibrarymember{#1}{#2}#1} @@ -301,7 +303,9 @@ {\noteoutro{#3}} \newenvironment{#1} {\begin{tail#1}} -{\end{tail#1}\small\par} % \small\par is for C++20 post-DIS compatibility +% \small\par is for C++20 post-DIS compatibility +{\end{tail#1}\small\par\penalty -200} + } \newnoteenvironment{note}{Note \arabic{note}}{end note} @@ -404,6 +408,7 @@ } \newcommand{\uname}[1]{\textsc{#1}} \newcommand{\unicode}[2]{\ucode{#1} \uname{#2}} +\newcommand{\UAX}[1]{\texorpdfstring{UAX~\textsmaller[1]{\raisebox{0.35ex}{\#}}#1}{UAX \##1}} \newcommand{\NTS}[1]{\textsc{#1}} \newcommand{\ntbs}{\NTS{ntbs}} \newcommand{\ntmbs}{\NTS{ntmbs}} diff --git a/source/memory.tex b/source/memory.tex index 9dc24f3078..8419e02b91 100644 --- a/source/memory.tex +++ b/source/memory.tex @@ -86,21 +86,22 @@ // \ref{obj.lifetime}, explicit lifetime management template - T* start_lifetime_as(void* p) noexcept; + T* start_lifetime_as(void* p) noexcept; // freestanding template - const T* start_lifetime_as(const void* p) noexcept; + const T* start_lifetime_as(const void* p) noexcept; // freestanding template - volatile T* start_lifetime_as(volatile void* p) noexcept; + volatile T* start_lifetime_as(volatile void* p) noexcept; // freestanding template - const volatile T* start_lifetime_as(const volatile void* p) noexcept; + const volatile T* start_lifetime_as(const volatile void* p) noexcept; // freestanding template - T* start_lifetime_as_array(void* p, size_t n) noexcept; + T* start_lifetime_as_array(void* p, size_t n) noexcept; // freestanding template - const T* start_lifetime_as_array(const void* p, size_t n) noexcept; + const T* start_lifetime_as_array(const void* p, size_t n) noexcept; // freestanding template - volatile T* start_lifetime_as_array(volatile void* p, size_t n) noexcept; + volatile T* start_lifetime_as_array(volatile void* p, size_t n) noexcept; // freestanding template - const volatile T* start_lifetime_as_array(const volatile void* p, size_t n) noexcept; + const volatile T* start_lifetime_as_array(const volatile void* p, // freestanding + size_t n) noexcept; // \ref{allocator.tag}, allocator argument tag struct allocator_arg_t { // freestanding @@ -113,7 +114,7 @@ // \ref{allocator.uses.trait}, \tcode{uses_allocator} template - inline constexpr bool @\libglobal{uses_allocator_v}@ = uses_allocator::value; // freestanding + constexpr bool @\libglobal{uses_allocator_v}@ = uses_allocator::value; // freestanding // \ref{allocator.uses.construction}, uses-allocator construction template @@ -594,13 +595,7 @@ \begin{codeblock} namespace std { template struct pointer_traits { - using pointer = Ptr; - using element_type = @\seebelow@; - using difference_type = @\seebelow@; - - template using rebind = @\seebelow@; - - static pointer pointer_to(@\seebelow@ r); + @\seebelow@; }; template struct pointer_traits { @@ -617,6 +612,46 @@ \rSec3[pointer.traits.types]{Member types} +\pnum +The definitions in this subclause make use of +the following exposition-only class template and concept: +\begin{codeblock} +template +struct @\exposid{ptr-traits-elem}@ // \expos +{ }; + +template requires requires { typename T::element_type; } +struct @\exposid{ptr-traits-elem}@ +{ using type = typename T::element_type; }; + +template class SomePointer, class T, class... Args> + requires (!requires { typename SomePointer::element_type; }) +struct @\exposid{ptr-traits-elem}@> +{ using type = T; }; + +template + concept @\defexposconcept{has-elem-type}@ = // \expos + requires { typename @\exposid{ptr-traits-elem}@::type; } +\end{codeblock} + +\pnum +If \tcode{Ptr} satisfies \exposconcept{has-elem-type}, +a specialization \tcode{pointer_traits} +generated from the \tcode{pointer_traits} primary template +has the following members +as well as those described in~\ref{pointer.traits.functions}; +otherwise, such a specialization has no members by any of those names. + +\indexlibrarymember{pointer}{pointer_traits}% +\begin{itemdecl} +using pointer = @\seebelow@; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\ctype \tcode{Ptr}. +\end{itemdescr} + \indexlibrarymember{element_type}{pointer_traits}% \begin{itemdecl} using element_type = @\seebelow@; @@ -624,12 +659,7 @@ \begin{itemdescr} \pnum -\ctype \tcode{Ptr::element_type} if -the \grammarterm{qualified-id} \tcode{Ptr::element_type} is valid and denotes a -type\iref{temp.deduct}; otherwise, \tcode{T} if -\tcode{Ptr} is a class template instantiation of the form \tcode{SomePointer}, -where \tcode{Args} is zero or more type arguments; otherwise, the specialization is -ill-formed. +\ctype \tcode{typename \exposid{ptr-traits-elem}::type}. \end{itemdescr} \indexlibrarymember{difference_type}{pointer_traits}% @@ -697,6 +727,8 @@ \pnum Specializations of \tcode{pointer_traits} may define the member declared in this subclause to customize the behavior of the standard library. +A specialization generated from the \tcode{pointer_traits} primary template +has no member by this name. \indexlibrarymember{to_address}{pointer_traits}% \begin{itemdecl} @@ -1012,18 +1044,18 @@ \begin{itemdescr} \pnum \constraints -\tcode{T} is not a specialization of \tcode{pair}. +\tcode{remove_cv_t} is not a specialization of \tcode{pair}. \pnum \returns A \tcode{tuple} value determined as follows: \begin{itemize} \item - If \tcode{uses_allocator_v} is \tcode{false} and - \tcode{is_constructible_v} is \tcode{true}, + If \tcode{uses_allocator_v, Alloc>} is \tcode{false} and + \tcode{is_constructible_v} is \tcode{true}, return \tcode{forward_as_tuple(std::forward(args)...)}. \item - Otherwise, if \tcode{uses_allocator_v} is \tcode{true} and + Otherwise, if \tcode{uses_allocator_v, Alloc>} is \tcode{true} and \tcode{is_constructible_v} is \tcode{true}, return @@ -1032,7 +1064,7 @@ allocator_arg, alloc, std::forward(args)...) \end{codeblock} \item - Otherwise, if \tcode{uses_allocator_v} is \tcode{true} and + Otherwise, if \tcode{uses_allocator_v, Alloc>} is \tcode{true} and \tcode{is_constructible_v} is \tcode{true}, return \tcode{forward_as_tuple(std::forward(args)..., alloc)}. \item @@ -1053,13 +1085,17 @@ \end{itemdecl} \begin{itemdescr} +\pnum +Let \tcode{T1} be \tcode{T::first_type}. +Let \tcode{T2} be \tcode{T::second_type}. + \pnum \constraints -\tcode{T} is a specialization of \tcode{pair}. +\tcode{remove_cv_t} is a specialization of \tcode{pair}. \pnum \effects -For \tcode{T} specified as \tcode{pair}, equivalent to: +Equivalent to: \begin{codeblock} return make_tuple( piecewise_construct, @@ -1083,7 +1119,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{T} is a specialization of \tcode{pair}. +\tcode{remove_cv_t} is a specialization of \tcode{pair}. \pnum \effects @@ -1104,7 +1140,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{T} is a specialization of \tcode{pair}. +\tcode{remove_cv_t} is a specialization of \tcode{pair}. \pnum \effects @@ -1129,7 +1165,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{T} is a specialization of \tcode{pair}. +\tcode{remove_cv_t} is a specialization of \tcode{pair}. \pnum \effects @@ -1154,7 +1190,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{T} is a specialization of \tcode{pair}. +\tcode{remove_cv_t} is a specialization of \tcode{pair}. \pnum \effects @@ -1182,7 +1218,7 @@ \pnum \constraints -\tcode{T} is a specialization of \tcode{pair}, and +\tcode{remove_cv_t} is a specialization of \tcode{pair}, and the expression \tcode{\exposid{FUN}(u)} is not well-formed when considered as an unevaluated operand. @@ -5193,9 +5229,9 @@ \item otherwise, \begin{codeblock} +@\exposid{release-statement}@; if (p) { apply([&](auto&&... args) { - @\exposid{release-statement}@; s.reset(static_cast(p), std::forward(args)...); }, std::move(a)); } \end{codeblock} @@ -5205,9 +5241,9 @@ \item otherwise, \begin{codeblock} +@\exposid{release-statement}@; if (p) { apply([&](auto&&... args) { - @\exposid{release-statement}@; s = Smart(static_cast(p), std::forward(args)...); }, std::move(a)); } \end{codeblock} diff --git a/source/meta.tex b/source/meta.tex index 11f69c16e7..3ff3f99edb 100644 --- a/source/meta.tex +++ b/source/meta.tex @@ -352,10 +352,10 @@ using @\libglobal{remove_cvref_t}@ = typename remove_cvref::type; template using @\libglobal{decay_t}@ = typename decay::type; - template - using @\libglobal{enable_if_t}@ = typename enable_if::type; - template - using @\libglobal{conditional_t}@ = typename conditional::type; + template + using @\libglobal{enable_if_t}@ = typename enable_if::type; + template + using @\libglobal{conditional_t}@ = typename conditional::type; template using @\libglobal{common_type_t}@ = typename common_type::type; template @@ -378,198 +378,198 @@ // \ref{meta.unary.cat}, primary type categories template - inline constexpr bool @\libglobal{is_void_v}@ = is_void::value; + constexpr bool @\libglobal{is_void_v}@ = is_void::value; template - inline constexpr bool @\libglobal{is_null_pointer_v}@ = is_null_pointer::value; + constexpr bool @\libglobal{is_null_pointer_v}@ = is_null_pointer::value; template - inline constexpr bool @\libglobal{is_integral_v}@ = is_integral::value; + constexpr bool @\libglobal{is_integral_v}@ = is_integral::value; template - inline constexpr bool @\libglobal{is_floating_point_v}@ = is_floating_point::value; + constexpr bool @\libglobal{is_floating_point_v}@ = is_floating_point::value; template - inline constexpr bool @\libglobal{is_array_v}@ = is_array::value; + constexpr bool @\libglobal{is_array_v}@ = is_array::value; template - inline constexpr bool @\libglobal{is_pointer_v}@ = is_pointer::value; + constexpr bool @\libglobal{is_pointer_v}@ = is_pointer::value; template - inline constexpr bool @\libglobal{is_lvalue_reference_v}@ = is_lvalue_reference::value; + constexpr bool @\libglobal{is_lvalue_reference_v}@ = is_lvalue_reference::value; template - inline constexpr bool @\libglobal{is_rvalue_reference_v}@ = is_rvalue_reference::value; + constexpr bool @\libglobal{is_rvalue_reference_v}@ = is_rvalue_reference::value; template - inline constexpr bool @\libglobal{is_member_object_pointer_v}@ = is_member_object_pointer::value; + constexpr bool @\libglobal{is_member_object_pointer_v}@ = is_member_object_pointer::value; template - inline constexpr bool @\libglobal{is_member_function_pointer_v}@ = is_member_function_pointer::value; + constexpr bool @\libglobal{is_member_function_pointer_v}@ = is_member_function_pointer::value; template - inline constexpr bool @\libglobal{is_enum_v}@ = is_enum::value; + constexpr bool @\libglobal{is_enum_v}@ = is_enum::value; template - inline constexpr bool @\libglobal{is_union_v}@ = is_union::value; + constexpr bool @\libglobal{is_union_v}@ = is_union::value; template - inline constexpr bool @\libglobal{is_class_v}@ = is_class::value; + constexpr bool @\libglobal{is_class_v}@ = is_class::value; template - inline constexpr bool @\libglobal{is_function_v}@ = is_function::value; + constexpr bool @\libglobal{is_function_v}@ = is_function::value; // \ref{meta.unary.comp}, composite type categories template - inline constexpr bool @\libglobal{is_reference_v}@ = is_reference::value; + constexpr bool @\libglobal{is_reference_v}@ = is_reference::value; template - inline constexpr bool @\libglobal{is_arithmetic_v}@ = is_arithmetic::value; + constexpr bool @\libglobal{is_arithmetic_v}@ = is_arithmetic::value; template - inline constexpr bool @\libglobal{is_fundamental_v}@ = is_fundamental::value; + constexpr bool @\libglobal{is_fundamental_v}@ = is_fundamental::value; template - inline constexpr bool @\libglobal{is_object_v}@ = is_object::value; + constexpr bool @\libglobal{is_object_v}@ = is_object::value; template - inline constexpr bool @\libglobal{is_scalar_v}@ = is_scalar::value; + constexpr bool @\libglobal{is_scalar_v}@ = is_scalar::value; template - inline constexpr bool @\libglobal{is_compound_v}@ = is_compound::value; + constexpr bool @\libglobal{is_compound_v}@ = is_compound::value; template - inline constexpr bool @\libglobal{is_member_pointer_v}@ = is_member_pointer::value; + constexpr bool @\libglobal{is_member_pointer_v}@ = is_member_pointer::value; // \ref{meta.unary.prop}, type properties template - inline constexpr bool @\libglobal{is_const_v}@ = is_const::value; + constexpr bool @\libglobal{is_const_v}@ = is_const::value; template - inline constexpr bool @\libglobal{is_volatile_v}@ = is_volatile::value; + constexpr bool @\libglobal{is_volatile_v}@ = is_volatile::value; template - inline constexpr bool @\libglobal{is_trivial_v}@ = is_trivial::value; + constexpr bool @\libglobal{is_trivial_v}@ = is_trivial::value; template - inline constexpr bool @\libglobal{is_trivially_copyable_v}@ = is_trivially_copyable::value; + constexpr bool @\libglobal{is_trivially_copyable_v}@ = is_trivially_copyable::value; template - inline constexpr bool @\libglobal{is_standard_layout_v}@ = is_standard_layout::value; + constexpr bool @\libglobal{is_standard_layout_v}@ = is_standard_layout::value; template - inline constexpr bool @\libglobal{is_empty_v}@ = is_empty::value; + constexpr bool @\libglobal{is_empty_v}@ = is_empty::value; template - inline constexpr bool @\libglobal{is_polymorphic_v}@ = is_polymorphic::value; + constexpr bool @\libglobal{is_polymorphic_v}@ = is_polymorphic::value; template - inline constexpr bool @\libglobal{is_abstract_v}@ = is_abstract::value; + constexpr bool @\libglobal{is_abstract_v}@ = is_abstract::value; template - inline constexpr bool @\libglobal{is_final_v}@ = is_final::value; + constexpr bool @\libglobal{is_final_v}@ = is_final::value; template - inline constexpr bool @\libglobal{is_aggregate_v}@ = is_aggregate::value; + constexpr bool @\libglobal{is_aggregate_v}@ = is_aggregate::value; template - inline constexpr bool @\libglobal{is_signed_v}@ = is_signed::value; + constexpr bool @\libglobal{is_signed_v}@ = is_signed::value; template - inline constexpr bool @\libglobal{is_unsigned_v}@ = is_unsigned::value; + constexpr bool @\libglobal{is_unsigned_v}@ = is_unsigned::value; template - inline constexpr bool @\libglobal{is_bounded_array_v}@ = is_bounded_array::value; + constexpr bool @\libglobal{is_bounded_array_v}@ = is_bounded_array::value; template - inline constexpr bool @\libglobal{is_unbounded_array_v}@ = is_unbounded_array::value; + constexpr bool @\libglobal{is_unbounded_array_v}@ = is_unbounded_array::value; template - inline constexpr bool @\libglobal{is_scoped_enum_v}@ = is_scoped_enum::value; + constexpr bool @\libglobal{is_scoped_enum_v}@ = is_scoped_enum::value; template - inline constexpr bool @\libglobal{is_constructible_v}@ = is_constructible::value; + constexpr bool @\libglobal{is_constructible_v}@ = is_constructible::value; template - inline constexpr bool @\libglobal{is_default_constructible_v}@ = is_default_constructible::value; + constexpr bool @\libglobal{is_default_constructible_v}@ = is_default_constructible::value; template - inline constexpr bool @\libglobal{is_copy_constructible_v}@ = is_copy_constructible::value; + constexpr bool @\libglobal{is_copy_constructible_v}@ = is_copy_constructible::value; template - inline constexpr bool @\libglobal{is_move_constructible_v}@ = is_move_constructible::value; + constexpr bool @\libglobal{is_move_constructible_v}@ = is_move_constructible::value; template - inline constexpr bool @\libglobal{is_assignable_v}@ = is_assignable::value; + constexpr bool @\libglobal{is_assignable_v}@ = is_assignable::value; template - inline constexpr bool @\libglobal{is_copy_assignable_v}@ = is_copy_assignable::value; + constexpr bool @\libglobal{is_copy_assignable_v}@ = is_copy_assignable::value; template - inline constexpr bool @\libglobal{is_move_assignable_v}@ = is_move_assignable::value; + constexpr bool @\libglobal{is_move_assignable_v}@ = is_move_assignable::value; template - inline constexpr bool @\libglobal{is_swappable_with_v}@ = is_swappable_with::value; + constexpr bool @\libglobal{is_swappable_with_v}@ = is_swappable_with::value; template - inline constexpr bool @\libglobal{is_swappable_v}@ = is_swappable::value; + constexpr bool @\libglobal{is_swappable_v}@ = is_swappable::value; template - inline constexpr bool @\libglobal{is_destructible_v}@ = is_destructible::value; + constexpr bool @\libglobal{is_destructible_v}@ = is_destructible::value; template - inline constexpr bool is_trivially_constructible_v + constexpr bool is_trivially_constructible_v = is_trivially_constructible::value; template - inline constexpr bool is_trivially_default_constructible_v + constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible::value; template - inline constexpr bool is_trivially_copy_constructible_v + constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible::value; template - inline constexpr bool is_trivially_move_constructible_v + constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible::value; template - inline constexpr bool @\libglobal{is_trivially_assignable_v}@ = is_trivially_assignable::value; + constexpr bool @\libglobal{is_trivially_assignable_v}@ = is_trivially_assignable::value; template - inline constexpr bool is_trivially_copy_assignable_v + constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable::value; template - inline constexpr bool is_trivially_move_assignable_v + constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable::value; template - inline constexpr bool @\libglobal{is_trivially_destructible_v}@ = is_trivially_destructible::value; + constexpr bool @\libglobal{is_trivially_destructible_v}@ = is_trivially_destructible::value; template - inline constexpr bool is_nothrow_constructible_v + constexpr bool is_nothrow_constructible_v = is_nothrow_constructible::value; template - inline constexpr bool is_nothrow_default_constructible_v + constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible::value; template - inline constexpr bool is_nothrow_copy_constructible_v + constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible::value; template - inline constexpr bool is_nothrow_move_constructible_v + constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible::value; template - inline constexpr bool @\libglobal{is_nothrow_assignable_v}@ = is_nothrow_assignable::value; + constexpr bool @\libglobal{is_nothrow_assignable_v}@ = is_nothrow_assignable::value; template - inline constexpr bool @\libglobal{is_nothrow_copy_assignable_v}@ = is_nothrow_copy_assignable::value; + constexpr bool @\libglobal{is_nothrow_copy_assignable_v}@ = is_nothrow_copy_assignable::value; template - inline constexpr bool @\libglobal{is_nothrow_move_assignable_v}@ = is_nothrow_move_assignable::value; + constexpr bool @\libglobal{is_nothrow_move_assignable_v}@ = is_nothrow_move_assignable::value; template - inline constexpr bool @\libglobal{is_nothrow_swappable_with_v}@ = is_nothrow_swappable_with::value; + constexpr bool @\libglobal{is_nothrow_swappable_with_v}@ = is_nothrow_swappable_with::value; template - inline constexpr bool @\libglobal{is_nothrow_swappable_v}@ = is_nothrow_swappable::value; + constexpr bool @\libglobal{is_nothrow_swappable_v}@ = is_nothrow_swappable::value; template - inline constexpr bool @\libglobal{is_nothrow_destructible_v}@ = is_nothrow_destructible::value; + constexpr bool @\libglobal{is_nothrow_destructible_v}@ = is_nothrow_destructible::value; template - inline constexpr bool @\libglobal{has_virtual_destructor_v}@ = has_virtual_destructor::value; + constexpr bool @\libglobal{has_virtual_destructor_v}@ = has_virtual_destructor::value; template - inline constexpr bool has_unique_object_representations_v + constexpr bool has_unique_object_representations_v = has_unique_object_representations::value; template - inline constexpr bool @\libglobal{reference_constructs_from_temporary_v}@ + constexpr bool @\libglobal{reference_constructs_from_temporary_v}@ = reference_constructs_from_temporary::value; template - inline constexpr bool @\libglobal{reference_converts_from_temporary_v}@ + constexpr bool @\libglobal{reference_converts_from_temporary_v}@ = reference_converts_from_temporary::value; // \ref{meta.unary.prop.query}, type property queries template - inline constexpr size_t @\libglobal{alignment_of_v}@ = alignment_of::value; + constexpr size_t @\libglobal{alignment_of_v}@ = alignment_of::value; template - inline constexpr size_t @\libglobal{rank_v}@ = rank::value; + constexpr size_t @\libglobal{rank_v}@ = rank::value; template - inline constexpr size_t @\libglobal{extent_v}@ = extent::value; + constexpr size_t @\libglobal{extent_v}@ = extent::value; // \ref{meta.rel}, type relations template - inline constexpr bool @\libglobal{is_same_v}@ = is_same::value; + constexpr bool @\libglobal{is_same_v}@ = is_same::value; template - inline constexpr bool @\libglobal{is_base_of_v}@ = is_base_of::value; + constexpr bool @\libglobal{is_base_of_v}@ = is_base_of::value; template - inline constexpr bool @\libglobal{is_convertible_v}@ = is_convertible::value; + constexpr bool @\libglobal{is_convertible_v}@ = is_convertible::value; template - inline constexpr bool @\libglobal{is_nothrow_convertible_v}@ = is_nothrow_convertible::value; + constexpr bool @\libglobal{is_nothrow_convertible_v}@ = is_nothrow_convertible::value; template - inline constexpr bool @\libglobal{is_layout_compatible_v}@ = is_layout_compatible::value; + constexpr bool @\libglobal{is_layout_compatible_v}@ = is_layout_compatible::value; template - inline constexpr bool is_pointer_interconvertible_base_of_v + constexpr bool is_pointer_interconvertible_base_of_v = is_pointer_interconvertible_base_of::value; template - inline constexpr bool @\libglobal{is_invocable_v}@ = is_invocable::value; + constexpr bool @\libglobal{is_invocable_v}@ = is_invocable::value; template - inline constexpr bool @\libglobal{is_invocable_r_v}@ = is_invocable_r::value; + constexpr bool @\libglobal{is_invocable_r_v}@ = is_invocable_r::value; template - inline constexpr bool @\libglobal{is_nothrow_invocable_v}@ = is_nothrow_invocable::value; + constexpr bool @\libglobal{is_nothrow_invocable_v}@ = is_nothrow_invocable::value; template - inline constexpr bool is_nothrow_invocable_r_v + constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r::value; // \ref{meta.logical}, logical operator traits template - inline constexpr bool @\libglobal{conjunction_v}@ = conjunction::value; + constexpr bool @\libglobal{conjunction_v}@ = conjunction::value; template - inline constexpr bool @\libglobal{disjunction_v}@ = disjunction::value; + constexpr bool @\libglobal{disjunction_v}@ = disjunction::value; template - inline constexpr bool @\libglobal{negation_v}@ = negation::value; + constexpr bool @\libglobal{negation_v}@ = negation::value; // \ref{meta.member}, member relationships template @@ -881,7 +881,7 @@ \tcode{template}\br \tcode{struct is_aggregate;} & \tcode{T} is an aggregate type\iref{dcl.init.aggr} & - \tcode{remove_all_extents_t} shall be a complete type or \cv~\keyword{void}. \\ \rowsep + \tcode{T} shall be an array type, a complete type, or \cv~\keyword{void}. \\ \rowsep \indexlibrary{\idxcode{is_signed}!class}% \tcode{template}\br @@ -1471,7 +1471,7 @@ \indexlibraryglobal{is_invocable}% \tcode{template}\br \tcode{struct is_invocable;} & - The expression \tcode{\placeholdernc{INVOKE}(declval(), declval()...)} + The expression \tcode{\placeholdernc{INVOKE}(declval(), declval()...)}\iref{func.require} is well-formed when treated as an unevaluated operand\iref{term.unevaluated.operand} & \tcode{Fn} and all types in the template parameter pack \tcode{ArgTypes} shall be complete types, \cv{}~\keyword{void}, or @@ -1896,11 +1896,12 @@ otherwise, there is no member \tcode{type}.\br \mandates \tcode{T} is not an incomplete enumeration type. \\ \rowsep +\indexlibraryglobal{invoke_result}% \tcode{template}\br \tcode{struct invoke_result;} & - If the expression \tcode{\placeholdernc{INVOKE}(declval(), declval()...)} + If the expression \tcode{\placeholdernc{INVOKE}(declval(), declval()...)}\iref{func.require} is well-formed when treated as an unevaluated operand\iref{term.unevaluated.operand}, the member typedef \tcode{type} denotes the type \tcode{decltype(\placeholdernc{INVOKE}(declval(), declval()...))}; @@ -2359,6 +2360,8 @@ \end{note} \rSec2[meta.const.eval]{Constant evaluation context} + +\indexlibraryglobal{is_constant_evaluated}% \begin{itemdecl} constexpr bool is_constant_evaluated() noexcept; \end{itemdecl} @@ -2430,39 +2433,39 @@ template struct ratio_greater_equal; template - inline constexpr bool @\libglobal{ratio_equal_v}@ = ratio_equal::value; + constexpr bool @\libglobal{ratio_equal_v}@ = ratio_equal::value; template - inline constexpr bool @\libglobal{ratio_not_equal_v}@ = ratio_not_equal::value; + constexpr bool @\libglobal{ratio_not_equal_v}@ = ratio_not_equal::value; template - inline constexpr bool @\libglobal{ratio_less_v}@ = ratio_less::value; + constexpr bool @\libglobal{ratio_less_v}@ = ratio_less::value; template - inline constexpr bool @\libglobal{ratio_less_equal_v}@ = ratio_less_equal::value; + constexpr bool @\libglobal{ratio_less_equal_v}@ = ratio_less_equal::value; template - inline constexpr bool @\libglobal{ratio_greater_v}@ = ratio_greater::value; + constexpr bool @\libglobal{ratio_greater_v}@ = ratio_greater::value; template - inline constexpr bool @\libglobal{ratio_greater_equal_v}@ = ratio_greater_equal::value; + constexpr bool @\libglobal{ratio_greater_equal_v}@ = ratio_greater_equal::value; // \ref{ratio.si}, convenience SI typedefs - using yocto = ratio<1, 1'000'000'000'000'000'000'000'000>; // see below - using zepto = ratio<1, 1'000'000'000'000'000'000'000>; // see below - using atto = ratio<1, 1'000'000'000'000'000'000>; - using femto = ratio<1, 1'000'000'000'000'000>; - using pico = ratio<1, 1'000'000'000'000>; - using nano = ratio<1, 1'000'000'000>; - using micro = ratio<1, 1'000'000>; - using milli = ratio<1, 1'000>; - using centi = ratio<1, 100>; - using deci = ratio<1, 10>; - using deca = ratio< 10, 1>; - using hecto = ratio< 100, 1>; - using kilo = ratio< 1'000, 1>; - using mega = ratio< 1'000'000, 1>; - using giga = ratio< 1'000'000'000, 1>; - using tera = ratio< 1'000'000'000'000, 1>; - using peta = ratio< 1'000'000'000'000'000, 1>; - using exa = ratio< 1'000'000'000'000'000'000, 1>; - using zetta = ratio< 1'000'000'000'000'000'000'000, 1>; // see below - using yotta = ratio<1'000'000'000'000'000'000'000'000, 1>; // see below + using @\libglobal{yocto}@ = ratio<1, 1'000'000'000'000'000'000'000'000>; // see below + using @\libglobal{zepto}@ = ratio<1, 1'000'000'000'000'000'000'000>; // see below + using @\libglobal{atto}@ = ratio<1, 1'000'000'000'000'000'000>; + using @\libglobal{femto}@ = ratio<1, 1'000'000'000'000'000>; + using @\libglobal{pico}@ = ratio<1, 1'000'000'000'000>; + using @\libglobal{nano}@ = ratio<1, 1'000'000'000>; + using @\libglobal{micro}@ = ratio<1, 1'000'000>; + using @\libglobal{milli}@ = ratio<1, 1'000>; + using @\libglobal{centi}@ = ratio<1, 100>; + using @\libglobal{deci}@ = ratio<1, 10>; + using @\libglobal{deca}@ = ratio< 10, 1>; + using @\libglobal{hecto}@ = ratio< 100, 1>; + using @\libglobal{kilo}@ = ratio< 1'000, 1>; + using @\libglobal{mega}@ = ratio< 1'000'000, 1>; + using @\libglobal{giga}@ = ratio< 1'000'000'000, 1>; + using @\libglobal{tera}@ = ratio< 1'000'000'000'000, 1>; + using @\libglobal{peta}@ = ratio< 1'000'000'000'000'000, 1>; + using @\libglobal{exa}@ = ratio< 1'000'000'000'000'000'000, 1>; + using @\libglobal{zetta}@ = ratio< 1'000'000'000'000'000'000'000, 1>; // see below + using @\libglobal{yotta}@ = ratio<1'000'000'000'000'000'000'000'000, 1>; // see below } \end{codeblockdigitsep} @@ -2498,7 +2501,7 @@ \tcode{N} and \tcode{D}: \begin{itemize} -\item \tcode{num} shall have the value \tcode{sign(N) * sign(D) * abs(N) / gcd}. +\item \tcode{num} shall have the value \tcode{$\operatorname{sgn}(\tcode{N})$ * $\operatorname{sgn}(\tcode{D})$ * abs(N) / gcd}. \item \tcode{den} shall have the value \tcode{abs(D) / gcd}. \end{itemize} @@ -2624,6 +2627,10 @@ \rSec2[ratio.si]{SI types for \tcode{ratio}} \pnum +\indexlibraryglobal{yocto}% +\indexlibraryglobal{zepto}% +\indexlibraryglobal{zetta}% +\indexlibraryglobal{yotta}% For each of the \grammarterm{typedef-name}{s} \tcode{yocto}, \tcode{zepto}, \tcode{zetta}, and \tcode{yotta}, if both of the constants used in its specification are representable by \tcode{intmax_t}, the typedef is diff --git a/source/modules.tex b/source/modules.tex index 3701762ced..0a65f8c069 100644 --- a/source/modules.tex +++ b/source/modules.tex @@ -196,7 +196,7 @@ \begin{bnf} \nontermdef{export-declaration}\br - \keyword{export} declaration\br + \keyword{export} name-declaration\br \keyword{export} \terminal{\{} \opt{declaration-seq} \terminal{\}}\br export-keyword module-import-declaration \end{bnf} @@ -209,10 +209,12 @@ or a \grammarterm{private-module-fragment}. An \grammarterm{export-declaration} has the declarative effects of its -\grammarterm{declaration}, +\grammarterm{name-declaration}, \grammarterm{declaration-seq} (if any), or \grammarterm{module-import-declaration}. -The \grammarterm{declaration} or \grammarterm{declaration-seq} of +The \grammarterm{name-declaration} of an \grammarterm{export-declaration} +shall not declare a partial specialization\iref{temp.decls.general}. +The \grammarterm{declaration-seq} of an \grammarterm{export-declaration} shall not contain an \grammarterm{export-declaration} or \grammarterm{module-import-declaration}. @@ -232,10 +234,7 @@ \end{itemize} \pnum -An exported declaration -that is not a \grammarterm{module-import-declaration} -shall declare at least one name. -If the declaration is not within a header unit, +If an exported declaration is not within a header unit, it shall not declare a name with internal linkage. \pnum @@ -249,17 +248,14 @@ #include "a.h" // error: declaration of \tcode{x} is not in the // purview of a module interface unit export module M; -export namespace {} // error: does not introduce any names -export namespace { - int a1; // error: export of name with internal linkage -} +export namespace {} // error: namespace has internal linkage namespace { export int a2; // error: export of name with internal linkage } export static int b; // error: b explicitly declared static export int f(); // OK export namespace N { } // OK -export using namespace N; // error: does not declare a name +export using namespace N; // OK \end{codeblocktu} \end{example} @@ -1048,7 +1044,6 @@ \end{codeblocktu} \begin{codeblocktu}{Translation unit \#5} -module X; import M; B b3; // error: no reachable definition of \tcode{struct B} void g() { f(); } // error: no reachable definition of \tcode{struct B} @@ -1069,7 +1064,6 @@ \end{codeblocktu} \begin{codeblocktu}{Translation unit \#2} -module B; import A; Y y; // OK, definition of \tcode{X} is reachable X x; // error: \tcode{X} not visible to unqualified lookup diff --git a/source/numerics.tex b/source/numerics.tex index 514319824d..e5b998e1ed 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -1571,9 +1571,9 @@ \tcode{T} is the type named by \tcode{S}'s associated \tcode{result_type}; \item - \tcode{q} is a value of \tcode{S} + \tcode{q} is a value of type \tcode{S} and - \tcode{r} is a possibly const value of \tcode{S}; + \tcode{r} is a value of type \tcode{S} or \tcode{const S}; \item \tcode{ib} and \tcode{ie} are input iterators with an unsigned integer \tcode{value_type} of at least 32 bits; @@ -1584,7 +1584,7 @@ \tcode{ob} is an output iterator; and \item - \tcode{il} is a value of \tcode{initializer_list}. + \tcode{il} is a value of type \tcode{initializer_list}. \end{itemize} @@ -1789,7 +1789,7 @@ \item \tcode{e} is a value of \tcode{E}, \tcode{v} is an lvalue of \tcode{E}, - \tcode{x} and \tcode{y} are (possibly \keyword{const}) values of \tcode{E}; + \tcode{x} and \tcode{y} are (possibly const) values of \tcode{E}; \item \tcode{s} is a value of \tcode{T}; \item @@ -2172,7 +2172,7 @@ \tcode{d} is a value of \tcode{D}, and - \tcode{x} and \tcode{y} are (possibly \keyword{const}) values of \tcode{D}; + \tcode{x} and \tcode{y} are (possibly const) values of \tcode{D}; \item \tcode{glb} and \tcode{lub} are values of \tcode{T} @@ -2181,7 +2181,7 @@ on the values potentially returned by \tcode{d}'s \tcode{operator()}, as determined by the current values of \tcode{d}'s parameters; \item - \tcode{p} is a (possibly \keyword{const}) value of \tcode{P}; + \tcode{p} is a (possibly const) value of \tcode{P}; \item \tcode{g}, \tcode{g1}, and \tcode{g2} are lvalues of a type meeting the requirements @@ -9401,7 +9401,7 @@ \indexlibrary{\idxcode{hypot}!3-argument form}% \begin{itemdecl} -@\placeholder{floating-point-type}@ hypot(@\placeholder{floating-point-type}@ x, @\placeholder{floating-point-type}@ y, double z); +@\placeholder{floating-point-type}@ hypot(@\placeholder{floating-point-type}@ x, @\placeholder{floating-point-type}@ y, @\placeholder{floating-point-type}@ z); \end{itemdecl} \begin{itemdescr} @@ -10301,33 +10301,33 @@ \indexheader{numbers}% \begin{codeblock} namespace std::numbers { - template inline constexpr T e_v = @\unspec@; - template inline constexpr T log2e_v = @\unspec@; - template inline constexpr T log10e_v = @\unspec@; - template inline constexpr T pi_v = @\unspec@; - template inline constexpr T inv_pi_v = @\unspec@; - template inline constexpr T inv_sqrtpi_v = @\unspec@; - template inline constexpr T ln2_v = @\unspec@; - template inline constexpr T ln10_v = @\unspec@; - template inline constexpr T sqrt2_v = @\unspec@; - template inline constexpr T sqrt3_v = @\unspec@; - template inline constexpr T inv_sqrt3_v = @\unspec@; - template inline constexpr T egamma_v = @\unspec@; - template inline constexpr T phi_v = @\unspec@; - - template<@\libconcept{floating_point}@ T> inline constexpr T e_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T log2e_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T log10e_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T pi_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T inv_pi_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T inv_sqrtpi_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T ln2_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T ln10_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T sqrt2_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T sqrt3_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T inv_sqrt3_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T egamma_v = @\seebelow@; - template<@\libconcept{floating_point}@ T> inline constexpr T phi_v = @\seebelow@; + template constexpr T e_v = @\unspec@; + template constexpr T log2e_v = @\unspec@; + template constexpr T log10e_v = @\unspec@; + template constexpr T pi_v = @\unspec@; + template constexpr T inv_pi_v = @\unspec@; + template constexpr T inv_sqrtpi_v = @\unspec@; + template constexpr T ln2_v = @\unspec@; + template constexpr T ln10_v = @\unspec@; + template constexpr T sqrt2_v = @\unspec@; + template constexpr T sqrt3_v = @\unspec@; + template constexpr T inv_sqrt3_v = @\unspec@; + template constexpr T egamma_v = @\unspec@; + template constexpr T phi_v = @\unspec@; + + template<@\libconcept{floating_point}@ T> constexpr T e_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T log2e_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T log10e_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T pi_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T inv_pi_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T inv_sqrtpi_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T ln2_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T ln10_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T sqrt2_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T sqrt3_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T inv_sqrt3_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T egamma_v = @\seebelow@; + template<@\libconcept{floating_point}@ T> constexpr T phi_v = @\seebelow@; inline constexpr double e = e_v; inline constexpr double log2e = log2e_v; diff --git a/source/overloading.tex b/source/overloading.tex index a43a964b5c..ec0d55b2fc 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -579,12 +579,6 @@ When comparing the call against a surrogate call function, the implied object argument is compared against the first parameter of the surrogate call function. -The -conversion function from which the surrogate call function was -derived will be used in the conversion sequence for that -parameter since it converts the implied object argument to the -appropriate function pointer or reference required by that first -parameter. \end{note} \begin{example} \begin{codeblock} @@ -2051,6 +2045,8 @@ to \tcode{A}. \end{example} + +\pnum When the parameter has a class type and the argument expression has the same type, the implicit conversion sequence is an identity conversion. When the parameter has a class type and the argument expression has a @@ -2058,11 +2054,13 @@ derived-to-base \indextext{conversion!derived-to-base}% conversion from the derived class to the base class. +A derived-to-base conversion has Conversion rank\iref{over.ics.scs}. \begin{note} There is no such standard conversion; this derived-to-base conversion exists only in the description of implicit conversion sequences. \end{note} -A derived-to-base conversion has Conversion rank\iref{over.ics.scs}. + +\pnum When the parameter is the implicit object parameter of a static member function, the implicit conversion sequence is a standard conversion sequence that is neither better nor worse than any other standard conversion sequence. @@ -3414,11 +3412,12 @@ where the \grammarterm{postfix-expression} is of class type, the operator function is selected by overload resolution\iref{over.call.object}. -If a surrogate call function for a conversion function -named \keyword{operator} \grammarterm{conversion-type-id} is selected, +If a surrogate call function is selected, +let $e$ be the result of invoking the corresponding conversion operator function on the \grammarterm{postfix-expression}; + the expression is interpreted as \begin{ncsimplebnf} -postfix-expression \terminal{.} \keyword{operator} conversion-type-id \terminal{(}\terminal{)} \terminal{(} \opt{expression-list} \terminal{)} +$e$ \terminal{(} \opt{expression-list} \terminal{)} \end{ncsimplebnf} Otherwise, the expression is interpreted as \begin{ncsimplebnf} @@ -3431,8 +3430,8 @@ \pnum A \defnadj{subscripting}{operator function} -is a function named \tcode{\keyword{operator}[]} -that is a non-static member function with an arbitrary number of parameters. +is a member function named \tcode{\keyword{operator}[]} +with an arbitrary number of parameters. It may have default arguments. For an expression of the form \begin{ncsimplebnf} diff --git a/source/preface.tex b/source/preface.tex new file mode 100644 index 0000000000..1e11dd524f --- /dev/null +++ b/source/preface.tex @@ -0,0 +1,4 @@ +%!TEX root = std.tex +\chapter{Foreword} + +[This page is intentionally left blank.] diff --git a/source/preprocessor.tex b/source/preprocessor.tex index af42cac023..d01c69babf 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -390,6 +390,7 @@ {ll} \topline \lhdr{Attribute} & \rhdr{Value} \\ \rowsep +\tcode{assume} & \tcode{202207L} \\ \tcode{carries_dependency} & \tcode{200809L} \\ \tcode{deprecated} & \tcode{201309L} \\ \tcode{fallthrough} & \tcode{201603L} \\ @@ -474,7 +475,7 @@ in~\ref{support.limits}. For the purposes of this token conversion and evaluation all signed and unsigned integer types act as if they have the same representation as, respectively, -\tcode{intmax_t} or \tcode{uintmax_t}\iref{cstdint}. +\tcode{intmax_t} or \tcode{uintmax_t}\iref{cstdint.syn}. \begin{note} Thus on an implementation where \tcode{std::numeric_limits::max()} is \tcode{0x7FFF} @@ -1765,7 +1766,8 @@ \mname{STDCPP_BFLOAT16_T}\\ Defined as the integer literal \tcode{1} if and only if the implementation supports an extended floating-point type -with the properties described in \ref{basic.extended.fp}. +with the properties of the \grammarterm{typedef-name} \tcode{std::bfloat16_t} +as described in \ref{basic.extended.fp}. \item \indextext{__time__@\mname{TIME}}% @@ -1799,10 +1801,10 @@ \defnxname{cpp_char8_t} & \tcode{202207L} \\ \rowsep \defnxname{cpp_concepts} & \tcode{202002L} \\ \rowsep \defnxname{cpp_conditional_explicit} & \tcode{201806L} \\ \rowsep -\defnxname{cpp_constexpr} & \tcode{202207L} \\ \rowsep +\defnxname{cpp_constexpr} & \tcode{202211L} \\ \rowsep \defnxname{cpp_constexpr_dynamic_alloc} & \tcode{201907L} \\ \rowsep \defnxname{cpp_constexpr_in_decltype} & \tcode{201711L} \\ \rowsep -\defnxname{cpp_consteval} & \tcode{201811L} \\ \rowsep +\defnxname{cpp_consteval} & \tcode{202211L} \\ \rowsep \defnxname{cpp_constinit} & \tcode{201907L} \\ \rowsep \defnxname{cpp_decltype} & \tcode{200707L} \\ \rowsep \defnxname{cpp_decltype_auto} & \tcode{201304L} \\ \rowsep @@ -1827,7 +1829,7 @@ \defnxname{cpp_inline_variables} & \tcode{201606L} \\ \rowsep \defnxname{cpp_lambdas} & \tcode{200907L} \\ \rowsep \defnxname{cpp_modules} & \tcode{201907L} \\ \rowsep -\defnxname{cpp_multidimensional_subscript} & \tcode{202110L} \\ \rowsep +\defnxname{cpp_multidimensional_subscript} & \tcode{202211L} \\ \rowsep \defnxname{cpp_named_character_escapes} & \tcode{202207L} \\ \rowsep \defnxname{cpp_namespace_attributes} & \tcode{201411L} \\ \rowsep \defnxname{cpp_noexcept_function_type} & \tcode{201510L} \\ \rowsep diff --git a/source/ranges.tex b/source/ranges.tex index 82e0257ed3..33bf7dd175 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -55,7 +55,7 @@ concept range = @\seebelow@; // freestanding template - inline constexpr bool enable_borrowed_range = false; // freestanding + constexpr bool enable_borrowed_range = false; // freestanding template concept borrowed_range = @\seebelow@; // freestanding @@ -66,6 +66,8 @@ using sentinel_t = decltype(ranges::end(declval())); // freestanding template<@\libconcept{range}@ R> using const_iterator_t = const_iterator>; // freestanding + template<@\libconcept{range}@ R> + using const_sentinel_t = const_sentinel>; // freestanding template<@\libconcept{range}@ R> using range_difference_t = iter_difference_t>; // freestanding template<@\libconcept{sized_range}@ R> @@ -81,14 +83,14 @@ // \ref{range.sized}, sized ranges template - inline constexpr bool disable_sized_range = false; // freestanding + constexpr bool disable_sized_range = false; // freestanding template concept sized_range = @\seebelow@; // freestanding // \ref{range.view}, views template - inline constexpr bool enable_view = @\seebelow@; // freestanding + constexpr bool enable_view = @\seebelow@; // freestanding struct view_base {}; // freestanding @@ -129,33 +131,33 @@ class view_interface; // freestanding // \ref{range.subrange}, sub-ranges - enum class subrange_kind : bool { unsized, sized }; // freestanding + enum class @\libglobal{subrange_kind}@ : bool { @\libmember{unsized}{subrange_kind}@, @\libmember{sized}{subrange_kind}@ }; // freestanding template<@\libconcept{input_or_output_iterator}@ I, @\libconcept{sentinel_for}@ S = I, subrange_kind K = @\seebelow@> requires (K == subrange_kind::sized || !@\libconcept{sized_sentinel_for}@) class subrange; // freestanding template - inline constexpr bool enable_borrowed_range> = true; // freestanding + constexpr bool enable_borrowed_range> = true; // freestanding template requires ((N == 0 && @\libconcept{copyable}@) || N == 1) - constexpr auto get(const subrange& r); + constexpr auto get(const subrange& r); // freestanding template requires (N < 2) - constexpr auto get(subrange&& r); + constexpr auto get(subrange&& r); // freestanding } namespace std { - using ranges::get; + using ranges::get; // freestanding } namespace std::ranges { // \ref{range.dangling}, dangling iterator handling struct dangling; // freestanding - // \ref{ranges.elementsof}, class template \tcode{elements_of} + // \ref{range.elementsof}, class template \tcode{elements_of} template<@\libconcept{range}@ R, class Allocator = allocator> struct elements_of; @@ -181,11 +183,11 @@ class empty_view; // freestanding template - inline constexpr bool enable_borrowed_range> = true; // freestanding + constexpr bool enable_borrowed_range> = true; // freestanding namespace views { template - inline constexpr empty_view @\libmember{empty}{views}@{}; // freestanding + constexpr empty_view @\libmember{empty}{views}@{}; // freestanding } // \ref{range.single}, single view @@ -204,17 +206,17 @@ class iota_view; // freestanding template - inline constexpr bool enable_borrowed_range> = true; // freestanding + constexpr bool enable_borrowed_range> = true; // freestanding namespace views { inline constexpr @\unspecnc@ iota = @\unspecnc@; } // freestanding // \ref{range.repeat}, repeat view - template<@\libconcept{move_constructible}@ W, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t> - requires (is_object_v && @\libconcept{same_as}@> + template<@\libconcept{move_constructible}@ T, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t> + requires (is_object_v && @\libconcept{same_as}@> && (@\exposid{is-integer-like}@ || @\libconcept{same_as}@)) - class repeat_view; + class repeat_view; // freestanding - namespace views { inline constexpr @\unspec@ repeat = @\unspec@; } + namespace views { inline constexpr @\unspecnc@ repeat = @\unspecnc@; } // freestanding // \ref{range.istream}, istream view template<@\libconcept{movable}@ Val, class CharT, class Traits = char_traits> @@ -225,7 +227,7 @@ template using wistream_view = basic_istream_view; - namespace views { template inline constexpr @\unspecnc@ istream = @\unspecnc@; } + namespace views { template constexpr @\unspecnc@ istream = @\unspecnc@; } // \ref{range.adaptor.object}, range adaptor objects template @@ -246,7 +248,7 @@ class ref_view; // freestanding template - inline constexpr bool enable_borrowed_range> = true; // freestanding + constexpr bool enable_borrowed_range> = true; // freestanding // \ref{range.owning.view}, owning view template<@\libconcept{range}@ R> @@ -254,7 +256,7 @@ class owning_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; // \ref{range.as.rvalue}, as rvalue view @@ -263,7 +265,7 @@ class as_rvalue_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; namespace views { inline constexpr @\unspecnc@ as_rvalue = @\unspecnc@; } // freestanding @@ -288,7 +290,7 @@ template<@\libconcept{view}@> class take_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; namespace views { inline constexpr @\unspecnc@ take = @\unspecnc@; } // freestanding @@ -306,7 +308,7 @@ class drop_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; namespace views { inline constexpr @\unspecnc@ drop = @\unspecnc@; } // freestanding @@ -318,7 +320,7 @@ class drop_while_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; namespace views { inline constexpr @\unspecnc@ drop_while = @\unspecnc@; } // freestanding @@ -372,7 +374,7 @@ class common_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; namespace views { inline constexpr @\unspecnc@ common = @\unspecnc@; } // freestanding @@ -383,7 +385,7 @@ class reverse_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; namespace views { inline constexpr @\unspecnc@ reverse = @\unspecnc@; } // freestanding @@ -403,7 +405,7 @@ class as_const_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; namespace views { inline constexpr @\unspecnc@ as_const = @\unspecnc@; } // freestanding @@ -414,7 +416,7 @@ class elements_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; template @@ -424,7 +426,7 @@ namespace views { template - inline constexpr @\unspecnc@ elements = @\unspecnc@; // freestanding + constexpr @\unspecnc@ elements = @\unspecnc@; // freestanding inline constexpr auto @\libmember{keys}{views}@ = elements<0>; // freestanding inline constexpr auto @\libmember{values}{views}@ = elements<1>; // freestanding } @@ -435,7 +437,7 @@ class zip_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding (enable_borrowed_range && ...); namespace views { inline constexpr @\unspecnc@ zip = @\unspecnc@; } // freestanding @@ -455,7 +457,7 @@ class adjacent_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding enable_borrowed_range; namespace views { @@ -485,7 +487,7 @@ class chunk_view; // freestanding template - inline constexpr bool enable_borrowed_range> = // freestanding + constexpr bool enable_borrowed_range> = // freestanding @\libconcept{forward_range}@ && enable_borrowed_range; namespace views { inline constexpr @\unspecnc@ chunk = @\unspecnc@; } // freestanding @@ -496,7 +498,7 @@ class slide_view; // freestanding template - inline constexpr bool enable_borrowed_range> = + constexpr bool enable_borrowed_range> = enable_borrowed_range; // freestanding namespace views { inline constexpr @\unspecnc@ slide = @\unspecnc@; } // freestanding @@ -511,19 +513,20 @@ // \ref{range.stride}, stride view template<@\libconcept{input_range}@ V> requires @\libconcept{view}@ - class stride_view; + class stride_view; // freestanding template - inline constexpr bool enable_borrowed_range> = enable_borrowed_range; + constexpr bool enable_borrowed_range> = // freestanding + enable_borrowed_range; - namespace views { inline constexpr @\unspecnc@ stride = @\unspecnc@; } + namespace views { inline constexpr @\unspecnc@ stride = @\unspecnc@; } // freestanding // \ref{range.cartesian}, cartesian product view template<@\libconcept{input_range}@ First, @\libconcept{forward_range}@... Vs> requires (@\libconcept{view}@ && ... && @\libconcept{view}@) - class cartesian_product_view; + class cartesian_product_view; // freestanding - namespace views { inline constexpr @\unspecnc@ cartesian_product = @\unspecnc@; } + namespace views { inline constexpr @\unspecnc@ cartesian_product = @\unspecnc@; } // freestanding } namespace std { @@ -637,15 +640,10 @@ \tcode{auto(begin(t))} is a valid expression whose type models \libconcept{input_or_output_iterator} - with overload resolution performed in a context in which - unqualified lookup for \tcode{begin} finds only the declarations -\begin{codeblock} -void begin(auto&) = delete; -void begin(const auto&) = delete; -\end{codeblock} + where the meaning of \tcode{begin} is established as-if by performing + argument-dependent lookup only\iref{basic.lookup.argdep}, then \tcode{ranges::begin(E)} is expression-equivalent to - \tcode{auto(begin(t))} - with overload resolution performed in the above context. + that expression. \item Otherwise, \tcode{ranges::begin(E)} is ill-formed. @@ -708,15 +706,10 @@ \tcode{auto(end(t))} is a valid expression whose type models \tcode{\libconcept{sentinel_for}>} - with overload resolution performed in a context in which - unqualified lookup for \tcode{end} finds only the declarations -\begin{codeblock} -void end(auto&) = delete; -void end(const auto&) = delete; -\end{codeblock} + where the meaning of \tcode{end} is established as-if by performing + argument-dependent lookup only\iref{basic.lookup.argdep}, then \tcode{ranges::end(E)} is expression-equivalent to - \tcode{auto(end(t))} - with overload resolution performed in the above context. + that expression. \item Otherwise, \tcode{ranges::end(E)} is ill-formed. @@ -830,15 +823,10 @@ \tcode{auto(rbegin(t))} is a valid expression whose type models \libconcept{input_or_output_iterator} - with overload resolution performed in a context in which - unqualified lookup for \tcode{rbegin} finds only the declarations -\begin{codeblock} -void rbegin(auto&) = delete; -void rbegin(const auto&) = delete; -\end{codeblock} + where the meaning of \tcode{rbegin} is established as-if by performing + argument-dependent lookup only\iref{basic.lookup.argdep}, then \tcode{ranges::rbegin(E)} is expression-equivalent to - \tcode{auto(rbegin(t))} - with overload resolution performed in the above context. + that expression. \item Otherwise, if both \tcode{ranges::begin(t)} and \tcode{ranges::end(t)} @@ -899,15 +887,10 @@ \tcode{auto(rend(t))} is a valid expression whose type models \tcode{\libconcept{sentinel_for}} - with overload resolution performed in a context in which - unqualified lookup for \tcode{rend} finds only the declarations -\begin{codeblock} -void rend(auto&) = delete; -void rend(const auto&) = delete; -\end{codeblock} + where the meaning of \tcode{rend} is established as-if by performing + argument-dependent lookup only\iref{basic.lookup.argdep}, then \tcode{ranges::rend(E)} is expression-equivalent to - \tcode{auto(rend(t))} - with overload resolution performed in the above context. + that expression. \item Otherwise, if both \tcode{ranges::begin(t)} and \tcode{ranges::end(t)} @@ -1029,15 +1012,10 @@ \tcode{disable_sized_range>} is \tcode{false} and \tcode{auto(size(t))} is a valid expression of integer-like type - with overload resolution performed in a context in which - unqualified lookup for \tcode{size} finds only the declarations -\begin{codeblock} -void size(auto&) = delete; -void size(const auto&) = delete; -\end{codeblock} + where the meaning of \tcode{size} is established as-if by performing + argument-dependent lookup only\iref{basic.lookup.argdep}, then \tcode{ranges::size(E)} is expression-equivalent to - \tcode{auto(size(t))} - with overload resolution performed in the above context. + that expression. \item Otherwise, if @@ -1303,7 +1281,7 @@ \pnum \begin{note} Equality preservation of both \tcode{ranges::begin} and -\tcode{ranges::end} enables passing a \libconcept{range} whose iterator +\tcode{ranges::end} enables passing a range whose iterator type models \libconcept{forward_iterator} to multiple algorithms and making multiple passes over the range by repeated calls to \tcode{ranges::begin} and \tcode{ranges::end}. @@ -1341,7 +1319,7 @@ \indexlibraryglobal{enable_borrowed_range}% \begin{itemdecl} template - inline constexpr bool enable_borrowed_range = false; + constexpr bool enable_borrowed_range = false; \end{itemdecl} \begin{itemdescr} @@ -1408,7 +1386,7 @@ \indexlibraryglobal{disable_sized_range}% \begin{itemdecl} template - inline constexpr bool disable_sized_range = false; + constexpr bool disable_sized_range = false; \end{itemdecl} \begin{itemdescr} @@ -1476,7 +1454,7 @@ \pnum \begin{example} -Examples of \libconcept{view}s are: +Examples of views are: \begin{itemize} \item A \libconcept{range} type that wraps a pair of iterators. @@ -1500,9 +1478,9 @@ \indexlibraryglobal{enable_view}% \begin{itemdecl} template - inline constexpr bool @\exposidnc{is-derived-from-view-interface}@ = @\seebelownc@; // \expos + constexpr bool @\exposidnc{is-derived-from-view-interface}@ = @\seebelownc@; // \expos template - inline constexpr bool enable_view = + constexpr bool enable_view = @\libconcept{derived_from}@ || @\exposid{is-derived-from-view-interface}@; \end{itemdecl} @@ -1606,7 +1584,7 @@ \pnum The \libconcept{viewable_range} concept specifies the requirements of a -\libconcept{range} type that can be converted to a \libconcept{view} safely. +\libconcept{range} type that can be converted to a view safely. \begin{itemdecl} template @@ -1663,7 +1641,7 @@ \pnum The class template \tcode{view_interface} is a helper for defining -\libconcept{view}-like types that offer a container-like interface. It is +view-like types that offer a container-like interface. It is parameterized with the type that is derived from it. \indexlibraryglobal{view_interface}% @@ -1694,17 +1672,17 @@ return ranges::begin(@\exposid{derived}@()) == ranges::end(@\exposid{derived}@()); } - constexpr auto cbegin() { - return ranges::cbegin(@\exposid{derived}@()); + constexpr auto cbegin() requires @\libconcept{input_range}@ { + return ranges::cbegin(@\exposid{derived}@()); } - constexpr auto cbegin() const requires @\libconcept{range}@ { - return ranges::cbegin(@\exposid{derived}@()); + constexpr auto cbegin() const requires @\libconcept{input_range}@ { + return ranges::cbegin(@\exposid{derived}@()); } - constexpr auto cend() { - return ranges::cend(@\exposid{derived}@()); + constexpr auto cend() requires @\libconcept{input_range}@ { + return ranges::cend(@\exposid{derived}@()); } - constexpr auto cend() const requires @\libconcept{range}@ { - return ranges::cend(@\exposid{derived}@()); + constexpr auto cend() const requires @\libconcept{input_range}@ { + return ranges::cend(@\exposid{derived}@()); } constexpr explicit operator bool() @@ -1726,11 +1704,11 @@ constexpr auto size() requires @\libconcept{forward_range}@ && @\libconcept{sized_sentinel_for}@, iterator_t> { - return ranges::end(@\exposid{derived}@()) - ranges::begin(@\exposid{derived}@()); + return @\exposid{to-unsigned-like}@(ranges::end(@\exposid{derived}@()) - ranges::begin(@\exposid{derived}@())); } constexpr auto size() const requires @\libconcept{forward_range}@ && @\libconcept{sized_sentinel_for}@, iterator_t> { - return ranges::end(@\exposid{derived}@()) - ranges::begin(@\exposid{derived}@()); + return @\exposid{to-unsigned-like}@(ranges::end(@\exposid{derived}@()) - ranges::begin(@\exposid{derived}@())); } constexpr decltype(auto) front() requires @\libconcept{forward_range}@; @@ -2138,7 +2116,7 @@ \rSec2[range.dangling]{Dangling iterator handling} \pnum -The tag type \tcode{dangling} is used together with the template aliases +The type \tcode{dangling} is used together with the template aliases \tcode{borrowed_iterator_t} and \tcode{borrowed_subrange_t}. When an algorithm that typically returns an iterator into, or a subrange of, a range argument @@ -2146,7 +2124,7 @@ that does not model \libconcept{borrowed_range}\iref{range.range}, the return value possibly refers to a range whose lifetime has ended. In such cases, -the tag type \tcode{dangling} is returned instead of an iterator or subrange. +the type \tcode{dangling} is returned instead of an iterator or subrange. \indexlibraryglobal{dangling}% \begin{codeblock} namespace std::ranges { @@ -2191,7 +2169,7 @@ denote \tcode{dangling}. \end{itemize} -\rSec2[ranges.elementsof]{Class template \tcode{elements_of}} +\rSec2[range.elementsof]{Class template \tcode{elements_of}} Specializations of \tcode{elements_of} encapsulate a range and act as a tag in overload sets to disambiguate @@ -2298,7 +2276,8 @@ constructed from the elements of \tcode{r} in the following manner: \begin{itemize} \item -If \tcode{\libconcept{convertible_to}, range_value_t>} +If \tcode{C} does not satisfy \libconcept{input_range} or +\tcode{\libconcept{convertible_to}, range_value_t>} is \tcode{true}: \begin{itemize} \item @@ -2338,7 +2317,7 @@ \begin{codeblock} C c(std::forward(args)...); if constexpr (@\libconcept{sized_range}@ && @\exposid{reservable-container}@) - c.reserve(ranges::size(r)); + c.reserve(static_cast>(ranges::size(r))); ranges::copy(r, @\exposid{container-inserter}@>(c)); \end{codeblock} \end{itemize} @@ -2444,7 +2423,7 @@ \pnum Subclause \ref{range.factories} defines \term{range factories}, -which are utilities to create a \libconcept{view}. +which are utilities to create a view. \pnum Range factories are declared in namespace \tcode{std::ranges::views}. @@ -2454,7 +2433,7 @@ \rSec3[range.empty.overview]{Overview} \pnum -\tcode{empty_view} produces a \libconcept{view} of no elements of +\tcode{empty_view} produces a view of no elements of a particular type. \pnum @@ -2489,7 +2468,7 @@ \rSec3[range.single.overview]{Overview} \pnum -\tcode{single_view} produces a \libconcept{view} that contains +\tcode{single_view} produces a view that contains exactly one element of a specified value. \pnum @@ -2800,6 +2779,8 @@ \expects \tcode{Bound} denotes \tcode{unreachable_sentinel_t} or \tcode{Bound()} is reachable from \tcode{value}. +When \tcode{W} and \tcode{Bound} model \libconcept{totally_ordered_with}, +then \tcode{bool(value <= Bound())} is \tcode{true}. \pnum \effects @@ -2929,7 +2910,6 @@ \rSec3[range.iota.iterator]{Class \tcode{iota_view::\exposid{iterator}}} -\indexlibraryglobal{iota_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{weakly_incrementable}@ W, @\libconcept{semiregular}@ Bound> @@ -2937,6 +2917,7 @@ struct iota_view::@\exposid{iterator}@ { private: W @\exposid{value_}@ = W(); // \expos + public: using iterator_concept = @\seebelow@; using iterator_category = input_iterator_tag; // present only if \tcode{W} models \libconcept{incrementable} and @@ -3007,7 +2988,7 @@ Overloads for \tcode{iter_move} and \tcode{iter_swap} are omitted intentionally. \end{note} -\indexlibraryctor{iota_view::iterator} +\indexlibraryctor{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr explicit @\exposid{iterator}@(W value); \end{itemdecl} @@ -3018,7 +2999,7 @@ Initializes \exposid{value_} with \tcode{value}. \end{itemdescr} -\indexlibrarymember{operator*}{iota_view::iterator} +\indexlibrarymember{operator*}{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr W operator*() const noexcept(is_nothrow_copy_constructible_v); \end{itemdecl} @@ -3035,7 +3016,7 @@ \end{note} \end{itemdescr} -\indexlibrarymember{operator++}{iota_view::iterator} +\indexlibrarymember{operator++}{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr @\exposid{iterator}@& operator++(); \end{itemdecl} @@ -3050,7 +3031,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator++}{iota_view::iterator} +\indexlibrarymember{operator++}{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} @@ -3061,7 +3042,7 @@ Equivalent to \tcode{++*this}. \end{itemdescr} -\indexlibrarymember{operator++}{iota_view::iterator} +\indexlibrarymember{operator++}{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr @\exposid{iterator}@ operator++(int) requires @\libconcept{incrementable}@; \end{itemdecl} @@ -3077,7 +3058,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{iota_view::iterator} +\indexlibrarymember{operator--}{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr @\exposid{iterator}@& operator--() requires @\exposconcept{decrementable}@; \end{itemdecl} @@ -3092,7 +3073,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{iota_view::iterator} +\indexlibrarymember{operator--}{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr @\exposid{iterator}@ operator--(int) requires @\exposconcept{decrementable}@; \end{itemdecl} @@ -3108,7 +3089,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator+=}{iota_view::iterator} +\indexlibrarymember{operator+=}{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr @\exposid{iterator}@& operator+=(difference_type n) requires @\exposconcept{advanceable}@; @@ -3131,7 +3112,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-=}{iota_view::iterator} +\indexlibrarymember{operator-=}{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr @\exposid{iterator}@& operator-=(difference_type n) requires @\exposconcept{advanceable}@; @@ -3154,7 +3135,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator[]}{iota_view::iterator} +\indexlibrarymember{operator[]}{iota_view::\exposid{iterator}} \begin{itemdecl} constexpr W operator[](difference_type n) const requires @\exposconcept{advanceable}@; @@ -3166,7 +3147,7 @@ Equivalent to: \tcode{return W(\exposid{value_} + n);} \end{itemdescr} -\indexlibrarymember{operator==}{iota_view::iterator} +\indexlibrarymember{operator==}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{equality_comparable}@; @@ -3178,7 +3159,7 @@ Equivalent to: \tcode{return x.\exposid{value_} == y.\exposid{value_};} \end{itemdescr} -\indexlibrarymember{operator<}{iota_view::iterator} +\indexlibrarymember{operator<}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr bool operator<(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{totally_ordered}@; @@ -3190,7 +3171,7 @@ Equivalent to: \tcode{return x.\exposid{value_} < y.\exposid{value_};} \end{itemdescr} -\indexlibrarymember{operator>}{iota_view::iterator} +\indexlibrarymember{operator>}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr bool operator>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{totally_ordered}@; @@ -3202,7 +3183,7 @@ Equivalent to: \tcode{return y < x;} \end{itemdescr} -\indexlibrarymember{operator<=}{iota_view::iterator} +\indexlibrarymember{operator<=}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr bool operator<=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{totally_ordered}@; @@ -3214,7 +3195,7 @@ Equivalent to: \tcode{return !(y < x);} \end{itemdescr} -\indexlibrarymember{operator>=}{iota_view::iterator} +\indexlibrarymember{operator>=}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{totally_ordered}@; @@ -3226,7 +3207,7 @@ Equivalent to: \tcode{return !(x < y);} \end{itemdescr} -\indexlibrarymember{operator<=>}{iota_view::iterator} +\indexlibrarymember{operator<=>}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{totally_ordered}@ && @\libconcept{three_way_comparable}@; @@ -3238,7 +3219,7 @@ Equivalent to: \tcode{return x.\exposid{value_} <=> y.\exposid{value_};} \end{itemdescr} -\indexlibrarymember{operator+}{iota_view::iterator} +\indexlibrarymember{operator+}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator+(@\exposid{iterator}@ i, difference_type n) requires @\exposconcept{advanceable}@; @@ -3254,7 +3235,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator+}{iota_view::iterator} +\indexlibrarymember{operator+}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator+(difference_type n, @\exposid{iterator}@ i) requires @\exposconcept{advanceable}@; @@ -3266,7 +3247,7 @@ Equivalent to: \tcode{return i + n;} \end{itemdescr} -\indexlibrarymember{operator-}{iota_view::iterator} +\indexlibrarymember{operator-}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator-(@\exposid{iterator}@ i, difference_type n) requires @\exposconcept{advanceable}@; @@ -3282,7 +3263,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-}{iota_view::iterator} +\indexlibrarymember{operator-}{iota_view::\exposid{iterator}} \begin{itemdecl} friend constexpr difference_type operator-(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\exposconcept{advanceable}@; @@ -3309,7 +3290,6 @@ \rSec3[range.iota.sentinel]{Class \tcode{iota_view::\exposid{sentinel}}} -\indexlibraryglobal{iota_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{weakly_incrementable}@ W, @\libconcept{semiregular}@ Bound> @@ -3317,6 +3297,7 @@ struct iota_view::@\exposid{sentinel}@ { private: Bound @\exposid{bound_}@ = Bound(); // \expos + public: @\exposid{sentinel}@() = default; constexpr explicit @\exposid{sentinel}@(Bound bound); @@ -3331,7 +3312,7 @@ } \end{codeblock} -\indexlibraryctor{iota_view::sentinel} +\indexlibraryctor{iota_view::\exposid{sentinel}} \begin{itemdecl} constexpr explicit @\exposid{sentinel}@(Bound bound); \end{itemdecl} @@ -3342,7 +3323,7 @@ Initializes \exposid{bound_} with \tcode{bound}. \end{itemdescr} -\indexlibrarymember{operator==}{iota_view::sentinel} +\indexlibrarymember{operator==}{iota_view::\exposid{sentinel}} \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{sentinel}@& y); \end{itemdecl} @@ -3405,28 +3386,28 @@ \begin{codeblock} namespace std::ranges { - template<@\libconcept{move_constructible}@ W, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t> - requires (is_object_v && @\libconcept{same_as}@> && + template<@\libconcept{move_constructible}@ T, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t> + requires (is_object_v && @\libconcept{same_as}@> && (@\exposid{is-integer-like}@ || @\libconcept{same_as}@)) - class @\libglobal{repeat_view}@ : public view_interface> { + class @\libglobal{repeat_view}@ : public view_interface> { private: // \ref{range.repeat.iterator}, class \tcode{repeat_view::\exposid{iterator}} struct @\exposidnc{iterator}@; // \expos - @\exposidnc{movable-box}@ @\exposid{value_}@ = W(); // \expos, see \ref{range.move.wrap} + @\exposidnc{movable-box}@ @\exposid{value_}@; // \expos, see \ref{range.move.wrap} Bound @\exposid{bound_}@ = Bound(); // \expos public: - repeat_view() requires @\libconcept{default_initializable}@ = default; + repeat_view() requires @\libconcept{default_initializable}@ = default; - constexpr explicit repeat_view(const W& value, Bound bound = Bound()) - requires @\libconcept{copy_constructible}@; - constexpr explicit repeat_view(W&& value, Bound bound = Bound()); - template - requires @\libconcept{constructible_from}@ && + constexpr explicit repeat_view(const T& value, Bound bound = Bound()) + requires @\libconcept{copy_constructible}@; + constexpr explicit repeat_view(T&& value, Bound bound = Bound()); + template + requires @\libconcept{constructible_from}@ && @\libconcept{constructible_from}@ constexpr explicit repeat_view(piecewise_construct_t, - tuple value_args, tuple bound_args = tuple<>{}); + tuple value_args, tuple bound_args = tuple<>{}); constexpr @\exposid{iterator}@ begin() const; constexpr @\exposid{iterator}@ end() const requires (!@\libconcept{same_as}@); @@ -3435,15 +3416,15 @@ constexpr auto size() const requires (!@\libconcept{same_as}@); }; - template - repeat_view(W, Bound) -> repeat_view; + template + repeat_view(T, Bound) -> repeat_view; } \end{codeblock} \indexlibraryctor{repeat_view}% \begin{itemdecl} -constexpr explicit repeat_view(const W& value, Bound bound = Bound()) - requires @\libconcept{copy_constructible}@; +constexpr explicit repeat_view(const T& value, Bound bound = Bound()) + requires @\libconcept{copy_constructible}@; \end{itemdecl} \begin{itemdescr} @@ -3460,7 +3441,7 @@ \indexlibraryctor{repeat_view}% \begin{itemdecl} -constexpr explicit repeat_view(W&& value, Bound bound = Bound()); +constexpr explicit repeat_view(T&& value, Bound bound = Bound()); \end{itemdecl} \begin{itemdescr} @@ -3476,17 +3457,17 @@ \indexlibraryctor{repeat_view}% \begin{itemdecl} -template - requires @\libconcept{constructible_from}@ && +template + requires @\libconcept{constructible_from}@ && @\libconcept{constructible_from}@ constexpr explicit repeat_view(piecewise_construct_t, - tuple value_args, tuple bound_args = tuple<>{}); + tuple value_args, tuple bound_args = tuple<>{}); \end{itemdecl} \begin{itemdescr} \pnum \effects -Initializes \exposid{value_} with arguments of types \tcode{WArgs...} +Initializes \exposid{value_} with arguments of types \tcode{TArgs...} obtained by forwarding the elements of \tcode{value_args} and initializes \exposid{bound_} with arguments of types \tcode{BoundArgs...} obtained by forwarding the elements of \tcode{bound_args}. @@ -3542,29 +3523,29 @@ \begin{codeblock} namespace std::ranges { - template<@\libconcept{move_constructible}@ W, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t> - requires (is_object_v && @\libconcept{same_as}@> && + template<@\libconcept{move_constructible}@ T, @\libconcept{semiregular}@ Bound = unreachable_sentinel_t> + requires (is_object_v && @\libconcept{same_as}@> && (@\exposid{is-integer-like}@ || @\libconcept{same_as}@)) - class repeat_view::@\exposid{iterator}@ { + class repeat_view::@\exposid{iterator}@ { private: using @\exposidnc{index-type}@ = // \expos conditional_t<@\libconcept{same_as}@, ptrdiff_t, Bound>; - const W* @\exposidnc{value_}@ = nullptr; // \expos + const T* @\exposidnc{value_}@ = nullptr; // \expos @\exposidnc{index-type}@ @\exposidnc{current_}@ = @\exposidnc{index-type}@(); // \expos - constexpr explicit @\exposid{iterator}@(const W* value, @\exposid{index-type}@ b = @\exposidnc{index-type}@()); // \expos + constexpr explicit @\exposid{iterator}@(const T* value, @\exposid{index-type}@ b = @\exposidnc{index-type}@()); // \expos public: using iterator_concept = random_access_iterator_tag; using iterator_category = random_access_iterator_tag; - using value_type = W; + using value_type = T; using difference_type = conditional_t<@\exposid{is-signed-integer-like}@<@\exposid{index-type}@>, @\exposid{index-type}@, @\placeholdernc{IOTA-DIFF-T}@(@\exposid{index-type}@)>; @\exposid{iterator}@() = default; - constexpr const W& operator*() const noexcept; + constexpr const T& operator*() const noexcept; constexpr @\exposid{iterator}@& operator++(); constexpr @\exposid{iterator}@ operator++(int); @@ -3574,7 +3555,7 @@ constexpr @\exposid{iterator}@& operator+=(difference_type n); constexpr @\exposid{iterator}@& operator-=(difference_type n); - constexpr const W& operator[](difference_type n) const noexcept; + constexpr const T& operator[](difference_type n) const noexcept; friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y); friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y); @@ -3588,9 +3569,9 @@ } \end{codeblock} -\indexlibraryctor{repeat_view::iterator}% +\indexlibraryctor{repeat_view::\exposid{iterator}}% \begin{itemdecl} -constexpr explicit @\exposid{iterator}@(const W* value, @\exposid{index-type}@ b = @\exposid{index-type}@()); +constexpr explicit @\exposid{iterator}@(const T* value, @\exposid{index-type}@ b = @\exposid{index-type}@()); \end{itemdecl} \begin{itemdescr} @@ -3604,9 +3585,9 @@ \exposid{current_} with \tcode{b}. \end{itemdescr} -\indexlibrarymember{operator*}{repeat_view::iterator}% +\indexlibrarymember{operator*}{repeat_view::\exposid{iterator}}% \begin{itemdecl} -constexpr const W& operator*() const noexcept; +constexpr const T& operator*() const noexcept; \end{itemdecl} \begin{itemdescr} @@ -3615,7 +3596,7 @@ Equivalent to: \tcode{return *\exposid{value_};} \end{itemdescr} -\indexlibrarymember{operator++}{repeat_view::iterator}% +\indexlibrarymember{operator++}{repeat_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator++(); \end{itemdecl} @@ -3630,7 +3611,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator++}{repeat_view::iterator}% +\indexlibrarymember{operator++}{repeat_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator++(int); \end{itemdecl} @@ -3646,7 +3627,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{repeat_view::iterator}% +\indexlibrarymember{operator--}{repeat_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator--(); \end{itemdecl} @@ -3666,7 +3647,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{repeat_view::iterator}% +\indexlibrarymember{operator--}{repeat_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator--(int); \end{itemdecl} @@ -3682,7 +3663,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator+=}{repeat_view::iterator}% +\indexlibrarymember{operator+=}{repeat_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator+=(difference_type n); \end{itemdecl} @@ -3702,7 +3683,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-=}{repeat_view::iterator}% +\indexlibrarymember{operator-=}{repeat_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator-=(difference_type n); \end{itemdecl} @@ -3722,9 +3703,9 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator[]}{repeat_view::iterator}% +\indexlibrarymember{operator[]}{repeat_view::\exposid{iterator}}% \begin{itemdecl} -constexpr const W& operator[](difference_type n) const noexcept; +constexpr const T& operator[](difference_type n) const noexcept; \end{itemdecl} \begin{itemdescr} @@ -3733,7 +3714,7 @@ Equivalent to: \tcode{return *(*this + n);} \end{itemdescr} -\indexlibrarymember{operator==}{repeat_view::iterator}% +\indexlibrarymember{operator==}{repeat_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y); \end{itemdecl} @@ -3744,7 +3725,7 @@ Equivalent to: \tcode{return x.\exposid{current_} == y.\exposid{current_};}. \end{itemdescr} -\indexlibrarymember{operator<=>}{repeat_view::iterator}% +\indexlibrarymember{operator<=>}{repeat_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y); \end{itemdecl} @@ -3755,7 +3736,7 @@ Equivalent to: \tcode{return x.\exposid{current_} <=> y.\exposid{current_};}. \end{itemdescr} -\indexlibrarymember{operator+}{repeat_view::iterator}% +\indexlibrarymember{operator+}{repeat_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator+(@\exposid{iterator}@ i, difference_type n); friend constexpr @\exposid{iterator}@ operator+(difference_type n, @\exposid{iterator}@ i); @@ -3771,7 +3752,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-}{repeat_view::iterator}% +\indexlibrarymember{operator-}{repeat_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator-(@\exposid{iterator}@ i, difference_type n); \end{itemdecl} @@ -3786,7 +3767,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-}{repeat_view::iterator}% +\indexlibrarymember{operator-}{repeat_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr difference_type operator-(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y); \end{itemdecl} @@ -3888,7 +3869,6 @@ \rSec3[range.istream.iterator]{Class \tcode{basic_istream_view::\exposid{iterator}}} -\indexlibraryglobal{basic_istream_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{movable}@ Val, class CharT, class Traits> @@ -3921,7 +3901,7 @@ } \end{codeblock} -\indexlibraryctor{basic_istream_view::iterator}% +\indexlibraryctor{basic_istream_view::\exposid{iterator}}% \begin{itemdecl} constexpr explicit @\exposid{iterator}@(basic_istream_view& parent) noexcept; \end{itemdecl} @@ -3932,7 +3912,7 @@ Initializes \exposid{parent_} with \tcode{addressof(parent)}. \end{itemdescr} -\indexlibrarymember{operator++}{basic_istream_view::iterator}% +\indexlibrarymember{operator++}{basic_istream_view::\exposid{iterator}}% \begin{itemdecl} @\exposid{iterator}@& operator++(); \end{itemdecl} @@ -3947,7 +3927,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator++}{basic_istream_view::iterator}% +\indexlibrarymember{operator++}{basic_istream_view::\exposid{iterator}}% \begin{itemdecl} void operator++(int); \end{itemdecl} @@ -3958,7 +3938,7 @@ Equivalent to \tcode{++*this}. \end{itemdescr} -\indexlibrarymember{operator*}{basic_istream_view::iterator}% +\indexlibrarymember{operator*}{basic_istream_view::\exposid{iterator}}% \begin{itemdecl} Val& operator*() const; \end{itemdecl} @@ -3969,7 +3949,7 @@ Equivalent to: \tcode{return \exposid{parent_}->\exposid{value_};} \end{itemdescr} -\indexlibrarymember{operator==}{basic_istream_view::iterator}% +\indexlibrarymember{operator==}{basic_istream_view::\exposid{iterator}}% \begin{itemdecl} friend bool operator==(const @\exposid{iterator}@& x, default_sentinel_t); \end{itemdecl} @@ -3986,7 +3966,7 @@ \pnum Subclause \ref{range.adaptors} defines \term{range adaptors}, which are utilities that transform a -\libconcept{range} into a \libconcept{view} with custom behaviors. These +range into a view with custom behaviors. These adaptors can be chained to create pipelines of range transformations that evaluate lazily as the resulting view is iterated. @@ -4015,7 +3995,7 @@ \pnum A \term{range adaptor closure object} is a unary function object that accepts -a \libconcept{range} argument. For +a range argument. For a range adaptor closure object \tcode{C} and an expression \tcode{R} such that \tcode{decltype((R))} models \libconcept{range}, the following expressions are equivalent: @@ -4048,7 +4028,7 @@ Given an object \tcode{t} of type \tcode{T}, where \begin{itemize} \item -\tcode{t} is a unary function object that accepts a \libconcept{range} argument, +\tcode{t} is a unary function object that accepts a range argument, \item \tcode{T} models \tcode{\libconcept{derived_from}>}, \item @@ -4083,8 +4063,7 @@ \pnum A \term{range adaptor object} is a customization point object\iref{customization.point.object} -that accepts a \libconcept{viewable_range} as its first argument and returns a -\libconcept{view}. +that accepts a \libconcept{viewable_range} as its first argument and returns a view. \pnum If a range adaptor object accepts only one argument, @@ -4277,7 +4256,7 @@ template constexpr void @\exposid{tuple-for-each}@(F&& f, Tuple&& t) { // \expos apply([&](Ts&&... elements) { - (invoke(f, std::forward(elements)), ...); + (static_cast(invoke(f, std::forward(elements))), ...); }, std::forward(t)); } } @@ -4289,8 +4268,8 @@ \pnum \indexlibrarymember{all}{views}% -\tcode{views::all} returns a \libconcept{view} that includes all elements of -its \libconcept{range} argument. +\tcode{views::all} returns a view that includes all elements of +its range argument. \pnum The name \tcode{views::all} denotes a @@ -4309,7 +4288,7 @@ \rSec3[range.ref.view]{Class template \tcode{ref_view}} \pnum -\tcode{ref_view} is a \libconcept{view} of the elements of some other \libconcept{range}. +\tcode{ref_view} is a view of the elements of some other range. \indexlibraryglobal{ref_view}% \begin{codeblock} namespace std::ranges { @@ -4318,6 +4297,7 @@ class ref_view : public view_interface> { private: R* @\exposid{r_}@; // \expos + public: template<@\exposconcept{different-from}@ T> requires @\seebelow@ @@ -4374,7 +4354,7 @@ \pnum \tcode{owning_view} is a move-only view -of the elements of some other \libconcept{range}. +of the elements of some other range. \begin{codeblock} namespace std::ranges { template<@\libconcept{range}@ R> @@ -4382,6 +4362,7 @@ class owning_view : public view_interface> { private: R @\exposid{r_}@ = R(); // \expos + public: owning_view() requires @\libconcept{default_initializable}@ = default; constexpr owning_view(R&& t); @@ -4435,7 +4416,7 @@ \rSec3[range.as.rvalue.overview]{Overview} \pnum -\tcode{as_rvalue_view} presents a \libconcept{view} of an underlying sequence +\tcode{as_rvalue_view} presents a view of an underlying sequence with the same behavior as the underlying sequence except that its elements are rvalues. Some generic algorithms can be called with a \tcode{as_rvalue_view} @@ -4481,9 +4462,9 @@ constexpr V base() && { return std::move(@\exposid{base_}@); } constexpr auto begin() requires (!@\exposconcept{simple-view}@) - { return move_iterator(ranges::begin(@\exposid{base_}@)); } + { return move_iterator(ranges::begin(@\exposid{base_}@)); } constexpr auto begin() const requires @\libconcept{range}@ - { return move_iterator(ranges::begin(@\exposid{base_}@)); } + { return move_iterator(ranges::begin(@\exposid{base_}@)); } constexpr auto end() requires (!@\exposconcept{simple-view}@) { if constexpr (@\libconcept{common_range}@) { @@ -4525,7 +4506,7 @@ \rSec3[range.filter.overview]{Overview} \pnum -\tcode{filter_view} presents a \libconcept{view} of the elements +\tcode{filter_view} presents a view of the elements of an underlying sequence that satisfy a predicate. \pnum @@ -4719,7 +4700,7 @@ \item Otherwise, \tcode{iterator_category} denotes \tcode{C}. \end{itemize} -\indexlibraryctor{filter_view::iterator}% +\indexlibraryctor{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@(filter_view& parent, iterator_t current); \end{itemdecl} @@ -4731,7 +4712,7 @@ \exposid{parent_} with \tcode{addressof(parent)}. \end{itemdescr} -\indexlibrarymember{base}{filter_view::iterator}% +\indexlibrarymember{base}{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr const iterator_t& base() const & noexcept; \end{itemdecl} @@ -4742,7 +4723,7 @@ Equivalent to: \tcode{return \exposid{current_};} \end{itemdescr} -\indexlibrarymember{base}{filter_view::iterator}% +\indexlibrarymember{base}{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr iterator_t base() &&; \end{itemdecl} @@ -4753,7 +4734,7 @@ Equivalent to: \tcode{return std::move(\exposid{current_});} \end{itemdescr} -\indexlibrarymember{operator*}{filter_view::iterator}% +\indexlibrarymember{operator*}{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr range_reference_t operator*() const; \end{itemdecl} @@ -4764,7 +4745,7 @@ Equivalent to: \tcode{return *\exposid{current_};} \end{itemdescr} -\indexlibrarymember{operator->}{filter_view::iterator}% +\indexlibrarymember{operator->}{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr iterator_t operator->() const requires @\exposconcept{has-arrow}@> && @\libconcept{copyable}@>; @@ -4776,7 +4757,7 @@ Equivalent to: \tcode{return \exposid{current_};} \end{itemdescr} -\indexlibrarymember{operator++}{filter_view::iterator}% +\indexlibrarymember{operator++}{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator++(); \end{itemdecl} @@ -4792,7 +4773,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator++}{filter_view::iterator}% +\indexlibrarymember{operator++}{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} @@ -4803,7 +4784,7 @@ Equivalent to \tcode{++*this}. \end{itemdescr} -\indexlibrarymember{operator++}{filter_view::iterator}% +\indexlibrarymember{operator++}{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator++(int) requires @\libconcept{forward_range}@; \end{itemdecl} @@ -4819,7 +4800,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{filter_view::iterator}% +\indexlibrarymember{operator--}{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator--() requires @\libconcept{bidirectional_range}@; \end{itemdecl} @@ -4836,7 +4817,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{filter_view::iterator}% +\indexlibrarymember{operator--}{filter_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator--(int) requires @\libconcept{bidirectional_range}@; \end{itemdecl} @@ -4852,7 +4833,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator==}{filter_view::iterator}% +\indexlibrarymember{operator==}{filter_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{equality_comparable}@>; @@ -4864,7 +4845,7 @@ Equivalent to: \tcode{return x.\exposid{current_} == y.\exposid{current_};} \end{itemdescr} -\indexlibrarymember{iter_move}{filter_view::iterator}% +\indexlibrarymember{iter_move}{filter_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr range_rvalue_reference_t iter_move(const @\exposid{iterator}@& i) noexcept(noexcept(ranges::iter_move(i.@\exposid{current_}@))); @@ -4876,7 +4857,7 @@ Equivalent to: \tcode{return ranges::iter_move(i.\exposid{current_});} \end{itemdescr} -\indexlibrarymember{iter_swap}{filter_view::iterator}% +\indexlibrarymember{iter_swap}{filter_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr void iter_swap(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) noexcept(noexcept(ranges::iter_swap(x.@\exposid{current_}@, y.@\exposid{current_}@))) @@ -4911,7 +4892,7 @@ } \end{codeblock} -\indexlibraryctor{filter_view::sentinel}% +\indexlibraryctor{filter_view::\exposid{sentinel}}% \begin{itemdecl} constexpr explicit @\exposid{sentinel}@(filter_view& parent); \end{itemdecl} @@ -4922,7 +4903,7 @@ Initializes \exposid{end_} with \tcode{ranges::end(parent.\exposid{base_})}. \end{itemdescr} -\indexlibrarymember{base}{filter_view::sentinel}% +\indexlibrarymember{base}{filter_view::\exposid{sentinel}}% \begin{itemdecl} constexpr sentinel_t base() const; \end{itemdecl} @@ -4933,7 +4914,7 @@ Equivalent to: \tcode{return \exposid{end_};} \end{itemdescr} -\indexlibrarymember{operator==}{filter_view::sentinel}% +\indexlibrarymember{operator==}{filter_view::\exposid{sentinel}}% \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{sentinel}@& y); \end{itemdecl} @@ -4950,7 +4931,7 @@ \pnum \tcode{transform_view} presents -a \libconcept{view} of an underlying sequence after +a view of an underlying sequence after applying a transformation function to each element. \pnum @@ -5128,7 +5109,6 @@ \rSec3[range.transform.iterator]{Class template \tcode{transform_view::\exposid{iterator}}} -\indexlibraryglobal{transform_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{input_range}@ V, @\libconcept{move_constructible}@ F> @@ -5231,7 +5211,7 @@ \tcode{iterator_traits>::iterator_category}. \begin{itemize} \item -If \tcode{is_lvalue_reference_v\&, range_reference_t<\linebreak\exposid{Base}>>>} +If \tcode{is_reference_v\&, range_reference_t<\exposid{Base}>>>} is \tcode{true}, then \begin{itemize} \item @@ -5247,7 +5227,7 @@ Otherwise, \tcode{iterator_category} denotes \tcode{input_iterator_tag}. \end{itemize} -\indexlibrarymember{iterator}{transform_view::iterator} +\indexlibrarymember{iterator}{transform_view::\exposid{iterator}} \begin{itemdecl} constexpr @\exposid{iterator}@(@\exposid{Parent}@& parent, iterator_t<@\exposid{Base}@> current); \end{itemdecl} @@ -5259,7 +5239,7 @@ \exposid{parent_} with \tcode{addressof(parent)}. \end{itemdescr} -\indexlibraryctor{transform_view::iterator}% +\indexlibraryctor{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@(@\exposid{iterator}@ i) requires Const && @\libconcept{convertible_to}@, iterator_t<@\exposid{Base}@>>; @@ -5272,7 +5252,7 @@ \exposid{parent_} with \tcode{i.\exposid{parent_}}. \end{itemdescr} -\indexlibrarymember{base}{transform_view::iterator}% +\indexlibrarymember{base}{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr const iterator_t<@\exposid{Base}@>& base() const & noexcept; \end{itemdecl} @@ -5283,7 +5263,7 @@ Equivalent to: \tcode{return \exposid{current_};} \end{itemdescr} -\indexlibrarymember{base}{transform_view::iterator}% +\indexlibrarymember{base}{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr iterator_t<@\exposid{Base}@> base() &&; \end{itemdecl} @@ -5294,7 +5274,7 @@ Equivalent to: \tcode{return std::move(\exposid{current_});} \end{itemdescr} -\indexlibrarymember{operator++}{transform_view::iterator}% +\indexlibrarymember{operator++}{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator++(); \end{itemdecl} @@ -5309,7 +5289,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator++}{transform_view::iterator}% +\indexlibrarymember{operator++}{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} @@ -5320,7 +5300,7 @@ Equivalent to \tcode{++\exposid{current_}}. \end{itemdescr} -\indexlibrarymember{operator++}{transform_view::iterator}% +\indexlibrarymember{operator++}{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator++(int) requires @\libconcept{forward_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -5336,7 +5316,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{transform_view::iterator}% +\indexlibrarymember{operator--}{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator--() requires @\libconcept{bidirectional_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -5351,7 +5331,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{transform_view::iterator}% +\indexlibrarymember{operator--}{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator--(int) requires @\libconcept{bidirectional_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -5367,7 +5347,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator+=}{transform_view::iterator}% +\indexlibrarymember{operator+=}{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator+=(difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -5383,7 +5363,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-=}{transform_view::iterator}% +\indexlibrarymember{operator-=}{transform_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator-=(difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -5399,7 +5379,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator==}{transform_view::iterator}% +\indexlibrarymember{operator==}{transform_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{equality_comparable}@>; @@ -5411,7 +5391,7 @@ Equivalent to: \tcode{return x.\exposid{current_} == y.\exposid{current_};} \end{itemdescr} -\indexlibrarymember{operator<}{transform_view::iterator}% +\indexlibrarymember{operator<}{transform_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator<(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -5423,7 +5403,7 @@ Equivalent to: \tcode{return x.\exposid{current_} < y.\exposid{current_};} \end{itemdescr} -\indexlibrarymember{operator>}{transform_view::iterator}% +\indexlibrarymember{operator>}{transform_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -5435,7 +5415,7 @@ Equivalent to: \tcode{return y < x;} \end{itemdescr} -\indexlibrarymember{operator<=}{transform_view::iterator}% +\indexlibrarymember{operator<=}{transform_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator<=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -5447,7 +5427,7 @@ Equivalent to: \tcode{return !(y < x);} \end{itemdescr} -\indexlibrarymember{operator>=}{transform_view::iterator}% +\indexlibrarymember{operator>=}{transform_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -5459,7 +5439,7 @@ Equivalent to: \tcode{return !(x < y);} \end{itemdescr} -\indexlibrarymember{operator<=>}{transform_view::iterator}% +\indexlibrarymember{operator<=>}{transform_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@> && @\libconcept{three_way_comparable}@>; @@ -5471,7 +5451,7 @@ Equivalent to: \tcode{return x.\exposid{current_} <=> y.\exposid{current_};} \end{itemdescr} -\indexlibrarymember{operator+}{transform_view::iterator}% +\indexlibrarymember{operator+}{transform_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator+(@\exposid{iterator}@ i, difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -5485,7 +5465,7 @@ Equivalent to: \tcode{return \exposid{iterator}\{*i.\exposid{parent_}, i.\exposid{current_} + n\};} \end{itemdescr} -\indexlibrarymember{operator-}{transform_view::iterator}% +\indexlibrarymember{operator-}{transform_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator-(@\exposid{iterator}@ i, difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -5497,7 +5477,7 @@ Equivalent to: \tcode{return \exposid{iterator}\{*i.\exposid{parent_}, i.\exposid{current_} - n\};} \end{itemdescr} -\indexlibrarymember{operator-}{transform_view::iterator}% +\indexlibrarymember{operator-}{transform_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr difference_type operator-(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{sized_sentinel_for}@, iterator_t<@\exposid{Base}@>>; @@ -5512,7 +5492,6 @@ \rSec3[range.transform.sentinel]{Class template \tcode{transform_view::\exposid{sentinel}}} -\indexlibraryglobal{transform_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{input_range}@ V, @\libconcept{move_constructible}@ F> @@ -5525,6 +5504,7 @@ using @\exposid{Parent}@ = @\exposid{maybe-const}@; // \expos using @\exposid{Base}@ = @\exposid{maybe-const}@; // \expos sentinel_t<@\exposid{Base}@> @\exposid{end_}@ = sentinel_t<@\exposid{Base}@>(); // \expos + public: @\exposid{sentinel}@() = default; constexpr explicit @\exposid{sentinel}@(sentinel_t<@\exposid{Base}@> end); @@ -5550,7 +5530,7 @@ } \end{codeblock} -\indexlibraryctor{transform_view::sentinel}% +\indexlibraryctor{transform_view::\exposid{sentinel}}% \begin{itemdecl} constexpr explicit @\exposid{sentinel}@(sentinel_t<@\exposid{Base}@> end); \end{itemdecl} @@ -5561,7 +5541,7 @@ Initializes \exposid{end_} with \tcode{end}. \end{itemdescr} -\indexlibraryctor{transform_view::sentinel}% +\indexlibraryctor{transform_view::\exposid{sentinel}}% \begin{itemdecl} constexpr @\exposid{sentinel}@(@\exposid{sentinel}@ i) requires Const && @\libconcept{convertible_to}@, sentinel_t<@\exposid{Base}@>>; @@ -5573,7 +5553,7 @@ Initializes \exposid{end_} with \tcode{std::move(i.\exposid{end_})}. \end{itemdescr} -\indexlibrarymember{base}{transform_view::sentinel} +\indexlibrarymember{base}{transform_view::\exposid{sentinel}} \begin{itemdecl} constexpr sentinel_t<@\exposid{Base}@> base() const; \end{itemdecl} @@ -5584,7 +5564,7 @@ Equivalent to: \tcode{return \exposid{end_};} \end{itemdescr} -\indexlibrarymember{operator==}{transform_view::sentinel} +\indexlibrarymember{operator==}{transform_view::\exposid{sentinel}} \begin{itemdecl} template requires @\libconcept{sentinel_for}@, iterator_t<@\exposid{maybe-const}@>> @@ -5597,7 +5577,7 @@ Equivalent to: \tcode{return x.\exposid{current_} == y.\exposid{end_};} \end{itemdescr} -\indexlibrarymember{operator-}{transform_view::sentinel}% +\indexlibrarymember{operator-}{transform_view::\exposid{sentinel}}% \begin{itemdecl} template requires @\libconcept{sized_sentinel_for}@, iterator_t<@\exposid{maybe-const}@>> @@ -5611,7 +5591,7 @@ Equivalent to: \tcode{return x.\exposid{current_} - y.\exposid{end_};} \end{itemdescr} -\indexlibrarymember{operator-}{transform_view::sentinel}% +\indexlibrarymember{operator-}{transform_view::\exposid{sentinel}}% \begin{itemdecl} template requires @\libconcept{sized_sentinel_for}@, iterator_t<@\exposid{maybe-const}@>> @@ -5630,9 +5610,9 @@ \rSec3[range.take.overview]{Overview} \pnum -\tcode{take_view} produces a \libconcept{view} of the first $N$ elements -from another \libconcept{view}, or all the elements if the adapted -\libconcept{view} contains fewer than $N$. +\tcode{take_view} produces a view of the first $N$ elements +from another view, or all the elements if the adapted +view contains fewer than $N$. \pnum \indexlibrarymember{take}{views}% @@ -5747,6 +5727,10 @@ auto sz = range_difference_t(size()); return counted_iterator(ranges::begin(@\exposid{base_}@), sz); } + } else if constexpr (@\libconcept{sized_sentinel_for}@, iterator_t>) { + auto it = ranges::begin(@\exposid{base_}@); + auto sz = std::min(@\exposid{count_}@, ranges::end(@\exposid{base_}@) - it); + return counted_iterator(std::move(it), sz); } else { return counted_iterator(ranges::begin(@\exposid{base_}@), @\exposid{count_}@); } @@ -5760,6 +5744,10 @@ auto sz = range_difference_t(size()); return counted_iterator(ranges::begin(@\exposid{base_}@), sz); } + } else if constexpr (@\libconcept{sized_sentinel_for}@, iterator_t>) { + auto it = ranges::begin(@\exposid{base_}@); + auto sz = std::min(@\exposid{count_}@, ranges::end(@\exposid{base_}@) - it); + return counted_iterator(std::move(it), sz); } else { return counted_iterator(ranges::begin(@\exposid{base_}@), @\exposid{count_}@); } @@ -5771,6 +5759,8 @@ return ranges::begin(@\exposid{base_}@) + range_difference_t(size()); else return default_sentinel; + } else if constexpr (@\libconcept{sized_sentinel_for}@, iterator_t>) { + return default_sentinel; } else { return @\exposid{sentinel}@{ranges::end(@\exposid{base_}@)}; } @@ -5782,6 +5772,8 @@ return ranges::begin(@\exposid{base_}@) + range_difference_t(size()); else return default_sentinel; + } else if constexpr (@\libconcept{sized_sentinel_for}@, iterator_t>) { + return default_sentinel; } else { return @\exposid{sentinel}@{ranges::end(@\exposid{base_}@)}; } @@ -5810,6 +5802,10 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\expects +\tcode{count >= 0} is \tcode{true}. + \pnum \effects Initializes \exposid{base_} with \tcode{std::move(base)} and @@ -5818,7 +5814,6 @@ \rSec3[range.take.sentinel]{Class template \tcode{take_view::\exposid{sentinel}}} -\indexlibraryglobal{take_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{view}@ V> @@ -5829,6 +5824,7 @@ template using @\exposid{CI}@ = counted_iterator>>; // \expos sentinel_t<@\exposid{Base}@> @\exposid{end_}@ = sentinel_t<@\exposid{Base}@>(); // \expos + public: @\exposid{sentinel}@() = default; constexpr explicit @\exposid{sentinel}@(sentinel_t<@\exposid{Base}@> end); @@ -5846,7 +5842,7 @@ } \end{codeblock} -\indexlibraryctor{take_view::sentinel}% +\indexlibraryctor{take_view::\exposid{sentinel}}% \begin{itemdecl} constexpr explicit @\exposid{sentinel}@(sentinel_t<@\exposid{Base}@> end); \end{itemdecl} @@ -5857,7 +5853,7 @@ Initializes \exposid{end_} with \tcode{end}. \end{itemdescr} -\indexlibraryctor{take_view::sentinel}% +\indexlibraryctor{take_view::\exposid{sentinel}}% \begin{itemdecl} constexpr @\exposid{sentinel}@(@\exposid{sentinel}@ s) requires Const && @\libconcept{convertible_to}@, sentinel_t<@\exposid{Base}@>>; @@ -5869,7 +5865,7 @@ Initializes \exposid{end_} with \tcode{std::move(s.\exposid{end_})}. \end{itemdescr} -\indexlibrarymember{base}{take_view::sentinel}% +\indexlibrarymember{base}{take_view::\exposid{sentinel}}% \begin{itemdecl} constexpr sentinel_t<@\exposid{Base}@> base() const; \end{itemdecl} @@ -5880,7 +5876,7 @@ Equivalent to: \tcode{return \exposid{end_};} \end{itemdescr} -\indexlibrarymember{operator==}{take_view::sentinel}% +\indexlibrarymember{operator==}{take_view::\exposid{sentinel}}% \begin{itemdecl} friend constexpr bool operator==(const @\exposid{CI}@& y, const @\exposid{sentinel}@& x); @@ -5901,8 +5897,8 @@ \rSec3[range.take.while.overview]{Overview} \pnum -Given a unary predicate \tcode{pred} and a \libconcept{view} \tcode{r}, -\tcode{take_while_view} produces a \libconcept{view} +Given a unary predicate \tcode{pred} and a view \tcode{r}, +\tcode{take_while_view} produces a view of the range \range{ranges::be\-gin(r)}{ranges::find_if_not(r, pred)}. \indexlibraryglobal{take_while}% @@ -6003,7 +5999,6 @@ \rSec3[range.take.while.sentinel]{Class template \tcode{take_while_view::\exposid{sentinel}}} -\indexlibraryglobal{take_while_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{view}@ V, class Pred> @@ -6034,7 +6029,7 @@ } \end{codeblock} -\indexlibraryctor{take_while_view::sentinel}% +\indexlibraryctor{take_while_view::\exposid{sentinel}}% \begin{itemdecl} constexpr explicit @\exposid{sentinel}@(sentinel_t<@\exposid{Base}@> end, const Pred* pred); \end{itemdecl} @@ -6045,7 +6040,7 @@ Initializes \exposid{end_} with \tcode{end} and \exposid{pred_} with \tcode{pred}. \end{itemdescr} -\indexlibraryctor{take_while_view::sentinel}% +\indexlibraryctor{take_while_view::\exposid{sentinel}}% \begin{itemdecl} constexpr @\exposid{sentinel}@(@\exposid{sentinel}@ s) requires Const && @\libconcept{convertible_to}@, sentinel_t<@\exposid{Base}@>>; @@ -6058,7 +6053,7 @@ \exposid{pred_} with \tcode{s.\exposid{pred_}}. \end{itemdescr} -\indexlibrarymember{operator==}{take_while_view::sentinel}% +\indexlibrarymember{operator==}{take_while_view::\exposid{sentinel}}% \begin{itemdecl} friend constexpr bool operator==(const iterator_t<@\exposid{Base}@>& x, const @\exposid{sentinel}@& y); @@ -6080,9 +6075,9 @@ \rSec3[range.drop.overview]{Overview} \pnum -\tcode{drop_view} produces a \libconcept{view} -excluding the first $N$ elements from another \libconcept{view}, or -an empty range if the adapted \libconcept{view} contains fewer than $N$ elements. +\tcode{drop_view} produces a view +excluding the first $N$ elements from another view, or +an empty range if the adapted view contains fewer than $N$ elements. \pnum \indexlibrarymember{drop}{views}% @@ -6262,8 +6257,8 @@ \rSec3[range.drop.while.overview]{Overview} \pnum -Given a unary predicate \tcode{pred} and a \libconcept{view} \tcode{r}, -\tcode{drop_while_view} produces a \libconcept{view} +Given a unary predicate \tcode{pred} and a view \tcode{r}, +\tcode{drop_while_view} produces a view of the range \range{ranges::find_if_not(r, pred)}{ranges::end(r)}. \pnum @@ -6277,7 +6272,7 @@ \pnum \begin{example} \begin{codeblock} -constexpr auto source = " \t \t \t hello there"; +constexpr auto source = " \t \t \t hello there"sv; auto is_invisible = [](const auto x) { return x == ' ' || x == '\t'; }; auto skip_ws = views::drop_while(source, is_invisible); for (auto c : skip_ws) { @@ -6376,8 +6371,7 @@ \rSec3[range.join.overview]{Overview} \pnum -\tcode{join_view} flattens a \libconcept{view} of ranges into a -\libconcept{view}. +\tcode{join_view} flattens a view of ranges into a view. \pnum \indexlibrarymember{join}{views}% @@ -6481,7 +6475,6 @@ \rSec3[range.join.iterator]{Class template \tcode{join_view::\exposid{iterator}}} -\indexlibraryglobal{join_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{input_range}@ V> @@ -6498,7 +6491,7 @@ is_reference_v>; @\exposidnc{OuterIter}@ @\exposid{outer_}@ = @\exposidnc{OuterIter}@(); // \expos - @\exposidnc{InnerIter}@ @\exposid{inner_}@ = @\exposidnc{InnerIter}@(); // \expos + optional<@\exposidnc{InnerIter}@> @\exposid{inner_}@; // \expos @\exposidnc{Parent}@* @\exposid{parent_}@ = nullptr; // \expos constexpr void @\exposidnc{satisfy}@(); // \expos @@ -6509,15 +6502,14 @@ using value_type = range_value_t>; using difference_type = @\seebelow@; - @\exposid{iterator}@() requires @\libconcept{default_initializable}@<@\exposid{OuterIter}@> && - @\itcorr[-2]\libconcept{default_initializable}@<@\exposid{InnerIter}@> = default; + @\exposid{iterator}@() requires @\libconcept{default_initializable}@<@\exposid{OuterIter}@> = default; constexpr @\exposid{iterator}@(@\exposid{Parent}@& parent, @\exposid{OuterIter}@ outer); constexpr @\exposid{iterator}@(@\exposid{iterator}@ i) requires Const && @\libconcept{convertible_to}@, @\exposid{OuterIter}@> && @\libconcept{convertible_to}@, @\exposid{InnerIter}@>; - constexpr decltype(auto) operator*() const { return *@\exposid{inner_}@; } + constexpr decltype(auto) operator*() const { return **@\exposid{inner_}@; } constexpr @\exposid{InnerIter}@ operator->() const requires @\exposconcept{has-arrow}@<@\exposid{InnerIter}@> && @\libconcept{copyable}@<@\exposid{InnerIter}@>; @@ -6543,12 +6535,12 @@ @\libconcept{equality_comparable}@>>; friend constexpr decltype(auto) iter_move(const @\exposid{iterator}@& i) - noexcept(noexcept(ranges::iter_move(i.@\exposid{inner_}@))) { - return ranges::iter_move(i.@\exposid{inner_}@); + noexcept(noexcept(ranges::iter_move(*i.@\exposid{inner_}@))) { + return ranges::iter_move(*i.@\exposid{inner_}@); } friend constexpr void iter_swap(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - noexcept(noexcept(ranges::iter_swap(x.@\exposid{inner_}@, y.@\exposid{inner_}@))) + noexcept(noexcept(ranges::iter_swap(*x.@\exposid{inner_}@, *y.@\exposid{inner_}@))) requires @\libconcept{indirectly_swappable}@<@\exposid{InnerIter}@>; }; } @@ -6625,15 +6617,15 @@ for (; @\exposid{outer_}@ != ranges::end(@\exposid{parent_}@->@\exposid{base_}@); ++@\exposid{outer_}@) { auto&& inner = update_inner(@\exposid{outer_}@); @\exposid{inner_}@ = ranges::begin(inner); - if (@\exposid{inner_}@ != ranges::end(inner)) + if (*@\exposid{inner_}@ != ranges::end(inner)) return; } if constexpr (@\exposid{ref-is-glvalue}@) - @\exposid{inner_}@ = @\exposid{InnerIter}@(); + @\exposid{inner_}@.reset(); \end{codeblock} \end{itemdescr} -\indexlibraryctor{join_view::iterator}% +\indexlibraryctor{join_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@(@\exposid{Parent}@& parent, @\exposid{OuterIter}@ outer); \end{itemdecl} @@ -6645,7 +6637,7 @@ \exposid{parent_} with \tcode{addressof(parent)}; then calls \tcode{\exposid{satisfy}()}. \end{itemdescr} -\indexlibraryctor{join_view::iterator}% +\indexlibraryctor{join_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@(@\exposid{iterator}@ i) requires Const && @@ -6661,7 +6653,7 @@ \exposid{parent_} with \tcode{i.\exposid{parent_}}. \end{itemdescr} -\indexlibrarymember{operator->}{join_view::iterator}% +\indexlibrarymember{operator->}{join_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{InnerIter}@ operator->() const requires @\exposconcept{has-arrow}@<@\exposid{InnerIter}@> && @\libconcept{copyable}@<@\exposid{InnerIter}@>; @@ -6670,10 +6662,10 @@ \begin{itemdescr} \pnum \effects -Equivalent to \tcode{return \exposid{inner_};} +Equivalent to: \tcode{return *\exposid{inner_};} \end{itemdescr} -\indexlibrarymember{operator++}{join_view::iterator}% +\indexlibrarymember{operator++}{join_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator++(); \end{itemdecl} @@ -6691,7 +6683,7 @@ Equivalent to: \begin{codeblock} auto&& inner_rng = @\placeholder{inner-range}@; -if (++@\exposid{inner_}@ == ranges::end(inner_rng)) { +if (++*@\exposid{inner_}@ == ranges::end(inner_rng)) { ++@\exposid{outer_}@; @\exposid{satisfy}@(); } @@ -6699,7 +6691,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator++}{join_view::iterator}% +\indexlibrarymember{operator++}{join_view::\exposid{iterator}}% \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} @@ -6710,7 +6702,7 @@ Equivalent to: \tcode{++*this}. \end{itemdescr} -\indexlibrarymember{operator++}{join_view::iterator}% +\indexlibrarymember{operator++}{join_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator++(int) requires @\exposid{ref-is-glvalue}@ && @\libconcept{forward_range}@<@\exposid{Base}@> && @@ -6728,7 +6720,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{join_view::iterator}% +\indexlibrarymember{operator--}{join_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator--() requires @\exposid{ref-is-glvalue}@ && @\libconcept{bidirectional_range}@<@\exposid{Base}@> && @@ -6743,14 +6735,14 @@ \begin{codeblock} if (@\exposid{outer_}@ == ranges::end(@\exposid{parent_}@->@\exposid{base_}@)) @\exposid{inner_}@ = ranges::end(*--@\exposid{outer_}@); -while (@\exposid{inner_}@ == ranges::begin(*@\exposid{outer_}@)) - @\exposid{inner_}@ = ranges::end(*--@\exposid{outer_}@); ---@\exposid{inner_}@; +while (*@\exposid{inner_}@ == ranges::begin(*@\exposid{outer_}@)) + *@\exposid{inner_}@ = ranges::end(*--@\exposid{outer_}@); +--*@\exposid{inner_}@; return *this; \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{join_view::iterator}% +\indexlibrarymember{operator--}{join_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator--(int) requires @\exposid{ref-is-glvalue}@ && @\libconcept{bidirectional_range}@<@\exposid{Base}@> && @@ -6769,7 +6761,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator==}{join_view::iterator}% +\indexlibrarymember{operator==}{join_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\exposid{ref-is-glvalue}@ && @\libconcept{equality_comparable}@> && @@ -6783,22 +6775,21 @@ \tcode{return x.\exposid{outer_} == y.\exposid{outer_} \&\& x.\exposid{inner_} == y.\exposid{inner_};} \end{itemdescr} -\indexlibrarymember{iter_swap}{join_view::iterator}% +\indexlibrarymember{iter_swap}{join_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr void iter_swap(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - noexcept(noexcept(ranges::iter_swap(x.@\exposid{inner_}@, y.@\exposid{inner_}@))) + noexcept(noexcept(ranges::iter_swap(*x.@\exposid{inner_}@, *y.@\exposid{inner_}@))) requires @\libconcept{indirectly_swappable}@<@\exposid{InnerIter}@>; \end{itemdecl} \begin{itemdescr} \pnum \effects -Equivalent to: \tcode{return ranges::iter_swap(x.\exposid{inner_}, y.\exposid{inner_});} +Equivalent to: \tcode{return ranges::iter_swap(*x.\exposid{inner_}, *y.\exposid{inner_});} \end{itemdescr} \rSec3[range.join.sentinel]{Class template \tcode{join_view::\exposid{sentinel}}} -\indexlibraryglobal{join_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{input_range}@ V> @@ -6824,7 +6815,7 @@ } \end{codeblock} -\indexlibraryctor{join_view::sentinel}% +\indexlibraryctor{join_view::\exposid{sentinel}}% \begin{itemdecl} constexpr explicit @\exposid{sentinel}@(@\exposid{Parent}@& parent); \end{itemdecl} @@ -6835,7 +6826,7 @@ Initializes \exposid{end_} with \tcode{ranges::end(parent.\exposid{base_})}. \end{itemdescr} -\indexlibraryctor{join_view::sentinel}% +\indexlibraryctor{join_view::\exposid{sentinel}}% \begin{itemdecl} constexpr @\exposid{sentinel}@(@\exposid{sentinel}@ s) requires Const && @\libconcept{convertible_to}@, sentinel_t<@\exposid{Base}@>>; @@ -6847,7 +6838,7 @@ Initializes \exposid{end_} with \tcode{std::move(s.\exposid{end_})}. \end{itemdescr} -\indexlibrarymember{operator==}{join_view::sentinel}%3431 +\indexlibrarymember{operator==}{join_view::\exposid{sentinel}}%3431 \begin{itemdecl} template @@ -6866,11 +6857,11 @@ \rSec3[range.join.with.overview]{Overview} \pnum -\tcode{join_with_view} takes a \libconcept{view} and a delimiter, and -flattens the \libconcept{view}, +\tcode{join_with_view} takes a view and a delimiter, and +flattens the view, inserting every element of the delimiter -in between elements of the \libconcept{view}. -The delimiter can be a single element or a \libconcept{view} of elements. +in between elements of the view. +The delimiter can be a single element or a view of elements. \pnum \indexlibrarymember{join_with}{views}% @@ -7039,28 +7030,28 @@ @\exposid{iterator}@() requires @\libconcept{default_initializable}@<@\exposid{OuterIter}@> = default; constexpr @\exposid{iterator}@(@\exposid{iterator}@ i) - requires Const && @\libconcept{convertible_to}@, @\exposid{OuterIter}@> && - @\libconcept{convertible_to}@, @\exposid{InnerIter}@> && - @\libconcept{convertible_to}@, @\exposid{PatternIter}@>; + requires Const && @\libconcept{convertible_to}@, @\exposid{OuterIter}@> && + @\libconcept{convertible_to}@, @\exposid{InnerIter}@> && + @\libconcept{convertible_to}@, @\exposid{PatternIter}@>; constexpr decltype(auto) operator*() const; constexpr @\exposid{iterator}@& operator++(); constexpr void operator++(int); constexpr @\exposid{iterator}@ operator++(int) - requires @\exposid{ref-is-glvalue}@ && @\libconcept{forward_iterator}@<@\exposid{OuterIter}@> && - @\libconcept{forward_iterator}@<@\exposid{InnerIter}@>; + requires @\exposid{ref-is-glvalue}@ && @\libconcept{forward_iterator}@<@\exposid{OuterIter}@> && + @\libconcept{forward_iterator}@<@\exposid{InnerIter}@>; constexpr @\exposid{iterator}@& operator--() - requires @\exposid{ref-is-glvalue}@ && @\libconcept{bidirectional_range}@<@\exposid{Base}@> && - @\exposconcept{bidirectional-common}@<@\exposid{InnerBase}@> && @\exposconcept{bidirectional-common}@<@\exposid{PatternBase}@>; + requires @\exposid{ref-is-glvalue}@ && @\libconcept{bidirectional_range}@<@\exposid{Base}@> && + @\exposconcept{bidirectional-common}@<@\exposid{InnerBase}@> && @\exposconcept{bidirectional-common}@<@\exposid{PatternBase}@>; constexpr @\exposid{iterator}@ operator--(int) - requires @\exposid{ref-is-glvalue}@ && @\libconcept{bidirectional_range}@<@\exposid{Base}@> && - @\exposconcept{bidirectional-common}@<@\exposid{InnerBase}@> && @\exposconcept{bidirectional-common}@<@\exposid{PatternBase}@>; + requires @\exposid{ref-is-glvalue}@ && @\libconcept{bidirectional_range}@<@\exposid{Base}@> && + @\exposconcept{bidirectional-common}@<@\exposid{InnerBase}@> && @\exposconcept{bidirectional-common}@<@\exposid{PatternBase}@>; friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\exposid{ref-is-glvalue}@ && @\libconcept{equality_comparable}@<@\exposid{OuterIter}@> && - @\libconcept{equality_comparable}@<@\exposid{InnerIter}@>; + requires @\exposid{ref-is-glvalue}@ && @\libconcept{equality_comparable}@<@\exposid{OuterIter}@> && + @\libconcept{equality_comparable}@<@\exposid{InnerIter}@>; friend constexpr decltype(auto) iter_move(const @\exposid{iterator}@& x) { using rvalue_reference = common_reference_t< @@ -7070,7 +7061,7 @@ } friend constexpr void iter_swap(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{indirectly_swappable}@<@\exposid{InnerIter}@, @\exposid{PatternIter}@> { + requires @\libconcept{indirectly_swappable}@<@\exposid{InnerIter}@, @\exposid{PatternIter}@> { visit(ranges::iter_swap, x.@\exposid{inner_it_}@, y.@\exposid{inner_it_}@); } }; @@ -7112,8 +7103,8 @@ \item If \begin{codeblock} -is_lvalue_reference_v, - iter_reference_t<@\exposid{PatternIter}@>>> +is_reference_v, + iter_reference_t<@\exposid{PatternIter}@>>> \end{codeblock} is \tcode{false}, \tcode{iterator_category} denotes \tcode{input_iterator_tag}. @@ -7449,9 +7440,9 @@ \rSec3[range.lazy.split.overview]{Overview} \pnum -\tcode{lazy_split_view} takes a \libconcept{view} and a delimiter, and splits -the \libconcept{view} into subranges on the delimiter. The delimiter can be -a single element or a \libconcept{view} of elements. +\tcode{lazy_split_view} takes a view and a delimiter, and splits +the view into subranges on the delimiter. The delimiter can be +a single element or a view of elements. \pnum \indexlibrarymember{lazy_split}{views}% @@ -7782,6 +7773,7 @@ : view_interface { private: @\exposid{outer-iterator}@ @\exposid{i_}@ = @\exposid{outer-iterator}@(); // \expos + public: value_type() = default; constexpr explicit value_type(@\exposid{outer-iterator}@ i); @@ -8011,9 +8003,9 @@ \rSec3[range.split.overview]{Overview} \pnum -\tcode{split_view} takes a \libconcept{view} and a delimiter, and -splits the \libconcept{view} into \tcode{subrange}s on the delimiter. -The delimiter can be a single element or a \libconcept{view} of elements. +\tcode{split_view} takes a view and a delimiter, and +splits the view into \tcode{subrange}s on the delimiter. +The delimiter can be a single element or a view of elements. \pnum The name \tcode{views::split} denotes @@ -8310,7 +8302,7 @@ \pnum \indextext{range!counted}% -A counted view presents a \libconcept{view} of the elements +A counted view presents a view of the elements of the counted range\iref{iterator.requirements.general} \countedrange{i}{n} for an iterator \tcode{i} and non-negative integer \tcode{n}. @@ -8352,8 +8344,8 @@ \rSec3[range.common.overview]{Overview} \pnum -\tcode{common_view} takes a \libconcept{view} which has different types for -its iterator and sentinel and turns it into a \libconcept{view} of the same +\tcode{common_view} takes a view which has different types for +its iterator and sentinel and turns it into a view of the same elements with an iterator and sentinel of the same type. \pnum @@ -8406,6 +8398,7 @@ class common_view : public view_interface> { private: V @\exposid{base_}@ = V(); // \expos + public: common_view() requires @\libconcept{default_initializable}@ = default; @@ -8430,14 +8423,14 @@ constexpr auto end() { if constexpr (@\libconcept{random_access_range}@ && @\libconcept{sized_range}@) - return ranges::begin(@\exposid{base_}@) + ranges::size(@\exposid{base_}@); + return ranges::begin(@\exposid{base_}@) + ranges::distance(@\exposid{base_}@); else return common_iterator, sentinel_t>(ranges::end(@\exposid{base_}@)); } constexpr auto end() const requires @\libconcept{range}@ { if constexpr (@\libconcept{random_access_range}@ && @\libconcept{sized_range}@) - return ranges::begin(@\exposid{base_}@) + ranges::size(@\exposid{base_}@); + return ranges::begin(@\exposid{base_}@) + ranges::distance(@\exposid{base_}@); else return common_iterator, sentinel_t>(ranges::end(@\exposid{base_}@)); } @@ -8471,8 +8464,8 @@ \rSec3[range.reverse.overview]{Overview} \pnum -\tcode{reverse_view} takes a bidirectional \libconcept{view} and produces -another \libconcept{view} that iterates the same elements in reverse order. +\tcode{reverse_view} takes a bidirectional view and produces +another view that iterates the same elements in reverse order. \pnum \indexlibrarymember{reverse}{views}% @@ -8527,6 +8520,7 @@ class reverse_view : public view_interface> { private: V @\exposid{base_}@ = V(); // \expos + public: reverse_view() requires @\libconcept{default_initializable}@ = default; @@ -8615,7 +8609,7 @@ \rSec3[range.as.const.overview]{Overview} \pnum -\tcode{as_const_view} presents a \libconcept{view} of an underlying sequence as constant. +\tcode{as_const_view} presents a view of an underlying sequence as constant. That is, the elements of an \tcode{as_const_view} cannot be modified. \pnum @@ -8647,7 +8641,7 @@ \pnum \begin{example} \begin{codeblock} -template +template<@\libconcept{constant_range}@ R> void cant_touch_this(R&&); vector hammer = {'m', 'c'}; @@ -8703,9 +8697,9 @@ \pnum \tcode{elements_view} takes -a \libconcept{view} of tuple-like values and a \tcode{size_t}, and -produces a \libconcept{view} with a value-type of the $N^\text{th}$ element -of the adapted \libconcept{view}'s value-type. +a view of tuple-like values and a \tcode{size_t}, and +produces a view with a value-type of the $N^\text{th}$ element +of the adapted view's value-type. \pnum \indexlibrarymember{elements}{views}% @@ -8838,7 +8832,6 @@ \rSec3[range.elements.iterator]{Class template \tcode{elements_view::\exposid{iterator}}} -\indexlibraryglobal{elements_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{input_range}@ V, size_t N> @@ -8946,7 +8939,6 @@ Otherwise, \tcode{iterator_category} denotes \tcode{C}. \end{itemize} -\indexlibrarymember{\exposid{get-element}}{elements_view::iterator}% \begin{itemdecl} static constexpr decltype(auto) @\exposid{get-element}@(const iterator_t<@\exposid{Base}@>& i); \end{itemdecl} @@ -8965,7 +8957,7 @@ \end{codeblock} \end{itemdescr} -\indexlibraryctor{elements_view::iterator}% +\indexlibraryctor{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr explicit @\exposid{iterator}@(iterator_t<@\exposid{Base}@> current); \end{itemdecl} @@ -8976,7 +8968,7 @@ Initializes \exposid{current_} with \tcode{std::move(current)}. \end{itemdescr} -\indexlibraryctor{elements_view::iterator}% +\indexlibraryctor{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@(@\exposid{iterator}@ i) requires Const && @\libconcept{convertible_to}@, iterator_t<@\exposid{Base}@>>; @@ -8988,7 +8980,7 @@ Initializes \exposid{current_} with \tcode{std::move(i.\exposid{current_})}. \end{itemdescr} -\indexlibrarymember{base}{elements_view::iterator}% +\indexlibrarymember{base}{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr const iterator_t<@\exposid{Base}@>& base() const & noexcept; \end{itemdecl} @@ -8999,7 +8991,7 @@ Equivalent to: \tcode{return \exposid{current_};} \end{itemdescr} -\indexlibrarymember{base}{elements_view::iterator}% +\indexlibrarymember{base}{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr iterator_t<@\exposid{Base}@> base() &&; \end{itemdecl} @@ -9010,7 +9002,7 @@ Equivalent to: \tcode{return std::move(\exposid{current_});} \end{itemdescr} -\indexlibrarymember{operator++}{elements_view::iterator}% +\indexlibrarymember{operator++}{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator++(); \end{itemdecl} @@ -9025,7 +9017,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator++}{elements_view::iterator}% +\indexlibrarymember{operator++}{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} @@ -9036,7 +9028,7 @@ Equivalent to: \tcode{++\exposid{current_}}. \end{itemdescr} -\indexlibrarymember{operator++}{elements_view::iterator}% +\indexlibrarymember{operator++}{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator++(int) requires @\libconcept{forward_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -9052,7 +9044,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{elements_view::iterator}% +\indexlibrarymember{operator--}{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator--() requires @\libconcept{bidirectional_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -9067,7 +9059,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{elements_view::iterator}% +\indexlibrarymember{operator--}{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator--(int) requires @\libconcept{bidirectional_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -9083,7 +9075,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator+=}{elements_view::iterator}% +\indexlibrarymember{operator+=}{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator+=(difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9099,7 +9091,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-=}{elements_view::iterator}% +\indexlibrarymember{operator-=}{elements_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator-=(difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9115,7 +9107,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator==}{elements_view::iterator}% +\indexlibrarymember{operator==}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{equality_comparable}@<@\exposid{Base}@>; @@ -9127,7 +9119,7 @@ Equivalent to: \tcode{return x.\exposid{current_} == y.\exposid{current_};} \end{itemdescr} -\indexlibrarymember{operator<}{elements_view::iterator}% +\indexlibrarymember{operator<}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator<(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9139,7 +9131,7 @@ Equivalent to: \tcode{return x.\exposid{current_} < y.\exposid{current_};} \end{itemdescr} -\indexlibrarymember{operator>}{elements_view::iterator}% +\indexlibrarymember{operator>}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9151,7 +9143,7 @@ Equivalent to: \tcode{return y < x;} \end{itemdescr} -\indexlibrarymember{operator<=}{elements_view::iterator}% +\indexlibrarymember{operator<=}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator<=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9163,7 +9155,7 @@ Equivalent to: \tcode{return !(y < x);} \end{itemdescr} -\indexlibrarymember{operator>=}{elements_view::iterator}% +\indexlibrarymember{operator>=}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9175,7 +9167,7 @@ Equivalent to: \tcode{return !(x < y);} \end{itemdescr} -\indexlibrarymember{operator<=>}{elements_view::iterator}% +\indexlibrarymember{operator<=>}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@> && @\libconcept{three_way_comparable}@>; @@ -9187,7 +9179,7 @@ Equivalent to: \tcode{return x.\exposid{current_} <=> y.\exposid{current_};} \end{itemdescr} -\indexlibrarymember{operator+}{elements_view::iterator}% +\indexlibrarymember{operator+}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator+(const @\exposid{iterator}@& x, difference_type y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9199,7 +9191,7 @@ Equivalent to: \tcode{return \exposid{iterator}\{x\} += y;} \end{itemdescr} -\indexlibrarymember{operator+}{elements_view::iterator}% +\indexlibrarymember{operator+}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator+(difference_type x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9211,7 +9203,7 @@ Equivalent to: \tcode{return y + x;} \end{itemdescr} -\indexlibrarymember{operator-}{elements_view::iterator}% +\indexlibrarymember{operator-}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator-(const @\exposid{iterator}@& x, difference_type y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -9223,7 +9215,7 @@ Equivalent to: \tcode{return \exposid{iterator}\{x\} -= y;} \end{itemdescr} -\indexlibrarymember{operator-}{elements_view::iterator}% +\indexlibrarymember{operator-}{elements_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr difference_type operator-(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{sized_sentinel_for}@, iterator_t<@\exposid{Base}@>>; @@ -9237,7 +9229,6 @@ \rSec3[range.elements.sentinel]{Class template \tcode{elements_view::\exposid{sentinel}}} -\indexlibraryglobal{elements_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{input_range}@ V, size_t N> @@ -9249,6 +9240,7 @@ private: using @\exposid{Base}@ = @\exposid{maybe-const}@; // \expos sentinel_t<@\exposid{Base}@> @\exposid{end_}@ = sentinel_t<@\exposid{Base}@>(); // \expos + public: @\exposid{sentinel}@() = default; constexpr explicit @\exposid{sentinel}@(sentinel_t<@\exposid{Base}@> end); @@ -9274,7 +9266,7 @@ } \end{codeblock} -\indexlibraryctor{elements_view::sentinel}% +\indexlibraryctor{elements_view::\exposid{sentinel}}% \begin{itemdecl} constexpr explicit @\exposid{sentinel}@(sentinel_t<@\exposid{Base}@> end); \end{itemdecl} @@ -9285,7 +9277,7 @@ Initializes \exposid{end_} with \tcode{end}. \end{itemdescr} -\indexlibraryctor{elements_view::sentinel}% +\indexlibraryctor{elements_view::\exposid{sentinel}}% \begin{itemdecl} constexpr @\exposid{sentinel}@(@\exposid{sentinel}@ other) requires Const && @\libconcept{convertible_to}@, sentinel_t<@\exposid{Base}@>>; @@ -9297,7 +9289,7 @@ Initializes \exposid{end_} with \tcode{std::move(other.\exposid{end_})}. \end{itemdescr} -\indexlibrarymember{base}{elements_view::sentinel}% +\indexlibrarymember{base}{elements_view::\exposid{sentinel}}% \begin{itemdecl} constexpr sentinel_t<@\exposid{Base}@> base() const; \end{itemdecl} @@ -9308,7 +9300,7 @@ Equivalent to: \tcode{return \exposid{end_};} \end{itemdescr} -\indexlibrarymember{operator==}{elements_view::sentinel}% +\indexlibrarymember{operator==}{elements_view::\exposid{sentinel}}% \begin{itemdecl} template requires @\libconcept{sentinel_for}@, iterator_t<@\exposid{maybe-const}@>> @@ -9321,7 +9313,7 @@ Equivalent to: \tcode{return x.\exposid{current_} == y.\exposid{end_};} \end{itemdescr} -\indexlibrarymember{operator-}{elements_view::sentinel}% +\indexlibrarymember{operator-}{elements_view::\exposid{sentinel}}% \begin{itemdecl} template requires @\libconcept{sized_sentinel_for}@, iterator_t<@\exposid{maybe-const}@>> @@ -9335,7 +9327,7 @@ Equivalent to: \tcode{return x.\exposid{current_} - y.\exposid{end_};} \end{itemdescr} -\indexlibrarymember{operator-}{elements_view::sentinel}% +\indexlibrarymember{operator-}{elements_view::\exposid{sentinel}}% \begin{itemdecl} template requires @\libconcept{sized_sentinel_for}@, iterator_t<@\exposid{maybe-const}@>> @@ -9355,8 +9347,8 @@ \pnum \indexlibraryglobal{zip_view}% -\tcode{zip_view} takes any number of \libconcept{view}s and -produces a \libconcept{view} of tuples of references +\tcode{zip_view} takes any number of views and +produces a view of tuples of references to the corresponding elements of the constituent views. \pnum @@ -9491,7 +9483,6 @@ \rSec3[range.zip.iterator]{Class template \tcode{zip_view::\exposid{iterator}}} -\indexlibraryglobal{zip_view::iterator}% \begin{codeblock} namespace std::ranges { template @@ -9872,7 +9863,6 @@ \rSec3[range.zip.sentinel]{Class template \tcode{zip_view::\exposid{sentinel}}} -\indexlibraryglobal{zip_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{input_range}@... Views> @@ -9985,8 +9975,8 @@ \pnum \indexlibraryglobal{zip_transform_view}% \tcode{zip_transform_view} takes an invocable object and -any number of \libconcept{view}s and -produces a \libconcept{view} +any number of views and +produces a view whose $M^\text{th}$ element is the result of applying the invocable object to the $M^\text{th}$ elements of all views. @@ -10003,7 +9993,7 @@ let \tcode{FD} be \tcode{decay_t}. \begin{itemize} \item -If \tcode{\libconcept{copy_constructible} \&\& +If \tcode{\libconcept{move_constructible} \&\& \libconcept{regular_invocable}} is \tcode{false}, or if \tcode{decay_t>} is not an object type, \tcode{views::zip_transform(F, Es...)} is ill-formed. @@ -10116,7 +10106,6 @@ \rSec3[range.zip.transform.iterator]{Class template \tcode{zip_transform_view::\exposid{iterator}}} -\indexlibraryglobal{zip_transform_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{move_constructible}@ F, @\libconcept{input_range}@... Views> @@ -10188,7 +10177,7 @@ \begin{codeblock} invoke_result_t<@\exposid{maybe-const}@&, range_reference_t<@\exposid{maybe-const}@>...> \end{codeblock} -is not an lvalue reference, +is not a reference, \tcode{iterator_category} denotes \tcode{input_iterator_tag}. \item Otherwise, let \tcode{Cs} denote the pack of types @@ -10428,7 +10417,6 @@ \rSec3[range.zip.transform.sentinel]{Class template \tcode{zip_transform_view::\exposid{sentinel}}} -\indexlibraryglobal{zip_transform_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{move_constructible}@ F, @\libconcept{input_range}@... Views> @@ -10518,8 +10506,8 @@ \pnum \indexlibraryglobal{adjacent_view}% -\tcode{adjacent_view} takes a \libconcept{view} and -produces a \libconcept{view} whose $M^\text{th}$ element is +\tcode{adjacent_view} takes a view and +produces a view whose $M^\text{th}$ element is a tuple of references to the $M^\text{th}$ through $(M + N - 1)^\text{th}$ elements of the original view. @@ -10637,7 +10625,6 @@ \rSec3[range.adjacent.iterator]{Class template \tcode{adjacent_view::\exposid{iterator}}} -\indexlibraryglobal{adjacent_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{forward_range}@ V, size_t N> @@ -11053,7 +11040,6 @@ \rSec3[range.adjacent.sentinel]{Class template \tcode{adjacent_view::\exposid{sentinel}}} -\indexlibraryglobal{adjacent_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{forward_range}@ V, size_t N> @@ -11152,7 +11138,7 @@ \pnum \indexlibraryglobal{adjacent_transform_view}% \tcode{adjacent_transform_view} takes an invocable object and -a \libconcept{view} and produces a \libconcept{view} +a view and produces a view whose $M^\text{th}$ element is the result of applying the invocable object to the $M^\text{th}$ through $(M + N - 1)^\text{th}$ elements of the original view. @@ -11197,9 +11183,9 @@ \begin{codeblock} namespace std::ranges { template<@\libconcept{forward_range}@ V, @\libconcept{move_constructible}@ F, size_t N> - requires @\libconcept{view}@ && (N > 0) && is_object_v && - @\libconcept{regular_invocable}@, N)...> && - @\exposconcept{can-reference}@, N)...>> + requires @\libconcept{view}@ && (N > 0) && is_object_v && + @\libconcept{regular_invocable}@, N)...> && + @\exposconcept{can-reference}@, N)...>> class adjacent_transform_view : public view_interface> { @\exposidnc{movable-box}@ @\exposid{fun_}@; // \expos adjacent_view @\exposid{inner_}@; // \expos @@ -11272,7 +11258,6 @@ \rSec3[range.adjacent.transform.iterator]{Class template \tcode{adjacent_transform_view::\exposid{iterator}}} -\indexlibraryglobal{adjacent_transform_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{forward_range}@ V, @\libconcept{move_constructible}@ F, size_t N> @@ -11342,7 +11327,7 @@ \item If \tcode{invoke_result_t<\exposid{maybe-const}\&, \exposid{REPEAT}(range_reference_t<\exposid{Base}>, N)...>} -is\linebreak not an lvalue reference, +is\linebreak not a reference, \tcode{iterator_category} denotes \tcode{input_iterator_tag}. \item Otherwise, let \tcode{C} denote the type @@ -11575,7 +11560,6 @@ \rSec3[range.adjacent.transform.sentinel]{Class template \tcode{adjacent_transform_view::\exposid{sentinel}}} -\indexlibraryglobal{adjacent_transform_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{forward_range}@ V, @\libconcept{move_constructible}@ F, size_t N> @@ -11665,11 +11649,11 @@ \rSec3[range.chunk.overview]{Overview} \pnum -\tcode{chunk_view} takes a \libconcept{view} and a number $N$ and -produces a range of \libconcept{view}s +\tcode{chunk_view} takes a view and a number $N$ and +produces a range of views that are $N$-sized non-overlapping successive chunks of -the elements of the original \libconcept{view}, in order. -The last \libconcept{view} in the range can have fewer than $N$ elements. +the elements of the original view, in order. +The last view in the range can have fewer than $N$ elements. \pnum \indexlibrarymember{chunk}{views}% @@ -11740,7 +11724,7 @@ }; template - chunk_view(R&& r, range_difference_t) -> chunk_view>; + chunk_view(R&&, range_difference_t) -> chunk_view>; } \end{codeblock} @@ -12224,7 +12208,6 @@ \rSec3[range.chunk.fwd.iter]{Class template \tcode{chunk_view::\exposid{iterator}} for forward ranges} -\indexlibraryglobal{chunk_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{view}@ V> @@ -12630,14 +12613,14 @@ \rSec3[range.slide.overview]{Overview} \pnum -\tcode{slide_view} takes a \libconcept{view} and a number $N$ and -produces a \libconcept{view} -whose $M^\text{th}$ element is a \libconcept{view} over +\tcode{slide_view} takes a view and a number $N$ and +produces a view +whose $M^\text{th}$ element is a view over the $M^\text{th}$ through $(M + N - 1)^\text{th}$ elements -of the original \libconcept{view}. -If the original \libconcept{view} has fewer than $N$ elements, -the resulting \libconcept{view} is empty. +of the original view. +If the original view has fewer than $N$ elements, +the resulting view is empty. \pnum \indexlibrarymember{slide}{views}% @@ -12702,7 +12685,7 @@ }; template - slide_view(R&& r, range_difference_t) -> slide_view>; + slide_view(R&&, range_difference_t) -> slide_view>; } \end{codeblock} @@ -12824,7 +12807,6 @@ \rSec3[range.slide.iterator]{Class template \tcode{slide_view::\exposid{iterator}}} -\indexlibraryglobal{slide_view::iterator}% \begin{codeblock} namespace std::ranges { template<@\libconcept{forward_range}@ V> @@ -13207,7 +13189,6 @@ \rSec3[range.slide.sentinel]{Class \tcode{slide_view::\exposid{sentinel}}} -\indexlibraryglobal{chunk_view::sentinel}% \begin{codeblock} namespace std::ranges { template<@\libconcept{forward_range}@ V> @@ -13287,8 +13268,8 @@ \rSec3[range.chunk.by.overview]{Overview} \pnum -\tcode{chunk_by_view} takes a \libconcept{view} and a predicate, and -splits the \libconcept{view} into \tcode{subrange}s +\tcode{chunk_by_view} takes a view and a predicate, and +splits the view into \tcode{subrange}s between each pair of adjacent elements for which the predicate returns \tcode{false}. @@ -13324,7 +13305,7 @@ requires @\libconcept{view}@ && is_object_v class chunk_by_view : public view_interface> { V @\exposid{base_}@ = V(); // \expos - @\exposidnc{movable-box}@ @\exposid{pred_}@ = Pred(); // \expos + @\exposidnc{movable-box}@ @\exposid{pred_}@; // \expos // \ref{range.chunk.by.iter}, class \tcode{chunk_by_view::\exposid{iterator}} class @\exposidnc{iterator}@; // \expos @@ -13616,7 +13597,7 @@ \rSec3[range.stride.overview]{Overview} \pnum -\tcode{stride_view} presents a \libconcept{view} of an underlying sequence, +\tcode{stride_view} presents a view of an underlying sequence, advancing over $n$ elements at a time, as opposed to the usual single-step succession. @@ -13803,7 +13784,7 @@ requires @\libconcept{random_access_range}@<@\exposid{Base}@>; friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires @\libconcept{random_access_range}@<@\exposid{Base}@> && @\libconcept{three_way_comparable}@>; + requires @\libconcept{random_access_range}@<@\exposid{Base}@> && @\libconcept{three_way_comparable}@>; friend constexpr @\exposid{iterator}@ operator+(const @\exposid{iterator}@& x, difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -13862,7 +13843,7 @@ Otherwise, \tcode{iterator_category} denotes \tcode{C}. \end{itemize} -\indexlibraryctor{stride_view::iterator}% +\indexlibraryctor{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@(@\exposid{Parent}@* parent, iterator_t<@\exposid{Base}@> current, range_difference_t<@\exposid{Base}@> missing = 0); @@ -13877,7 +13858,7 @@ \exposid{missing_} with \tcode{missing}. \end{itemdescr} -\indexlibraryctor{stride_view::iterator}% +\indexlibraryctor{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@(@\exposid{iterator}@ i) requires Const && @\libconcept{convertible_to}@, iterator_t<@\exposid{Base}@>> @@ -13893,7 +13874,7 @@ \exposid{missing_} with \tcode{i.\exposid{missing_}}. \end{itemdescr} -\indexlibrarymember{base}{stride_view::iterator}% +\indexlibrarymember{base}{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr iterator_t<@\exposid{Base}@> base() &&; \end{itemdecl} @@ -13904,7 +13885,7 @@ \tcode{std::move(\exposid{current_})}. \end{itemdescr} -\indexlibrarymember{base}{stride_view::iterator}% +\indexlibrarymember{base}{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr const iterator_t<@\exposid{Base}@>& base() const & noexcept; \end{itemdecl} @@ -13915,7 +13896,7 @@ \exposid{current_}. \end{itemdescr} -\indexlibrarymember{operator++}{stride_view::iterator}% +\indexlibrarymember{operator++}{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator++(); \end{itemdecl} @@ -13934,7 +13915,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator++}{stride_view::iterator}% +\indexlibrarymember{operator++}{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} @@ -13945,7 +13926,7 @@ Equivalent to: \tcode{++*this;} \end{itemdescr} -\indexlibrarymember{operator++}{stride_view::iterator}% +\indexlibrarymember{operator++}{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator++(int) requires @\libconcept{forward_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -13961,7 +13942,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{stride_view::iterator}% +\indexlibrarymember{operator--}{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator--() requires @\libconcept{bidirectional_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -13977,7 +13958,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator--}{stride_view::iterator}% +\indexlibrarymember{operator--}{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@ operator--(int) requires @\libconcept{bidirectional_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -13993,7 +13974,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator+=}{stride_view::iterator}% +\indexlibrarymember{operator+=}{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator+=(difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; \end{itemdecl} @@ -14022,7 +14003,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-=}{stride_view::iterator}% +\indexlibrarymember{operator-=}{stride_view::\exposid{iterator}}% \begin{itemdecl} constexpr @\exposid{iterator}@& operator-=(difference_type x) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -14034,7 +14015,7 @@ Equivalent to: \tcode{return *this += -x;} \end{itemdescr} -\indexlibrarymember{operator==}{stride_view::iterator}% +\indexlibrarymember{operator==}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, default_sentinel_t); \end{itemdecl} @@ -14045,7 +14026,7 @@ \tcode{x.\exposid{current_} == x.\exposid{end_}}. \end{itemdescr} -\indexlibrarymember{operator==}{stride_view::iterator}% +\indexlibrarymember{operator==}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator==(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{equality_comparable}@>; @@ -14057,7 +14038,7 @@ \tcode{x.\exposid{current_} == y.\exposid{current_}}. \end{itemdescr} -\indexlibrarymember{operator<}{stride_view::iterator}% +\indexlibrarymember{operator<}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator<(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -14069,7 +14050,7 @@ \tcode{x.\exposid{current_} < y.\exposid{current_}}. \end{itemdescr} -\indexlibrarymember{operator>}{stride_view::iterator}% +\indexlibrarymember{operator>}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -14081,7 +14062,7 @@ Equivalent to: \tcode{return y < x;} \end{itemdescr} -\indexlibrarymember{operator<=}{stride_view::iterator}% +\indexlibrarymember{operator<=}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator<=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -14093,7 +14074,7 @@ Equivalent to: \tcode{return !(y < x);} \end{itemdescr} -\indexlibrarymember{operator>=}{stride_view::iterator}% +\indexlibrarymember{operator>=}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -14105,7 +14086,7 @@ Equivalent to: \tcode{return !(x < y);} \end{itemdescr} -\indexlibrarymember{operator<=>}{stride_view::iterator}% +\indexlibrarymember{operator<=>}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{random_access_range}@<@\exposid{Base}@> && @\libconcept{three_way_comparable}@>; @@ -14117,7 +14098,7 @@ \tcode{x.\exposid{current_} <=> y.\exposid{current_}}. \end{itemdescr} -\indexlibrarymember{operator+}{stride_view::iterator}% +\indexlibrarymember{operator+}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator+(const @\exposid{iterator}@& i, difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -14136,7 +14117,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-}{stride_view::iterator}% +\indexlibrarymember{operator-}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr @\exposid{iterator}@ operator-(const @\exposid{iterator}@& i, difference_type n) requires @\libconcept{random_access_range}@<@\exposid{Base}@>; @@ -14153,7 +14134,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{operator-}{stride_view::iterator}% +\indexlibrarymember{operator-}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr difference_type operator-(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\libconcept{sized_sentinel_for}@, iterator_t<@\exposid{Base}@>>; @@ -14174,7 +14155,7 @@ \end{itemize} \end{itemdescr} -\indexlibrarymember{operator-}{stride_view::iterator}% +\indexlibrarymember{operator-}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr difference_type operator-(default_sentinel_t y, const @\exposid{iterator}@& x) requires @\libconcept{sized_sentinel_for}@, iterator_t<@\exposid{Base}@>>; @@ -14186,7 +14167,7 @@ \tcode{\exposid{div-ceil}(x.\exposid{end_} - x.\exposid{current_}, x.\exposid{stride_})}. \end{itemdescr} -\indexlibrarymember{operator-}{stride_view::iterator}% +\indexlibrarymember{operator-}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr difference_type operator-(const @\exposid{iterator}@& x, default_sentinel_t y) requires @\libconcept{sized_sentinel_for}@, iterator_t<@\exposid{Base}@>>; @@ -14198,7 +14179,7 @@ Equivalent to: \tcode{return -(y - x);} \end{itemdescr} -\indexlibrarymember{iter_move}{stride_view::iterator}% +\indexlibrarymember{iter_move}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr range_rvalue_reference_t<@\exposid{Base}@> iter_move(const @\exposid{iterator}@& i) noexcept(noexcept(ranges::iter_move(i.@\exposid{current_}@))); @@ -14210,7 +14191,7 @@ Equivalent to: \tcode{return ranges::iter_move(i.\exposid{current_});} \end{itemdescr} -\indexlibrarymember{iter_swap}{stride_view::iterator}% +\indexlibrarymember{iter_swap}{stride_view::\exposid{iterator}}% \begin{itemdecl} friend constexpr void iter_swap(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) noexcept(noexcept(ranges::iter_swap(x.@\exposid{current_}@, y.@\exposid{current_}@))) @@ -14315,8 +14296,9 @@ class cartesian_product_view : public view_interface> { private: tuple @\exposid{bases_}@; // \expos - // \ref{ranges.cartesian.iterator}, class template \tcode{cartesian_product_view::\exposid{iterator}} + // \ref{range.cartesian.iterator}, class template \tcode{cartesian_product_view::\exposid{iterator}} template class @\exposid{iterator}@; // \expos + public: constexpr cartesian_product_view() = default; constexpr explicit cartesian_product_view(First first_base, Vs... bases); @@ -14364,7 +14346,9 @@ \pnum \effects Equivalent to: -\tcode{return \exposid{iterator}(\exposid{tuple-transform}(ranges::begin, \exposid{bases_}));} +\begin{codeblock} +return @\exposid{iterator}@(*this, @\exposid{tuple-transform}@(ranges::begin, @\exposid{bases_}@)); +\end{codeblock} \end{itemdescr} \begin{itemdecl} @@ -14376,7 +14360,9 @@ \pnum \effects Equivalent to: -\tcode{return \exposid{iterator}(\exposid{tuple-transform}(ranges::begin, \exposid{bases_}));} +\begin{codeblock} +return @\exposid{iterator}@(*this, @\exposid{tuple-transform}@(ranges::begin, @\exposid{bases_}@)); +\end{codeblock} \end{itemdescr} \begin{itemdecl} @@ -14410,7 +14396,7 @@ \effects Equivalent to: \begin{codeblock} -@\exposid{iterator}@<@\exposid{is-const}@> it(@\exposid{tuple-transform}@( +@\exposid{iterator}@<@\exposid{is-const}@> it(*this, @\exposid{tuple-transform}@( [](auto& rng){ return @\exposid{begin-or-first-end}@(rng); }, @\exposid{bases_}@)); return it; \end{codeblock} @@ -14455,7 +14441,7 @@ $p$. \end{itemdescr} -\rSec3[ranges.cartesian.iterator]{Class template \tcode{cartesian_product_view::\exposid{iterator}}} +\rSec3[range.cartesian.iterator]{Class template \tcode{cartesian_product_view::\exposid{iterator}}} \begin{codeblock} namespace std::ranges { @@ -14513,9 +14499,9 @@ friend constexpr difference_type operator-(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires @\exposconcept{cartesian-is-sized-sentinel}@; - friend constexpr difference_type operator-(@\exposid{iterator}@ i, default_sentinel_t) + friend constexpr difference_type operator-(const @\exposid{iterator}@& i, default_sentinel_t) requires @\exposconcept{cartesian-is-sized-sentinel}@; - friend constexpr difference_type operator-(default_sentinel_t, @\exposid{iterator}@ i) + friend constexpr difference_type operator-(default_sentinel_t, const @\exposid{iterator}@& i) requires @\exposconcept{cartesian-is-sized-sentinel}@; friend constexpr auto iter_move(const @\exposid{iterator}@& i) noexcept(@\seebelow@); @@ -14525,21 +14511,22 @@ @\libconcept{indirectly_swappable}@>>); private: - @\exposid{maybe-const}@* @\exposid{parent_}@ = nullptr; // \expos + using @\exposidnc{Parent}@ = @\exposidnc{maybe-const}@; // \expos + @\exposidnc{Parent}@* @\exposidnc{parent_}@ = nullptr; // \expos tuple>, - iterator_t<@\exposid{maybe-const}@>...> @\exposid{current_}@; // \expos + iterator_t<@\exposidnc{maybe-const}@>...> @\exposidnc{current_}@; // \expos template - constexpr void @\exposid{next}@(); // \expos + constexpr void @\exposidnc{next}@(); // \expos template - constexpr void @\exposid{prev}@(); // \expos + constexpr void @\exposidnc{prev}@(); // \expos template - constexpr difference_type @\exposid{distance-from}@(Tuple t); // \expos + constexpr difference_type @\exposidnc{distance-from}@(const Tuple& t) const; // \expos - constexpr explicit @\exposid{iterator}@(tuple>, - iterator_t<@\exposid{maybe-const}@>...> current); // \expos + constexpr @\exposid{iterator}@(@\exposid{Parent}@& parent, tuple>, + iterator_t<@\exposidnc{maybe-const}@>...> current); // \expos }; } \end{codeblock} @@ -14622,7 +14609,7 @@ \begin{itemdecl} template - constexpr difference_type @\exposid{distance-from}@(Tuple t); + constexpr difference_type @\exposid{distance-from}@(const Tuple& t) const; \end{itemdecl} \begin{itemdescr} @@ -14633,7 +14620,7 @@ $\exposid{scaled-size}(N)$ be the product of \tcode{static_cast(ranges::size(std::get<\brk{}$N$>(\exposid{parent_}->\exposid{bases_})))} and $\exposid{scaled-size}(N+1)$ -if $N < \tcode{sizeof...(Vs)}$, otherwise \tcode{static_cast(1)}; +if $N \le \tcode{sizeof...(Vs)}$, otherwise \tcode{static_cast(1)}; \item $\exposid{scaled-distance}(N)$ be the product of \tcode{static_cast(std::get<$N$>(\exposid{cur\-rent_}) - std::get<$N$>(t))} and $\exposid{scaled-size}(N+1)$; and @@ -14652,14 +14639,16 @@ \end{itemdescr} \begin{itemdecl} -constexpr explicit @\exposid{iterator}@(tuple>, +constexpr @\exposid{iterator}@(@\exposid{Parent}@& parent, tuple>, iterator_t<@\exposid{maybe-const}@>...> current); \end{itemdecl} \begin{itemdescr} \pnum \effects -Initializes \exposid{current_} with \tcode{std::move(current)}. +Initializes +\exposid{parent_} with \tcode{addressof(parent)} and +\exposid{current_} with \tcode{std::move(current)}. \end{itemdescr} \begin{itemdecl} @@ -14671,7 +14660,9 @@ \begin{itemdescr} \pnum \effects -Initializes \exposid{current_} with \tcode{std::move(i.\exposid{current_})}. +Initializes +\exposid{parent_} with \tcode{i.\exposid{parent_}} and +\exposid{current_} with \tcode{std::move(i.\exposid{current_})}. \end{itemdescr} \begin{itemdecl} @@ -14903,7 +14894,7 @@ \end{itemdescr} \begin{itemdecl} -friend constexpr difference_type operator-(@\exposid{iterator}@ i, default_sentinel_t) +friend constexpr difference_type operator-(const @\exposid{iterator}@& i, default_sentinel_t) requires @\exposconcept{cartesian-is-sized-sentinel}@; \end{itemdecl} @@ -14927,7 +14918,7 @@ \end{itemdescr} \begin{itemdecl} -friend constexpr difference_type operator-(default_sentinel_t s, @\exposid{iterator}@ i) +friend constexpr difference_type operator-(default_sentinel_t s, const @\exposid{iterator}@& i) requires @\exposconcept{cartesian-is-sized-sentinel}@; \end{itemdecl} @@ -14990,7 +14981,7 @@ \pnum Class template \tcode{generator} presents -a \libconcept{view} of the elements yielded by the evaluation of a coroutine. +a view of the elements yielded by the evaluation of a coroutine. \pnum A \tcode{generator} generates a sequence of elements by @@ -15235,8 +15226,8 @@ @\libconcept{constructible_from}@, const remove_reference_t&>; template - requires @\libconcept{same_as}@::yielded, yielded> - auto yield_value(ranges::elements_of&&, Unused> g) noexcept; + requires @\libconcept{same_as}@::yielded, yielded> + auto yield_value(ranges::elements_of&&, Unused> g) noexcept; template requires @\libconcept{convertible_to}@, yielded> @@ -15338,7 +15329,7 @@ A handle referring to the coroutine whose promise object is \tcode{*this} is at the top of \tcode{*\exposid{active_}} -of some \tcode{generator} object \tcode{x}. +of some \tcode{generator} object. \pnum \returns @@ -15361,9 +15352,9 @@ \indexlibrarymember{yield_value}{generator::promise_type}% \begin{itemdecl} -template - requires @\libconcept{same_as}@::yielded, yielded> - auto yield_value(ranges::elements_of&&, Unused> g) noexcept; +template + requires @\libconcept{same_as}@::yielded, yielded> + auto yield_value(ranges::elements_of&&, Unused> g) noexcept; \end{itemdecl} \begin{itemdescr} @@ -15423,9 +15414,10 @@ \end{codeblock} \pnum -\remarks +\begin{note} A \grammarterm{yield-expression} that calls this function has type \tcode{void}\iref{expr.yield}. +\end{note} \end{itemdescr} \indexlibrarymember{unhandled_exception}{generator::promise_type}% @@ -15445,8 +15437,8 @@ If the handle referring to the coroutine whose promise object is \tcode{*this} is the sole element of \tcode{*x.\exposid{active_}}, -equivalent to: \tcode{throw;} -Otherwise, assigns \tcode{current_exception()} to \exposid{except_}. +equivalent to \tcode{throw}, +otherwise, assigns \tcode{current_exception()} to \exposid{except_}. \end{itemdescr} \indexlibrarymember{operator new}{generator::promise_type}% @@ -15535,7 +15527,7 @@ @\exposid{iterator}@& operator++(); void operator++(int); - friend bool operator==(@\exposid{iterator}@ i, default_sentinel_t); + friend bool operator==(const @\exposid{iterator}@& i, default_sentinel_t); private: coroutine_handle @\exposid{coroutine_}@; // \expos @@ -15543,7 +15535,7 @@ } \end{codeblock} -\indexlibraryctor{generator::iterator}% +\indexlibraryctor{generator::\exposid{iterator}}% \begin{itemdecl} @\exposid{iterator}@(@\exposid{iterator}@&& other) noexcept; \end{itemdecl} @@ -15555,7 +15547,7 @@ with \tcode{exchange(other.\exposid{coroutine_}, \{\})}. \end{itemdescr} -\indexlibrarymember{operator=}{generator::iterator}% +\indexlibrarymember{operator=}{generator::\exposid{iterator}}% \begin{itemdecl} @\exposid{iterator}@& operator=(@\exposid{iterator}@&& other) noexcept; \end{itemdecl} @@ -15571,7 +15563,7 @@ \tcode{*this}. \end{itemdescr} -\indexlibrarymember{operator*}{generator::iterator}% +\indexlibrarymember{operator*}{generator::\exposid{iterator}}% \begin{itemdecl} @\exposid{reference}@ operator*() const noexcept(is_nothrow_copy_constructible_v<@\exposid{reference}@>); \end{itemdecl} @@ -15590,7 +15582,7 @@ \tcode{return static_cast<\exposid{reference}>(*p.\exposid{value_});} \end{itemdescr} -\indexlibrarymember{operator++}{generator::iterator}% +\indexlibrarymember{operator++}{generator::\exposid{iterator}}% \begin{itemdecl} @\exposid{iterator}@& operator++(); \end{itemdecl} @@ -15610,7 +15602,7 @@ \tcode{*this}. \end{itemdescr} -\indexlibrarymember{operator++}{generator::iterator}% +\indexlibrarymember{operator++}{generator::\exposid{iterator}}% \begin{itemdecl} void operator++(int); \end{itemdecl} @@ -15621,9 +15613,9 @@ Equivalent to \tcode{++*this}. \end{itemdescr} -\indexlibrarymember{operator==}{generator::iterator}% +\indexlibrarymember{operator==}{generator::\exposid{iterator}}% \begin{itemdecl} -friend bool operator==(@\exposid{iterator}@ i, default_sentinel_t); +friend bool operator==(const @\exposid{iterator}@& i, default_sentinel_t); \end{itemdecl} \begin{itemdescr} diff --git a/source/statements.tex b/source/statements.tex index bca992c936..9bcd85d5bc 100644 --- a/source/statements.tex +++ b/source/statements.tex @@ -57,6 +57,7 @@ \end{note} \pnum +\indextext{statement!enclosing}% A \grammarterm{statement} \tcode{S1} \defnx{encloses}{enclosing statement} a \grammarterm{statement} \tcode{S2} if \begin{itemize} @@ -74,6 +75,11 @@ \item \tcode{S1} encloses a statement \tcode{S3} and \tcode{S3} encloses \tcode{S2}. \end{itemize} +\indextext{statement!enclosed by}% +A statement \tcode{S1} is +\defnx{enclosed by}{enclosed by statement} +a statement \tcode{S2} if +\tcode{S2} encloses \tcode{S1}. \pnum \indextext{\idxgram{condition}{s}!rules for}% @@ -94,11 +100,8 @@ declared variable contextually converted to \tcode{bool}\iref{conv}. If that -conversion is ill-formed, the program is ill-formed. The value of a -\grammarterm{condition} that is an initialized declaration in a -\keyword{switch} statement is the value of the declared variable if it has -integral or enumeration type, or of that variable implicitly converted -to integral or enumeration type otherwise. The value of a +conversion is ill-formed, the program is ill-formed. +The value of a \grammarterm{condition} that is an expression is the value of the expression, contextually converted to \tcode{bool} for statements other @@ -148,9 +151,12 @@ before its introduction. \pnum +\indextext{\idxgram{labeled-statement}}% \indextext{label!\idxcode{case}}% \indextext{label!\idxcode{default}}% -Case labels and default labels shall occur only in \keyword{switch} statements. +A \grammarterm{labeled-statement} +whose \grammarterm{label} is a \keyword{case} or \keyword{default} label +shall be enclosed by\iref{stmt.pre} a \keyword{switch} statement\iref{stmt.switch}. \pnum A \defnadj{control-flow-limited}{statement} is a statement \tcode{S} for which: @@ -403,7 +409,11 @@ several statements depending on the value of a condition. \pnum -The condition shall be of integral type, enumeration type, or class +The value of a \grammarterm{condition} +that is an initialized declaration +is the value of the declared variable, +or the value of the \grammarterm{expression} otherwise. +The value of the condition shall be of integral type, enumeration type, or class type. If of class type, the condition is contextually implicitly converted\iref{conv} to an integral or enumeration type. @@ -694,7 +704,6 @@ \end{note} \end{itemize} \end{itemize} - \begin{example} \begin{codeblock} int array[5] = { 1, 2, 3, 4, 5 }; @@ -702,6 +711,23 @@ x *= 2; \end{codeblock} \end{example} +\begin{note} +The lifetime of some temporaries in the \grammarterm{for-range-initializer} +is extended to cover the entire loop\iref{class.temporary}. +\end{note} +\begin{example} +\begin{codeblock} +using T = std::list; +const T& f1(const T& t) { return t; } +const T& f2(T t) { return t; } +T g(); + +void foo() { + for (auto e : f1(g())) {} // OK, lifetime of return value of \tcode{g()} extended + for (auto e : f2(g())) {} // undefined behavior +} +\end{codeblock} +\end{example} \pnum In the \grammarterm{decl-specifier-seq} of a \grammarterm{for-range-declaration}, @@ -759,25 +785,27 @@ \indextext{statement!\idxcode{break}} \pnum -The \keyword{break} statement shall occur only in an +A \keyword{break} statement shall be enclosed by\iref{stmt.pre} \indextext{\idxgram{iteration-statement}}% \indextext{statement!\idxcode{switch}}% -\grammarterm{iteration-statement} or a \keyword{switch} statement and causes -termination of the smallest enclosing \grammarterm{iteration-statement} or -\keyword{switch} statement; control passes to the statement following the +an \grammarterm{iteration-statement}\iref{stmt.iter} or +a \keyword{switch} statement\iref{stmt.switch}. +The \keyword{break} statement causes +termination of the smallest such enclosing statement; +control passes to the statement following the terminated statement, if any. \rSec2[stmt.cont]{The \keyword{continue} statement}% \indextext{statement!\idxcode{continue}} \pnum -The -\keyword{continue} -statement shall occur only in an +A \keyword{continue} +statement shall be enclosed by\iref{stmt.pre} an \indextext{\idxgram{iteration-statement}}% -\grammarterm{iteration-statement} -and causes control to pass to the loop-continuation portion of the -smallest enclosing \grammarterm{iteration-statement}, that is, to the end +\grammarterm{iteration-statement}\iref{stmt.iter}. +The \keyword{continue} statement +causes control to pass to the loop-continuation portion of the +smallest such enclosing statement, that is, to the end of the loop. More precisely, in each of the statements \begin{minipage}{.30\hsize} diff --git a/source/std.tex b/source/std.tex index 040decb135..b58362bcb1 100644 --- a/source/std.tex +++ b/source/std.tex @@ -34,9 +34,7 @@ \hypersetup{pdftitle={C++ Working Draft}, pdfsubject={ISO/IEC JTC1 SC22 WG21, C++}, pdfcreator={Thomas K\"{o}ppe}, - bookmarks=true, bookmarksnumbered=true, - pdfpagelabels=true, pdfpagemode=UseOutlines, pdfstartview=FitH, linktocpage=true, diff --git a/source/strings.tex b/source/strings.tex index d9bd3cef43..433abb6e66 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -541,9 +541,9 @@ class basic_string_view; template - inline constexpr bool ranges::enable_view> = true; + constexpr bool ranges::enable_view> = true; template - inline constexpr bool ranges::enable_borrowed_range> = true; + constexpr bool ranges::enable_borrowed_range> = true; // \ref{string.view.comparison}, non-member comparison functions template @@ -4961,10 +4961,9 @@ object is destroyed. \pnum -If the function extracts no characters, it calls -\tcode{is.setstate(ios_base::failbit)}, -which may throw -\tcode{ios_base::fail\-ure}\iref{iostate.flags}. +If the function extracts no characters, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \pnum \returns @@ -5015,24 +5014,19 @@ until any of the following occurs: \begin{itemize} \item -end-of-file occurs on the input sequence -(in which case, the -\tcode{getline} -function calls -\tcode{is.setstate(\brk{}ios_base::eofbit)}). +end-of-file occurs on the input sequence; \item \tcode{traits::eq(c, delim)} for the next available input character \textit{c} (in which case, \textit{c} -is extracted but not appended)\iref{iostate.flags} +is extracted but not appended); \item \tcode{str.max_size()} characters are stored (in which case, -the function calls -\tcode{is.setstate(ios_base::fail\-bit))}\iref{iostate.flags} +\tcode{ios_base::failbit} is set in the input function's local error state). \end{itemize} \pnum @@ -5043,10 +5037,9 @@ object is destroyed. \pnum -If the function extracts no characters, it calls -\tcode{is.setstate(ios_base::fail\-bit)} -which may throw -\tcode{ios_base::fail\-ure}\iref{iostate.flags}. +If the function extracts no characters, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \pnum \returns diff --git a/source/support.tex b/source/support.tex index 3ea8ec79c5..62d366aca3 100644 --- a/source/support.tex +++ b/source/support.tex @@ -26,8 +26,7 @@ \tcode{}, \tcode{} \\ \rowsep \ref{support.limits} & Implementation properties & \tcode{}, \tcode{}, \tcode{}, \tcode{} \\ \rowsep -\ref{cstdint} & Integer types & \tcode{} \\ \rowsep -\ref{stdfloat.syn} & Header \libheader{stdfloat} synopsis & \tcode{} \\ \rowsep +\ref{support.arith.types} & Arithmetic types & \tcode{}, \tcode{} \\ \rowsep \ref{support.start.term} & Start and termination & \tcode{} \\ \rowsep \ref{support.dynamic} & Dynamic memory management & \tcode{} \\ \rowsep \ref{support.rtti} & Type identification & \tcode{} \\ \rowsep @@ -592,7 +591,7 @@ #define @\defnlibxname{cpp_lib_clamp}@ 201603L // also in \libheader{algorithm} #define @\defnlibxname{cpp_lib_complex_udls}@ 201309L // also in \libheader{complex} #define @\defnlibxname{cpp_lib_concepts}@ 202207L // also in \libheader{concepts}, \libheader{compare} -#define @\defnlibxname{cpp_lib_constexpr_algorithms}@ 201806L // also in \libheader{algorithm} +#define @\defnlibxname{cpp_lib_constexpr_algorithms}@ 201806L // also in \libheader{algorithm}, \libheader{utility} #define @\defnlibxname{cpp_lib_constexpr_bitset}@ 202202L // also in \libheader{bitset} #define @\defnlibxname{cpp_lib_constexpr_charconv}@ 202207L // also in \libheader{charconv} #define @\defnlibxname{cpp_lib_constexpr_cmath}@ 202202L // also in \libheader{cmath}, \libheader{cstdlib} @@ -620,11 +619,13 @@ // \libheader{unordered_set} #define @\defnlibxname{cpp_lib_exchange_function}@ 201304L // also in \libheader{utility} #define @\defnlibxname{cpp_lib_execution}@ 201902L // also in \libheader{execution} -#define @\defnlibxname{cpp_lib_expected}@ 202202L // also in \libheader{expected} +#define @\defnlibxname{cpp_lib_expected}@ 202211L // also in \libheader{expected} #define @\defnlibxname{cpp_lib_filesystem}@ 201703L // also in \libheader{filesystem} #define @\defnlibxname{cpp_lib_find_last}@ 202207L // also in \libheader{algorithm} #define @\defnlibxname{cpp_lib_flat_map}@ 202207L // also in \libheader{flat_map} +#define @\defnlibxname{cpp_lib_flat_set}@ 202207L // also in \libheader{flat_set} #define @\defnlibxname{cpp_lib_format}@ 202207L // also in \libheader{format} +#define @\defnlibxname{cpp_lib_format_ranges}@ 202207L // also in \libheader{format} #define @\defnlibxname{cpp_lib_forward_like}@ 202207L // also in \libheader{utility} #define @\defnlibxname{cpp_lib_gcd_lcm}@ 201606L // also in \libheader{numeric} #define @\defnlibxname{cpp_lib_generator}@ 202207L // also in \libheader{generator} @@ -683,7 +684,7 @@ #define @\defnlibxname{cpp_lib_polymorphic_allocator}@ 201902L // also in \libheader{memory_resource} #define @\defnlibxname{cpp_lib_print}@ 202207L // also in \libheader{print}, \libheader{ostream} #define @\defnlibxname{cpp_lib_quoted_string_io}@ 201304L // also in \libheader{iomanip} -#define @\defnlibxname{cpp_lib_ranges}@ 202207L +#define @\defnlibxname{cpp_lib_ranges}@ 202211L // also in \libheader{algorithm}, \libheader{functional}, \libheader{iterator}, \libheader{memory}, \libheader{ranges} #define @\defnlibxname{cpp_lib_ranges_as_const}@ 202207L // also in \libheader{ranges} #define @\defnlibxname{cpp_lib_ranges_as_rvalue}@ 202207L // also in \libheader{ranges} @@ -1745,8 +1746,9 @@ The header \libheader{climits} defines all macros the same as the C standard library header \libheader{limits.h}. \begin{note} -The types of the constants defined by macros in \libheader{climits} are not -required to match the types to which the macros refer. +Except for \tcode{CHAR_BIT} and \tcode{MB_LEN_MAX}, a macro referring to +an integer type \tcode{T} defines a constant whose type is the promoted +type of \tcode{T}\iref{conv.prom}. \end{note} \xrefc{5.2.4.2.1} @@ -1844,18 +1846,15 @@ \xrefc{5.2.4.2.2} -\rSec1[cstdint]{Integer types} +\rSec1[support.arith.types]{Arithmetic types} -\rSec2[cstdint.general]{General} +\rSec2[cstdint.syn]{Header \tcode{} synopsis} \pnum -The header -\libheaderref{cstdint} +The header \libheader{cstdint} supplies integer types having specified widths, and macros that specify limits of integer types. -\rSec2[cstdint.syn]{Header \tcode{} synopsis} - \indexheader{cstdint}% \indexlibraryglobal{int8_t}% \indexlibraryglobal{int16_t}% @@ -1997,7 +1996,12 @@ respectively. \end{note} -\rSec1[stdfloat.syn]{Header \tcode{} synopsis} +\rSec2[stdfloat.syn]{Header \tcode{} synopsis} + +\pnum +The header \libheader{stdfloat} defines type aliases for +the optional extended floating-point types that are specified in +\ref{basic.extended.fp}. \indexheader{stdfloat}% \begin{codeblock} @@ -2285,12 +2289,12 @@ [[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept; -void operator delete(void* ptr) noexcept; -void operator delete(void* ptr, std::size_t size) noexcept; -void operator delete(void* ptr, std::align_val_t alignment) noexcept; -void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept; -void operator delete(void* ptr, const std::nothrow_t&) noexcept; -void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept; +void operator delete(void* ptr) noexcept; +void operator delete(void* ptr, std::size_t size) noexcept; +void operator delete(void* ptr, std::align_val_t alignment) noexcept; +void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept; +void operator delete(void* ptr, const std::nothrow_t&) noexcept; +void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept; [[nodiscard]] void* operator new[](std::size_t size); [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment); @@ -2298,17 +2302,17 @@ [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept; -void operator delete[](void* ptr) noexcept; -void operator delete[](void* ptr, std::size_t size) noexcept; -void operator delete[](void* ptr, std::align_val_t alignment) noexcept; -void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept; -void operator delete[](void* ptr, const std::nothrow_t&) noexcept; -void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept; +void operator delete[](void* ptr) noexcept; +void operator delete[](void* ptr, std::size_t size) noexcept; +void operator delete[](void* ptr, std::align_val_t alignment) noexcept; +void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept; +void operator delete[](void* ptr, const std::nothrow_t&) noexcept; +void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept; [[nodiscard]] void* operator new (std::size_t size, void* ptr) noexcept; [[nodiscard]] void* operator new[](std::size_t size, void* ptr) noexcept; -void operator delete (void* ptr, void*) noexcept; -void operator delete[](void* ptr, void*) noexcept; +void operator delete (void* ptr, void*) noexcept; +void operator delete[](void* ptr, void*) noexcept; \end{codeblock} \rSec2[new.delete]{Storage allocation and deallocation} @@ -3393,11 +3397,10 @@ The type \tcode{source_location} meets the \oldconcept{DefaultConstructible}, \oldconcept{CopyConstructible}, -\oldconcept{Copy\-Assignable}, and +\oldconcept{Copy\-Assignable}, +\oldconcept{Swappable}, and \oldconcept{Destructible} -requirements\iref{utility.arg.requirements}. -Lvalues of type \tcode{source_location} -are swappable\iref{swappable.requirements}. +requirements\iref{utility.arg.requirements,swappable.requirements}. All of the following conditions are \tcode{true}: \begin{itemize} \item \tcode{is_nothrow_move_constructible_v} @@ -4920,8 +4923,8 @@ \item Otherwise, \tcode{strong_ordering(strong_order(E, F))} if it is a well-formed expression - with overload resolution performed in a context - that does not include a declaration of \tcode{std::strong_order}. + where the meaning of \tcode{strong_order} is established as-if by performing + argument-dependent lookup only\iref{basic.lookup.argdep}. \item Otherwise, if the decayed type \tcode{T} of \tcode{E} is a floating-point type, @@ -4958,8 +4961,8 @@ \item Otherwise, \tcode{weak_ordering(weak_order(E, F))} if it is a well-formed expression - with overload resolution performed in a context - that does not include a declaration of \tcode{std::weak_order}. + where the meaning of \tcode{weak_order} is established as-if by performing + argument-dependent lookup only\iref{basic.lookup.argdep}. \item Otherwise, if the decayed type \tcode{T} of \tcode{E} is a floating-point type, @@ -5010,8 +5013,8 @@ \item Otherwise, \tcode{partial_ordering(partial_order(E, F))} if it is a well-formed expression - with overload resolution performed in a context - that does not include a declaration of \tcode{std::partial_order}. + where the meaning of \tcode{partial_order} is established as-if by performing + argument-dependent lookup only\iref{basic.lookup.argdep}. \item Otherwise, \tcode{partial_ordering(compare_three_way()(E, F))} if it is a well-formed expression. @@ -5043,7 +5046,9 @@ Otherwise, \tcode{strong_order(E, F)} if it is a well-formed expression. \item Otherwise, if the expressions \tcode{E == F} and \tcode{E < F} - are both well-formed and convertible to \tcode{bool}, + are both well-formed and + each of \tcode{decltype(E == F)} and \tcode{decltype(E < F)} models + \exposconcept{boolean-testable}, \begin{codeblock} E == F ? strong_ordering::equal : E < F ? strong_ordering::less : @@ -5075,7 +5080,9 @@ Otherwise, \tcode{weak_order(E, F)} if it is a well-formed expression. \item Otherwise, if the expressions \tcode{E == F} and \tcode{E < F} - are both well-formed and convertible to \tcode{bool}, + are both well-formed and + each of \tcode{decltype(E == F)} and \tcode{decltype(E < F)} models + \exposconcept{boolean-testable}, \begin{codeblock} E == F ? weak_ordering::equivalent : E < F ? weak_ordering::less : @@ -5108,7 +5115,9 @@ \item Otherwise, if the expressions \tcode{E == F}, \tcode{E < F}, and \tcode{F < E} - are all well-formed and convertible to \tcode{bool}, + are all well-formed and + each of \tcode{decltype(E == F)} and \tcode{decltype(E < F)} models + \exposconcept{boolean-testable}, \begin{codeblock} E == F ? partial_ordering::equivalent : E < F ? partial_ordering::less : @@ -5781,6 +5790,11 @@ \pnum The contents of the header \libheaderdef{cstdarg} are the same as the C standard library header \libheader{stdarg.h}, with the following changes: +\begin{itemize} +\item +In lieu of the default argument promotions specified in ISO C 6.5.2.2, +the definition in~\ref{expr.call} applies. +\item The restrictions that ISO C places on the second parameter to the \indexlibraryglobal{va_start}% \tcode{va_start} macro in header \libheader{stdarg.h} @@ -5806,6 +5820,7 @@ is of a reference type, or of a type that is not compatible with the type that results when passing an argument for which there is no parameter, the behavior is undefined. +\end{itemize} \xrefc{7.16.1.1} @@ -6148,6 +6163,7 @@ header is placed within the global namespace scope, except for the functions described in \ref{sf.cmath}, +the \tcode{std::lerp} function overloads\iref{c.math.lerp}, the declaration of \tcode{std::byte}\iref{cstddef.syn}, and the functions and function templates described in \ref{support.types.byteops}. It is unspecified whether these names are first declared or defined within diff --git a/source/templates.tex b/source/templates.tex index 873ad16891..c726e771ff 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -2839,30 +2839,40 @@ The instantiation of a \grammarterm{fold-expression}\iref{expr.prim.fold} produces: \begin{itemize} \item +% Note: "\space" used below because " " inside tcode adds too much whitespace; +% one could optionally use mathfont inside tcode, e.g. "\tcode{($ $}". +\tcode{(}\space \tcode{((}$\mathtt{E}_1$ \placeholder{op} $\mathtt{E}_2$\tcode{)} \placeholder{op} $\cdots$\tcode{)} \placeholder{op} $\mathtt{E}_N$ +\space\tcode{)} for a unary left fold, \item +\tcode{(}\space $\mathtt{E}_1$ \placeholder{op} \tcode{(}$\cdots$ \placeholder{op} \tcode{(}$\mathtt{E}_{N-1}$ \placeholder{op} $\mathtt{E}_N$\tcode{))} +\space\tcode{)} for a unary right fold, \item +\tcode{(}\space \tcode{(((}$\mathtt{E}$ \placeholder{op} $\mathtt{E}_1$\tcode{)} \placeholder{op} $\mathtt{E}_2$\tcode{)} \placeholder{op} $\cdots$\tcode{)} \placeholder{op} $\mathtt{E}_N$ +\space\tcode{)} for a binary left fold, and \item +\tcode{(}\space $\mathtt{E}_1$ \placeholder{op} \tcode{(}$\cdots$ \placeholder{op} \tcode{(}$\mathtt{E}_{N-1}$ \placeholder{op} \tcode{(}$\mathtt{E}_{N}$ \placeholder{op} $\mathtt{E}$\tcode{)))} +\space\tcode{)} for a binary right fold. \end{itemize} @@ -3743,6 +3753,16 @@ whether two constructs are equivalent, and they are functionally equivalent but not equivalent, the program is ill-formed, no diagnostic required. +% FIXME: What does it mean for two function templates to correspond? +Furthermore, if two function templates that do not correspond +\begin{itemize} +\item have the same name, +\item have corresponding signatures\iref{basic.scope.scope}, +\item would declare the same entity\iref{basic.link} considering them to correspond, and +% FIXME: What does it mean for a set of template argument lists to satisfy a function template? +\item accept and are satisfied by the same set of template argument lists, +\end{itemize} +the program is ill-formed, no diagnostic required. \pnum \begin{note} @@ -4125,7 +4145,7 @@ \begin{bnf} \nontermdef{concept-definition}\br - \keyword{concept} concept-name \terminal{=} constraint-expression \terminal{;} + \keyword{concept} concept-name \opt{attribute-specifier-seq} \terminal{=} constraint-expression \terminal{;} \end{bnf} \begin{bnf} @@ -4139,6 +4159,7 @@ Its \grammarterm{identifier} becomes a \grammarterm{concept-name} referring to that concept within its scope. +The optional \grammarterm{attribute-specifier-seq} appertains to the concept. \begin{example} \begin{codeblock} template @@ -4213,7 +4234,7 @@ struct D : B { T get() { return operator T(); } // \grammarterm{conversion-function-id} is dependent }; -int f(D d) { return d.get(); } // OK, lookup finds A::operator int +int f(D d) { return d.get(); } // OK, lookup finds \tcode{A::operator int} \end{codeblock} \end{example} \begin{example} @@ -4534,7 +4555,7 @@ enclosed in \tcode{<>}. \pnum -When the inject-class-name of a class template specialization or +When the injected-class-name of a class template specialization or partial specialization is used as a \grammarterm{type-name}, it is equivalent to the \grammarterm{template-name} followed by the \grammarterm{template-argument}{s} @@ -4616,7 +4637,8 @@ \pnum The name of a \grammarterm{template-parameter} -shall not be bound to any following declaration contained by the scope +shall not be bound to any following declaration +whose locus is contained by the scope to which the template-parameter belongs. \begin{example} \begin{codeblock} @@ -5956,13 +5978,17 @@ It is unspecified whether or not an implementation implicitly instantiates a virtual member function of a class template if the virtual member function would not otherwise be instantiated. -The use of a template specialization in a default argument -shall not cause the template to be implicitly instantiated except that a -class template may be instantiated where its complete type is needed to determine -the correctness of the default argument. +The use of a template specialization in +a default argument or default member initializer +shall not cause the template to be implicitly instantiated except +where needed to determine +the correctness of the default argument or default member initializer. The use of a default argument in a function call causes specializations in the default argument to be implicitly instantiated. +Similarly, the use of a default member initializer +in a constructor definition or an aggregate initialization +causes specializations in the default member initializer to be instantiated. \pnum If a function template @@ -6353,6 +6379,8 @@ \end{example} \pnum +The \grammarterm{declaration} in an \grammarterm{explicit-specialization} +shall not be an \grammarterm{export-declaration}. An explicit specialization shall not use a \grammarterm{storage-class-specifier}\iref{dcl.stc} other than \keyword{thread_local}. @@ -6579,6 +6607,9 @@ is inline, constexpr, or an immediate function is determined by the explicit specialization and is independent of those properties of the template. +Similarly, +attributes appearing in the declaration of a template +have no effect on an explicit specialization of that template. \begin{example} \begin{codeblock} template void f(T) { @\commentellip@ } @@ -6586,6 +6617,12 @@ template<> inline void f<>(int) { @\commentellip@ } // OK, inline template<> int g<>(int) { @\commentellip@ } // OK, not inline + +template [[noreturn]] void h([[maybe_unused]] int i); +template<> void h(int i) { + // Implementations are expected not to warn that the function returns + // but can warn about the unused parameter. +} \end{codeblock} \end{example} @@ -7099,8 +7136,16 @@ obtained from default arguments are substituted. \pnum -The substitution occurs in all types and expressions that are used in the function -type and in template parameter declarations. The expressions include not only +\indextext{deduction!deduction substitution loci}% +The \defn{deduction substitution loci} are +\begin{itemize} +\item the function type outside of the \grammarterm{noexcept-specifier}, +\item the \grammarterm{explicit-specifier}, and +\item the template parameter declarations. +\end{itemize} +The substitution occurs in all types and expressions that are used +in the deduction substitution loci. +The expressions include not only constant expressions such as those that appear in array bounds or as nontype template arguments but also general expressions (i.e., non-constant expressions) inside \tcode{sizeof}, \keyword{decltype}, and other contexts that allow non-constant @@ -7144,11 +7189,8 @@ as part of the substitution process. \end{note} -Only invalid types and expressions in the immediate context of -the function type, -its template parameter types, -and its \grammarterm{explicit-specifier} -can result in a deduction failure. +Invalid types and expressions can result in a deduction failure +only in the immediate context of the deduction substitution loci. \begin{note} The substitution into types and expressions can result in effects such as the instantiation of class template specializations and/or @@ -7289,9 +7331,11 @@ \begin{example} \begin{codeblock} template struct S {}; -template int f(S*); -struct X {}; -int i0 = f(0); +template int f(S*); // \#1 +class X { + int m; +}; +int i0 = f(0); // \#1 uses a value of non-structural type \tcode{X} as a non-type template argument \end{codeblock} \end{example} @@ -7302,7 +7346,7 @@ \begin{example} \begin{codeblock} template int f(int); -int i2 = f(0); // can't conv \tcode{1} to \tcode{int*} +int i2 = f(0); // can't convert \tcode{1} to \tcode{int*} \end{codeblock} \end{example} @@ -7679,7 +7723,7 @@ (call it \tcode{A}) as described in~\ref{temp.deduct.type}. If the \grammarterm{conversion-function-id} is constructed during overload resolution\iref{over.match.funcs}, -the following transformations apply. +the rules in the remainder of this subclause apply. \pnum If \tcode{P} is a reference type, the type referred to by \tcode{P} is used in place @@ -7744,14 +7788,13 @@ (i.e., the type referred to by the reference). \item If the original \tcode{A} is -a function pointer or pointer-to-member-function type, -its \keyword{noexcept}. +a function pointer or pointer-to-member-function type +with a potentially-throwing exception specification\iref{except.spec}, +the exception specification. \item Any cv-qualifiers in \tcode{A} that can be restored by a qualification conversion. \end{itemize} - -\pnum These attributes are ignored only if type deduction would otherwise fail. If ignoring them allows more than one possible deduced diff --git a/source/threads.tex b/source/threads.tex index a383dd8181..accde75f3e 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -30,8 +30,14 @@ \pnum Throughout this Clause, the names of template parameters are used to express type requirements. -If a template parameter is named \tcode{Predicate}, \tcode{operator()} applied to -the template argument shall return a value that is convertible to \tcode{bool}. +\tcode{Predicate} is a function object type\iref{function.objects}. +Let \tcode{pred} denote an lvalue of type \tcode{Predicate}. +Then the expression \tcode{pred()} shall be well-formed and +the type \tcode{decltype(pred())} shall model +\exposconcept{boolean-testable}\iref{concept.booleantestable}. +The return value of \tcode{pred()}, converted to \tcode{bool}, +yields \tcode{true} if the corresponding test condition is satisfied, and +\tcode{false} otherwise. If a template parameter is named \tcode{Clock}, the corresponding template argument shall be a type \tcode{C} that meets the \oldconcept{Clock} requirements\iref{time.clock.req}; @@ -498,9 +504,9 @@ }; inline constexpr nostopstate_t nostopstate{}; - // \ref{stopcallback}, class \tcode{stop_callback} + // \ref{stopcallback}, class template \tcode{stop_callback} template - class stop_callback; + class stop_callback; } \end{codeblock} @@ -1338,7 +1344,8 @@ \effects The new thread of execution executes \begin{codeblock} -invoke(auto(std::forward(f)), auto(std::forward(args))...) +invoke(auto(std::forward(f)), // for \tcode{invoke}, see \ref{func.invoke} + auto(std::forward(args))...) \end{codeblock} with the values produced by \tcode{auto} being materialized\iref{conv.rval} in the constructing thread. @@ -1669,7 +1676,7 @@ Initializes \tcode{ssource}. The new thread of execution executes \begin{codeblock} -invoke(auto(std::forward(f)), get_stop_token(), +invoke(auto(std::forward(f)), get_stop_token(), // for \tcode{invoke}, see \ref{func.invoke} auto(std::forward(args))...) \end{codeblock} if that expression is well-formed, @@ -1755,19 +1762,18 @@ \begin{itemdescr} \pnum \effects -If \tcode{joinable()} is \tcode{true}, -calls \tcode{request_stop()} and then \tcode{join()}. -Assigns the state of \tcode{x} to \tcode{*this} +If \tcode{\&x == this} is \tcode{true}, there are no effects. +Otherwise, if \tcode{joinable()} is \tcode{true}, +calls \tcode{request_stop()} and then \tcode{join()}, +then assigns the state of \tcode{x} to \tcode{*this} and sets \tcode{x} to a default constructed state. \pnum \ensures -\tcode{x.get_id() == id()} -and \tcode{get_id()} returns the value of \tcode{x.get_id()} +\tcode{get_id()} returns the value of \tcode{x.get_id()} prior to the assignment. \tcode{ssource} has the value of \tcode{x.ssource} -prior to the assignment -and \tcode{x.ssource.stop_possible()} is \tcode{false}. +prior to the assignment. \pnum \returns @@ -1969,10 +1975,11 @@ \begin{itemdescr} \pnum \returns -An object of type \tcode{thread::id} that uniquely identifies the current thread of -execution. No other thread of execution has this id and this thread of execution -always has this id. The object returned does not compare equal to a default constructed -\tcode{thread::id}. +An object of type \tcode{thread::id} +that uniquely identifies the current thread of execution. +Every invocation from this thread of execution returns the same value. +The object returned does not compare equal to +a default-constructed \tcode{thread::id}. \end{itemdescr} \indexlibrarymember{yield}{this_thread}% @@ -2048,13 +2055,13 @@ \begin{codeblock} namespace std { // \ref{atomics.order}, order and consistency - enum class memory_order : @\unspec@; // freestanding - inline constexpr memory_order memory_order_relaxed = memory_order::relaxed; - inline constexpr memory_order memory_order_consume = memory_order::consume; - inline constexpr memory_order memory_order_acquire = memory_order::acquire; - inline constexpr memory_order memory_order_release = memory_order::release; - inline constexpr memory_order memory_order_acq_rel = memory_order::acq_rel; - inline constexpr memory_order memory_order_seq_cst = memory_order::seq_cst; + enum class memory_order : @\unspecnc@; // freestanding + inline constexpr memory_order memory_order_relaxed = memory_order::relaxed; // freestanding + inline constexpr memory_order memory_order_consume = memory_order::consume; // freestanding + inline constexpr memory_order memory_order_acquire = memory_order::acquire; // freestanding + inline constexpr memory_order memory_order_release = memory_order::release; // freestanding + inline constexpr memory_order memory_order_acq_rel = memory_order::acq_rel; // freestanding + inline constexpr memory_order memory_order_seq_cst = memory_order::seq_cst; // freestanding template T kill_dependency(T y) noexcept; // freestanding @@ -2220,24 +2227,25 @@ memory_order) noexcept; template - void atomic_wait(const volatile atomic*, typename atomic::value_type); // freestanding + void atomic_wait(const volatile atomic*, // freestanding + typename atomic::value_type) noexcept; template - void atomic_wait(const atomic*, typename atomic::value_type); // freestanding + void atomic_wait(const atomic*, typename atomic::value_type) noexcept; // freestanding template void atomic_wait_explicit(const volatile atomic*, // freestanding typename atomic::value_type, - memory_order); + memory_order) noexcept; template void atomic_wait_explicit(const atomic*, typename atomic::value_type, // freestanding - memory_order); + memory_order) noexcept; template - void atomic_notify_one(volatile atomic*); // freestanding + void atomic_notify_one(volatile atomic*) noexcept; // freestanding template - void atomic_notify_one(atomic*); // freestanding + void atomic_notify_one(atomic*) noexcept; // freestanding template - void atomic_notify_all(volatile atomic*); // freestanding + void atomic_notify_all(volatile atomic*) noexcept; // freestanding template - void atomic_notify_all(atomic*); // freestanding + void atomic_notify_all(atomic*) noexcept; // freestanding // \ref{atomics.alias}, type aliases using atomic_bool = atomic; // freestanding @@ -2750,6 +2758,7 @@ template struct atomic_ref { private: T* ptr; // \expos + public: using value_type = T; static constexpr size_t required_alignment = @\impdefx{required alignment for \tcode{atomic_ref} type's operations}@; @@ -2817,8 +2826,8 @@ \indexlibrarymember{required_alignment}{atomic_ref}% \indexlibrarymember{required_alignment}{atomic_ref}% -\indexlibrarymember{required_alignment}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{required_alignment}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{required_alignment}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{required_alignment}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} static constexpr size_t required_alignment; \end{itemdecl} @@ -2843,8 +2852,8 @@ \indexlibrarymember{is_always_lock_free}{atomic_ref}% \indexlibrarymember{is_always_lock_free}{atomic_ref}% -\indexlibrarymember{is_always_lock_free}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{is_always_lock_free}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{is_always_lock_free}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{is_always_lock_free}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} static constexpr bool is_always_lock_free; \end{itemdecl} @@ -2858,8 +2867,8 @@ \indexlibrarymember{is_lock_free}{atomic_ref}% \indexlibrarymember{is_lock_free}{atomic_ref}% -\indexlibrarymember{is_lock_free}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{is_lock_free}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{is_lock_free}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{is_lock_free}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} bool is_lock_free() const noexcept; \end{itemdecl} @@ -2874,8 +2883,8 @@ \indexlibraryctor{atomic_ref}% \indexlibraryctor{atomic_ref}% -\indexlibrary{\idxcode{atomic_ref<\placeholder{integral}>}!constructor}% -\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point}>}!constructor}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{integral-type}>}!constructor}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point-type}>}!constructor}% \begin{itemdecl} atomic_ref(T& obj); \end{itemdecl} @@ -2896,8 +2905,8 @@ \indexlibraryctor{atomic_ref}% \indexlibraryctor{atomic_ref}% -\indexlibrary{\idxcode{atomic_ref<\placeholder{integral}>}!constructor}% -\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point}>}!constructor}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{integral-type}>}!constructor}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point-type}>}!constructor}% \begin{itemdecl} atomic_ref(const atomic_ref& ref) noexcept; \end{itemdecl} @@ -2910,8 +2919,8 @@ \indexlibrarymember{store}{atomic_ref}% \indexlibrarymember{store}{atomic_ref}% -\indexlibrarymember{store}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{store}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{store}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{store}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} void store(T desired, memory_order order = memory_order::seq_cst) const noexcept; \end{itemdecl} @@ -2933,8 +2942,8 @@ \indexlibrarymember{operator=}{atomic_ref}% \indexlibrarymember{operator=}{atomic_ref}% -\indexlibrarymember{operator=}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{operator=}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{operator=}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{operator=}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} T operator=(T desired) const noexcept; \end{itemdecl} @@ -2951,8 +2960,8 @@ \indexlibrarymember{load}{atomic_ref}% \indexlibrarymember{load}{atomic_ref}% -\indexlibrarymember{load}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{load}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{load}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{load}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} T load(memory_order order = memory_order::seq_cst) const noexcept; \end{itemdecl} @@ -2974,8 +2983,8 @@ \indexlibrarymember{operator \placeholder{type}}{atomic_ref}% \indexlibrarymember{operator T*}{atomic_ref}% -\indexlibrarymember{operator \placeholder{integral}}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{operator \placeholder{floating-point}}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{operator \placeholder{integral-type}}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{operator \placeholder{floating-point-type}}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} operator T() const noexcept; \end{itemdecl} @@ -2988,8 +2997,8 @@ \indexlibrarymember{exchange}{atomic_ref}% \indexlibrarymember{exchange}{atomic_ref}% -\indexlibrarymember{exchange}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{exchange}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{exchange}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{exchange}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} T exchange(T desired, memory_order order = memory_order::seq_cst) const noexcept; \end{itemdecl} @@ -3010,12 +3019,12 @@ \indexlibrarymember{compare_exchange_weak}{atomic_ref}% \indexlibrarymember{compare_exchange_weak}{atomic_ref}% -\indexlibrarymember{compare_exchange_weak}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{compare_exchange_weak}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{compare_exchange_weak}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{compare_exchange_weak}{atomic_ref<\placeholder{floating-point-type}>}% \indexlibrarymember{compare_exchange_strong}{atomic_ref}% \indexlibrarymember{compare_exchange_strong}{atomic_ref}% -\indexlibrarymember{compare_exchange_strong}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{compare_exchange_strong}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{compare_exchange_strong}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{compare_exchange_strong}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} bool compare_exchange_weak(T& expected, T desired, memory_order success, memory_order failure) const noexcept; @@ -3158,7 +3167,7 @@ \rSec3[atomics.ref.int]{Specializations for integral types} \pnum -\indexlibrary{\idxcode{atomic_ref<\placeholder{integral}>}}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{integral-type}>}}% There are specializations of the \tcode{atomic_ref} class template for the integral types \tcode{char}, @@ -3177,8 +3186,8 @@ \keyword{char32_t}, \keyword{wchar_t}, and any other types needed by the typedefs in the header \libheaderref{cstdint}. -For each such type \tcode{\placeholder{integral}}, -the specialization \tcode{atomic_ref<\placeholder{integral}>} provides +For each such type \tcode{\placeholder{integral-type}}, +the specialization \tcode{atomic_ref<\placeholder{integral-type}>} provides additional atomic operations appropriate to integral types. \begin{note} The specialization \tcode{atomic_ref} @@ -3187,59 +3196,60 @@ \begin{codeblock} namespace std { - template<> struct atomic_ref<@\placeholder{integral}@> { + template<> struct atomic_ref<@\placeholder{integral-type}@> { private: - @\placeholder{integral}@* ptr; // \expos + @\placeholder{integral-type}@* ptr; // \expos + public: - using value_type = @\placeholder{integral}@; + using value_type = @\placeholder{integral-type}@; using difference_type = value_type; static constexpr size_t required_alignment = @\impdefx{required alignment for \tcode{atomic_ref} type's operations}@; static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic_ref} type's operations are always lock free}@; bool is_lock_free() const noexcept; - explicit atomic_ref(@\placeholder{integral}@&); + explicit atomic_ref(@\placeholder{integral-type}@&); atomic_ref(const atomic_ref&) noexcept; atomic_ref& operator=(const atomic_ref&) = delete; - void store(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) const noexcept; - @\placeholdernc{integral}@ operator=(@\placeholder{integral}@) const noexcept; - @\placeholdernc{integral}@ load(memory_order = memory_order::seq_cst) const noexcept; - operator @\placeholdernc{integral}@() const noexcept; + void store(@\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) const noexcept; + @\placeholdernc{integral-type}@ operator=(@\placeholder{integral-type}@) const noexcept; + @\placeholdernc{integral-type}@ load(memory_order = memory_order::seq_cst) const noexcept; + operator @\placeholdernc{integral-type}@() const noexcept; - @\placeholdernc{integral}@ exchange(@\placeholdernc{integral}@, - memory_order = memory_order::seq_cst) const noexcept; - bool compare_exchange_weak(@\placeholder{integral}@&, @\placeholder{integral}@, + @\placeholdernc{integral-type}@ exchange(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) const noexcept; + bool compare_exchange_weak(@\placeholder{integral-type}@&, @\placeholder{integral-type}@, memory_order, memory_order) const noexcept; - bool compare_exchange_strong(@\placeholder{integral}@&, @\placeholder{integral}@, + bool compare_exchange_strong(@\placeholder{integral-type}@&, @\placeholder{integral-type}@, memory_order, memory_order) const noexcept; - bool compare_exchange_weak(@\placeholder{integral}@&, @\placeholder{integral}@, + bool compare_exchange_weak(@\placeholder{integral-type}@&, @\placeholder{integral-type}@, memory_order = memory_order::seq_cst) const noexcept; - bool compare_exchange_strong(@\placeholder{integral}@&, @\placeholder{integral}@, + bool compare_exchange_strong(@\placeholder{integral-type}@&, @\placeholder{integral-type}@, memory_order = memory_order::seq_cst) const noexcept; - @\placeholdernc{integral}@ fetch_add(@\placeholdernc{integral}@, - memory_order = memory_order::seq_cst) const noexcept; - @\placeholdernc{integral}@ fetch_sub(@\placeholdernc{integral}@, - memory_order = memory_order::seq_cst) const noexcept; - @\placeholdernc{integral}@ fetch_and(@\placeholdernc{integral}@, - memory_order = memory_order::seq_cst) const noexcept; - @\placeholdernc{integral}@ fetch_or(@\placeholdernc{integral}@, - memory_order = memory_order::seq_cst) const noexcept; - @\placeholdernc{integral}@ fetch_xor(@\placeholdernc{integral}@, - memory_order = memory_order::seq_cst) const noexcept; - - @\placeholdernc{integral}@ operator++(int) const noexcept; - @\placeholdernc{integral}@ operator--(int) const noexcept; - @\placeholdernc{integral}@ operator++() const noexcept; - @\placeholdernc{integral}@ operator--() const noexcept; - @\placeholdernc{integral}@ operator+=(@\placeholdernc{integral}@) const noexcept; - @\placeholdernc{integral}@ operator-=(@\placeholdernc{integral}@) const noexcept; - @\placeholdernc{integral}@ operator&=(@\placeholdernc{integral}@) const noexcept; - @\placeholdernc{integral}@ operator|=(@\placeholdernc{integral}@) const noexcept; - @\placeholdernc{integral}@ operator^=(@\placeholdernc{integral}@) const noexcept; - - void wait(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) const noexcept; + @\placeholdernc{integral-type}@ fetch_add(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) const noexcept; + @\placeholdernc{integral-type}@ fetch_sub(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) const noexcept; + @\placeholdernc{integral-type}@ fetch_and(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) const noexcept; + @\placeholdernc{integral-type}@ fetch_or(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) const noexcept; + @\placeholdernc{integral-type}@ fetch_xor(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) const noexcept; + + @\placeholdernc{integral-type}@ operator++(int) const noexcept; + @\placeholdernc{integral-type}@ operator--(int) const noexcept; + @\placeholdernc{integral-type}@ operator++() const noexcept; + @\placeholdernc{integral-type}@ operator--() const noexcept; + @\placeholdernc{integral-type}@ operator+=(@\placeholdernc{integral-type}@) const noexcept; + @\placeholdernc{integral-type}@ operator-=(@\placeholdernc{integral-type}@) const noexcept; + @\placeholdernc{integral-type}@ operator&=(@\placeholdernc{integral-type}@) const noexcept; + @\placeholdernc{integral-type}@ operator|=(@\placeholdernc{integral-type}@) const noexcept; + @\placeholdernc{integral-type}@ operator^=(@\placeholdernc{integral-type}@) const noexcept; + + void wait(@\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) const noexcept; void notify_one() const noexcept; void notify_all() const noexcept; }; @@ -3255,13 +3265,14 @@ The correspondence among key, operator, and computation is specified in \tref{atomic.types.int.comp}. -\indexlibrarymember{fetch_add}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{fetch_and}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{fetch_or}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{fetch_sub}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{fetch_xor}{atomic_ref<\placeholder{integral}>}% +\indexlibrarymember{fetch_add}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{fetch_and}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{fetch_or}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{fetch_sub}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{fetch_xor}{atomic_ref<\placeholder{integral-type}>}% \begin{itemdecl} -@\placeholdernc{integral}@ fetch_@\placeholdernc{key}@(@\placeholdernc{integral}@ operand, memory_order order = memory_order::seq_cst) const noexcept; +@\placeholdernc{integral-type}@ fetch_@\placeholdernc{key}@(@\placeholdernc{integral-type}@ operand, + memory_order order = memory_order::seq_cst) const noexcept; \end{itemdecl} \begin{itemdescr} @@ -3291,13 +3302,13 @@ \end{note} \end{itemdescr} -\indexlibrarymember{operator+=}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{operator-=}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{operator\&=}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{operator"|=}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{operator\caret=}{atomic_ref<\placeholder{integral}>}% +\indexlibrarymember{operator+=}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{operator-=}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{operator\&=}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{operator"|=}{atomic_ref<\placeholder{integral-type}>}% +\indexlibrarymember{operator\caret=}{atomic_ref<\placeholder{integral-type}>}% \begin{itemdecl} -@\placeholdernc{integral}@ operator @\placeholder{op}@=(@\placeholdernc{integral}@ operand) const noexcept; +@\placeholdernc{integral-type}@ operator @\placeholder{op}@=(@\placeholdernc{integral-type}@ operand) const noexcept; \end{itemdecl} \begin{itemdescr} @@ -3310,55 +3321,56 @@ \rSec3[atomics.ref.float]{Specializations for floating-point types} \pnum -\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point}>}}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point-type}>}}% There are specializations of the \tcode{atomic_ref} class template for all cv-unqualified floating-point types. -For each such type \tcode{\placeholder{floating-point}}, +For each such type \tcode{\placeholder{floating-point-type}}, the specialization \tcode{atomic_ref<\placeholder{floating-\-point}>} provides additional atomic operations appropriate to floating-point types. \begin{codeblock} namespace std { - template<> struct atomic_ref<@\placeholder{floating-point}@> { + template<> struct atomic_ref<@\placeholder{floating-point-type}@> { private: - @\placeholder{floating-point}@* ptr; // \expos + @\placeholder{floating-point-type}@* ptr; // \expos + public: - using value_type = @\placeholder{floating-point}@; + using value_type = @\placeholder{floating-point-type}@; using difference_type = value_type; static constexpr size_t required_alignment = @\impdefx{required alignment for \tcode{atomic_ref} type's operations}@; static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic_ref} type's operations are always lock free}@; bool is_lock_free() const noexcept; - explicit atomic_ref(@\placeholder{floating-point}@&); + explicit atomic_ref(@\placeholder{floating-point-type}@&); atomic_ref(const atomic_ref&) noexcept; atomic_ref& operator=(const atomic_ref&) = delete; - void store(@\placeholdernc{floating-point}@, memory_order = memory_order::seq_cst) const noexcept; - @\placeholder{floating-point}@ operator=(@\placeholder{floating-point}@) const noexcept; - @\placeholder{floating-point}@ load(memory_order = memory_order::seq_cst) const noexcept; - operator @\placeholdernc{floating-point}@() const noexcept; + void store(@\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) const noexcept; + @\placeholder{floating-point-type}@ operator=(@\placeholder{floating-point-type}@) const noexcept; + @\placeholder{floating-point-type}@ load(memory_order = memory_order::seq_cst) const noexcept; + operator @\placeholdernc{floating-point-type}@() const noexcept; - @\placeholder{floating-point}@ exchange(@\placeholdernc{floating-point}@, - memory_order = memory_order::seq_cst) const noexcept; - bool compare_exchange_weak(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + @\placeholder{floating-point-type}@ exchange(@\placeholdernc{floating-point-type}@, + memory_order = memory_order::seq_cst) const noexcept; + bool compare_exchange_weak(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order, memory_order) const noexcept; - bool compare_exchange_strong(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_strong(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order, memory_order) const noexcept; - bool compare_exchange_weak(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_weak(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) const noexcept; - bool compare_exchange_strong(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_strong(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) const noexcept; - @\placeholder{floating-point}@ fetch_add(@\placeholdernc{floating-point}@, - memory_order = memory_order::seq_cst) const noexcept; - @\placeholder{floating-point}@ fetch_sub(@\placeholdernc{floating-point}@, - memory_order = memory_order::seq_cst) const noexcept; + @\placeholder{floating-point-type}@ fetch_add(@\placeholdernc{floating-point-type}@, + memory_order = memory_order::seq_cst) const noexcept; + @\placeholder{floating-point-type}@ fetch_sub(@\placeholdernc{floating-point-type}@, + memory_order = memory_order::seq_cst) const noexcept; - @\placeholder{floating-point}@ operator+=(@\placeholder{floating-point}@) const noexcept; - @\placeholder{floating-point}@ operator-=(@\placeholder{floating-point}@) const noexcept; + @\placeholder{floating-point-type}@ operator+=(@\placeholder{floating-point-type}@) const noexcept; + @\placeholder{floating-point-type}@ operator-=(@\placeholder{floating-point-type}@) const noexcept; - void wait(@\placeholdernc{floating-point}@, memory_order = memory_order::seq_cst) const noexcept; + void wait(@\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) const noexcept; void notify_one() const noexcept; void notify_all() const noexcept; }; @@ -3374,10 +3386,10 @@ The correspondence among key, operator, and computation is specified in \tref{atomic.types.int.comp}. -\indexlibrarymember{fetch_add}{atomic_ref<\placeholder{floating-point}>}% -\indexlibrarymember{fetch_sub}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{fetch_add}{atomic_ref<\placeholder{floating-point-type}>}% +\indexlibrarymember{fetch_sub}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} -@\placeholder{floating-point}@ fetch_@\placeholdernc{key}@(@\placeholder{floating-point}@ operand, +@\placeholder{floating-point-type}@ fetch_@\placeholdernc{key}@(@\placeholder{floating-point-type}@ operand, memory_order order = memory_order::seq_cst) const noexcept; \end{itemdecl} @@ -3400,18 +3412,18 @@ If the result is not a representable value for its type\iref{expr.pre}, the result is unspecified, but the operations otherwise have no undefined behavior. -Atomic arithmetic operations on \tcode{\placeholder{floating-point}} should conform to -the \tcode{std::numeric_limits<\placeholder{floating-point}>} traits +Atomic arithmetic operations on \tcode{\placeholder{floating-point-type}} should conform to +the \tcode{std::numeric_limits<\placeholder{floating-point-type}>} traits associated with the floating-point type\iref{limits.syn}. The floating-point environment\iref{cfenv} -for atomic arithmetic operations on \tcode{\placeholder{floating-point}} +for atomic arithmetic operations on \tcode{\placeholder{floating-point-type}} may be different than the calling thread's floating-point environment. \end{itemdescr} -\indexlibrarymember{operator+=}{atomic_ref<\placeholder{floating-point}>}% -\indexlibrarymember{operator-=}{atomic_ref<\placeholder{floating-point}>}% +\indexlibrarymember{operator+=}{atomic_ref<\placeholder{floating-point-type}>}% +\indexlibrarymember{operator-=}{atomic_ref<\placeholder{floating-point-type}>}% \begin{itemdecl} -@\placeholder{floating-point}@ operator @\placeholder{op}@=(@\placeholder{floating-point}@ operand) const noexcept; +@\placeholder{floating-point-type}@ operator @\placeholder{op}@=(@\placeholder{floating-point-type}@ operand) const noexcept; \end{itemdecl} \begin{itemdescr} @@ -3429,6 +3441,7 @@ template struct atomic_ref { private: T** ptr; // \expos + public: using value_type = T*; using difference_type = ptrdiff_t; @@ -3529,7 +3542,7 @@ common to integers and pointers to objects} \indexlibrarymember{operator++}{atomic_ref}% -\indexlibrarymember{operator++}{atomic_ref<\placeholder{integral}>}% +\indexlibrarymember{operator++}{atomic_ref<\placeholder{integral-type}>}% \begin{itemdecl} value_type operator++(int) const noexcept; \end{itemdecl} @@ -3541,7 +3554,7 @@ \end{itemdescr} \indexlibrarymember{operator--}{atomic_ref}% -\indexlibrarymember{operator--}{atomic_ref<\placeholder{integral}>}% +\indexlibrarymember{operator--}{atomic_ref<\placeholder{integral-type}>}% \begin{itemdecl} value_type operator--(int) const noexcept; \end{itemdecl} @@ -3553,7 +3566,7 @@ \end{itemdescr} \indexlibrarymember{operator++}{atomic_ref}% -\indexlibrarymember{operator++}{atomic_ref<\placeholder{integral}>}% +\indexlibrarymember{operator++}{atomic_ref<\placeholder{integral-type}>}% \begin{itemdecl} value_type operator++() const noexcept; \end{itemdecl} @@ -3565,7 +3578,7 @@ \end{itemdescr} \indexlibrarymember{operator--}{atomic_ref}% -\indexlibrarymember{operator--}{atomic_ref<\placeholder{integral}>}% +\indexlibrarymember{operator--}{atomic_ref<\placeholder{integral-type}>}% \begin{itemdecl} value_type operator--() const noexcept; \end{itemdecl} @@ -3660,8 +3673,8 @@ \indexlibraryctor{atomic}% \indexlibraryctor{atomic}% -\indexlibrary{\idxcode{atomic<\placeholder{integral}>}!constructor}% -\indexlibrary{\idxcode{atomic<\placeholder{floating-point}>}!constructor}% +\indexlibrary{\idxcode{atomic<\placeholder{integral-type}>}!constructor}% +\indexlibrary{\idxcode{atomic<\placeholder{floating-point-type}>}!constructor}% \begin{itemdecl} constexpr atomic() noexcept(is_nothrow_default_constructible_v); \end{itemdecl} @@ -3679,8 +3692,8 @@ \indexlibraryctor{atomic}% \indexlibraryctor{atomic}% -\indexlibrary{\idxcode{atomic<\placeholder{integral}>}!constructor}% -\indexlibrary{\idxcode{atomic<\placeholder{floating-point}>}!constructor}% +\indexlibrary{\idxcode{atomic<\placeholder{integral-type}>}!constructor}% +\indexlibrary{\idxcode{atomic<\placeholder{floating-point-type}>}!constructor}% \begin{itemdecl} constexpr atomic(T desired) noexcept; \end{itemdecl} @@ -3702,8 +3715,8 @@ \indexlibrarymember{is_always_lock_free}{atomic}% \indexlibrarymember{is_always_lock_free}{atomic}% -\indexlibrarymember{is_always_lock_free}{atomic<\placeholder{integral}>}% -\indexlibrarymember{is_always_lock_free}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{is_always_lock_free}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{is_always_lock_free}{atomic<\placeholder{floating-point-type}>}% \indexlibrarymember{is_always_lock_free}{atomic>}% \indexlibrarymember{is_always_lock_free}{atomic>}% \begin{itemdecl} @@ -3723,8 +3736,8 @@ \indexlibraryglobal{atomic_is_lock_free}% \indexlibrarymember{is_lock_free}{atomic}% \indexlibrarymember{is_lock_free}{atomic}% -\indexlibrarymember{is_lock_free}{atomic<\placeholder{integral}>}% -\indexlibrarymember{is_lock_free}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{is_lock_free}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{is_lock_free}{atomic<\placeholder{floating-point-type}>}% \indexlibrarymember{is_lock_free}{atomic>}% \indexlibrarymember{is_lock_free}{atomic>}% \begin{itemdecl} @@ -3746,8 +3759,8 @@ \indexlibraryglobal{atomic_store_explicit}% \indexlibrarymember{store}{atomic}% \indexlibrarymember{store}{atomic}% -\indexlibrarymember{store}{atomic<\placeholder{integral}>}% -\indexlibrarymember{store}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{store}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{store}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} void store(T desired, memory_order order = memory_order::seq_cst) volatile noexcept; void store(T desired, memory_order order = memory_order::seq_cst) noexcept; @@ -3773,8 +3786,8 @@ \indexlibrarymember{operator=}{atomic}% \indexlibrarymember{operator=}{atomic}% -\indexlibrarymember{operator=}{atomic<\placeholder{integral}>}% -\indexlibrarymember{operator=}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{operator=}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{operator=}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} T operator=(T desired) volatile noexcept; T operator=(T desired) noexcept; @@ -3799,8 +3812,8 @@ \indexlibraryglobal{atomic_load_explicit}% \indexlibrarymember{load}{atomic}% \indexlibrarymember{load}{atomic}% -\indexlibrarymember{load}{atomic<\placeholder{integral}>}% -\indexlibrarymember{load}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{load}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{load}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} T load(memory_order order = memory_order::seq_cst) const volatile noexcept; T load(memory_order order = memory_order::seq_cst) const noexcept; @@ -3827,8 +3840,8 @@ \indexlibrarymember{operator \placeholder{type}}{atomic}% \indexlibrarymember{operator T*}{atomic}% -\indexlibrarymember{operator \placeholder{integral}}{atomic<\placeholder{integral}>}% -\indexlibrarymember{operator \placeholder{floating-point}}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{operator \placeholder{integral-type}}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{operator \placeholder{floating-point-type}}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} operator T() const volatile noexcept; operator T() const noexcept; @@ -3850,8 +3863,8 @@ \indexlibraryglobal{atomic_exchange_explicit}% \indexlibrarymember{exchange}{atomic}% \indexlibrarymember{exchange}{atomic}% -\indexlibrarymember{exchange}{atomic<\placeholder{integral}>}% -\indexlibrarymember{exchange}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{exchange}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{exchange}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} T exchange(T desired, memory_order order = memory_order::seq_cst) volatile noexcept; T exchange(T desired, memory_order order = memory_order::seq_cst) noexcept; @@ -3881,12 +3894,12 @@ \indexlibraryglobal{atomic_compare_exchange_strong_explicit}% \indexlibrarymember{compare_exchange_weak}{atomic}% \indexlibrarymember{compare_exchange_weak}{atomic}% -\indexlibrarymember{compare_exchange_weak}{atomic<\placeholder{integral}>}% -\indexlibrarymember{compare_exchange_weak}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{compare_exchange_weak}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{compare_exchange_weak}{atomic<\placeholder{floating-point-type}>}% \indexlibrarymember{compare_exchange_strong}{atomic}% \indexlibrarymember{compare_exchange_strong}{atomic}% -\indexlibrarymember{compare_exchange_strong}{atomic<\placeholder{integral}>}% -\indexlibrarymember{compare_exchange_strong}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{compare_exchange_strong}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{compare_exchange_strong}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} bool compare_exchange_weak(T& expected, T desired, memory_order success, memory_order failure) volatile noexcept; @@ -4056,8 +4069,8 @@ \indexlibrarymember{wait}{atomic}% \indexlibrarymember{wait}{atomic}% -\indexlibrarymember{wait}{atomic<\placeholder{integral}>}% -\indexlibrarymember{wait}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{wait}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{wait}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} void wait(T old, memory_order order = memory_order::seq_cst) const volatile noexcept; void wait(T old, memory_order order = memory_order::seq_cst) const noexcept; @@ -4089,8 +4102,8 @@ \indexlibrarymember{notify_one}{atomic}% \indexlibrarymember{notify_one}{atomic}% -\indexlibrarymember{notify_one}{atomic<\placeholder{integral}>}% -\indexlibrarymember{notify_one}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{notify_one}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{notify_one}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} void notify_one() volatile noexcept; void notify_one() noexcept; @@ -4110,8 +4123,8 @@ \indexlibrarymember{notify_all}{atomic}% \indexlibrarymember{notify_all}{atomic}% -\indexlibrarymember{notify_all}{atomic<\placeholder{integral}>}% -\indexlibrarymember{notify_all}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{notify_all}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{notify_all}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} void notify_all() volatile noexcept; void notify_all() noexcept; @@ -4130,7 +4143,7 @@ \rSec3[atomics.types.int]{Specializations for integers} -\indexlibrary{\idxcode{atomic<\placeholder{integral}>}}% +\indexlibrary{\idxcode{atomic<\placeholder{integral-type}>}}% \pnum There are specializations of the \tcode{atomic} class template for the integral types @@ -4150,8 +4163,8 @@ \keyword{char32_t}, \keyword{wchar_t}, and any other types needed by the typedefs in the header \libheaderref{cstdint}. -For each such type \tcode{\placeholder{integral}}, the specialization -\tcode{atomic<\placeholder{integral}>} provides additional atomic operations appropriate to integral types. +For each such type \tcode{\placeholder{integral-type}}, the specialization +\tcode{atomic<\placeholder{integral-type}>} provides additional atomic operations appropriate to integral types. \begin{note} The specialization \tcode{atomic} uses the primary template\iref{atomics.types.generic}. @@ -4159,8 +4172,8 @@ \begin{codeblock} namespace std { - template<> struct atomic<@\placeholder{integral}@> { - using value_type = @\placeholder{integral}@; + template<> struct atomic<@\placeholder{integral-type}@> { + using value_type = @\placeholder{integral-type}@; using difference_type = value_type; static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic} type's operations are always lock free}@; @@ -4168,71 +4181,83 @@ bool is_lock_free() const noexcept; constexpr atomic() noexcept; - constexpr atomic(@\placeholdernc{integral}@) noexcept; + constexpr atomic(@\placeholdernc{integral-type}@) noexcept; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - void store(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) volatile noexcept; - void store(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) noexcept; - @\placeholdernc{integral}@ operator=(@\placeholdernc{integral}@) volatile noexcept; - @\placeholdernc{integral}@ operator=(@\placeholdernc{integral}@) noexcept; - @\placeholdernc{integral}@ load(memory_order = memory_order::seq_cst) const volatile noexcept; - @\placeholdernc{integral}@ load(memory_order = memory_order::seq_cst) const noexcept; - operator @\placeholdernc{integral}@() const volatile noexcept; - operator @\placeholdernc{integral}@() const noexcept; - - @\placeholdernc{integral}@ exchange(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{integral}@ exchange(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) noexcept; - bool compare_exchange_weak(@\placeholder{integral}@&, @\placeholdernc{integral}@, + void store(@\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) volatile noexcept; + void store(@\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) noexcept; + @\placeholdernc{integral-type}@ operator=(@\placeholdernc{integral-type}@) volatile noexcept; + @\placeholdernc{integral-type}@ operator=(@\placeholdernc{integral-type}@) noexcept; + @\placeholdernc{integral-type}@ load(memory_order = memory_order::seq_cst) const volatile noexcept; + @\placeholdernc{integral-type}@ load(memory_order = memory_order::seq_cst) const noexcept; + operator @\placeholdernc{integral-type}@() const volatile noexcept; + operator @\placeholdernc{integral-type}@() const noexcept; + + @\placeholdernc{integral-type}@ exchange(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{integral-type}@ exchange(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) noexcept; + bool compare_exchange_weak(@\placeholder{integral-type}@&, @\placeholdernc{integral-type}@, memory_order, memory_order) volatile noexcept; - bool compare_exchange_weak(@\placeholder{integral}@&, @\placeholdernc{integral}@, + bool compare_exchange_weak(@\placeholder{integral-type}@&, @\placeholdernc{integral-type}@, memory_order, memory_order) noexcept; - bool compare_exchange_strong(@\placeholder{integral}@&, @\placeholdernc{integral}@, + bool compare_exchange_strong(@\placeholder{integral-type}@&, @\placeholdernc{integral-type}@, memory_order, memory_order) volatile noexcept; - bool compare_exchange_strong(@\placeholder{integral}@&, @\placeholdernc{integral}@, + bool compare_exchange_strong(@\placeholder{integral-type}@&, @\placeholdernc{integral-type}@, memory_order, memory_order) noexcept; - bool compare_exchange_weak(@\placeholder{integral}@&, @\placeholdernc{integral}@, + bool compare_exchange_weak(@\placeholder{integral-type}@&, @\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) volatile noexcept; - bool compare_exchange_weak(@\placeholder{integral}@&, @\placeholdernc{integral}@, + bool compare_exchange_weak(@\placeholder{integral-type}@&, @\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) noexcept; - bool compare_exchange_strong(@\placeholder{integral}@&, @\placeholdernc{integral}@, + bool compare_exchange_strong(@\placeholder{integral-type}@&, @\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) volatile noexcept; - bool compare_exchange_strong(@\placeholder{integral}@&, @\placeholdernc{integral}@, + bool compare_exchange_strong(@\placeholder{integral-type}@&, @\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) noexcept; - @\placeholdernc{integral}@ fetch_add(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{integral}@ fetch_add(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) noexcept; - @\placeholdernc{integral}@ fetch_sub(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{integral}@ fetch_sub(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) noexcept; - @\placeholdernc{integral}@ fetch_and(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{integral}@ fetch_and(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) noexcept; - @\placeholdernc{integral}@ fetch_or(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{integral}@ fetch_or(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) noexcept; - @\placeholdernc{integral}@ fetch_xor(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{integral}@ fetch_xor(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) noexcept; - - @\placeholdernc{integral}@ operator++(int) volatile noexcept; - @\placeholdernc{integral}@ operator++(int) noexcept; - @\placeholdernc{integral}@ operator--(int) volatile noexcept; - @\placeholdernc{integral}@ operator--(int) noexcept; - @\placeholdernc{integral}@ operator++() volatile noexcept; - @\placeholdernc{integral}@ operator++() noexcept; - @\placeholdernc{integral}@ operator--() volatile noexcept; - @\placeholdernc{integral}@ operator--() noexcept; - @\placeholdernc{integral}@ operator+=(@\placeholdernc{integral}@) volatile noexcept; - @\placeholdernc{integral}@ operator+=(@\placeholdernc{integral}@) noexcept; - @\placeholdernc{integral}@ operator-=(@\placeholdernc{integral}@) volatile noexcept; - @\placeholdernc{integral}@ operator-=(@\placeholdernc{integral}@) noexcept; - @\placeholdernc{integral}@ operator&=(@\placeholdernc{integral}@) volatile noexcept; - @\placeholdernc{integral}@ operator&=(@\placeholdernc{integral}@) noexcept; - @\placeholdernc{integral}@ operator|=(@\placeholdernc{integral}@) volatile noexcept; - @\placeholdernc{integral}@ operator|=(@\placeholdernc{integral}@) noexcept; - @\placeholdernc{integral}@ operator^=(@\placeholdernc{integral}@) volatile noexcept; - @\placeholdernc{integral}@ operator^=(@\placeholdernc{integral}@) noexcept; - - void wait(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) const noexcept; + @\placeholdernc{integral-type}@ fetch_add(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{integral-type}@ fetch_add(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) noexcept; + @\placeholdernc{integral-type}@ fetch_sub(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{integral-type}@ fetch_sub(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) noexcept; + @\placeholdernc{integral-type}@ fetch_and(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{integral-type}@ fetch_and(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) noexcept; + @\placeholdernc{integral-type}@ fetch_or(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{integral-type}@ fetch_or(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) noexcept; + @\placeholdernc{integral-type}@ fetch_xor(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{integral-type}@ fetch_xor(@\placeholdernc{integral-type}@, + memory_order = memory_order::seq_cst) noexcept; + + @\placeholdernc{integral-type}@ operator++(int) volatile noexcept; + @\placeholdernc{integral-type}@ operator++(int) noexcept; + @\placeholdernc{integral-type}@ operator--(int) volatile noexcept; + @\placeholdernc{integral-type}@ operator--(int) noexcept; + @\placeholdernc{integral-type}@ operator++() volatile noexcept; + @\placeholdernc{integral-type}@ operator++() noexcept; + @\placeholdernc{integral-type}@ operator--() volatile noexcept; + @\placeholdernc{integral-type}@ operator--() noexcept; + @\placeholdernc{integral-type}@ operator+=(@\placeholdernc{integral-type}@) volatile noexcept; + @\placeholdernc{integral-type}@ operator+=(@\placeholdernc{integral-type}@) noexcept; + @\placeholdernc{integral-type}@ operator-=(@\placeholdernc{integral-type}@) volatile noexcept; + @\placeholdernc{integral-type}@ operator-=(@\placeholdernc{integral-type}@) noexcept; + @\placeholdernc{integral-type}@ operator&=(@\placeholdernc{integral-type}@) volatile noexcept; + @\placeholdernc{integral-type}@ operator&=(@\placeholdernc{integral-type}@) noexcept; + @\placeholdernc{integral-type}@ operator|=(@\placeholdernc{integral-type}@) volatile noexcept; + @\placeholdernc{integral-type}@ operator|=(@\placeholdernc{integral-type}@) noexcept; + @\placeholdernc{integral-type}@ operator^=(@\placeholdernc{integral-type}@) volatile noexcept; + @\placeholdernc{integral-type}@ operator^=(@\placeholdernc{integral-type}@) noexcept; + + void wait(@\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) const volatile noexcept; + void wait(@\placeholdernc{integral-type}@, memory_order = memory_order::seq_cst) const noexcept; void notify_one() volatile noexcept; void notify_one() noexcept; void notify_all() volatile noexcept; @@ -4291,11 +4316,11 @@ \indexlibraryglobal{atomic_fetch_or_explicit}% \indexlibraryglobal{atomic_fetch_sub_explicit}% \indexlibraryglobal{atomic_fetch_xor_explicit}% -\indexlibrarymember{fetch_add}{atomic<\placeholder{integral}>}% -\indexlibrarymember{fetch_and}{atomic<\placeholder{integral}>}% -\indexlibrarymember{fetch_or}{atomic<\placeholder{integral}>}% -\indexlibrarymember{fetch_sub}{atomic<\placeholder{integral}>}% -\indexlibrarymember{fetch_xor}{atomic<\placeholder{integral}>}% +\indexlibrarymember{fetch_add}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{fetch_and}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{fetch_or}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{fetch_sub}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{fetch_xor}{atomic<\placeholder{integral-type}>}% \begin{itemdecl} T fetch_@\placeholdernc{key}@(T operand, memory_order order = memory_order::seq_cst) volatile noexcept; T fetch_@\placeholdernc{key}@(T operand, memory_order order = memory_order::seq_cst) noexcept; @@ -4335,11 +4360,11 @@ \indexlibrarymember{operator+=}{atomic}% \indexlibrarymember{operator-=}{atomic}% -\indexlibrarymember{operator+=}{atomic<\placeholder{integral}>}% -\indexlibrarymember{operator-=}{atomic<\placeholder{integral}>}% -\indexlibrarymember{operator\&=}{atomic<\placeholder{integral}>}% -\indexlibrarymember{operator"|=}{atomic<\placeholder{integral}>}% -\indexlibrarymember{operator\caret=}{atomic<\placeholder{integral}>}% +\indexlibrarymember{operator+=}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{operator-=}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{operator\&=}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{operator"|=}{atomic<\placeholder{integral-type}>}% +\indexlibrarymember{operator\caret=}{atomic<\placeholder{integral-type}>}% \begin{itemdecl} T operator @\placeholder{op}@=(T operand) volatile noexcept; T operator @\placeholder{op}@=(T operand) noexcept; @@ -4358,18 +4383,18 @@ \rSec3[atomics.types.float]{Specializations for floating-point types} -\indexlibrary{\idxcode{atomic<\placeholder{floating-point}>}}% +\indexlibrary{\idxcode{atomic<\placeholder{floating-point-type}>}}% \pnum There are specializations of the \tcode{atomic} class template for all cv-unqualified floating-point types. -For each such type \tcode{\placeholdernc{floating-point}}, -the specialization \tcode{atomic<\placeholder{floating-point}>} +For each such type \tcode{\placeholdernc{floating-point-type}}, +the specialization \tcode{atomic<\placeholder{floating-point-type}>} provides additional atomic operations appropriate to floating-point types. \begin{codeblock} namespace std { - template<> struct atomic<@\placeholder{floating-point}@> { - using value_type = @\placeholdernc{floating-point}@; + template<> struct atomic<@\placeholder{floating-point-type}@> { + using value_type = @\placeholdernc{floating-point-type}@; using difference_type = value_type; static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic} type's operations are always lock free}@; @@ -4377,57 +4402,57 @@ bool is_lock_free() const noexcept; constexpr atomic() noexcept; - constexpr atomic(@\placeholder{floating-point}@) noexcept; + constexpr atomic(@\placeholder{floating-point-type}@) noexcept; atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete; - void store(@\placeholdernc{floating-point}@, memory_order = memory_order::seq_cst) volatile noexcept; - void store(@\placeholdernc{floating-point}@, memory_order = memory_order::seq_cst) noexcept; - @\placeholdernc{floating-point}@ operator=(@\placeholder{floating-point}@) volatile noexcept; - @\placeholdernc{floating-point}@ operator=(@\placeholder{floating-point}@) noexcept; - @\placeholdernc{floating-point}@ load(memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{floating-point}@ load(memory_order = memory_order::seq_cst) noexcept; - operator @\placeholdernc{floating-point}@() volatile noexcept; - operator @\placeholdernc{floating-point}@() noexcept; + void store(@\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) volatile noexcept; + void store(@\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) noexcept; + @\placeholdernc{floating-point-type}@ operator=(@\placeholder{floating-point-type}@) volatile noexcept; + @\placeholdernc{floating-point-type}@ operator=(@\placeholder{floating-point-type}@) noexcept; + @\placeholdernc{floating-point-type}@ load(memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{floating-point-type}@ load(memory_order = memory_order::seq_cst) noexcept; + operator @\placeholdernc{floating-point-type}@() volatile noexcept; + operator @\placeholdernc{floating-point-type}@() noexcept; - @\placeholdernc{floating-point}@ exchange(@\placeholdernc{floating-point}@, - memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{floating-point}@ exchange(@\placeholdernc{floating-point}@, - memory_order = memory_order::seq_cst) noexcept; - bool compare_exchange_weak(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + @\placeholdernc{floating-point-type}@ exchange(@\placeholdernc{floating-point-type}@, + memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{floating-point-type}@ exchange(@\placeholdernc{floating-point-type}@, + memory_order = memory_order::seq_cst) noexcept; + bool compare_exchange_weak(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order, memory_order) volatile noexcept; - bool compare_exchange_weak(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_weak(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order, memory_order) noexcept; - bool compare_exchange_strong(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_strong(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order, memory_order) volatile noexcept; - bool compare_exchange_strong(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_strong(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order, memory_order) noexcept; - bool compare_exchange_weak(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_weak(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) volatile noexcept; - bool compare_exchange_weak(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_weak(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) noexcept; - bool compare_exchange_strong(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_strong(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) volatile noexcept; - bool compare_exchange_strong(@\placeholder{floating-point}@&, @\placeholdernc{floating-point}@, + bool compare_exchange_strong(@\placeholder{floating-point-type}@&, @\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) noexcept; - @\placeholdernc{floating-point}@ fetch_add(@\placeholdernc{floating-point}@, - memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{floating-point}@ fetch_add(@\placeholdernc{floating-point}@, - memory_order = memory_order::seq_cst) noexcept; - @\placeholdernc{floating-point}@ fetch_sub(@\placeholdernc{floating-point}@, - memory_order = memory_order::seq_cst) volatile noexcept; - @\placeholdernc{floating-point}@ fetch_sub(@\placeholdernc{floating-point}@, - memory_order = memory_order::seq_cst) noexcept; - - @\placeholdernc{floating-point}@ operator+=(@\placeholder{floating-point}@) volatile noexcept; - @\placeholdernc{floating-point}@ operator+=(@\placeholder{floating-point}@) noexcept; - @\placeholdernc{floating-point}@ operator-=(@\placeholder{floating-point}@) volatile noexcept; - @\placeholdernc{floating-point}@ operator-=(@\placeholder{floating-point}@) noexcept; - - void wait(@\placeholdernc{floating-point}@, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(@\placeholdernc{floating-point}@, memory_order = memory_order::seq_cst) const noexcept; + @\placeholdernc{floating-point-type}@ fetch_add(@\placeholdernc{floating-point-type}@, + memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{floating-point-type}@ fetch_add(@\placeholdernc{floating-point-type}@, + memory_order = memory_order::seq_cst) noexcept; + @\placeholdernc{floating-point-type}@ fetch_sub(@\placeholdernc{floating-point-type}@, + memory_order = memory_order::seq_cst) volatile noexcept; + @\placeholdernc{floating-point-type}@ fetch_sub(@\placeholdernc{floating-point-type}@, + memory_order = memory_order::seq_cst) noexcept; + + @\placeholdernc{floating-point-type}@ operator+=(@\placeholder{floating-point-type}@) volatile noexcept; + @\placeholdernc{floating-point-type}@ operator+=(@\placeholder{floating-point-type}@) noexcept; + @\placeholdernc{floating-point-type}@ operator-=(@\placeholder{floating-point-type}@) volatile noexcept; + @\placeholdernc{floating-point-type}@ operator-=(@\placeholder{floating-point-type}@) noexcept; + + void wait(@\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) const volatile noexcept; + void wait(@\placeholdernc{floating-point-type}@, memory_order = memory_order::seq_cst) const noexcept; void notify_one() volatile noexcept; void notify_one() noexcept; void notify_all() volatile noexcept; @@ -4454,8 +4479,8 @@ \indexlibraryglobal{atomic_fetch_sub}% \indexlibraryglobal{atomic_fetch_add_explicit}% \indexlibraryglobal{atomic_fetch_sub_explicit}% -\indexlibrarymember{fetch_add}{atomic<\placeholder{floating-point}>}% -\indexlibrarymember{fetch_sub}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{fetch_add}{atomic<\placeholder{floating-point-type}>}% +\indexlibrarymember{fetch_sub}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} T fetch_@\placeholdernc{key}@(T operand, memory_order order = memory_order::seq_cst) volatile noexcept; T fetch_@\placeholdernc{key}@(T operand, memory_order order = memory_order::seq_cst) noexcept; @@ -4483,18 +4508,18 @@ \remarks If the result is not a representable value for its type\iref{expr.pre} the result is unspecified, but the operations otherwise have no undefined -behavior. Atomic arithmetic operations on \tcode{\placeholder{floating-point}} -should conform to the \tcode{std::numeric_limits<\placeholder{floating-point}>} +behavior. Atomic arithmetic operations on \tcode{\placeholder{floating-point-type}} +should conform to the \tcode{std::numeric_limits<\placeholder{floating-point-type}>} traits associated with the floating-point type\iref{limits.syn}. The floating-point environment\iref{cfenv} for atomic arithmetic operations -on \tcode{\placeholder{floating-point}} may be different than the +on \tcode{\placeholder{floating-point-type}} may be different than the calling thread's floating-point environment. \end{itemdescr} \indexlibrarymember{operator+=}{atomic}% \indexlibrarymember{operator-=}{atomic}% -\indexlibrarymember{operator+=}{atomic<\placeholder{floating-point}>}% -\indexlibrarymember{operator-=}{atomic<\placeholder{floating-point}>}% +\indexlibrarymember{operator+=}{atomic<\placeholder{floating-point-type}>}% +\indexlibrarymember{operator-=}{atomic<\placeholder{floating-point-type}>}% \begin{itemdecl} T operator @\placeholder{op}@=(T operand) volatile noexcept; T operator @\placeholder{op}@=(T operand) noexcept; @@ -4514,11 +4539,11 @@ \remarks If the result is not a representable value for its type\iref{expr.pre} the result is unspecified, but the operations otherwise have no undefined -behavior. Atomic arithmetic operations on \tcode{\placeholder{floating-point}} -should conform to the \tcode{std::numeric_limits<\placeholder{floating-point}>} +behavior. Atomic arithmetic operations on \tcode{\placeholder{floating-point-type}} +should conform to the \tcode{std::numeric_limits<\placeholder{floating-point-type}>} traits associated with the floating-point type\iref{limits.syn}. The floating-point environment\iref{cfenv} for atomic arithmetic operations -on \tcode{\placeholder{floating-point}} may be different than the +on \tcode{\placeholder{floating-point-type}} may be different than the calling thread's floating-point environment. \end{itemdescr} @@ -4687,7 +4712,7 @@ \rSec3[atomics.types.memop]{Member operators common to integers and pointers to objects} \indexlibrarymember{operator++}{atomic}% -\indexlibrarymember{operator++}{atomic<\placeholder{integral}>}% +\indexlibrarymember{operator++}{atomic<\placeholder{integral-type}>}% \begin{itemdecl} value_type operator++(int) volatile noexcept; value_type operator++(int) noexcept; @@ -4705,7 +4730,7 @@ \end{itemdescr} \indexlibrarymember{operator--}{atomic}% -\indexlibrarymember{operator--}{atomic<\placeholder{integral}>}% +\indexlibrarymember{operator--}{atomic<\placeholder{integral-type}>}% \begin{itemdecl} value_type operator--(int) volatile noexcept; value_type operator--(int) noexcept; @@ -4723,7 +4748,7 @@ \end{itemdescr} \indexlibrarymember{operator++}{atomic}% -\indexlibrarymember{operator++}{atomic<\placeholder{integral}>}% +\indexlibrarymember{operator++}{atomic<\placeholder{integral-type}>}% \begin{itemdecl} value_type operator++() volatile noexcept; value_type operator++() noexcept; @@ -4741,7 +4766,7 @@ \end{itemdescr} \indexlibrarymember{operator--}{atomic}% -\indexlibrarymember{operator--}{atomic<\placeholder{integral}>}% +\indexlibrarymember{operator--}{atomic<\placeholder{integral-type}>}% \begin{itemdecl} value_type operator--() volatile noexcept; value_type operator--() noexcept; @@ -8095,7 +8120,7 @@ is an \term{active} execution. An active execution calls \tcode{\placeholdernc{INVOKE}(\brk{}% std::forward(func), -std::forward(args)...)}. If such a call to \tcode{func} +std::forward(args)...)}\iref{func.require}. If such a call to \tcode{func} throws an exception the execution is \term{exceptional}, otherwise it is \term{returning}. An exceptional execution propagates the exception to the caller of \tcode{call_once}. Among all executions of \tcode{call_once} for any given @@ -9916,7 +9941,7 @@ A reference to an object of a type derived from class \tcode{error_category}. \pnum -The object's \tcode{default_error_condition} and equivalent virtual functions shall +The object's \tcode{default_error_condition} and \tcode{equivalent} virtual functions shall behave as specified for the class \tcode{error_category}. The object's \tcode{name} virtual function returns a pointer to the string \tcode{"future"}. \end{itemdescr} @@ -10561,6 +10586,8 @@ \begin{itemdescr} \pnum \effects +If \tcode{addressof(rhs) == this} is \tcode{true}, there are no effects. +Otherwise: \begin{itemize} \item Releases any shared state\iref{futures.state}. @@ -10576,6 +10603,7 @@ assignment. \item +If \tcode{addressof(rhs) == this} is \tcode{false}, \tcode{rhs.valid() == false}. \end{itemize} \end{itemdescr} @@ -10882,6 +10910,8 @@ \begin{itemdescr} \pnum \effects +If \tcode{addressof(rhs) == this} is \tcode{true}, there are no effects. +Otherwise: \begin{itemize} \item Releases any shared state\iref{futures.state}; @@ -10897,6 +10927,7 @@ the assignment. \item +If \tcode{addressof(rhs) == this} is \tcode{false}, \tcode{rhs.valid() == false}. \end{itemize} \end{itemdescr} @@ -10909,6 +10940,8 @@ \begin{itemdescr} \pnum \effects +If \tcode{addressof(rhs) == this} is \tcode{true}, there are no effects. +Otherwise: \begin{itemize} \item Releases any shared state\iref{futures.state}; @@ -11114,7 +11147,7 @@ \begin{itemize} \item If \tcode{launch::async} is set in \tcode{policy}, calls -\tcode{invoke(auto(std::forward(f)), auto(std::for\-ward(args))...)}\iref{func.require,thread.thread.constr} +\tcode{invoke(auto(std::forward(f)), auto(std::for\-ward(args))...)}\iref{func.invoke,thread.thread.constr} as if in a new thread of execution represented by a \tcode{thread} object with the values produced by \tcode{auto} being materialized\iref{conv.rval} in the thread that called \tcode{async}. @@ -11313,7 +11346,7 @@ \indexlibraryctor{packaged_task}% \begin{itemdecl} template - packaged_task(F&& f); + explicit packaged_task(F&& f); \end{itemdecl} \begin{itemdescr} @@ -11561,7 +11594,7 @@ \throws \begin{itemize} \item \tcode{bad_alloc} if memory for the new shared state cannot be allocated. -\item any exception thrown by the move constructor of the task stored in the shared +\item Any exception thrown by the move constructor of the task stored in the shared state. \item \tcode{future_error} with an error condition of \tcode{no_state} if \tcode{*this} has no shared state. diff --git a/source/time.tex b/source/time.tex index 2263d4b7cc..04f414aba6 100644 --- a/source/time.tex +++ b/source/time.tex @@ -88,12 +88,12 @@ // \ref{time.traits}, customization traits template struct treat_as_floating_point; template - inline constexpr bool treat_as_floating_point_v = treat_as_floating_point::value; + constexpr bool treat_as_floating_point_v = treat_as_floating_point::value; template struct duration_values; template struct is_clock; - template inline constexpr bool is_clock_v = is_clock::value; + template constexpr bool is_clock_v = is_clock::value; // \ref{time.duration.nonmember}, \tcode{duration} arithmetic template @@ -1012,24 +1012,24 @@ \pnum A type \tcode{TC} meets the \oldconcept{TrivialClock} requirements if: \begin{itemize} -\item \tcode{TC} meets the \oldconcept{Clock} requirements, +\item +\tcode{TC} meets the \oldconcept{Clock} requirements, -\item the types \tcode{TC::rep}, \tcode{TC::duration}, and \tcode{TC::time_point} +\item +the types \tcode{TC::rep}, \tcode{TC::duration}, and \tcode{TC::time_point} meet the \oldconcept{EqualityComparable} (\tref{cpp17.equalitycomparable}) and \oldconcept{LessThanComparable} (\tref{cpp17.lessthancomparable}) +and \oldconcept{Swappable}\iref{swappable.requirements} requirements and the requirements of -numeric types\iref{numeric.requirements}. +numeric types\iref{numeric.requirements}, \begin{note} This means, in particular, that operations on these types will not throw exceptions. \end{note} - -\item lvalues of the types \tcode{TC::rep}, \tcode{TC::duration}, and -\tcode{TC::time_point} are swappable\iref{swappable.requirements}, - -\item the function \tcode{TC::now()} does not throw exceptions, and - -\item the type \tcode{TC::time_point::clock} meets the \oldconcept{TrivialClock} +\item +the function \tcode{TC::now()} does not throw exceptions, and +\item +the type \tcode{TC::time_point::clock} meets the \oldconcept{TrivialClock} requirements, recursively. \end{itemize} @@ -2717,7 +2717,7 @@ \effects Equivalent to: \begin{codeblock} -return os << format(os.getloc(), @\placeholder{STATICALLY-WIDEN}@("{:L%F %T}"), tp); +return os << format(os.getloc(), @\placeholder{STATICALLY-WIDEN}@("{:L%F %T}"), tp); \end{codeblock} \pnum @@ -9622,7 +9622,7 @@ explicit zoned_time(string_view name); template - zoned_time(const zoned_time& zt); + zoned_time(const zoned_time& y); zoned_time(TimeZonePtr z, const sys_time& st); zoned_time(string_view name, const sys_time& st); @@ -9633,17 +9633,17 @@ zoned_time(string_view name, const local_time& tp, choose c); template - zoned_time(TimeZonePtr z, const zoned_time& zt); + zoned_time(TimeZonePtr z, const zoned_time& y); template - zoned_time(TimeZonePtr z, const zoned_time& zt, choose); + zoned_time(TimeZonePtr z, const zoned_time& y, choose); template - zoned_time(string_view name, const zoned_time& zt); + zoned_time(string_view name, const zoned_time& y); template - zoned_time(string_view name, const zoned_time& zt, choose); + zoned_time(string_view name, const zoned_time& y, choose c); zoned_time& operator=(const sys_time& st); - zoned_time& operator=(const local_time& ut); + zoned_time& operator=(const local_time& lt); operator sys_time() const; explicit operator local_time() const; @@ -10100,7 +10100,7 @@ \effects Equivalent to: \begin{codeblock} -return os << format(os.getloc(), @\placeholder{STATICALLY-WIDEN}@("{:L%F %T %Z}"), t); +return os << format(os.getloc(), @\placeholder{STATICALLY-WIDEN}@("{:L%F %T %Z}"), t); \end{codeblock} \end{itemdescr} @@ -10194,7 +10194,7 @@ \tcode{+1s} to indicate a positive leap second or \tcode{-1s} to indicate a negative leap second. \begin{note} -All leap seconds inserted up through 2019 were positive leap seconds. +All leap seconds inserted up through 2022 were positive leap seconds. \end{note} \end{itemdescr} @@ -10787,7 +10787,7 @@ \pnum If the \fmtgrammarterm{chrono-specs} is omitted, the chrono object is formatted -as if by streaming it to \tcode{std::ostringstream os} +as if by streaming it to \tcode{basic_ostring\-stream os} with the formatting locale imbued and copying \tcode{os.str()} through the output iterator of the context with additional padding and adjustments as specified by the format specifiers. @@ -10963,7 +10963,7 @@ : formatter, charT> { template typename FormatContext::iterator - format(const chrono::zoned_time& tp, FormatContext& ctx); + format(const chrono::zoned_time& tp, FormatContext& ctx) const; }; \end{codeblock} @@ -10971,7 +10971,7 @@ \begin{itemdecl} template typename FormatContext::iterator - format(const chrono::zoned_time& tp, FormatContext& ctx); + format(const chrono::zoned_time& tp, FormatContext& ctx) const; \end{itemdecl} \begin{itemdescr} diff --git a/source/uax31.tex b/source/uax31.tex index 64f4b873b7..aea6e6b5ba 100644 --- a/source/uax31.tex +++ b/source/uax31.tex @@ -1,14 +1,14 @@ %!TEX root = std.tex -\infannex{uaxid}{Conformance with UAX \#31} +\infannex{uaxid}{Conformance with \UAX{31}} \rSec1[uaxid.general]{General} \pnum This Annex describes the choices made in application of -UAX \#31 (``Unicode Identifier and Pattern Syntax'') -to \Cpp{} in terms of the requirements from UAX \#31 and +\UAX{31} (``Unicode Identifier and Pattern Syntax'') +to \Cpp{} in terms of the requirements from \UAX{31} and how they do or do not apply to \Cpp{}. -In terms of UAX \#31, +In terms of \UAX{31}, \Cpp{} conforms by meeting the requirements R1 ``Default Identifiers'' and R4 ``Equivalent Normalized Identifiers''. @@ -20,8 +20,8 @@ \rSec2[uaxid.def.general]{General} \pnum -UAX \#31 specifies a default syntax for identifiers -based on properties from the Unicode Character Database, UAX \#44. +\UAX{31} specifies a default syntax for identifiers +based on properties from the Unicode Character Database, \UAX{44}. The general syntax is \begin{codeblock} := * ( +)* @@ -33,7 +33,7 @@ to the set of permitted \tcode{} characters, the \tcode{} set is empty, and the \tcode{} characters are unmodified. -In the grammar used in UAX \#31, this is +In the grammar used in \UAX{31}, this is \begin{codeblock} := * := XID_Start + @\textrm{\ucode{005f}}@ @@ -49,8 +49,8 @@ \rSec2[uaxid.def.rfmt]{R1a Restricted format characters} \pnum -If an implementation of UAX \#31 wishes to allow format characters -such as ZERO WIDTH JOINER or ZERO WIDTH NON-JOINER +If an implementation of \UAX{31} wishes to allow format characters +such as \unicode{200d}{zero width joiner} or \unicode{200c}{zero width non-joiner} it must define a profile allowing them, or describe precisely which combinations are permitted. @@ -60,13 +60,13 @@ \rSec2[uaxid.def.stable]{R1b Stable identifiers} \pnum -An implementation of UAX \#31 may choose to guarantee +An implementation of \UAX{31} may choose to guarantee that identifiers are stable across versions of the Unicode Standard. Once a string qualifies as an identifier it does so in all future versions. \pnum \Cpp{} does not make this guarantee, -except to the extent that UAX \#31 guarantees +except to the extent that \UAX{31} guarantees the stability of the XID_Start and XID_Continue properties. \rSec1[uaxid.immutable]{R2 Immutable identifiers} @@ -85,19 +85,18 @@ \rSec1[uaxid.pattern]{R3 Pattern_White_Space and Pattern_Syntax characters} \pnum -UAX \#31 describes how languages that use or interpret patterns of characters, -such as regular expressions or number formats, -may describe that syntax with Unicode properties. +\UAX{31} describes how formal languages +such as computer languages should describe and implement +their use of whitespace and syntactically significant characters +during the processes of lexing and parsing. \pnum -\Cpp{} does not do this as part of the language, -deferring to library components for such usage of patterns. -This requirement does not apply to \Cpp{}. +\Cpp{} does not claim conformance with this requirement. \rSec1[uaxid.eqn]{R4 Equivalent normalized identifiers} \pnum -UAX \#31 requires that implementations describe +\UAX{31} requires that implementations describe how identifiers are compared and considered equivalent. \pnum @@ -116,7 +115,7 @@ \pnum If any characters are excluded from normalization, -UAX \#31 requires a precise specification of those exclusions. +\UAX{31} requires a precise specification of those exclusions. \pnum \Cpp{} does not make any such exclusions. diff --git a/source/utilities.tex b/source/utilities.tex index df39cb6a9b..03f38b6e3f 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -207,13 +207,13 @@ struct in_place_type_t { explicit in_place_type_t() = default; }; - template inline constexpr in_place_type_t in_place_type{}; + template constexpr in_place_type_t in_place_type{}; template struct in_place_index_t { explicit in_place_index_t() = default; }; - template inline constexpr in_place_index_t in_place_index{}; + template constexpr in_place_index_t in_place_index{}; } \end{codeblock} @@ -367,6 +367,10 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\mandates +\tcode{T} is a referenceable type\iref{defns.referenceable}. + \pnum \begin{itemize} \item @@ -1265,6 +1269,11 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\expects +Each of \tcode{decltype(x.first == y.first)} and +\tcode{decltype(x.second == y.second)} models \exposconcept{boolean-testable}. + \pnum \returns \tcode{x.first == y.first \&\& x.second == y.second}. @@ -1575,7 +1584,7 @@ // \ref{tuple.helper}, tuple helper classes template - inline constexpr size_t @\libglobal{tuple_size_v}@ = tuple_size::value; + constexpr size_t @\libglobal{tuple_size_v}@ = tuple_size::value; } \end{codeblock} @@ -2463,6 +2472,9 @@ \end{itemdecl} \begin{itemdescr} +\pnum +Let $i$ be in the range \range{0}{sizeof...(Types)} in order. + \pnum \mandates \begin{itemize} @@ -2476,13 +2488,11 @@ \pnum \expects -Each element in \tcode{*this} is swappable with\iref{swappable.requirements} -the corresponding element in \tcode{rhs}. +For all $i$, \tcode{get<$i$>(*this)} is swappable with\iref{swappable.requirements} \tcode{get<$i$>(rhs)}. \pnum \effects -Calls \tcode{swap} for each element in \tcode{*this} and its -corresponding element in \tcode{rhs}. +For each $i$, calls \tcode{swap} for \tcode{get<$i$>(*this)} with \tcode{get<$i$>(rhs)}. \pnum \throws @@ -2903,11 +2913,15 @@ \mandates For all \tcode{i}, where $0 \leq \tcode{i} < \tcode{sizeof...(TTypes)}$, -\tcode{get(t) == get(u)} is a valid expression -returning a type that is convertible to \tcode{bool}. +\tcode{get(t) == get(u)} is a valid expression. \tcode{sizeof...(TTypes)} equals \tcode{tuple_size_v}. +\pnum +\expects +For all \tcode{i}, \tcode{decltype(get(t) == get(u))} models +\exposconcept{boolean-testable}. + \pnum \returns \tcode{true} if \tcode{get(t) == get(u)} for all @@ -3131,9 +3145,9 @@ class optional; template - constexpr bool @\exposid{is-optional}@ = false; // \expos - template - constexpr bool @\exposid{is-optional}@> = true; // \expos + concept @\defexposconcept{is-derived-from-optional}@ = requires(const T& t) { // \expos + [](const optional&){ }(t); + }; // \ref{optional.nullopt}, no-value state indicator struct nullopt_t{@\seebelow@}; @@ -3177,7 +3191,8 @@ template constexpr bool operator<=(const T&, const optional&); template constexpr bool operator>=(const optional&, const U&); template constexpr bool operator>=(const T&, const optional&); - template requires (!@\exposid{is-optional}@) && @\libconcept{three_way_comparable_with}@ + template + requires (!@\exposconcept{is-derived-from-optional}@) && @\libconcept{three_way_comparable_with}@ constexpr compare_three_way_result_t operator<=>(const optional&, const U&); @@ -3304,6 +3319,18 @@ \rSec3[optional.ctor]{Constructors} +\pnum +The exposition-only variable template \exposid{converts-from-any-cvref} +is used by some constructors for \tcode{optional}. +\begin{codeblock} +template +constexpr bool @\exposid{converts-from-any-cvref}@ = // \expos + disjunction_v, is_convertible, + is_constructible, is_convertible, + is_constructible, is_convertible, + is_constructible, is_convertible>; +\end{codeblock} + \indexlibraryctor{optional}% \begin{itemdecl} constexpr optional() noexcept; @@ -3478,15 +3505,8 @@ \pnum \constraints \begin{itemize} -\item \tcode{is_constructible_v} is \tcode{true}, -\item \tcode{is_constructible_v\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&\&>} is \tcode{false}, -\item \tcode{is_convertible_v\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&, T>} is \tcode{false}, and -\item \tcode{is_convertible_v\&\&, T>} is \tcode{false}. +\item \tcode{is_constructible_v} is \tcode{true}, and +\item \tcode{\exposid{converts-from-any-cvref}>} is \tcode{false}. \end{itemize} \pnum @@ -3519,15 +3539,8 @@ \pnum \constraints \begin{itemize} -\item \tcode{is_constructible_v} is \tcode{true}, -\item \tcode{is_constructible_v\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&\&>} is \tcode{false}, -\item \tcode{is_convertible_v\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&, T>} is \tcode{false}, and -\item \tcode{is_convertible_v\&\&, T>} is \tcode{false}. +\item \tcode{is_constructible_v} is \tcode{true}, and +\item \tcode{\exposid{converts-from-any-cvref}>} is \tcode{false}. \end{itemize} \pnum @@ -3736,14 +3749,7 @@ \begin{itemize} \item \tcode{is_constructible_v} is \tcode{true}, \item \tcode{is_assignable_v} is \tcode{true}, -\item \tcode{is_constructible_v\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&\&>} is \tcode{false}, -\item \tcode{is_convertible_v\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&\&, T>} is \tcode{false}, +\item \tcode{\exposid{converts-from-any-cvref}>} is \tcode{false}, \item \tcode{is_assignable_v\&>} is \tcode{false}, \item \tcode{is_assignable_v\&\&>} is \tcode{false}, \item \tcode{is_assignable_v\&>} is \tcode{false}, and @@ -3798,14 +3804,7 @@ \begin{itemize} \item \tcode{is_constructible_v} is \tcode{true}, \item \tcode{is_assignable_v} is \tcode{true}, -\item \tcode{is_constructible_v\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&>} is \tcode{false}, -\item \tcode{is_constructible_v\&\&>} is \tcode{false}, -\item \tcode{is_convertible_v\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&, T>} is \tcode{false}, -\item \tcode{is_convertible_v\&\&, T>} is \tcode{false}, +\item \tcode{\exposid{converts-from-any-cvref}>} is \tcode{false}, \item \tcode{is_assignable_v\&>} is \tcode{false}, \item \tcode{is_assignable_v\&\&>} is \tcode{false}, \item \tcode{is_assignable_v\&>} is \tcode{false}, and @@ -3928,7 +3927,7 @@ \pnum \expects -Lvalues of type \tcode{T} are swappable. +\tcode{T} meets the \oldconcept{Swappable} requirements\iref{swappable.requirements}. \pnum \effects @@ -4748,7 +4747,8 @@ \indexlibrarymember{operator<=>}{optional}% \begin{itemdecl} -template requires (!@\exposid{is-optional}@) && @\libconcept{three_way_comparable_with}@ +template + requires (!@\exposconcept{is-derived-from-optional}@) && @\libconcept{three_way_comparable_with}@ constexpr compare_three_way_result_t operator<=>(const optional& x, const U& v); \end{itemdecl} @@ -4857,7 +4857,7 @@ template struct variant_size; // \notdef template struct variant_size; template - inline constexpr size_t @\libglobal{variant_size_v}@ = variant_size::value; + constexpr size_t @\libglobal{variant_size_v}@ = variant_size::value; template struct variant_size>; @@ -5698,7 +5698,7 @@ \pnum \expects -Lvalues of type $\tcode{T}_i$ are swappable\iref{swappable.requirements}. +Each $\tcode{T}_i$ meets the \oldconcept{Swappable} requirements\iref{swappable.requirements}. \pnum \effects @@ -6917,6 +6917,7 @@ template class unexpected { public: + // \ref{expected.un.cons}, constructors constexpr unexpected(const unexpected&) = default; constexpr unexpected(unexpected&&) = default; template @@ -6957,7 +6958,7 @@ a cv-qualified type is ill-formed. -\rSec3[expected.un.ctor]{Constructors} +\rSec3[expected.un.cons]{Constructors} \indexlibraryctor{unexpected}% \begin{itemdecl} @@ -7119,6 +7120,7 @@ const E& error() const & noexcept; E&& error() && noexcept; const E&& error() const && noexcept; + private: E @\exposidnc{unex}@; // \expos }; @@ -7190,6 +7192,7 @@ bad_expected_access& operator=(const bad_expected_access&); bad_expected_access& operator=(bad_expected_access&&); ~bad_expected_access(); + public: const char* what() const noexcept override; }; @@ -7223,7 +7226,7 @@ template using @\libmember{rebind}{expected}@ = expected; - // \ref{expected.object.ctor}, constructors + // \ref{expected.object.cons}, constructors constexpr expected(); constexpr expected(const expected&); constexpr expected(expected&&) noexcept(@\seebelow@); @@ -7236,9 +7239,9 @@ constexpr explicit(@\seebelow@) expected(U&& v); template - constexpr expected(const unexpected&); + constexpr explicit(@\seebelow@) expected(const unexpected&); template - constexpr expected(unexpected&&); + constexpr explicit(@\seebelow@) expected(unexpected&&); template constexpr explicit expected(in_place_t, Args&&...); @@ -7289,6 +7292,26 @@ constexpr E&& error() && noexcept; template constexpr T value_or(U&&) const &; template constexpr T value_or(U&&) &&; + template constexpr E error_or(G&&) const &; + template constexpr E error_or(G&&) &&; + + // \ref{expected.object.monadic}, monadic operations + template constexpr auto and_then(F&& f) &; + template constexpr auto and_then(F&& f) &&; + template constexpr auto and_then(F&& f) const &; + template constexpr auto and_then(F&& f) const &&; + template constexpr auto or_else(F&& f) &; + template constexpr auto or_else(F&& f) &&; + template constexpr auto or_else(F&& f) const &; + template constexpr auto or_else(F&& f) const &&; + template constexpr auto transform(F&& f) &; + template constexpr auto transform(F&& f) &&; + template constexpr auto transform(F&& f) const &; + template constexpr auto transform(F&& f) const &&; + template constexpr auto transform_error(F&& f) &; + template constexpr auto transform_error(F&& f) &&; + template constexpr auto transform_error(F&& f) const &; + template constexpr auto transform_error(F&& f) const &&; // \ref{expected.object.eq}, equality operators template requires (!is_void_v) @@ -7319,12 +7342,14 @@ contains an object of type \tcode{T}. \pnum -A program -that instantiates the definition of template \tcode{expected} -for a reference type, a function type, or -for possibly cv-qualified types \tcode{in_place_t}, \tcode{unexpect_t}, or -a specialization of \tcode{unexpected} for the \tcode{T} parameter -is ill-formed. +A type \tcode{T} is a \term{valid value type for \tcode{expected}}, +if \tcode{remove_cv_t} is \tcode{void} +or a complete non-array object type that is not \tcode{in_place_t}, +\tcode{unexpect_t}, +or a specialization of \tcode{unexpected}. +A program which instantiates class template \tcode{expected} +with an argument \tcode{T} that is not a valid value +type for \tcode{expected} is ill-formed. A program that instantiates the definition of the template \tcode{expected} with a type for the \tcode{E} parameter @@ -7336,7 +7361,12 @@ \tcode{E} shall meet the \oldconcept{Destructible} requirements. -\rSec3[expected.object.ctor]{Constructors} +\rSec3[expected.object.cons]{Constructors} + +\pnum +The exposition-only variable template \exposid{converts-from-any-cvref} +defined in \ref{optional.ctor} +is used by some constructors for \tcode{expected}. \indexlibraryctor{expected}% \begin{itemdecl} @@ -7476,21 +7506,7 @@ \item \tcode{is_constructible_v} is \tcode{true}; and \item -\tcode{is_constructible_v\&>} is \tcode{false}; and -\item -\tcode{is_constructible_v>} is \tcode{false}; and -\item -\tcode{is_constructible_v\&>} is \tcode{false}; and -\item -\tcode{is_constructible_v>} is \tcode{false}; and -\item -\tcode{is_convertible_v\&, T>} is \tcode{false}; and -\item -\tcode{is_convertible_v\&\&, T>} is \tcode{false}; and -\item -\tcode{is_convertible_v\&, T>} is \tcode{false}; and -\item -\tcode{is_convertible_v\&\&, T>} is \tcode{false}; and +\tcode{\exposid{converts-from-any-cvref}>} is \tcode{false}; and \item \tcode{is_constructible_v, expected\&>} is \tcode{false}; and \item @@ -8230,6 +8246,309 @@ \tcode{has_value() ? std::move(**this) : static_cast(std::forward(v))}. \end{itemdescr} +\indexlibrarymember{error_or}{expected}% +\begin{itemdecl} +template constexpr E error_or(G&& e) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\mandates +\tcode{is_copy_constructible_v} is \tcode{true} and +\tcode{is_convertible_v} is \tcode{true}. + +\pnum +\returns +\tcode{std::forward(e)} if \tcode{has_value()} is \tcode{true}, +\tcode{error()} otherwise. +\end{itemdescr} + +\indexlibrarymember{error_or}{expected}% +\begin{itemdecl} +template constexpr E error_or(G&& e) &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\mandates +\tcode{is_move_constructible_v} is \tcode{true} and +\tcode{is_convertible_v} is \tcode{true}. + +\pnum +\returns +\tcode{std::forward(e)} if \tcode{has_value()} is \tcode{true}, +\tcode{std::move(error())} otherwise. +\end{itemdescr} + +\rSec3[expected.object.monadic]{Monadic operations} + +\indexlibrarymember{and_then}{expected}% +\begin{itemdecl} +template constexpr auto and_then(F&& f) &; +template constexpr auto and_then(F&& f) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{U} be \tcode{remove_cvref_t>}. + +\pnum +\constraints +\tcode{is_copy_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{U} is a specialization of \tcode{expected} and +\tcode{is_same_v} is \tcode{true}. + +\pnum +\effects +Equivalent to: +\begin{codeblock} +if (has_value()) + return invoke(std::forward(f), value()); +else + return U(unexpect, error()); +\end{codeblock} +\end{itemdescr} + +\indexlibrarymember{and_then}{expected}% +\begin{itemdecl} +template constexpr auto and_then(F&& f) &&; +template constexpr auto and_then(F&& f) const &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{U} be +\tcode{remove_cvref_t>}. + +\pnum +\constraints +\tcode{is_move_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{U} is a specialization of \tcode{expected} and +\tcode{is_same_v} is \tcode{true}. + +\pnum +\effects +Equivalent to: +\begin{codeblock} +if (has_value()) + return invoke(std::forward(f), std::move(value())); +else + return U(unexpect, std::move(error())); +\end{codeblock} +\end{itemdescr} + +\indexlibrarymember{or_else}{expected}% +\begin{itemdecl} +template constexpr auto or_else(F&& f) &; +template constexpr auto or_else(F&& f) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{G} be \tcode{remove_cvref_t>}. + +\pnum +\constraints +\tcode{is_copy_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{G} is a specialization of \tcode{expected} and +\tcode{is_same_v} is \tcode{true}. + +\pnum +\effects +Equivalent to: +\begin{codeblock} +if (has_value()) + return G(in_place, value()); +else + return invoke(std::forward(f), error()); +\end{codeblock} +\end{itemdescr} + +\indexlibrarymember{or_else}{expected}% +\begin{itemdecl} +template constexpr auto or_else(F&& f) &&; +template constexpr auto or_else(F&& f) const &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{G} be +\tcode{remove_cvref_t>}. + +\pnum +\constraints +\tcode{is_move_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{G} is a specialization of \tcode{expected} and +\tcode{is_same_v} is \tcode{true}. + +\pnum +\effects +Equivalent to: +\begin{codeblock} +if (has_value()) + return G(in_place, std::move(value())); +else + return invoke(std::forward(f), std::move(error())); +\end{codeblock} +\end{itemdescr} + +\indexlibrarymember{transform}{expected}% +\begin{itemdecl} +template constexpr auto transform(F&& f) &; +template constexpr auto transform(F&& f) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{U} be +\tcode{remove_cv_t>}. + +\pnum +\constraints +\tcode{is_copy_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{U} is a valid value type for \tcode{expected}. +If \tcode{is_void_v} is \tcode{false}, +the declaration +\begin{codeblock} +U u(invoke(std::forward(f), value())); +\end{codeblock} +is well-formed. + +\pnum +\effects +\begin{itemize} +\item +If \tcode{has_value()} is \tcode{false}, returns +\tcode{expected(unexpect, error())}. +\item +Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an +\tcode{expected} object whose \exposid{has_val} member is \tcode{true} +and \exposid{val} member is direct-non-list-initialized with +\tcode{invoke(std::forward(f), value())}. +\item +Otherwise, evaluates \tcode{invoke(std::forward(f), value())} and then +returns \tcode{expected()}. +\end{itemize} +\end{itemdescr} + +\indexlibrarymember{transform}{expected}% +\begin{itemdecl} +template constexpr auto transform(F&& f) &&; +template constexpr auto transform(F&& f) const &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{U} be +\tcode{remove_cv_t>}. + +\pnum +\constraints +\tcode{is_move_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{U} is a valid value type for \tcode{expected}. If \tcode{is_void_v} is +\tcode{false}, the declaration +\begin{codeblock} +U u(invoke(std::forward(f), std::move(value()))); +\end{codeblock} +is well-formed for some invented variable \tcode{u}. + +\pnum +\effects +\begin{itemize} +\item +If \tcode{has_value()} is \tcode{false}, returns +\tcode{expected(unexpect, std::move(error()))}. +\item +Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an +\tcode{expected} object whose \exposid{has_val} member is \tcode{true} +and \exposid{val} member is direct-non-list-initialized with +\tcode{invoke(std::forward(f), std::move(value()))}. +\item +Otherwise, evaluates \tcode{invoke(std::forward(f), std::move(value()))} and +then returns \tcode{expected()}. +\end{itemize} +\end{itemdescr} + +\indexlibrarymember{transform_error}{expected}% +\begin{itemdecl} +template constexpr auto transform_error(F&& f) &; +template constexpr auto transform_error(F&& f) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{G} be \tcode{remove_cv_t>}. + +\pnum +\constraints +\tcode{is_copy_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{G} is a valid value type for \tcode{expected} and the declaration +\begin{codeblock} +G g(invoke(std::forward(f), error())); +\end{codeblock} +is well-formed. + +\pnum +\returns +If \tcode{has_value()} is \tcode{true}, +\tcode{expected(in_place, value())}; otherwise, an \tcode{expected} +object whose \exposid{has_val} member is \tcode{false} and \exposid{unex} member +is direct-non-list-initialized with \tcode{invoke(std::forward(f), error())}. +\end{itemdescr} + +\indexlibrarymember{transform_error}{expected}% +\begin{itemdecl} +template constexpr auto transform_error(F&& f) &&; +template constexpr auto transform_error(F&& f) const &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{G} be +\tcode{remove_cv_t>}. + +\pnum +\constraints +\tcode{is_move_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{G} is a valid value type for \tcode{expected} and the declaration +\begin{codeblock} +G g(invoke(std::forward(f), std::move(error()))); +\end{codeblock} +is well-formed. + +\pnum +\returns +If \tcode{has_value()} is \tcode{true}, +\tcode{expected(in_place, std::move(value()))}; otherwise, an +\tcode{expected} object whose \exposid{has_val} member is \tcode{false} +and \exposid{unex} member is direct-non-list-initialized with +\tcode{invoke(std::forward(f), std::move(error()))}. +\end{itemdescr} + \rSec3[expected.object.eq]{Equality operators} \indexlibrarymember{operator==}{expected}% @@ -8301,7 +8620,7 @@ template using @\libmember{rebind}{expected}@ = expected; - // \ref{expected.void.ctor}, constructors + // \ref{expected.void.cons}, constructors constexpr expected() noexcept; constexpr expected(const expected&); constexpr expected(expected&&) noexcept(@\seebelow@); @@ -8311,9 +8630,9 @@ constexpr explicit(@\seebelow@) expected(expected&&); template - constexpr expected(const unexpected&); + constexpr explicit(@\seebelow@) expected(const unexpected&); template - constexpr expected(unexpected&&); + constexpr explicit(@\seebelow@) expected(unexpected&&); constexpr explicit expected(in_place_t) noexcept; template @@ -8348,6 +8667,26 @@ constexpr E& error() & noexcept; constexpr const E&& error() const && noexcept; constexpr E&& error() && noexcept; + template constexpr E error_or(G&&) const &; + template constexpr E error_or(G&&) &&; + + // \ref{expected.void.monadic}, monadic operations + template constexpr auto and_then(F&& f) &; + template constexpr auto and_then(F&& f) &&; + template constexpr auto and_then(F&& f) const &; + template constexpr auto and_then(F&& f) const &&; + template constexpr auto or_else(F&& f) &; + template constexpr auto or_else(F&& f) &&; + template constexpr auto or_else(F&& f) const &; + template constexpr auto or_else(F&& f) const &&; + template constexpr auto transform(F&& f) &; + template constexpr auto transform(F&& f) &&; + template constexpr auto transform(F&& f) const &; + template constexpr auto transform(F&& f) const &&; + template constexpr auto transform_error(F&& f) &; + template constexpr auto transform_error(F&& f) &&; + template constexpr auto transform_error(F&& f) const &; + template constexpr auto transform_error(F&& f) const &&; // \ref{expected.void.eq}, equality operators template requires is_void_v @@ -8382,7 +8721,7 @@ \tcode{E} shall meet the requirements of \oldconcept{Destructible} (\tref{cpp17.destructible}). -\rSec3[expected.void.ctor]{Constructors} +\rSec3[expected.void.cons]{Constructors} \indexlibraryctor{expected}% \begin{itemdecl} @@ -8876,6 +9215,288 @@ \tcode{std::move(\exposid{unex})}. \end{itemdescr} +\indexlibrarymember{error_or}{expected}% +\begin{itemdecl} +template constexpr E error_or(G&& e) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\mandates +\tcode{is_copy_constructible_v} is \tcode{true} and +\tcode{is_convertible_v} is \tcode{true}. + +\pnum +\returns +\tcode{std::forward(e)} if \tcode{has_value()} is \tcode{true}, +\tcode{error()} otherwise. +\end{itemdescr} + +\indexlibrarymember{error_or}{expected}% +\begin{itemdecl} +template constexpr E error_or(G&& e) &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\mandates +\tcode{is_move_constructible_v} is \tcode{true} and +\tcode{is_convertible_v} is \tcode{true}. + +\pnum +\returns +\tcode{std::forward(e)} if \tcode{has_value()} is \tcode{true}, +\tcode{std::move(error())} otherwise. +\end{itemdescr} + +\rSec3[expected.void.monadic]{Monadic operations} + +\indexlibrarymember{and_then}{expected}% +\begin{itemdecl} +template constexpr auto and_then(F&& f) &; +template constexpr auto and_then(F&& f) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{U} be \tcode{remove_cvref_t>}. + +\pnum +\constraints +\tcode{is_copy_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{U} is a specialization of \tcode{expected} and +\tcode{is_same_v} is \tcode{true}. + +\pnum +\effects +Equivalent to: +\begin{codeblock} +if (has_value()) + return invoke(std::forward(f)); +else + return U(unexpect, error()); +\end{codeblock} +\end{itemdescr} + +\indexlibrarymember{and_then}{expected}% +\begin{itemdecl} +template constexpr auto and_then(F&& f) &&; +template constexpr auto and_then(F&& f) const &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{U} be \tcode{remove_cvref_t>}. + +\pnum +\constraints +\tcode{is_move_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{U} is a specialization of \tcode{expected} and +\tcode{is_same_v} is \tcode{true}. + +\pnum +\effects +Equivalent to: +\begin{codeblock} +if (has_value()) + return invoke(std::forward(f)); +else + return U(unexpect, std::move(error())); +\end{codeblock} +\end{itemdescr} + +\indexlibrarymember{or_else}{expected}% +\begin{itemdecl} +template constexpr auto or_else(F&& f) &; +template constexpr auto or_else(F&& f) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{G} be \tcode{remove_cvref_t>}. + +\pnum +\mandates +\tcode{G} is a specialization of \tcode{expected} and +\tcode{is_same_v} is \tcode{true}. + +\pnum +\effects +Equivalent to: +\begin{codeblock} +if (has_value()) + return G(); +else + return invoke(std::forward(f), error()); +\end{codeblock} +\end{itemdescr} + +\indexlibrarymember{or_else}{expected}% +\begin{itemdecl} +template constexpr auto or_else(F&& f) &&; +template constexpr auto or_else(F&& f) const &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{G} be +\tcode{remove_cvref_t>}. + +\pnum +\mandates +\tcode{G} is a specialization of \tcode{expected} and +\tcode{is_same_v} is \tcode{true}. + +\pnum +\effects +Equivalent to: +\begin{codeblock} +if (has_value()) + return G(); +else + return invoke(std::forward(f), std::move(error())); +\end{codeblock} +\end{itemdescr} + +\indexlibrarymember{transform}{expected}% +\begin{itemdecl} +template constexpr auto transform(F&& f) &; +template constexpr auto transform(F&& f) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{U} be \tcode{remove_cv_t>}. + +\pnum +\constraints +\tcode{is_copy_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{U} is a valid value type for \tcode{expected}. If \tcode{is_void_v} is +\tcode{false}, the declaration +\begin{codeblock} +U u(invoke(std::forward(f))); +\end{codeblock} +is well-formed. + +\pnum +\effects +\begin{itemize} +\item +If \tcode{has_value()} is \tcode{false}, returns +\tcode{expected(unexpect, error())}. +\item +Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an +\tcode{expected} object whose \exposid{has_val} member is \tcode{true} and +\exposid{val} member is direct-non-list-initialized with +\tcode{invoke(std::forward(f))}. +\item +Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns +\tcode{expected()}. +\end{itemize} +\end{itemdescr} + +\indexlibrarymember{transform}{expected}% +\begin{itemdecl} +template constexpr auto transform(F&& f) &&; +template constexpr auto transform(F&& f) const &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{U} be \tcode{remove_cv_t>}. + +\pnum +\constraints +\tcode{is_move_constructible_v} is \tcode{true}. + +\pnum +\mandates +\tcode{U} is a valid value type for \tcode{expected}. If \tcode{is_void_v} is +\tcode{false}, the declaration +\begin{codeblock} +U u(invoke(std::forward(f))); +\end{codeblock} +is well-formed. + +\pnum +\effects +\begin{itemize} +\item +If \tcode{has_value()} is \tcode{false}, returns +\tcode{expected(unexpect, std::move(error()))}. +\item +Otherwise, if \tcode{is_void_v} is \tcode{false}, returns an +\tcode{expected} object whose \exposid{has_val} member is \tcode{true} and +\exposid{val} member is direct-non-list-initialized with +\tcode{invoke(std::forward(f))}. +\item +Otherwise, evaluates \tcode{invoke(std::forward(f))} and then returns +\tcode{expected()}. +\end{itemize} +\end{itemdescr} + +\indexlibrarymember{transform_error}{expected}% +\begin{itemdecl} +template constexpr auto transform_error(F&& f) &; +template constexpr auto transform_error(F&& f) const &; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{G} be \tcode{remove_cv_t>}. + +\pnum +\mandates +\tcode{G} is a valid value type for \tcode{expected} and the declaration +\begin{codeblock} +G g(invoke(std::forward(f), error())); +\end{codeblock} +is well-formed. + +\pnum +\returns +If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an +\tcode{expected} object whose \exposid{has_val} member is \tcode{false} +and \exposid{unex} member is direct-non-list-initialized with +\tcode{invoke(std::for\-ward(f), error())}. +\end{itemdescr} + +\indexlibrarymember{transform_error}{expected}% +\begin{itemdecl} +template constexpr auto transform_error(F&& f) &&; +template constexpr auto transform_error(F&& f) const &&; +\end{itemdecl} + +\begin{itemdescr} +\pnum +Let \tcode{G} be +\tcode{remove_cv_t>}. + +\pnum +\mandates +\tcode{G} is a valid value type for \tcode{expected} and the declaration +\begin{codeblock} +G g(invoke(std::forward(f), std::move(error()))); +\end{codeblock} +is well-formed. + +\pnum +\returns +If \tcode{has_value()} is \tcode{true}, \tcode{expected()}; otherwise, an +\tcode{expected} object whose \exposid{has_val} member is \tcode{false} +and \exposid{unex} member is direct-non-list-initialized with +\tcode{invoke(std::for\-ward(f), std::move(error()))}. +\end{itemdescr} + \rSec3[expected.void.eq]{Equality operators} \indexlibrarymember{operator==}{expected}% @@ -8993,6 +9614,8 @@ constexpr bitset& operator^=(const bitset& rhs) noexcept; constexpr bitset& operator<<=(size_t pos) noexcept; constexpr bitset& operator>>=(size_t pos) noexcept; + constexpr bitset operator<<(size_t pos) const noexcept; + constexpr bitset operator>>(size_t pos) const noexcept; constexpr bitset& set() noexcept; constexpr bitset& set(size_t pos, bool val = true); constexpr bitset& reset() noexcept; @@ -9002,8 +9625,8 @@ constexpr bitset& flip(size_t pos); // element access - constexpr bool operator[](size_t pos) const; // for \tcode{b[i];} - constexpr reference operator[](size_t pos); // for \tcode{b[i];} + constexpr bool operator[](size_t pos) const; + constexpr reference operator[](size_t pos); constexpr unsigned long to_ulong() const; constexpr unsigned long long to_ullong() const; @@ -9013,6 +9636,7 @@ constexpr basic_string to_string(charT zero = charT('0'), charT one = charT('1')) const; + // observers constexpr size_t count() const noexcept; constexpr size_t size() const noexcept; constexpr bool operator==(const bitset& rhs) const noexcept; @@ -9020,8 +9644,6 @@ constexpr bool all() const noexcept; constexpr bool any() const noexcept; constexpr bool none() const noexcept; - constexpr bitset operator<<(size_t pos) const noexcept; - constexpr bitset operator>>(size_t pos) const noexcept; }; // \ref{bitset.hash}, hash support @@ -9281,6 +9903,28 @@ \tcode{*this}. \end{itemdescr} +\indexlibrarymember{operator<<}{bitset}% +\begin{itemdecl} +constexpr bitset operator<<(size_t pos) const noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +\tcode{bitset(*this) <<= pos}. +\end{itemdescr} + +\indexlibrarymember{operator>>}{bitset}% +\begin{itemdecl} +constexpr bitset operator>>(size_t pos) const noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +\tcode{bitset(*this) >>= pos}. +\end{itemdescr} + % Do not use \indexlibrarymember. \indexlibrary{\idxcode{set} (member)!\idxcode{bitset}}% \indexlibrary{\idxcode{bitset}!\idxcode{set}}% @@ -9415,6 +10059,59 @@ \tcode{out_of_range} if \tcode{pos} does not correspond to a valid bit position. \end{itemdescr} +\indexlibrarymember{operator[]}{bitset}% +\begin{itemdecl} +constexpr bool operator[](size_t pos) const; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\expects +\tcode{pos} is valid. + +\pnum +\returns +\tcode{true} if the bit at position \tcode{pos} in \tcode{*this} has the value +one, otherwise \tcode{false}. + +\pnum +\throws +Nothing. +\end{itemdescr} + +\indexlibrarymember{operator[]}{bitset}% +\begin{itemdecl} +constexpr bitset::reference operator[](size_t pos); +\end{itemdecl} + +\begin{itemdescr} +\pnum +\expects +\tcode{pos} is valid. + +\pnum +\returns +An object of type +\tcode{bitset::reference} +such that +\tcode{(*this)[pos] == this->test(pos)}, +and such that +\tcode{(*this)[pos] = val} +is equivalent to +\tcode{this->set(pos, val)}. + +\pnum +\throws +Nothing. + +\pnum +\remarks +For the purpose of determining the presence of a data +race\iref{intro.multithread}, any access or update through the resulting +reference potentially accesses or modifies, respectively, the entire +underlying bitset. +\end{itemdescr} + \indexlibrarymember{to_ulong}{bitset}% \begin{itemdecl} constexpr unsigned long to_ulong() const; @@ -9570,81 +10267,6 @@ \tcode{count() == 0}. \end{itemdescr} -\indexlibrarymember{operator<<}{bitset}% -\begin{itemdecl} -constexpr bitset operator<<(size_t pos) const noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns -\tcode{bitset(*this) <<= pos}. -\end{itemdescr} - -\indexlibrarymember{operator>>}{bitset}% -\begin{itemdecl} -constexpr bitset operator>>(size_t pos) const noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns -\tcode{bitset(*this) >>= pos}. -\end{itemdescr} - -\indexlibrarymember{operator[]}{bitset}% -\begin{itemdecl} -constexpr bool operator[](size_t pos) const; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\expects -\tcode{pos} is valid. - -\pnum -\returns -\tcode{true} if the bit at position \tcode{pos} in \tcode{*this} has the value -one, otherwise \tcode{false}. - -\pnum -\throws -Nothing. -\end{itemdescr} - -\indexlibrarymember{operator[]}{bitset}% -\begin{itemdecl} -constexpr bitset::reference operator[](size_t pos); -\end{itemdecl} - -\begin{itemdescr} -\pnum -\expects -\tcode{pos} is valid. - -\pnum -\returns -An object of type -\tcode{bitset::reference} -such that -\tcode{(*this)[pos] == this->test(pos)}, -and such that -\tcode{(*this)[pos] = val} -is equivalent to -\tcode{this->set(pos, val)}. - -\pnum -\throws -Nothing. - -\pnum -\remarks -For the purpose of determining the presence of a data -race\iref{intro.multithread}, any access or update through the resulting -reference potentially accesses or modifies, respectively, the entire -underlying bitset. -\end{itemdescr} - \rSec2[bitset.hash]{\tcode{bitset} hash support} \indexlibraryglobal{hash_code}% @@ -9730,10 +10352,9 @@ \end{itemize} \pnum -If \tcode{N > 0} and no characters are stored in \tcode{str}, calls -\tcode{is.setstate(ios_base::failbit)} -(which may throw -\tcode{ios_base::failure}\iref{iostate.flags}). +If \tcode{N > 0} and no characters are stored in \tcode{str}, +\tcode{ios_base::failbit} is set in the input function's local error state +before \tcode{setstate} is called. \pnum \returns @@ -9872,11 +10493,11 @@ // \ref{func.bind}, bind template struct is_bind_expression; // freestanding template - inline constexpr bool @\libglobal{is_bind_expression_v}@ = // freestanding + constexpr bool @\libglobal{is_bind_expression_v}@ = // freestanding is_bind_expression::value; template struct is_placeholder; // freestanding template - inline constexpr int @\libglobal{is_placeholder_v}@ = // freestanding + constexpr int @\libglobal{is_placeholder_v}@ = // freestanding is_placeholder::value; template @@ -10007,6 +10628,7 @@ \rSec2[func.require]{Requirements} \pnum +\indextext{invoke@\tcode{\placeholder{INVOKE}}}% \indexlibrary{invoke@\tcode{\placeholder{INVOKE}}}% Define \tcode{\placeholdernc{INVOKE}(f, t$_1$, t$_2$, $\dotsc$, t$_N$)} as follows: \begin{itemize} @@ -10179,7 +10801,8 @@ // \ref{refwrap.invoke}, invocation template - constexpr invoke_result_t operator()(ArgTypes&&...) const; + constexpr invoke_result_t operator()(ArgTypes&&...) const + noexcept(is_nothrow_invocable_v); }; template @@ -10288,7 +10911,7 @@ \begin{itemdecl} template constexpr invoke_result_t - operator()(ArgTypes&&... args) const; + operator()(ArgTypes&&... args) const noexcept(is_nothrow_invocable_v); \end{itemdecl} \begin{itemdescr} @@ -11633,8 +12256,20 @@ \end{codeblock} \pnum +\indexlibraryglobal{placeholders}% +\indexlibrary{1@\tcode{_1}}% +\indexlibrary{2@\tcode{_2}}% +\indexlibrary{3@\tcode{_3}}% +\indexlibrary{4@\tcode{_4}}% +\indexlibrary{5@\tcode{_5}}% +\indexlibrary{6@\tcode{_6}}% +\indexlibrary{7@\tcode{_7}}% +\indexlibrary{8@\tcode{_8}}% +\indexlibrary{9@\tcode{_9}}% +\indexlibrary{10@\tcode{_10}}% The class template \tcode{is_placeholder} can be used to detect the standard placeholders -\tcode{_1}, \tcode{_2}, and so on. The function template \tcode{bind} uses +\tcode{_1}, \tcode{_2}, and so on\iref{func.bind.place}. +The function template \tcode{bind} uses \tcode{is_placeholder} to detect placeholders. \pnum @@ -11767,9 +12402,22 @@ \indexlibraryglobal{placeholders}% \indexlibrary{1@\tcode{_1}}% +\indexlibrary{2@\tcode{_2}}% +\indexlibrary{3@\tcode{_3}}% +\indexlibrary{4@\tcode{_4}}% +\indexlibrary{5@\tcode{_5}}% +\indexlibrary{6@\tcode{_6}}% +\indexlibrary{7@\tcode{_7}}% +\indexlibrary{8@\tcode{_8}}% +\indexlibrary{9@\tcode{_9}}% +\indexlibrary{10@\tcode{_10}}% +% FIXME: Fomatting for M and the members _1, _2, _M below, +% as well as their usages elsewhere is inconsistent. +% Should they all follow the formatting used in delcaration of +% "namespace placeholders" in [functional.syn]? \begin{codeblock} namespace std::placeholders { - // M is the \impldef{number of placeholders for bind expressions} number of placeholders + // M is the number of placeholders @\seebelow@ _1; @\seebelow@ _2; . @@ -11779,6 +12427,10 @@ } \end{codeblock} +\pnum +The number \tcode{\placeholder{M}} of placeholders is +\impldef{number of placeholders for bind expressions}. + \pnum All placeholder types meet the \oldconcept{DefaultConstructible} and \oldconcept{CopyConstructible} requirements, and @@ -11802,7 +12454,8 @@ \indextext{function object!binders|)} \pnum -Placeholders are freestanding entities\iref{freestanding.entity}. +\indextext{placeholders!freestanding item}% +Placeholders are freestanding items\iref{freestanding.item}. \rSec2[func.memfn]{Function template \tcode{mem_fn}}% \indextext{function object!\idxcode{mem_fn}|(} @@ -12334,7 +12987,7 @@ there is a placeholder \placeholder{inv-quals} defined as follows: \begin{itemize} \item -If \placeholder{ref} is empty, let \placeholder{inv-quals} be \tcode{\cv{}\&}, +If \placeholder{ref} is empty, let \placeholder{inv-quals} be \cv{}\tcode{\&}, \item otherwise, let \placeholder{inv-quals} be \cv{} \placeholder{ref}. \end{itemize} @@ -12400,7 +13053,7 @@ \rSec4[func.wrap.move.ctor]{Constructors, assignment, and destructor} -\indexlibrarymember{\exposid{is-callable-from}}{move_only_function}% +\indextext{move_only_function::is-callable-from@\tcode{move_only_function::\exposid{is-callable-from}}}% \begin{itemdecl} template static constexpr bool @\exposid{is-callable-from}@ = @\seebelow@; @@ -13057,7 +13710,7 @@ with \tcode{Key} as the function call argument type, the \oldconcept{Default\-Constructible} requirements (\tref{cpp17.defaultconstructible}), the \oldconcept{CopyAssignable} requirements (\tref{cpp17.copyassignable}), -\item be swappable\iref{swappable.requirements} for lvalues, +the \oldconcept{Swappable} requirements\iref{swappable.requirements}, \item meet the requirement that if \tcode{k1 == k2} is \tcode{true}, \tcode{h(k1) == h(k2)} is also \tcode{true}, where \tcode{h} is an object of type \tcode{hash} and \tcode{k1} and \tcode{k2} are objects of type \tcode{Key}; @@ -13273,7 +13926,7 @@ namespace std { // \ref{execpol.type}, execution policy type trait template struct is_execution_policy; - template inline constexpr bool @\libglobal{is_execution_policy_v}@ = is_execution_policy::value; + template constexpr bool @\libglobal{is_execution_policy_v}@ = is_execution_policy::value; } namespace std::execution { @@ -14341,7 +14994,7 @@ implementations should estimate the width of a string as the sum of estimated widths of the first code points in its extended grapheme clusters. -The extended grapheme clusters of a string are defined by UAX \#29. +The extended grapheme clusters of a string are defined by \UAX{29}. The estimated width of the following code points is 2: \begin{itemize} \item \ucode{1100} -- \ucode{115f} @@ -14639,7 +15292,7 @@ \begin{codeblock} to_chars(first, last, reinterpret_cast(value), 16) \end{codeblock} -with the prefix \tcode{0x} added to the output; +with the prefix \tcode{0x} inserted immediately before the output of \tcode{to_chars}; otherwise, implementation-defined. \\ \end{floattable} @@ -14979,25 +15632,18 @@ \rSec3[formatter.requirements]{Formatter requirements} \pnum -A type \tcode{F} meets the \defnnewoldconcept{BasicFormatter} requirements if: -\begin{itemize} -\item +A type \tcode{F} meets the \defnnewoldconcept{BasicFormatter} requirements if it meets the \begin{itemize} \item \oldconcept{DefaultConstructible} (\tref{cpp17.defaultconstructible}), \item \oldconcept{CopyConstructible} (\tref{cpp17.copyconstructible}), -\item \oldconcept{CopyAssignable} (\tref{cpp17.copyassignable}), and +\item \oldconcept{CopyAssignable} (\tref{cpp17.copyassignable}), +\item \oldconcept{Swappable}\iref{swappable.requirements}, and \item \oldconcept{Destructible} (\tref{cpp17.destructible}) \end{itemize} -requirements, - -\item -it is swappable\iref{swappable.requirements} for lvalues, and - -\item +requirements, and the expressions shown in \tref{formatter.basic} are valid and have the indicated semantics. -\end{itemize} \pnum A type \tcode{F} meets the \defnnewoldconcept{Formatter} requirements @@ -15010,7 +15656,8 @@ \tcode{Out}, and formatting argument type \tcode{T}, in \tref{formatter.basic} and \tref{formatter}: \begin{itemize} -\item \tcode{f} is a value of type \tcode{F}, +\item \tcode{f} is a value of type (possibly const) \tcode{F}, +\item \tcode{g} is an lvalue of type \tcode{F}, \item \tcode{u} is an lvalue of type \tcode{T}, \item \tcode{t} is a value of a type convertible to (possibly const) \tcode{T}, \item \tcode{PC} is \tcode{basic_format_parse_context}, @@ -15030,7 +15677,7 @@ {p{1.2in}p{1in}p{2.9in}} \topline \hdstyle{Expression} & \hdstyle{Return type} & \hdstyle{Requirement} \\ \capsep -\tcode{f.parse(pc)} & +\tcode{g.parse(pc)} & \tcode{PC::iterator} & Parses \fmtgrammarterm{format-spec}\iref{format.string} for type \tcode{T} @@ -15228,7 +15875,7 @@ const char* color_names[] = { "red", "green", "blue" }; template<> struct std::formatter : std::formatter { - auto format(color c, format_context& ctx) { + auto format(color c, format_context& ctx) const { return formatter::format(color_names[c], ctx); } }; @@ -15288,7 +15935,7 @@ a UCS scalar value whose Unicode property \tcode{General_Category} has a value in the groups \tcode{Separator} (\tcode{Z}) or \tcode{Other} (\tcode{C}) or to a UCS scalar value which has the Unicode property \tcode{Grapheme_Extend=Yes}, -as described by table 12 of UAX \#44, or +as described by table 12 of \UAX{44}, or \item \placeholder{CE} is not a Unicode encoding and @@ -15382,8 +16029,7 @@ // The following examples assume use of the UTF-8 encoding string s4 = format("[{:?}]", string("\0 \n \t \x02 \x1b", 9)); // \tcode{s4} has value: \tcode{["\textbackslash u\{0\} \textbackslash n \textbackslash t \textbackslash u\{2\} \textbackslash u\{1b\}"]} -string s5 = format("[{:?}]", "\xc3\x28"); // invalid UTF-8 - // \tcode{s5} has value: \tcode{["\textbackslash x\{c3\}\textbackslash x\{28\}"]} +string s5 = format("[{:?}]", "\xc3\x28"); // invalid UTF-8, \tcode{s5} has value: \tcode{["\textbackslash x\{c3\}("]} \end{codeblock} \end{example} @@ -15662,7 +16308,7 @@ } // Formats an \tcode{S} with width given by the argument \tcode{width_arg_id}. - auto format(S s, format_context& ctx) { + auto format(S s, format_context& ctx) const { int width = visit_format_arg([](auto value) -> int { if constexpr (!is_integral_v) throw format_error("width is not integral"); @@ -15975,7 +16621,7 @@ \rSec3[format.range.fmtdef]{Class template \exposid{range-default-formatter}} -\indexlibraryglobal{\exposid{range-default-formatter}}% +\indexlibrary{range-default-formatter@\exposid{range-default-formatter}}% \begin{codeblock} namespace std { template @@ -16001,7 +16647,7 @@ } \end{codeblock} -\indexlibrarymember{set_separator}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{set_separator}{range-default-formatter}% \begin{itemdecl} constexpr void set_separator(basic_string_view sep); \end{itemdecl} @@ -16012,7 +16658,7 @@ Equivalent to: \tcode{\exposid{underlying_}.set_separator(sep);} \end{itemdescr} -\indexlibrarymember{set_brackets}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{set_brackets}{range-default-formatter}% \begin{itemdecl} constexpr void set_brackets(basic_string_view opening, basic_string_view closing); \end{itemdecl} @@ -16023,7 +16669,7 @@ Equivalent to: \tcode{\exposid{underlying_}.set_brackets(opening, closing);} \end{itemdescr} -\indexlibrarymember{parse}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{parse}{range-default-formatter}% \begin{itemdecl} template constexpr typename ParseContext::iterator @@ -16036,7 +16682,7 @@ Equivalent to: \tcode{return \exposid{underlying_}.parse(ctx);} \end{itemdescr} -\indexlibrarymember{format}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{format}{range-default-formatter}% \begin{itemdecl} template typename FormatContext::iterator @@ -16051,7 +16697,7 @@ \rSec3[format.range.fmtmap]{Specialization of \exposid{range-default-formatter} for maps} -\indexlibraryglobal{\exposid{range-default-formatter}}% +\indexlibrary{range-default-formatter@\exposid{range-default-formatter}}% \begin{codeblock} namespace std { template @@ -16061,6 +16707,7 @@ using @\exposidnc{element-type}@ = // \expos remove_cvref_t>; range_formatter<@\exposidnc{element-type}@, charT> @\exposid{underlying_}@; // \expos + public: constexpr @\exposid{range-default-formatter}@(); @@ -16075,7 +16722,7 @@ } \end{codeblock} -\indexlibraryctor{\exposid{range-default-formatter}}% +\indexlibrarymisc{range-default-formatter@\exposid{range-default-formatter}}{constructor}% \begin{itemdecl} constexpr @\exposid{range-default-formatter}@(); \end{itemdecl} @@ -16102,7 +16749,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{parse}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{parse}{range-default-formatter}% \begin{itemdecl} template constexpr typename ParseContext::iterator @@ -16115,7 +16762,7 @@ Equivalent to: \tcode{return \exposid{underlying_}.parse(ctx);} \end{itemdescr} -\indexlibrarymember{format}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{format}{range-default-formatter}% \begin{itemdecl} template typename FormatContext::iterator @@ -16130,7 +16777,7 @@ \rSec3[format.range.fmtset]{Specialization of \exposid{range-default-formatter} for sets} -\indexlibraryglobal{\exposid{range-default-formatter}}% +\indexlibrary{range-default-formatter@\exposid{range-default-formatter}}% \begin{codeblock} namespace std { template @@ -16154,7 +16801,7 @@ } \end{codeblock} -\indexlibraryctor{\exposid{range-default-formatter}}% +\indexlibrarymisc{range-default-formatter@\exposid{range-default-formatter}}{constructor}% \begin{itemdecl} constexpr @\exposid{range-default-formatter}@(); \end{itemdecl} @@ -16168,7 +16815,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{parse}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{parse}{range-default-formatter}% \begin{itemdecl} template constexpr typename ParseContext::iterator @@ -16181,7 +16828,7 @@ Equivalent to: \tcode{return \exposid{underlying_}.parse(ctx);} \end{itemdescr} -\indexlibrarymember{format}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{format}{range-default-formatter}% \begin{itemdecl} template typename FormatContext::iterator @@ -16196,7 +16843,7 @@ \rSec3[format.range.fmtstr]{Specialization of \exposid{range-default-formatter} for strings} -\indexlibraryglobal{\exposid{range-default-formatter}}% +\indexlibrary{range-default-formatter@\exposid{range-default-formatter}}% \begin{codeblock} namespace std { template @@ -16222,7 +16869,7 @@ \tcode{\libconcept{same_as}>, charT>} is \tcode{true}. -\indexlibrarymember{parse}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{parse}{range-default-formatter}% \begin{itemdecl} template constexpr typename ParseContext::iterator @@ -16242,7 +16889,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrarymember{format}{\exposid{range-default-formatter}}% +\indexlibrarymemberexpos{format}{range-default-formatter}% \begin{itemdecl} template typename FormatContext::iterator @@ -16562,7 +17209,7 @@ \begin{itemdescr} \pnum \effects -Equivalent to: \tcode{return visit(forward(vis), arg.value);} +Equivalent to: \tcode{return visit(std::forward(vis), arg.value);} \end{itemdescr} \rSec3[format.arg.store]{Class template \exposid{format-arg-store}} diff --git a/source/xrefdelta.tex b/source/xrefdelta.tex index f81f0a2eef..d001fc93d8 100644 --- a/source/xrefdelta.tex +++ b/source/xrefdelta.tex @@ -100,9 +100,15 @@ % P1467R9 Extended floating-point types and standard names \movedxref{complex.special}{complex.members} +\movedxref{cstdint}{support.arith.types} +\removedxref{cstdint.general} % LWG3659 Consider ATOMIC_FLAG_INIT undeprecation \removedxref{depr.atomics.flag} +% LWG3818 Exposition-only concepts are not described in library intro +\movedxref{expos.only.func}{expos.only.entity} +\removedxref{expos.only.types} + % Deprecated features. %\deprxref{old.label} (if moved to depr.old.label, otherwise use \movedxref) diff --git a/source/xrefprev b/source/xrefprev index 60227e5598..bfc3b4452f 100644 --- a/source/xrefprev +++ b/source/xrefprev @@ -31,7 +31,6 @@ \glossaryentry{defns.modifier@ {\memgloterm{defns.modifier}}{\memglodesc{(\ref {defns.modifier})}} {\memgloref{}}|memjustarg}{5} \glossaryentry{defns.move.assign@ {\memgloterm{defns.move.assign}}{\memglodesc{(\ref {defns.move.assign})}} {\memgloref{}}|memjustarg}{5} \glossaryentry{defns.move.constr@ {\memgloterm{defns.move.constr}}{\memglodesc{(\ref {defns.move.constr})}} {\memgloref{}}|memjustarg}{5} -\glossaryentry{defns.multibyte@ {\memgloterm{defns.multibyte}}{\memglodesc{(\ref {defns.multibyte})}} {\memgloref{}}|memjustarg}{5} \glossaryentry{defns.ntcts@ {\memgloterm{defns.ntcts}}{\memglodesc{(\ref {defns.ntcts})}} {\memgloref{}}|memjustarg}{5} \glossaryentry{defns.observer@ {\memgloterm{defns.observer}}{\memglodesc{(\ref {defns.observer})}} {\memgloref{}}|memjustarg}{5} \glossaryentry{defns.parameter@ {\memgloterm{defns.parameter}}{\memglodesc{(\ref {defns.parameter})}} {\memgloref{}}|memjustarg}{6} diff --git a/tools/check-source.sh b/tools/check-source.sh index db5291587d..415f6221d3 100755 --- a/tools/check-source.sh +++ b/tools/check-source.sh @@ -73,7 +73,11 @@ grep -n "// not defined" $texfiles | # Use \Cpp{} instead of C++ grep -n '^[^%]*[^{"]C++[^"}]' $texfiles | - fail 'use \Cpp{} instead' || failed=1 + fail 'use \\Cpp{} instead' || failed=1 + +# Use \caret instead of \^ +fgrep -n '\^' $texfiles | + fail 'use \\caret instead' || failed=1 # Use \unicode instead of U+nnnn grep -n 'U+' $texfiles | @@ -112,6 +116,14 @@ grep -Hne '^\\\(change\|rationale\|effect\|difficulty\|howwide\)\s.\+$' compatib grep -ne 'template\s\+<' $texlib | fail 'space between "template" and "<"' || failed=1 +# In library declarations, constexpr should not follow explicit +grep -ne '\bexplicit\b.*\bconstexpr\b' $texlib | + fail 'explicit constexpr' || failed=1 + +# In library declarations, static should not follow constexpr +grep -ne '\bconstexpr\b.*\bstatic\b' $texlib | grep -ve '\bconstexpr\b.*\bnon-static\b' | + fail 'constexpr static' || failed=1 + # "Class" heading without namespace for f in $texlib; do sed -n '/rSec[0-9].*{Class/,/\\end{codeblock}/{/\\begin{example}/,/\\end{example}/b;/\\begin{codeblock}/,/\(^namespace\)\|\(\\end{codeblock}\)/{s/template<[^>]*>//;/\(class\|struct\)[A-Za-z0-9_: ]*{/{=;p;};};}' $f | @@ -181,6 +193,16 @@ done | grep -n '\\logop{[^}]*[^andor}][^}]*}' $texfiles | fail 'bad argument for \\logop' || failed=1 +# Bad indexing for ::iterator and ::sentinel exposition-only classes +grep -Hn '\\indexlibrary\(ctor\|member\).*::\(iterator\|sentinel\)}.*' ranges.tex | + fail 'use \\exposid for iterator/sentinel member indexing' || failed=1 +# Fixup: sed -i '/indexlibrary\(member\|ctor\)/s/::\(iterator\|sentinel\)/::\\exposid{\1}/' ranges.tex + +# Do not index the exposition-only ::iterator and ::sentinel class names +grep -Hn '\\indexlibraryglobal.*::\(iterator\|sentinel\)}.*' ranges.tex | + fail 'do not index exposition-only ::iterator and ::sentinel class names' ranges.tex || failed=1 +# Fixup: sed -i '/indexlibraryglobal.*::\(iterator\|sentinel\)}.*/d' ranges.tex + # Hanging paragraphs for f in $texfiles; do sed -n '/^\\rSec/{=;p;};/^\\pnum/{s/^.*$/x/;=;p;}' $f |