diff --git a/.travis.yml b/.travis.yml index 02876d6572..2bf7dcc1b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,20 +14,16 @@ before_install: - docker run -itd -v $TRAVIS_BUILD_DIR:/$TRAVIS_REPO_SLUG --name texlive-basic godbyk/texlive-basic env: - - BUILD_TYPE=latexmk # build using latexmk, also check for overfull hboxes + - BUILD_TYPE=latexmk # build using latexmk, also apply all checks - BUILD_TYPE=make # build using Makefile - BUILD_TYPE=complete # build manually and regenerate figures, grammar, and cross-references - - BUILD_TYPE=check-whitespace # check for whitespace at the ends of lines - - BUILD_TYPE=check-newlines # check for blank lines at the ends of files - - BUILD_TYPE=check-macro-use # check for proper macro use script: # Build std.pdf - pushd source - if [ "$BUILD_TYPE" = "latexmk" ]; then docker exec -it texlive-basic bash -c "cd /$TRAVIS_REPO_SLUG/source && latexmk -pdf std -silent"; - ! grep -Fe "Overfull \\hbox" std.log && - ! grep "LaTeX Warning..There were undefined references" std.log; + ../tools/check.sh; fi - if [ "$BUILD_TYPE" = "make" ]; then docker exec -it texlive-basic bash -c "cd /$TRAVIS_REPO_SLUG/source && make -j2"; @@ -50,19 +46,6 @@ script: docker exec -it texlive-basic bash -c "cd /$TRAVIS_REPO_SLUG/source && pdflatex std"; fi - popd - # Fail if there is whitespace at the ends of any lines - - if [ "$BUILD_TYPE" = "check-whitespace" ]; then - ! grep '\s$' source/*.tex; - fi - # Fail if there are blank lines at the ends of any files - - if [ "$BUILD_TYPE" = "check-newlines" ]; then - for f in source/*.tex; do [ $(tail -c 2 $f | wc -l) -eq 1 ] || exit 1; done; - fi - # Fail if macros are used incorrectly - - if [ "$BUILD_TYPE" = "check-macro-use" ]; then - ! grep '\\opt[^{}]' source/*.tex; - ! grep 'opt{}' source/*.tex; - fi # Check to see if generated files are out-dated - pushd source - for FIGURE in *.dot; do diff --git a/papers/n4835.pdf b/papers/n4835.pdf new file mode 100644 index 0000000000..291ee317b2 Binary files /dev/null and b/papers/n4835.pdf differ diff --git a/papers/n4836.html b/papers/n4836.html new file mode 100644 index 0000000000..21c926d358 --- /dev/null +++ b/papers/n4836.html @@ -0,0 +1,617 @@ +N4836 +

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

+ +

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

+ +

Acknowledgements

+ +

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

+ +

New papers

+ + + +

Motions incorporated into working draft

+ +

Fixed application of P1643R1 (2019-07 LWG Motion 9): +two added paragraphs should have been labeled Effects: instead of Expects:.

+ +

Fixed application of P1463R1 (2019-03 LWG Motion 10): +an added != in [list.ops] has been replaced with the correct ==.

+ +

Notable editorial changes

+ +

Improved indices

+ + + +

Changes to section labels

+ + + +

Several "Preamble" sections were added to avoid hanging paragraphs.

+ +

Feature test macros

+ +

An explicit synopsis for the <version> header has been added. +This synopsis describes the complete set of library feature test macros +and replaces the prior use of a table for this purpose. +For wording papers, we will continue to accept instructions of the form +"Add a feature test macro __cpp_lib_blah with a suitable value"; +explicit lists of edits to [version.syn] are also acceptable.

+ +

Minor editorial fixes

+ +

A log of editorial fixes made to the working draft since N4830 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 4fe8325ff6cf63055f9d064ba1b4f24614863649
+Author: S. B. Tam <cpplearner@outlook.com>
+Date:   Tue Aug 20 05:14:29 2019 +0800
+
+    [thread.jthread.class] fix typos (#3183)
+
+commit aaea74e8dcfa456043ec315511463fb6d4a80108
+Author: David Olsen <dolsen@nvidia.com>
+Date:   Mon Aug 19 14:17:33 2019 -0700
+
+    [atomics.ref.operations] Change Expects to Effects for atomic_ref::notify_{one,all} (#3180)
+
+    Fix an editorial issue that resulted from an incorrect merge.  In the
+    description of atomic_ref::notify_one and atomic_ref::notify_all in
+    [atomics.ref.operations] p25 and p27, N4830 has "Expects" in both of
+    those paragraphs.  But the paper that was merged in, P1643R1
+    ( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1643r1.html )
+    has "Effects".  "Effects" is correct, and it matches notify_one and
+    notify_all in the four other atomics-related classes.
+
+commit 538f7c69f1423551628fdc638e8c4654bf1c7662
+Author: Eelis <github.com@contacts.eelis.net>
+Date:   Mon Aug 19 23:20:53 2019 +0200
+
+    [std] Add/fix periods at end of sentences. (#3177)
+
+commit 600f1c0d1e94b0b6198c99516a95ec5ba439237a
+Author: Eelis <github.com@contacts.eelis.net>
+Date:   Mon Aug 19 23:22:26 2019 +0200
+
+    [std] Use consistent punctuation to terminate non-final list items. (#3175)
+
+commit fc240342df42f090563ed09c991c01925f1f4f27
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Mon Aug 19 23:31:56 2019 +0200
+
+    [tuple.elem] Canonicalize comments in example. (#3161)
+
+commit 221f1062d929688811aaa96c9752b54443ba29db
+Author: Dan Raviv <dan.raviv@gmail.com>
+Date:   Fri Aug 23 10:00:40 2019 +0300
+
+    [lex.key,diff.header.iso646.h] Consistent tokens order (#3190)
+
+    Order the alternative tokens in [diff.header.iso646.h] in the same way
+    they are ordered in Table 6 in [lex.key].
+
+commit 92f599b75123280d0ef17f00a1717f0ca89a19f8
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sat Aug 24 22:20:56 2019 +0200
+
+    [basic.def] Move rule on template definition here
+
+    from its original location in [temp] p3.
+
+commit ee7b223aad941219d583b4a6cbf058abb740d63f
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Tue Sep 3 14:50:19 2019 +0100
+
+    [span.syn] Fix inconsistent class key in tuple_size/tuple_element (#3211)
+
+commit fad5d71d46953f73d50e4629671dc83022f53d38
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Tue Sep 3 14:53:56 2019 +0100
+
+    [span.tuple] Simplify definition of get(span<T, I>) (#3210)
+
+commit c241ddeeb2fb2d4b9930ecc0fd84f12249953e12
+Author: Richard Smith <richard@metafoo.co.uk>
+Date:   Tue Sep 3 14:06:55 2019 -0700
+
+    [diff.cpp17] Add 'constinit' to one more list of new keywords in C++20.
+
+commit ab2ae01387d493148693ee5ae63e032eae3b0bb4
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sat Sep 14 00:25:48 2019 +0200
+
+    [basic.stc.dynamic.safety] Avoid undefined term 'dynamic object'. (#3225)
+
+commit a9f6cedab5ea58cd74f809086accc2a7779a078c
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sat Sep 14 00:40:05 2019 +0200
+
+    [temp.param] Define X in the example. (#3226)
+
+commit df69a5194d0903a8a2a574aeffd4a486d98d7122
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sat Sep 14 21:32:26 2019 +0200
+
+    [basic.stc.dynamic.safety] Fix ambiguous antecedent for 'it'. (#3228)
+
+commit af85c4c882efc554a99cf46cc0044b23ef7da322
+Author: onihusube <44743040+onihusube@users.noreply.github.com>
+Date:   Thu Sep 19 03:21:35 2019 +0900
+
+    [class.spaceship] Fix weak_ordering::equal to equivalent (#3220)
+
+commit e02bdecfb150dbd9f1086912317024d1c9d06cd7
+Author: Jonathan Wakely <cxx@kayari.org>
+Date:   Wed Sep 18 19:24:06 2019 +0100
+
+    [concepts.arithmetic] Fix notes that use undefined terms (#3223)
+
+    The terms "signed integral types" and "unsigned integral types" are not
+    defined in [basic.fundamental]. The notes are trying to talk about
+    signed/unsigned *integer* types. char and bool are not signed or
+    unsigned *integer* types, but they certainly are *integral* types, and
+    so they model one of signed_integral or unsigned_integral.
+
+commit 8fdd7d4307f1ea0ecf1af00503142f46e23bd15f
+Author: Casey Carter <Casey@Carter.net>
+Date:   Mon Sep 23 22:39:44 2019 -0700
+
+    [ostream.iterator] Correct typo (#3240)
+
+commit 7fc9efbdda5a7ff77dc28ea81f56f9479e471869
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Tue Oct 1 12:23:55 2019 +0200
+
+    [meta] Harmonize ordering in descriptions. (#3166)
+
+commit 338edc433819e6d4fc7237f29ff372d223eda150
+Author: mordante <zar-rpg@xs4all.nl>
+Date:   Tue Oct 1 12:37:11 2019 +0200
+
+    [re.regex] Rename template parameters for "assign". (#3198)
+
+    basic_regex::assign uses template parameters `class string_traits' and
+    `class A' while similar places use `class ST' and `class SA'.
+
+commit 7f45b9e37b02c9f75b9d401ae77560468bd2df5c
+Author: Thomas Köppe <tkoeppe@google.com>
+Date:   Tue Oct 1 13:20:08 2019 +0100
+
+    [list.ops] Fix misapplication of P1463R1, "!=" should be "==". (#3258)
+
+    Misapplication in 019baa941945c1c8529fcaa0288ed5e98944f7a4.
+
+    Also restore the edit "." -> ", and".
+
+commit d2cc230ad3795f6b367bfa60e6b2bac5a7644f69
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Wed Oct 2 18:17:31 2019 +0200
+
+    [lib] Remove parameter names from deleted special member functions. (#3259)
+
+commit 17d48e05aed86d965f33efc75d73addf04e7d436
+Author: Casey Carter <cartec69@gmail.com>
+Date:   Fri Oct 4 01:13:07 2019 -0700
+
+    [span.iterators] Fix typo in paragraph 5 (#3276)
+
+    "Returns: Equivalent To:" is not a library wording form, but an obvious misspelling of "Effects: Equivalent to:".
+
+commit 311f57196dc94eebcba61799401fd20bebb27c62
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Oct 4 19:20:57 2019 +0200
+
+    [concept.boolean] Avoid undefined phrase 'Boolean context'. (#3269)
+
+commit 8a13bc1a109a0b0672120da3fabec360bd6823ed
+Author: 江添亮 <boostcpp@gmail.com>
+Date:   Sun Oct 6 12:18:14 2019 +0900
+
+    [rand] Use 1.0, not 1, as a literal of floating-point type
+
+commit 63427e429d11e40a9f2796459ff31b379354f7e1
+Author: frederick-vs-ja <de34@live.cn>
+Date:   Sat Jun 15 10:54:36 2019 +0800
+
+    [move.sent.ops] Add missing description of move_sentinel::base
+
+    Or add a section like `\rSec3[move.sent.ops.conv]{Conversion}` ?
+
+commit ecbe188a5fd7d889a602180c656bddc6a125149e
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Aug 8 00:14:33 2019 +0200
+
+    [std] Harmonize cross-references for explicit casts.
+
+commit 3cd1ef2343a3aa705c97157186abbfda890835bf
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Aug 8 21:37:49 2019 +0200
+
+    [tuple] Make descriptions of non-members siblings of [tuple.tuple].
+
+commit ed20772b95de38a927d17ec6c5afaed51cec5d39
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Aug 8 21:53:52 2019 +0200
+
+    [thread.jthread.class] Rephrase introductory sentence.
+
+commit 997aa48537482815b4a1098e84496778a80884c2
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Aug 9 21:34:57 2019 +0200
+
+    [std] Hyphenate floating-point and avoid 'floating'.
+
+commit d11e53e3ac075e72d373a92a4975d2ed55298fc3
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sat Aug 10 09:18:30 2019 +0200
+
+    [std] Rename 'floating literal' to 'floating-point literal'.
+
+commit 4455bf4c5694d1fc09eaf68a75c370666467962a
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Tue Aug 20 22:04:30 2019 +0200
+
+    [temp.names] Remove misleading note.
+
+commit 37cc5affe2c52a3dde21ca38e3aa70afc756db9b
+Author: Dan Raviv <dan.raviv@gmail.com>
+Date:   Wed Aug 21 23:27:19 2019 +0300
+
+    [diff.library] Consistency for wide char types
+
+    [diff.char16] says `char16_t` and `char_32t`
+    > ...do not appear as *macro* names...
+
+    [diff.wchar.t] says `wchar_t`
+    > ...does not appear as a *type* name...
+
+commit 97977a1d742340d2198910912df3c511b8154afa
+Author: Dan Raviv <dan.raviv@gmail.com>
+Date:   Wed Aug 21 23:25:49 2019 +0300
+
+    [intro.compliance] Fix reference in footnote
+
+    It seems this footnote is supposed to point at [intro.abstract] which describes how the implementation's documentations also defines implementation-defined behavior; In the same way that the footnote in [intro.abstract] points into [intro.compliance] where it says that the documentation also includes things which are listed there.
+
+commit 94cf6f3a6408929088c546661094009ae921a725
+Author: Roger Orr <rogero@howzatt.demon.co.uk>
+Date:   Sat Aug 24 19:36:51 2019 +0100
+
+    [temp.param] Remove unused class template from example.
+
+commit 089b47bf447d5ef199380053d08b3c99734cd41c
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Wed Sep 4 00:15:56 2019 +0200
+
+    [lex.pptoken] Mention import keywords in the category list.
+
+commit 34cc4a7ce6155e75d1b5df0e9cea6d1e46cf790e
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Wed Sep 4 00:21:08 2019 +0200
+
+    [class.dtor] Group declaration properties vs. behavior.
+
+commit eaf23727c160e22a47f54419d5a66abfd672cc50
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Sep 5 21:22:41 2019 +0200
+
+    [thread.latch] Subordinate [latch.syn] and [thread.latch.class]
+
+commit 901b742c1caf74deab046599264e7d5c9862eb55
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Sat Sep 14 00:43:55 2019 +0200
+
+    [dcl.spec.auto] Add example to show variable redeclaration with 'auto'.
+
+    CWG2389 Agreement of deduced and explicitly-specified variable types
+
+commit 219506555b1a943a94db546a5d68745e1a7de242
+Author: mordante <koraq@xs4all.nl>
+Date:   Sun Oct 6 07:06:26 2019 +0200
+
+    [re.regex] Use consistent names for function parameters
+
+commit e2c85a91953b0bd672960d0cf662c85ba1ba7470
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Tue Sep 24 21:19:51 2019 +0200
+
+    [locale] Fix example.
+
+commit 081375e2d152beea2c246119bd2b2c6fa42d0954
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Tue Sep 24 21:35:07 2019 +0200
+
+    [class.temporary] Fix typo in example.
+
+commit 37ca3fadf39edb7e6453515e386e6e6c7ae46d1e
+Author: Jason Cobb <jason.e.cobb@gmail.com>
+Date:   Tue Sep 24 21:30:00 2019 -0400
+
+    [expr.prim.id] Fix immediate function id-expression requirement
+
+    Move possibilities into a list, and add "only" after "appear".
+
+    Reason for being editorial: not intent to require all programs
+    to use an "id-expression that denotes an immediate function",
+    and moving the possiblities into a list does not change the meaning.
+
+commit 2845d903cb36f7567fcda36746cac95fc43f147a
+Author: Daveed Vandevoorde <daveed@vandevoorde.com>
+Date:   Wed Sep 25 11:43:19 2019 -0400
+
+    Avoid confusion between lookup and overall overload resolution
+
+commit e71fce40a3eded0d9ff573eb41b9b1e33ce3d883
+Author: Krystian Stasiowski <sdkrystian@gmail.com>
+Date:   Sun Oct 6 01:21:02 2019 -0400
+
+    [temp.alias] Change type-id to defining-type-id in the running text
+
+     to match the portion of the grammar that it's referring to.
+
+commit b04e94bba0c7998920bd09c6cc462ccda93efaa4
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Sep 27 09:42:25 2019 +0200
+
+    [std] Introduce 'Preamble' sections to avoid hanging paragraphs.
+
+commit c3b2c86e5e218ee6e80bd170eae653a6ad0d4047
+Author: frederick-vs-ja <de34@live.cn>
+Date:   Sun Oct 6 13:23:04 2019 +0800
+
+    [class.copy.elision] Update example to match resolution of CWG 2278
+
+commit 5fe6230c72e29a8595cc8f66ba149a560282ec3e
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Oct 3 00:07:58 2019 +0200
+
+    [expr.typeid] Add note highlighting prohibition of bad function types.
+
+    Function types that can only be used for member functions
+    (because they have cv-qualifiers or a ref-qualifier)
+    cannot appear as a typeid operand.
+
+commit 599635d72caf3a9c768f5137f0bc19765ab4db2e
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Oct 3 09:39:14 2019 +0200
+
+    [atomics] Reorder members of atomic, atomic_ref, atomic_flag
+
+    for a more conventional and meaningful order.
+
+commit ca09b84c8dcd0d7d0b15923a28b1be6692ccf37d
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Oct 3 15:01:05 2019 +0200
+
+    [expr.const] Excise 'initialization full-expression'
+
+    which is an undefined term. Instead, use 'full-expression
+    of the initialization'.
+
+commit d0a0da6bdb2ff02175d4c01bf60fb3274e37f5ee
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Oct 3 15:07:56 2019 +0200
+
+    [atomics.ref.ops] Rename stable label from .operations
+
+commit 97a85b438144ba083301ce234da27f028c5a7e97
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Oct 3 15:11:30 2019 +0200
+
+    [basic.def.odr] Replace misleading 'for which' with 'where'.
+
+commit 1327a34586617c26c48e615316f243b0ebf9d6d9
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Oct 3 15:25:33 2019 +0200
+
+    [support.srcloc] Canonicalize presentation.
+
+    - Avoid hanging paragraph.
+    - Rename label [source_location.syn] to [source.location.syn].
+    - Add automated check for clean labels.
+    - Separate header synopsis from class synopsis.
+
+commit 7724f6d359e72a981206c312c9d42903e988d1bd
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Oct 4 19:10:06 2019 +0200
+
+    [class.mem] Avoid 'shall have been defined'
+
+    when describing implicit definitions of defaulted
+    special member functions.  Instead, use plain 'are'.
+
+commit 8685db27c43a5b41c0682318c07a00906fe6c7d1
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Aug 15 10:25:22 2019 +0200
+
+    [locale.numpunct,locale.moneypunct] Canonicalize local grammar presentation.
+
+    In [locale.numpunct], rename the 'integer' non-terminal
+    to 'intval', consistent with 'floatval'.
+    Also remove the superfluous 'plusminus' non-terminal.
+
+commit 03dd1b8abfe921d4e6b643cd109310c03801cbfb
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Fri Sep 13 23:43:15 2019 +0200
+
+    [over.match.funcs] Remove bullet for single-item bulleted list.
+
+commit d0e718b6a514a22118367a815107281a9a24c805
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Tue May 28 22:33:54 2019 +0200
+
+    [std] Consistently use 'immediately-declared constraint'.
+
+    Harmonize the phrasing in [expr.prim.req.compound],
+    [dcl.type.auto.deduct], [temp], and [temp.param].
+
+commit 2c2b29248d04dc0ce3c22a74a9537c0582c36ee2
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Thu Aug 8 22:06:21 2019 +0200
+
+    [version.syn] Add synopsis for <version> header.
+
+    This replaces the table of feature-test macros for the library.
+
+commit e9fb3f03f05e48aa02d36ee42305f00bc056356b
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Mon Oct 7 21:11:30 2019 +0200
+
+    [rand.predef] Add digit separators to large numbers.
+
+commit 7edac42a3b64406242c0c71b62264e05eab7e1a3
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date:   Mon Oct 7 22:24:16 2019 +0200
+
+    [intro.defs] Hyphenate parameter-type-list.
+
+commit d8935d972ee4f07f4507eea55df209ab7b1a508d
+Author: Sergey Zubkov <cubbi@cubbi.com>
+Date:   Tue Oct 8 09:25:11 2019 -0400
+
+    [expr.const] drop unused declaration from example
+
diff --git a/papers/n4836.md b/papers/n4836.md new file mode 100644 index 0000000000..971f653df8 --- /dev/null +++ b/papers/n4836.md @@ -0,0 +1,487 @@ +# N4836 Editors' Report -- Programming Languages -- C++ + +2019-10-08 +Richard Smith (editor) (Google Inc) +Thomas Köppe (co-editor) (Google DeepMind) +Jens Maurer (co-editor) +Dawn Perchik (co-editor) (Bright Side Computing, LLC) +`` + +## Acknowledgements + +Thanks to all those who have [submitted editorial +issues](https://github.com/cplusplus/draft/wiki/How-to-submit-an-editorial-issue) +and to those who have provided pull requests with fixes. + +## New papers + + * [N4835](http://wg21.link/n4835) is the current C++ working draft. It replaces [N4830](http://wg21.link/n4830). + * N4836 is this Editors' Report. + +## Motions incorporated into working draft + +Fixed application of [P1643R1](http://wg21.link/p1643r1) (2019-07 LWG Motion 9): +two added paragraphs should have been labeled *Effects:* instead of *Expects:*. + +Fixed application of [P1463R1](http://wg21.link/p1463r1) (2019-03 LWG Motion 10): +an added `!=` in [list.ops] has been replaced with the correct `==`. + +## Notable editorial changes + +### Improved indices + + * The index of library headers now shows the location of the header synopsis in boldface. + * An index presenting all concept names (including exposition-only concepts) was added. + * The main index and the index of library names now show subdivisions per letter. + +### Changes to section labels + + * [source_location.syn] -> [source.location.syn] + * [atomics.ref.operations] -> [atomics.ref.ops] + +Several "Preamble" sections were added to avoid hanging paragraphs. + +### Feature test macros + +An explicit synopsis for the `` header has been added. +This synopsis describes the complete set of library feature test macros +and replaces the prior use of a table for this purpose. +For wording papers, we will continue to accept instructions of the form +"Add a feature test macro `__cpp_lib_blah` with a suitable value"; +explicit lists of edits to [version.syn] are also acceptable. + +## Minor editorial fixes + +A log of editorial fixes made to the working draft since N4830 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/n4830...n4835). + + commit 4fe8325ff6cf63055f9d064ba1b4f24614863649 + Author: S. B. Tam + Date: Tue Aug 20 05:14:29 2019 +0800 + + [thread.jthread.class] fix typos (#3183) + + commit aaea74e8dcfa456043ec315511463fb6d4a80108 + Author: David Olsen + Date: Mon Aug 19 14:17:33 2019 -0700 + + [atomics.ref.operations] Change Expects to Effects for atomic_ref::notify_{one,all} (#3180) + + Fix an editorial issue that resulted from an incorrect merge. In the + description of atomic_ref::notify_one and atomic_ref::notify_all in + [atomics.ref.operations] p25 and p27, N4830 has "Expects" in both of + those paragraphs. But the paper that was merged in, P1643R1 + ( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1643r1.html ) + has "Effects". "Effects" is correct, and it matches notify_one and + notify_all in the four other atomics-related classes. + + commit 538f7c69f1423551628fdc638e8c4654bf1c7662 + Author: Eelis + Date: Mon Aug 19 23:20:53 2019 +0200 + + [std] Add/fix periods at end of sentences. (#3177) + + commit 600f1c0d1e94b0b6198c99516a95ec5ba439237a + Author: Eelis + Date: Mon Aug 19 23:22:26 2019 +0200 + + [std] Use consistent punctuation to terminate non-final list items. (#3175) + + commit fc240342df42f090563ed09c991c01925f1f4f27 + Author: Jens Maurer + Date: Mon Aug 19 23:31:56 2019 +0200 + + [tuple.elem] Canonicalize comments in example. (#3161) + + commit 221f1062d929688811aaa96c9752b54443ba29db + Author: Dan Raviv + Date: Fri Aug 23 10:00:40 2019 +0300 + + [lex.key,diff.header.iso646.h] Consistent tokens order (#3190) + + Order the alternative tokens in [diff.header.iso646.h] in the same way + they are ordered in Table 6 in [lex.key]. + + commit 92f599b75123280d0ef17f00a1717f0ca89a19f8 + Author: Jens Maurer + Date: Sat Aug 24 22:20:56 2019 +0200 + + [basic.def] Move rule on template definition here + + from its original location in [temp] p3. + + commit ee7b223aad941219d583b4a6cbf058abb740d63f + Author: Jonathan Wakely + Date: Tue Sep 3 14:50:19 2019 +0100 + + [span.syn] Fix inconsistent class key in tuple_size/tuple_element (#3211) + + commit fad5d71d46953f73d50e4629671dc83022f53d38 + Author: Jonathan Wakely + Date: Tue Sep 3 14:53:56 2019 +0100 + + [span.tuple] Simplify definition of get(span) (#3210) + + commit c241ddeeb2fb2d4b9930ecc0fd84f12249953e12 + Author: Richard Smith + Date: Tue Sep 3 14:06:55 2019 -0700 + + [diff.cpp17] Add 'constinit' to one more list of new keywords in C++20. + + commit ab2ae01387d493148693ee5ae63e032eae3b0bb4 + Author: Jens Maurer + Date: Sat Sep 14 00:25:48 2019 +0200 + + [basic.stc.dynamic.safety] Avoid undefined term 'dynamic object'. (#3225) + + commit a9f6cedab5ea58cd74f809086accc2a7779a078c + Author: Jens Maurer + Date: Sat Sep 14 00:40:05 2019 +0200 + + [temp.param] Define X in the example. (#3226) + + commit df69a5194d0903a8a2a574aeffd4a486d98d7122 + Author: Jens Maurer + Date: Sat Sep 14 21:32:26 2019 +0200 + + [basic.stc.dynamic.safety] Fix ambiguous antecedent for 'it'. (#3228) + + commit af85c4c882efc554a99cf46cc0044b23ef7da322 + Author: onihusube <44743040+onihusube@users.noreply.github.com> + Date: Thu Sep 19 03:21:35 2019 +0900 + + [class.spaceship] Fix weak_ordering::equal to equivalent (#3220) + + commit e02bdecfb150dbd9f1086912317024d1c9d06cd7 + Author: Jonathan Wakely + Date: Wed Sep 18 19:24:06 2019 +0100 + + [concepts.arithmetic] Fix notes that use undefined terms (#3223) + + The terms "signed integral types" and "unsigned integral types" are not + defined in [basic.fundamental]. The notes are trying to talk about + signed/unsigned *integer* types. char and bool are not signed or + unsigned *integer* types, but they certainly are *integral* types, and + so they model one of signed_integral or unsigned_integral. + + commit 8fdd7d4307f1ea0ecf1af00503142f46e23bd15f + Author: Casey Carter + Date: Mon Sep 23 22:39:44 2019 -0700 + + [ostream.iterator] Correct typo (#3240) + + commit 7fc9efbdda5a7ff77dc28ea81f56f9479e471869 + Author: Jens Maurer + Date: Tue Oct 1 12:23:55 2019 +0200 + + [meta] Harmonize ordering in descriptions. (#3166) + + commit 338edc433819e6d4fc7237f29ff372d223eda150 + Author: mordante + Date: Tue Oct 1 12:37:11 2019 +0200 + + [re.regex] Rename template parameters for "assign". (#3198) + + basic_regex::assign uses template parameters `class string_traits' and + `class A' while similar places use `class ST' and `class SA'. + + commit 7f45b9e37b02c9f75b9d401ae77560468bd2df5c + Author: Thomas Köppe + Date: Tue Oct 1 13:20:08 2019 +0100 + + [list.ops] Fix misapplication of P1463R1, "!=" should be "==". (#3258) + + Misapplication in 019baa941945c1c8529fcaa0288ed5e98944f7a4. + + Also restore the edit "." -> ", and". + + commit d2cc230ad3795f6b367bfa60e6b2bac5a7644f69 + Author: Jens Maurer + Date: Wed Oct 2 18:17:31 2019 +0200 + + [lib] Remove parameter names from deleted special member functions. (#3259) + + commit 17d48e05aed86d965f33efc75d73addf04e7d436 + Author: Casey Carter + Date: Fri Oct 4 01:13:07 2019 -0700 + + [span.iterators] Fix typo in paragraph 5 (#3276) + + "Returns: Equivalent To:" is not a library wording form, but an obvious misspelling of "Effects: Equivalent to:". + + commit 311f57196dc94eebcba61799401fd20bebb27c62 + Author: Jens Maurer + Date: Fri Oct 4 19:20:57 2019 +0200 + + [concept.boolean] Avoid undefined phrase 'Boolean context'. (#3269) + + commit 8a13bc1a109a0b0672120da3fabec360bd6823ed + Author: 江添亮 + Date: Sun Oct 6 12:18:14 2019 +0900 + + [rand] Use 1.0, not 1, as a literal of floating-point type + + commit 63427e429d11e40a9f2796459ff31b379354f7e1 + Author: frederick-vs-ja + Date: Sat Jun 15 10:54:36 2019 +0800 + + [move.sent.ops] Add missing description of move_sentinel::base + + Or add a section like `\rSec3[move.sent.ops.conv]{Conversion}` ? + + commit ecbe188a5fd7d889a602180c656bddc6a125149e + Author: Jens Maurer + Date: Thu Aug 8 00:14:33 2019 +0200 + + [std] Harmonize cross-references for explicit casts. + + commit 3cd1ef2343a3aa705c97157186abbfda890835bf + Author: Jens Maurer + Date: Thu Aug 8 21:37:49 2019 +0200 + + [tuple] Make descriptions of non-members siblings of [tuple.tuple]. + + commit ed20772b95de38a927d17ec6c5afaed51cec5d39 + Author: Jens Maurer + Date: Thu Aug 8 21:53:52 2019 +0200 + + [thread.jthread.class] Rephrase introductory sentence. + + commit 997aa48537482815b4a1098e84496778a80884c2 + Author: Jens Maurer + Date: Fri Aug 9 21:34:57 2019 +0200 + + [std] Hyphenate floating-point and avoid 'floating'. + + commit d11e53e3ac075e72d373a92a4975d2ed55298fc3 + Author: Jens Maurer + Date: Sat Aug 10 09:18:30 2019 +0200 + + [std] Rename 'floating literal' to 'floating-point literal'. + + commit 4455bf4c5694d1fc09eaf68a75c370666467962a + Author: Jens Maurer + Date: Tue Aug 20 22:04:30 2019 +0200 + + [temp.names] Remove misleading note. + + commit 37cc5affe2c52a3dde21ca38e3aa70afc756db9b + Author: Dan Raviv + Date: Wed Aug 21 23:27:19 2019 +0300 + + [diff.library] Consistency for wide char types + + [diff.char16] says `char16_t` and `char_32t` + > ...do not appear as *macro* names... + + [diff.wchar.t] says `wchar_t` + > ...does not appear as a *type* name... + + commit 97977a1d742340d2198910912df3c511b8154afa + Author: Dan Raviv + Date: Wed Aug 21 23:25:49 2019 +0300 + + [intro.compliance] Fix reference in footnote + + It seems this footnote is supposed to point at [intro.abstract] which describes how the implementation's documentations also defines implementation-defined behavior; In the same way that the footnote in [intro.abstract] points into [intro.compliance] where it says that the documentation also includes things which are listed there. + + commit 94cf6f3a6408929088c546661094009ae921a725 + Author: Roger Orr + Date: Sat Aug 24 19:36:51 2019 +0100 + + [temp.param] Remove unused class template from example. + + commit 089b47bf447d5ef199380053d08b3c99734cd41c + Author: Jens Maurer + Date: Wed Sep 4 00:15:56 2019 +0200 + + [lex.pptoken] Mention import keywords in the category list. + + commit 34cc4a7ce6155e75d1b5df0e9cea6d1e46cf790e + Author: Jens Maurer + Date: Wed Sep 4 00:21:08 2019 +0200 + + [class.dtor] Group declaration properties vs. behavior. + + commit eaf23727c160e22a47f54419d5a66abfd672cc50 + Author: Jens Maurer + Date: Thu Sep 5 21:22:41 2019 +0200 + + [thread.latch] Subordinate [latch.syn] and [thread.latch.class] + + commit 901b742c1caf74deab046599264e7d5c9862eb55 + Author: Jens Maurer + Date: Sat Sep 14 00:43:55 2019 +0200 + + [dcl.spec.auto] Add example to show variable redeclaration with 'auto'. + + CWG2389 Agreement of deduced and explicitly-specified variable types + + commit 219506555b1a943a94db546a5d68745e1a7de242 + Author: mordante + Date: Sun Oct 6 07:06:26 2019 +0200 + + [re.regex] Use consistent names for function parameters + + commit e2c85a91953b0bd672960d0cf662c85ba1ba7470 + Author: Jens Maurer + Date: Tue Sep 24 21:19:51 2019 +0200 + + [locale] Fix example. + + commit 081375e2d152beea2c246119bd2b2c6fa42d0954 + Author: Jens Maurer + Date: Tue Sep 24 21:35:07 2019 +0200 + + [class.temporary] Fix typo in example. + + commit 37ca3fadf39edb7e6453515e386e6e6c7ae46d1e + Author: Jason Cobb + Date: Tue Sep 24 21:30:00 2019 -0400 + + [expr.prim.id] Fix immediate function id-expression requirement + + Move possibilities into a list, and add "only" after "appear". + + Reason for being editorial: not intent to require all programs + to use an "id-expression that denotes an immediate function", + and moving the possiblities into a list does not change the meaning. + + commit 2845d903cb36f7567fcda36746cac95fc43f147a + Author: Daveed Vandevoorde + Date: Wed Sep 25 11:43:19 2019 -0400 + + Avoid confusion between lookup and overall overload resolution + + commit e71fce40a3eded0d9ff573eb41b9b1e33ce3d883 + Author: Krystian Stasiowski + Date: Sun Oct 6 01:21:02 2019 -0400 + + [temp.alias] Change type-id to defining-type-id in the running text + + to match the portion of the grammar that it's referring to. + + commit b04e94bba0c7998920bd09c6cc462ccda93efaa4 + Author: Jens Maurer + Date: Fri Sep 27 09:42:25 2019 +0200 + + [std] Introduce 'Preamble' sections to avoid hanging paragraphs. + + commit c3b2c86e5e218ee6e80bd170eae653a6ad0d4047 + Author: frederick-vs-ja + Date: Sun Oct 6 13:23:04 2019 +0800 + + [class.copy.elision] Update example to match resolution of CWG 2278 + + commit 5fe6230c72e29a8595cc8f66ba149a560282ec3e + Author: Jens Maurer + Date: Thu Oct 3 00:07:58 2019 +0200 + + [expr.typeid] Add note highlighting prohibition of bad function types. + + Function types that can only be used for member functions + (because they have cv-qualifiers or a ref-qualifier) + cannot appear as a typeid operand. + + commit 599635d72caf3a9c768f5137f0bc19765ab4db2e + Author: Jens Maurer + Date: Thu Oct 3 09:39:14 2019 +0200 + + [atomics] Reorder members of atomic, atomic_ref, atomic_flag + + for a more conventional and meaningful order. + + commit ca09b84c8dcd0d7d0b15923a28b1be6692ccf37d + Author: Jens Maurer + Date: Thu Oct 3 15:01:05 2019 +0200 + + [expr.const] Excise 'initialization full-expression' + + which is an undefined term. Instead, use 'full-expression + of the initialization'. + + commit d0a0da6bdb2ff02175d4c01bf60fb3274e37f5ee + Author: Jens Maurer + Date: Thu Oct 3 15:07:56 2019 +0200 + + [atomics.ref.ops] Rename stable label from .operations + + commit 97a85b438144ba083301ce234da27f028c5a7e97 + Author: Jens Maurer + Date: Thu Oct 3 15:11:30 2019 +0200 + + [basic.def.odr] Replace misleading 'for which' with 'where'. + + commit 1327a34586617c26c48e615316f243b0ebf9d6d9 + Author: Jens Maurer + Date: Thu Oct 3 15:25:33 2019 +0200 + + [support.srcloc] Canonicalize presentation. + + - Avoid hanging paragraph. + - Rename label [source_location.syn] to [source.location.syn]. + - Add automated check for clean labels. + - Separate header synopsis from class synopsis. + + commit 7724f6d359e72a981206c312c9d42903e988d1bd + Author: Jens Maurer + Date: Fri Oct 4 19:10:06 2019 +0200 + + [class.mem] Avoid 'shall have been defined' + + when describing implicit definitions of defaulted + special member functions. Instead, use plain 'are'. + + commit 8685db27c43a5b41c0682318c07a00906fe6c7d1 + Author: Jens Maurer + Date: Thu Aug 15 10:25:22 2019 +0200 + + [locale.numpunct,locale.moneypunct] Canonicalize local grammar presentation. + + In [locale.numpunct], rename the 'integer' non-terminal + to 'intval', consistent with 'floatval'. + Also remove the superfluous 'plusminus' non-terminal. + + commit 03dd1b8abfe921d4e6b643cd109310c03801cbfb + Author: Jens Maurer + Date: Fri Sep 13 23:43:15 2019 +0200 + + [over.match.funcs] Remove bullet for single-item bulleted list. + + commit d0e718b6a514a22118367a815107281a9a24c805 + Author: Jens Maurer + Date: Tue May 28 22:33:54 2019 +0200 + + [std] Consistently use 'immediately-declared constraint'. + + Harmonize the phrasing in [expr.prim.req.compound], + [dcl.type.auto.deduct], [temp], and [temp.param]. + + commit 2c2b29248d04dc0ce3c22a74a9537c0582c36ee2 + Author: Jens Maurer + Date: Thu Aug 8 22:06:21 2019 +0200 + + [version.syn] Add synopsis for header. + + This replaces the table of feature-test macros for the library. + + commit e9fb3f03f05e48aa02d36ee42305f00bc056356b + Author: Jens Maurer + Date: Mon Oct 7 21:11:30 2019 +0200 + + [rand.predef] Add digit separators to large numbers. + + commit 7edac42a3b64406242c0c71b62264e05eab7e1a3 + Author: Jens Maurer + Date: Mon Oct 7 22:24:16 2019 +0200 + + [intro.defs] Hyphenate parameter-type-list. + + commit d8935d972ee4f07f4507eea55df209ab7b1a508d + Author: Sergey Zubkov + Date: Tue Oct 8 09:25:11 2019 -0400 + + [expr.const] drop unused declaration from example diff --git a/source/Makefile b/source/Makefile index 8215ae9d77..f47cdfde7e 100644 --- a/source/Makefile +++ b/source/Makefile @@ -26,11 +26,12 @@ reindex: $(STDPDF) $(STDPDF) $(STDPDF) - makeindex generalindex + makeindex -s generalindex.ist generalindex makeindex headerindex - makeindex libraryindex + makeindex -s libraryindex.ist libraryindex makeindex grammarindex makeindex impldefindex + makeindex conceptindex $(STDPDF) makeindex -s basic.gst -o xrefindex.gls xrefindex.glo makeindex -s basic.gst -o xrefdelta.gls xrefdelta.glo diff --git a/source/algorithms.tex b/source/algorithms.tex index c2518033ec..668330bb46 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -46,7 +46,7 @@ void foo() { using namespace std::ranges; std::vector vec{1,2,3}; - find(begin(vec), end(vec), 2); // \#1 + find(begin(vec), end(vec), 2); // \#1 } \end{codeblock} The function call expression at \tcode{\#1} invokes \tcode{std::ranges::find}, @@ -457,7 +457,7 @@ int a[] = {0,1}; std::vector v; std::for_each(std::execution::par, std::begin(a), std::end(a), [&](int i) { - v.push_back(i*2+1); // incorrect: data race + v.push_back(i*2+1); // incorrect: data race }); \end{codeblock} The program above has a data race because of the unsynchronized access to the @@ -470,7 +470,7 @@ std::for_each(std::execution::par, std::begin(a), std::end(a), [&](int) { x.fetch_add(1, std::memory_order::relaxed); // spin wait for another iteration to change the value of \tcode{x} - while (x.load(std::memory_order::relaxed) == 1) { } // incorrect: assumes execution order + while (x.load(std::memory_order::relaxed) == 1) { } // incorrect: assumes execution order }); \end{codeblock} The above example depends on the order of execution of the iterations, and @@ -604,7 +604,7 @@ \tcode{is_execution_policy_v>} is \tcode{true}. \rSec1[algorithm.syn]{Header \tcode{} synopsis} -\indexhdr{algorithm}% +\indexheader{algorithm}% \begin{codeblock} #include @@ -615,7 +615,7 @@ template constexpr bool all_of(InputIterator first, InputIterator last, Predicate pred); template - bool all_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool all_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred); namespace ranges { @@ -631,7 +631,7 @@ template constexpr bool any_of(InputIterator first, InputIterator last, Predicate pred); template - bool any_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool any_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred); namespace ranges { @@ -647,7 +647,7 @@ template constexpr bool none_of(InputIterator first, InputIterator last, Predicate pred); template - bool none_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool none_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred); namespace ranges { @@ -663,7 +663,7 @@ template constexpr Function for_each(InputIterator first, InputIterator last, Function f); template - void for_each(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void for_each(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Function f); namespace ranges { @@ -698,7 +698,7 @@ template constexpr InputIterator for_each_n(InputIterator first, Size n, Function f); template - ForwardIterator for_each_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator for_each_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, Size n, Function f); // \ref{alg.find}, find @@ -706,21 +706,21 @@ constexpr InputIterator find(InputIterator first, InputIterator last, const T& value); template - ForwardIterator find(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator find(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, const T& value); template constexpr InputIterator find_if(InputIterator first, InputIterator last, Predicate pred); template - ForwardIterator find_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator find_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred); template constexpr InputIterator find_if_not(InputIterator first, InputIterator last, Predicate pred); template - ForwardIterator find_if_not(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator find_if_not(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred); @@ -760,13 +760,13 @@ BinaryPredicate pred); template ForwardIterator1 - find_end(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + find_end(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template ForwardIterator1 - find_end(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + find_end(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); @@ -798,13 +798,13 @@ BinaryPredicate pred); template ForwardIterator1 - find_first_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + find_first_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template ForwardIterator1 - find_first_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + find_first_of(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); @@ -836,11 +836,11 @@ BinaryPredicate pred); template ForwardIterator - adjacent_find(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + adjacent_find(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last); template ForwardIterator - adjacent_find(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + adjacent_find(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, BinaryPredicate pred); @@ -861,14 +861,14 @@ count(InputIterator first, InputIterator last, const T& value); template typename iterator_traits::difference_type - count(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + count(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, const T& value); template constexpr typename iterator_traits::difference_type count_if(InputIterator first, InputIterator last, Predicate pred); template typename iterator_traits::difference_type - count_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + count_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred); namespace ranges { @@ -910,24 +910,24 @@ BinaryPredicate pred); template pair - mismatch(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + mismatch(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); template pair - mismatch(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + mismatch(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate pred); template pair - mismatch(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + mismatch(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template pair - mismatch(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + mismatch(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); @@ -982,21 +982,21 @@ InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred); template - bool equal(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool equal(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); template - bool equal(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool equal(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate pred); template - bool equal(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool equal(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template - bool equal(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool equal(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); @@ -1057,13 +1057,13 @@ BinaryPredicate pred); template ForwardIterator1 - search(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + search(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template ForwardIterator1 - search(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + search(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred); @@ -1095,13 +1095,13 @@ BinaryPredicate pred); template ForwardIterator - search_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + search_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Size count, const T& value); template ForwardIterator - search_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + search_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Size count, const T& value, BinaryPredicate pred); @@ -1131,7 +1131,7 @@ constexpr OutputIterator copy(InputIterator first, InputIterator last, OutputIterator result); template - ForwardIterator2 copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator2 copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result); @@ -1169,7 +1169,7 @@ OutputIterator result); template - ForwardIterator2 copy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator2 copy_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, Size n, ForwardIterator2 result); @@ -1188,7 +1188,7 @@ OutputIterator result, Predicate pred); template - ForwardIterator2 copy_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator2 copy_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result, Predicate pred); @@ -1233,7 +1233,7 @@ OutputIterator result); template - ForwardIterator2 move(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator2 move(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result); @@ -1275,7 +1275,7 @@ constexpr ForwardIterator2 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); template - ForwardIterator2 swap_ranges(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator2 swap_ranges(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); @@ -1310,13 +1310,13 @@ template ForwardIterator2 - transform(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + transform(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 result, UnaryOperation op); template ForwardIterator - transform(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + transform(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator result, BinaryOperation binary_op); @@ -1379,14 +1379,14 @@ constexpr void replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value); template - void replace(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void replace(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value); template constexpr void replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value); template - void replace_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void replace_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value); @@ -1417,7 +1417,7 @@ OutputIterator result, const T& old_value, const T& new_value); template - ForwardIterator2 replace_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator2 replace_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result, const T& old_value, const T& new_value); @@ -1427,7 +1427,7 @@ Predicate pred, const T& new_value); template - ForwardIterator2 replace_copy_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator2 replace_copy_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result, Predicate pred, const T& new_value); @@ -1472,13 +1472,13 @@ template constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value); template - void fill(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void fill(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, const T& value); template constexpr OutputIterator fill_n(OutputIterator first, Size n, const T& value); template - ForwardIterator fill_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator fill_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, Size n, const T& value); namespace ranges { @@ -1495,13 +1495,13 @@ constexpr void generate(ForwardIterator first, ForwardIterator last, Generator gen); template - void generate(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void generate(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Generator gen); template constexpr OutputIterator generate_n(OutputIterator first, Size n, Generator gen); template - ForwardIterator generate_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator generate_n(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, Size n, Generator gen); namespace ranges { @@ -1521,14 +1521,14 @@ constexpr ForwardIterator remove(ForwardIterator first, ForwardIterator last, const T& value); template - ForwardIterator remove(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator remove(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, const T& value); template constexpr ForwardIterator remove_if(ForwardIterator first, ForwardIterator last, Predicate pred); template - ForwardIterator remove_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator remove_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred); @@ -1558,7 +1558,7 @@ template ForwardIterator2 - remove_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + remove_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result, const T& value); template @@ -1568,7 +1568,7 @@ template ForwardIterator2 - remove_copy_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + remove_copy_if(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result, Predicate pred); @@ -1610,10 +1610,10 @@ constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred); template - ForwardIterator unique(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator unique(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last); template - ForwardIterator unique(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator unique(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, BinaryPredicate pred); @@ -1638,13 +1638,13 @@ OutputIterator result, BinaryPredicate pred); template ForwardIterator2 - unique_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + unique_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result); template ForwardIterator2 - unique_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + unique_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 result, BinaryPredicate pred); @@ -1674,7 +1674,7 @@ template constexpr void reverse(BidirectionalIterator first, BidirectionalIterator last); template - void reverse(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void reverse(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} BidirectionalIterator first, BidirectionalIterator last); namespace ranges { @@ -1692,7 +1692,7 @@ OutputIterator result); template ForwardIterator - reverse_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + reverse_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} BidirectionalIterator first, BidirectionalIterator last, ForwardIterator result); @@ -1716,7 +1716,7 @@ ForwardIterator middle, ForwardIterator last); template - ForwardIterator rotate(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator rotate(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator middle, ForwardIterator last); @@ -1735,7 +1735,7 @@ ForwardIterator last, OutputIterator result); template ForwardIterator2 - rotate_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + rotate_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first, ForwardIterator1 middle, ForwardIterator1 last, ForwardIterator2 result); @@ -1784,7 +1784,7 @@ typename iterator_traits::difference_type n); template ForwardIterator - shift_left(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + shift_left(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, typename iterator_traits::difference_type n); template @@ -1793,7 +1793,7 @@ typename iterator_traits::difference_type n); template ForwardIterator - shift_right(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + shift_right(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, typename iterator_traits::difference_type n); @@ -1805,10 +1805,10 @@ constexpr void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); template - void sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator last); template - void sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator last, Compare comp); @@ -1830,10 +1830,10 @@ void stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp); template - void stable_sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void stable_sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator last); template - void stable_sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void stable_sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator last, Compare comp); @@ -1857,12 +1857,12 @@ RandomAccessIterator middle, RandomAccessIterator last, Compare comp); template - void partial_sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void partial_sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); template - void partial_sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void partial_sort(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp); @@ -1893,14 +1893,14 @@ Compare comp); template RandomAccessIterator - partial_sort_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + partial_sort_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, RandomAccessIterator result_first, RandomAccessIterator result_last); template RandomAccessIterator - partial_sort_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + partial_sort_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, RandomAccessIterator result_first, RandomAccessIterator result_last, @@ -1934,10 +1934,10 @@ constexpr bool is_sorted(ForwardIterator first, ForwardIterator last, Compare comp); template - bool is_sorted(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool is_sorted(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last); template - bool is_sorted(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool is_sorted(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Compare comp); @@ -1959,11 +1959,11 @@ Compare comp); template ForwardIterator - is_sorted_until(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + is_sorted_until(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last); template ForwardIterator - is_sorted_until(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + is_sorted_until(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Compare comp); @@ -1985,11 +1985,11 @@ constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); template - void nth_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void nth_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last); template - void nth_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void nth_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp); @@ -2093,7 +2093,7 @@ template constexpr bool is_partitioned(InputIterator first, InputIterator last, Predicate pred); template - bool is_partitioned(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool is_partitioned(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred); namespace ranges { @@ -2110,7 +2110,7 @@ ForwardIterator last, Predicate pred); template - ForwardIterator partition(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator partition(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Predicate pred); @@ -2132,7 +2132,7 @@ BidirectionalIterator last, Predicate pred); template - BidirectionalIterator stable_partition(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + BidirectionalIterator stable_partition(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} BidirectionalIterator first, BidirectionalIterator last, Predicate pred); @@ -2157,7 +2157,7 @@ template pair - partition_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + partition_copy(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, ForwardIterator1 out_true, ForwardIterator2 out_false, Predicate pred); @@ -2230,14 +2230,14 @@ template ForwardIterator - merge(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + merge(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result); template ForwardIterator - merge(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + merge(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result, Compare comp); @@ -2270,12 +2270,12 @@ BidirectionalIterator middle, BidirectionalIterator last, Compare comp); template - void inplace_merge(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void inplace_merge(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last); template - void inplace_merge(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + void inplace_merge(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp); @@ -2301,12 +2301,12 @@ InputIterator2 first2, InputIterator2 last2, Compare comp); template - bool includes(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool includes(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template - bool includes(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool includes(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, Compare comp); @@ -2339,14 +2339,14 @@ template ForwardIterator - set_union(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + set_union(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result); template ForwardIterator - set_union(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + set_union(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result, Compare comp); @@ -2383,14 +2383,14 @@ template ForwardIterator - set_intersection(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + set_intersection(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result); template ForwardIterator - set_intersection(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + set_intersection(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result, Compare comp); @@ -2427,14 +2427,14 @@ template ForwardIterator - set_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + set_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result); template ForwardIterator - set_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + set_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result, Compare comp); @@ -2471,14 +2471,14 @@ template ForwardIterator - set_symmetric_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + set_symmetric_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result); template ForwardIterator - set_symmetric_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + set_symmetric_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, ForwardIterator result, Compare comp); @@ -2582,10 +2582,10 @@ constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); template - bool is_heap(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool is_heap(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator last); template - bool is_heap(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + bool is_heap(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator last, Compare comp); @@ -2607,11 +2607,11 @@ Compare comp); template RandomAccessIterator - is_heap_until(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + is_heap_until(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator last); template RandomAccessIterator - is_heap_until(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + is_heap_until(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} RandomAccessIterator first, RandomAccessIterator last, Compare comp); @@ -2718,10 +2718,10 @@ constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last, Compare comp); template - ForwardIterator min_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator min_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last); template - ForwardIterator min_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator min_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Compare comp); @@ -2741,10 +2741,10 @@ constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last, Compare comp); template - ForwardIterator max_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator max_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last); template - ForwardIterator max_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator max_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Compare comp); @@ -2766,11 +2766,11 @@ minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); template pair - minmax_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + minmax_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last); template pair - minmax_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + minmax_element(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, Compare comp); namespace ranges { @@ -2805,13 +2805,13 @@ Compare comp); template bool - lexicographical_compare(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + lexicographical_compare(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2); template bool - lexicographical_compare(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + lexicographical_compare(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, Compare comp); @@ -2901,7 +2901,7 @@ \rSec2[alg.all.of]{All of} -\indexlibrary{\idxcode{all_of}}% +\indexlibraryglobal{all_of}% \begin{itemdecl} template constexpr bool all_of(InputIterator first, InputIterator last, Predicate pred); @@ -2935,7 +2935,7 @@ \rSec2[alg.any.of]{Any of} -\indexlibrary{\idxcode{any_of}}% +\indexlibraryglobal{any_of}% \begin{itemdecl} template constexpr bool any_of(InputIterator first, InputIterator last, Predicate pred); @@ -2962,13 +2962,14 @@ in the range \range{first}{last}, and \tcode{false} otherwise. \pnum -\complexity At most \tcode{last - first} applications of the predicate +\complexity +At most \tcode{last - first} applications of the predicate and any projection. \end{itemdescr} \rSec2[alg.none.of]{None of} -\indexlibrary{\idxcode{none_of}}% +\indexlibraryglobal{none_of}% \begin{itemdecl} template constexpr bool none_of(InputIterator first, InputIterator last, Predicate pred); @@ -3002,7 +3003,7 @@ \rSec2[alg.foreach]{For each} -\indexlibrary{\idxcode{for_each}}% +\indexlibraryglobal{for_each}% \begin{itemdecl} template constexpr Function for_each(InputIterator first, InputIterator last, Function f); @@ -3041,7 +3042,7 @@ If \tcode{f} returns a result, the result is ignored. \end{itemdescr} -\indexlibrary{\idxcode{for_each}}% +\indexlibraryglobal{for_each}% \begin{itemdecl} template void for_each(ExecutionPolicy&& exec, @@ -3081,7 +3082,7 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{for_each}}% +\indexlibraryglobal{for_each}% \begin{itemdecl} template S, class Proj = identity, indirectly_unary_invocable> Fun> @@ -3123,7 +3124,7 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{for_each_n}}% +\indexlibraryglobal{for_each_n}% \begin{itemdecl} template constexpr InputIterator for_each_n(InputIterator first, Size n, Function f); @@ -3132,7 +3133,7 @@ \begin{itemdescr} \pnum \requires -\tcode{Function} shall meet the \oldconcept{MoveConstructible} requirements +\tcode{Function} shall meet the \oldconcept{MoveConstructible} requirements. \begin{note} \tcode{Function} need not meet the requirements of \oldconcept{CopyConstructible}. @@ -3160,7 +3161,7 @@ If \tcode{f} returns a result, the result is ignored. \end{itemdescr} -\indexlibrary{\idxcode{for_each_n}}% +\indexlibraryglobal{for_each_n}% \begin{itemdecl} template ForwardIterator for_each_n(ExecutionPolicy&& exec, ForwardIterator first, Size n, @@ -3199,9 +3200,9 @@ \rSec2[alg.find]{Find} -\indexlibrary{\idxcode{find}}% -\indexlibrary{\idxcode{find_if}}% -\indexlibrary{\idxcode{find_if_not}}% +\indexlibraryglobal{find}% +\indexlibraryglobal{find_if}% +\indexlibraryglobal{find_if_not}% \begin{itemdecl} template constexpr InputIterator find(InputIterator first, InputIterator last, @@ -3274,7 +3275,7 @@ \rSec2[alg.find.end]{Find end} -\indexlibrary{\idxcode{find_end}}% +\indexlibraryglobal{find_end}% \begin{itemdecl} template constexpr ForwardIterator1 @@ -3359,7 +3360,7 @@ \rSec2[alg.find.first.of]{Find first} -\indexlibrary{\idxcode{find_first_of}}% +\indexlibraryglobal{find_first_of}% \begin{itemdecl} template constexpr InputIterator @@ -3432,7 +3433,7 @@ \rSec2[alg.adjacent.find]{Adjacent find} -\indexlibrary{\idxcode{adjacent_find}}% +\indexlibraryglobal{adjacent_find}% \begin{itemdecl} template constexpr ForwardIterator @@ -3490,8 +3491,8 @@ \rSec2[alg.count]{Count} -\indexlibrary{\idxcode{count}}% -\indexlibrary{\idxcode{count_if}}% +\indexlibraryglobal{count}% +\indexlibraryglobal{count_if}% \begin{itemdecl} template constexpr typename iterator_traits::difference_type @@ -3558,7 +3559,7 @@ \rSec2[mismatch]{Mismatch} -\indexlibrary{\idxcode{mismatch}}% +\indexlibraryglobal{mismatch}% \begin{itemdecl} template constexpr pair @@ -3659,7 +3660,7 @@ \rSec2[alg.equal]{Equal} -\indexlibrary{\idxcode{equal}}% +\indexlibraryglobal{equal}% \begin{itemdecl} template constexpr bool equal(InputIterator1 first1, InputIterator1 last1, @@ -3771,7 +3772,7 @@ \rSec2[alg.is.permutation]{Is permutation} -\indexlibrary{\idxcode{is_permutation}}% +\indexlibraryglobal{is_permutation}% \begin{itemdecl} template constexpr bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, @@ -3828,7 +3829,7 @@ otherwise, at worst \bigoh{N^2}, where $N$ has the value \tcode{last1 - first1}. \end{itemdescr} -\indexlibrary{\idxcode{is_permutation}}% +\indexlibraryglobal{is_permutation}% \begin{itemdecl} template S1, forward_iterator I2, sentinel_for S2, class Pred = ranges::equal_to, class Proj1 = identity, @@ -3872,7 +3873,7 @@ \rSec2[alg.search]{Search} -\indexlibrary{\idxcode{search}}% +\indexlibraryglobal{search}% \begin{itemdecl} template constexpr ForwardIterator1 @@ -3916,7 +3917,7 @@ of the corresponding predicate. \end{itemdescr} -\indexlibrary{\idxcode{search}}% +\indexlibraryglobal{search}% \begin{itemdecl} template S1, forward_iterator I2, sentinel_for S2, class Pred = ranges::equal_to, @@ -3958,7 +3959,7 @@ of the corresponding predicate and projections. \end{itemdescr} -\indexlibrary{\idxcode{search_n}}% +\indexlibraryglobal{search_n}% \begin{itemdecl} template constexpr ForwardIterator @@ -4004,7 +4005,7 @@ At most \tcode{last - first} applications of the corresponding predicate. \end{itemdescr} -\indexlibrary{\idxcode{search_n}}% +\indexlibraryglobal{search_n}% \begin{itemdecl} template S, class T, class Pred = ranges::equal_to, class Proj = identity> @@ -4036,7 +4037,7 @@ of the corresponding predicate and projection. \end{itemdescr} -\indexlibrary{\idxcode{search}}% +\indexlibraryglobal{search}% \begin{itemdecl} template constexpr ForwardIterator @@ -4057,7 +4058,7 @@ \rSec2[alg.copy]{Copy} -\indexlibrary{\idxcode{copy}}% +\indexlibraryglobal{copy}% \begin{itemdecl} template constexpr OutputIterator copy(InputIterator first, InputIterator last, @@ -4101,7 +4102,7 @@ Exactly $N$ assignments. \end{itemdescr} -\indexlibrary{\idxcode{copy}}% +\indexlibraryglobal{copy}% \begin{itemdecl} template ForwardIterator2 copy(ExecutionPolicy&& policy, @@ -4131,7 +4132,7 @@ Exactly \tcode{last - first} assignments. \end{itemdescr} -\indexlibrary{\idxcode{copy_n}}% +\indexlibraryglobal{copy_n}% \begin{itemdecl} template constexpr OutputIterator copy_n(InputIterator first, Size n, @@ -4172,7 +4173,7 @@ Exactly $M$ assignments. \end{itemdescr} -\indexlibrary{\idxcode{copy_if}}% +\indexlibraryglobal{copy_if}% \begin{itemdecl} template constexpr OutputIterator copy_if(InputIterator first, InputIterator last, @@ -4247,7 +4248,7 @@ Stable\iref{algorithm.stable}. \end{itemdescr} -\indexlibrary{\idxcode{copy_backward}}% +\indexlibraryglobal{copy_backward}% \begin{itemdecl} template constexpr BidirectionalIterator2 @@ -4390,7 +4391,7 @@ Exactly $N$ assignments. \end{itemdescr} -\indexlibrary{\idxcode{move_backward}}% +\indexlibraryglobal{move_backward}% \begin{itemdecl} template constexpr BidirectionalIterator2 @@ -4452,7 +4453,7 @@ \rSec2[alg.swap]{Swap} -\indexlibrary{\idxcode{swap_ranges}}% +\indexlibraryglobal{swap_ranges}% \begin{itemdecl} template constexpr ForwardIterator2 @@ -4520,7 +4521,7 @@ Exactly $M$ swaps. \end{itemdescr} -\indexlibrary{\idxcode{iter_swap}}% +\indexlibraryglobal{iter_swap}% \begin{itemdecl} template constexpr void iter_swap(ForwardIterator1 a, ForwardIterator2 b); @@ -4539,7 +4540,7 @@ \rSec2[alg.transform]{Transform} -\indexlibrary{\idxcode{transform}}% +\indexlibraryglobal{transform}% \begin{itemdecl} template @@ -4667,8 +4668,8 @@ \rSec2[alg.replace]{Replace} -\indexlibrary{\idxcode{replace}}% -\indexlibrary{\idxcode{replace_if}}% +\indexlibraryglobal{replace}% +\indexlibraryglobal{replace_if}% \begin{itemdecl} template constexpr void replace(ForwardIterator first, ForwardIterator last, @@ -4737,8 +4738,8 @@ of the corresponding predicate and any projection. \end{itemdescr} -\indexlibrary{\idxcode{replace_copy}}% -\indexlibrary{\idxcode{replace_copy_if}}% +\indexlibraryglobal{replace_copy}% +\indexlibraryglobal{replace_copy_if}% \begin{itemdecl} template constexpr OutputIterator @@ -4843,8 +4844,8 @@ \rSec2[alg.fill]{Fill} -\indexlibrary{\idxcode{fill}}% -\indexlibrary{\idxcode{fill_n}}% +\indexlibraryglobal{fill}% +\indexlibraryglobal{fill_n}% \begin{itemdecl} template constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value); @@ -4895,8 +4896,8 @@ \rSec2[alg.generate]{Generate} -\indexlibrary{\idxcode{generate}}% -\indexlibrary{\idxcode{generate_n}}% +\indexlibraryglobal{generate}% +\indexlibraryglobal{generate_n}% \begin{itemdecl} template constexpr void generate(ForwardIterator first, ForwardIterator last, @@ -4949,8 +4950,8 @@ \rSec2[alg.remove]{Remove} -\indexlibrary{\idxcode{remove}}% -\indexlibrary{\idxcode{remove_if}}% +\indexlibraryglobal{remove}% +\indexlibraryglobal{remove_if}% \begin{itemdecl} template constexpr ForwardIterator remove(ForwardIterator first, ForwardIterator last, @@ -5034,8 +5035,8 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{remove_copy}}% -\indexlibrary{\idxcode{remove_copy_if}}% +\indexlibraryglobal{remove_copy}% +\indexlibraryglobal{remove_copy_if}% \begin{itemdecl} template constexpr OutputIterator @@ -5131,7 +5132,7 @@ \rSec2[alg.unique]{Unique} -\indexlibrary{\idxcode{unique}}% +\indexlibraryglobal{unique}% \begin{itemdecl} template constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last); @@ -5201,7 +5202,7 @@ no more than twice as many applications of any projection. \end{itemdescr} -\indexlibrary{\idxcode{unique_copy}}% +\indexlibraryglobal{unique_copy}% \begin{itemdecl} template constexpr OutputIterator @@ -5304,7 +5305,7 @@ \returns \begin{itemize} \item \tcode{result + $N$} for the overloads in namespace \tcode{std}, or -\item \tcode{\{last, result + $N$\}} for the overloads in namespace \tcode{ranges} +\item \tcode{\{last, result + $N$\}} for the overloads in namespace \tcode{ranges}. \end{itemize} \pnum @@ -5316,7 +5317,7 @@ \rSec2[alg.reverse]{Reverse} -\indexlibrary{\idxcode{reverse}}% +\indexlibraryglobal{reverse}% \begin{itemdecl} template constexpr void reverse(BidirectionalIterator first, BidirectionalIterator last); @@ -5355,7 +5356,7 @@ Exactly \tcode{(last - first)/2} swaps. \end{itemdescr} -\indexlibrary{\idxcode{reverse_copy}}% +\indexlibraryglobal{reverse_copy}% \begin{itemdecl} template constexpr OutputIterator @@ -5409,7 +5410,7 @@ \rSec2[alg.rotate]{Rotate} -\indexlibrary{\idxcode{rotate}}% +\indexlibraryglobal{rotate}% \begin{itemdecl} template constexpr ForwardIterator @@ -5472,7 +5473,7 @@ \tcode{return ranges::rotate(ranges::begin(r), middle, ranges::end(r));} \end{itemdescr} -\indexlibrary{\idxcode{rotate_copy}}% +\indexlibraryglobal{rotate_copy}% \begin{itemdecl} template constexpr OutputIterator @@ -5539,7 +5540,7 @@ \rSec2[alg.random.sample]{Sample} -\indexlibrary{\idxcode{sample}}% +\indexlibraryglobal{sample}% \begin{itemdecl} template @@ -5608,7 +5609,7 @@ \rSec2[alg.random.shuffle]{Shuffle} -\indexlibrary{\idxcode{shuffle}}% +\indexlibraryglobal{shuffle}% \begin{itemdecl} template void shuffle(RandomAccessIterator first, @@ -5661,7 +5662,7 @@ \rSec2[alg.shift]{Shift} -\indexlibrary{\idxcode{shift_left}}% +\indexlibraryglobal{shift_left}% \begin{itemdecl} template constexpr ForwardIterator @@ -5700,7 +5701,7 @@ At most \tcode{(last - first) - n} assignments. \end{itemdescr} -\indexlibrary{\idxcode{shift_right}}% +\indexlibraryglobal{shift_right}% \begin{itemdecl} template constexpr ForwardIterator @@ -5830,7 +5831,7 @@ \rSec3[sort]{\tcode{sort}} -\indexlibrary{\idxcode{sort}}% +\indexlibraryglobal{sort}% \begin{itemdecl} template constexpr void sort(RandomAccessIterator first, RandomAccessIterator last); @@ -5889,7 +5890,7 @@ \rSec3[stable.sort]{\tcode{stable_sort}} -\indexlibrary{\idxcode{stable_sort}}% +\indexlibraryglobal{stable_sort}% \begin{itemdecl} template void stable_sort(RandomAccessIterator first, RandomAccessIterator last); @@ -5953,7 +5954,7 @@ \rSec3[partial.sort]{\tcode{partial_sort}} -\indexlibrary{\idxcode{partial_sort}}% +\indexlibraryglobal{partial_sort}% \begin{itemdecl} template constexpr void partial_sort(RandomAccessIterator first, @@ -6038,7 +6039,7 @@ \rSec3[partial.sort.copy]{\tcode{partial_sort_copy}} -\indexlibrary{\idxcode{partial_sort_copy}}% +\indexlibraryglobal{partial_sort_copy}% \begin{itemdecl} template constexpr RandomAccessIterator @@ -6145,7 +6146,7 @@ \rSec3[is.sorted]{\tcode{is_sorted}} -\indexlibrary{\idxcode{is_sorted}}% +\indexlibraryglobal{is_sorted}% \begin{itemdecl} template constexpr bool is_sorted(ForwardIterator first, ForwardIterator last); @@ -6157,7 +6158,7 @@ Equivalent to: \tcode{return is_sorted_until(first, last) == last;} \end{itemdescr} -\indexlibrary{\idxcode{is_sorted}}% +\indexlibraryglobal{is_sorted}% \begin{itemdecl} template bool is_sorted(ExecutionPolicy&& exec, @@ -6173,7 +6174,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{is_sorted}}% +\indexlibraryglobal{is_sorted}% \begin{itemdecl} template constexpr bool is_sorted(ForwardIterator first, ForwardIterator last, @@ -6187,7 +6188,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{is_sorted}}% +\indexlibraryglobal{is_sorted}% \begin{itemdecl} template bool is_sorted(ExecutionPolicy&& exec, @@ -6204,7 +6205,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{is_sorted}}% +\indexlibraryglobal{is_sorted}% \begin{itemdecl} template S, class Proj = identity, indirect_strict_weak_order> Comp = ranges::less> @@ -6221,7 +6222,7 @@ \tcode{return ranges::is_sorted_until(first, last, comp, proj) == last;} \end{itemdescr} -\indexlibrary{\idxcode{is_sorted_until}}% +\indexlibraryglobal{is_sorted_until}% \begin{itemdecl} template constexpr ForwardIterator @@ -6269,7 +6270,7 @@ \rSec2[alg.nth.element]{Nth element} -\indexlibrary{\idxcode{nth_element}}% +\indexlibraryglobal{nth_element}% \begin{itemdecl} template constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth, @@ -6364,7 +6365,7 @@ \rSec3[lower.bound]{\tcode{lower_bound}} -\indexlibrary{\idxcode{lower_bound}}% +\indexlibraryglobal{lower_bound}% \begin{itemdecl} template constexpr ForwardIterator @@ -6412,7 +6413,7 @@ \rSec3[upper.bound]{\tcode{upper_bound}} -\indexlibrary{\idxcode{upper_bound}}% +\indexlibraryglobal{upper_bound}% \begin{itemdecl} template constexpr ForwardIterator @@ -6459,7 +6460,7 @@ \rSec3[equal.range]{\tcode{equal_range}} -\indexlibrary{\idxcode{equal_range}}% +\indexlibraryglobal{equal_range}% \begin{itemdecl} template constexpr pair @@ -6524,7 +6525,7 @@ \rSec3[binary.search]{\tcode{binary_search}} -\indexlibrary{\idxcode{binary_search}}% +\indexlibraryglobal{binary_search}% \begin{itemdecl} template constexpr bool @@ -6578,7 +6579,7 @@ \rSec2[alg.partitions]{Partitions} -\indexlibrary{\idxcode{is_partitioned}}% +\indexlibraryglobal{is_partitioned}% \begin{itemdecl} template constexpr bool is_partitioned(InputIterator first, InputIterator last, Predicate pred); @@ -6611,7 +6612,7 @@ At most \tcode{last - first} applications of \tcode{pred} and \tcode{proj}. \end{itemdescr} -\indexlibrary{\idxcode{partition}}% +\indexlibraryglobal{partition}% \begin{itemdecl} template constexpr ForwardIterator @@ -6662,7 +6663,8 @@ \pnum -\complexity Let $N = \tcode{last - first}$: +\complexity +Let $N = \tcode{last - first}$: \begin{itemize} \item For the overload with no \tcode{ExecutionPolicy}, @@ -6680,7 +6682,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{stable_partition}}% +\indexlibraryglobal{stable_partition}% \begin{itemdecl} template BidirectionalIterator @@ -6748,7 +6750,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{partition_copy}}% +\indexlibraryglobal{partition_copy}% \begin{itemdecl} template @@ -6818,7 +6820,7 @@ Exactly \tcode{last - first} applications of \tcode{pred} and \tcode{proj}. \end{itemdescr} -\indexlibrary{\idxcode{partition_point}}% +\indexlibraryglobal{partition_point}% \begin{itemdecl} template constexpr ForwardIterator @@ -6849,7 +6851,7 @@ An iterator \tcode{mid} such that $E(\tcode{*i})$ is \tcode{true} for all iterators \tcode{i} in \range{first}{mid}, and -\tcode{false} for all iterators \tcode{i} in \range{mid}{last} +\tcode{false} for all iterators \tcode{i} in \range{mid}{last}. \pnum \complexity @@ -6859,7 +6861,7 @@ \rSec2[alg.merge]{Merge} -\indexlibrary{\idxcode{merge}}% +\indexlibraryglobal{merge}% \begin{itemdecl} template @@ -6958,7 +6960,7 @@ Stable\iref{algorithm.stable}. \end{itemdescr} -\indexlibrary{\idxcode{inplace_merge}}% +\indexlibraryglobal{inplace_merge}% \begin{itemdecl} template void inplace_merge(BidirectionalIterator first, @@ -7060,7 +7062,7 @@ \rSec3[includes]{\tcode{includes}} -\indexlibrary{\idxcode{includes}}% +\indexlibraryglobal{includes}% \begin{itemdecl} template constexpr bool includes(InputIterator1 first1, InputIterator1 last1, @@ -7124,7 +7126,7 @@ \rSec3[set.union]{\tcode{set_union}} -\indexlibrary{\idxcode{set_union}}% +\indexlibraryglobal{set_union}% \begin{itemdecl} template @@ -7219,7 +7221,7 @@ \rSec3[set.intersection]{\tcode{set_intersection}} -\indexlibrary{\idxcode{set_intersection}}% +\indexlibraryglobal{set_intersection}% \begin{itemdecl} template @@ -7312,7 +7314,7 @@ \rSec3[set.difference]{\tcode{set_difference}} -\indexlibrary{\idxcode{set_difference}}% +\indexlibraryglobal{set_difference}% \begin{itemdecl} template @@ -7406,7 +7408,7 @@ \rSec3[set.symmetric.difference]{\tcode{set_symmetric_difference}} -\indexlibrary{\idxcode{set_symmetric_difference}}% +\indexlibraryglobal{set_symmetric_difference}% \begin{itemdecl} template @@ -7534,7 +7536,7 @@ \rSec3[push.heap]{\tcode{push_heap}} -\indexlibrary{\idxcode{push_heap}}% +\indexlibraryglobal{push_heap}% \begin{itemdecl} template constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last); @@ -7585,7 +7587,7 @@ \rSec3[pop.heap]{\tcode{pop_heap}} -\indexlibrary{\idxcode{pop_heap}}% +\indexlibraryglobal{pop_heap}% \begin{itemdecl} template constexpr void pop_heap(RandomAccessIterator first, RandomAccessIterator last); @@ -7643,7 +7645,7 @@ \rSec3[make.heap]{\tcode{make_heap}} -\indexlibrary{\idxcode{make_heap}}% +\indexlibraryglobal{make_heap}% \begin{itemdecl} template constexpr void make_heap(RandomAccessIterator first, RandomAccessIterator last); @@ -7692,7 +7694,7 @@ \rSec3[sort.heap]{\tcode{sort_heap}} -\indexlibrary{\idxcode{sort_heap}}% +\indexlibraryglobal{sort_heap}% \begin{itemdecl} template constexpr void sort_heap(RandomAccessIterator first, RandomAccessIterator last); @@ -7746,7 +7748,7 @@ \rSec3[is.heap]{\tcode{is_heap}} -\indexlibrary{\idxcode{is_heap}}% +\indexlibraryglobal{is_heap}% \begin{itemdecl} template constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last); @@ -7758,7 +7760,7 @@ Equivalent to: \tcode{return is_heap_until(first, last) == last;} \end{itemdescr} -\indexlibrary{\idxcode{is_heap}}% +\indexlibraryglobal{is_heap}% \begin{itemdecl} template bool is_heap(ExecutionPolicy&& exec, @@ -7774,7 +7776,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{is_heap}}% +\indexlibraryglobal{is_heap}% \begin{itemdecl} template constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last, @@ -7787,7 +7789,7 @@ Equivalent to: \tcode{return is_heap_until(first, last, comp) == last;} \end{itemdescr} -\indexlibrary{\idxcode{is_heap}}% +\indexlibraryglobal{is_heap}% \begin{itemdecl} template bool is_heap(ExecutionPolicy&& exec, @@ -7804,7 +7806,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{is_heap}}% +\indexlibraryglobal{is_heap}% \begin{itemdecl} template S, class Proj = identity, indirect_strict_weak_order> Comp = ranges::less> @@ -7821,7 +7823,7 @@ \tcode{return ranges::is_heap_until(first, last, comp, proj) == last;} \end{itemdescr} -\indexlibrary{\idxcode{is_heap_until}}% +\indexlibraryglobal{is_heap_until}% \begin{itemdecl} template constexpr RandomAccessIterator @@ -7870,7 +7872,7 @@ \rSec2[alg.min.max]{Minimum and maximum} -\indexlibrary{\idxcode{min}}% +\indexlibraryglobal{min}% \begin{itemdecl} template constexpr const T& min(const T& a, const T& b); @@ -7904,7 +7906,7 @@ Exactly one comparison and two applications of the projection, if any. \end{itemdescr} -\indexlibrary{\idxcode{min}}% +\indexlibraryglobal{min}% \begin{itemdecl} template constexpr T min(initializer_list r); @@ -7947,7 +7949,7 @@ and twice as many applications of the projection, if any. \end{itemdescr} -\indexlibrary{\idxcode{max}}% +\indexlibraryglobal{max}% \begin{itemdecl} template constexpr const T& max(const T& a, const T& b); @@ -7981,7 +7983,7 @@ Exactly one comparison and two applications of the projection, if any. \end{itemdescr} -\indexlibrary{\idxcode{max}}% +\indexlibraryglobal{max}% \begin{itemdecl} template constexpr T max(initializer_list r); @@ -8024,7 +8026,7 @@ and twice as many applications of the projection, if any. \end{itemdescr} -\indexlibrary{\idxcode{minmax}}% +\indexlibraryglobal{minmax}% \begin{itemdecl} template constexpr pair minmax(const T& a, const T& b); @@ -8060,7 +8062,7 @@ Exactly one comparison and two applications of the projection, if any. \end{itemdescr} -\indexlibrary{\idxcode{minmax}}% +\indexlibraryglobal{minmax}% \begin{itemdecl} template constexpr pair minmax(initializer_list t); @@ -8107,7 +8109,7 @@ and twice as many applications of the projection, if any. \end{itemdescr} -\indexlibrary{\idxcode{min_element}}% +\indexlibraryglobal{min_element}% \begin{itemdecl} template constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last); @@ -8155,7 +8157,7 @@ twice as many projections. \end{itemdescr} -\indexlibrary{\idxcode{max_element}}% +\indexlibraryglobal{max_element}% \begin{itemdecl} template constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last); @@ -8202,7 +8204,7 @@ twice as many projections. \end{itemdescr} -\indexlibrary{\idxcode{minmax_element}}% +\indexlibraryglobal{minmax_element}% \begin{itemdecl} template constexpr pair @@ -8250,7 +8252,7 @@ \rSec2[alg.clamp]{Bounded value} -\indexlibrary{\idxcode{clamp}}% +\indexlibraryglobal{clamp}% \begin{itemdecl} template constexpr const T& clamp(const T& v, const T& lo, const T& hi); @@ -8283,7 +8285,7 @@ \rSec2[alg.lex.comparison]{Lexicographical comparison} -\indexlibrary{\idxcode{lexicographical_compare}}% +\indexlibraryglobal{lexicographical_compare}% \begin{itemdecl} template constexpr bool @@ -8370,7 +8372,7 @@ \rSec2[alg.three.way]{Three-way comparison algorithms} -\indexlibrary{\idxcode{lexicographical_compare_three_way}}% +\indexlibraryglobal{lexicographical_compare_three_way}% \begin{itemdecl} template constexpr auto @@ -8401,7 +8403,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{lexicographical_compare_three_way}}% +\indexlibraryglobal{lexicographical_compare_three_way}% \begin{itemdecl} template constexpr auto @@ -8420,7 +8422,7 @@ \rSec2[alg.permutation.generators]{Permutation generators} -\indexlibrary{\idxcode{next_permutation}}% +\indexlibraryglobal{next_permutation}% \begin{itemdecl} template constexpr bool next_permutation(BidirectionalIterator first, @@ -8479,7 +8481,7 @@ At most \tcode{(last - first) / 2} swaps. \end{itemdescr} -\indexlibrary{\idxcode{prev_permutation}}% +\indexlibraryglobal{prev_permutation}% \begin{itemdecl} template constexpr bool prev_permutation(BidirectionalIterator first, @@ -8540,7 +8542,7 @@ \rSec1[numeric.ops.overview]{Header \tcode{} synopsis} -\indexhdr{numeric}% +\indexheader{numeric}% \begin{codeblock} namespace std { // \ref{accumulate}, accumulate @@ -8559,13 +8561,13 @@ T reduce(InputIterator first, InputIterator last, T init, BinaryOperation binary_op); template typename iterator_traits::value_type - reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last); template - T reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + T reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, T init); template - T reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + T reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator first, ForwardIterator last, T init, BinaryOperation binary_op); // \ref{inner.product}, inner product @@ -8576,182 +8578,164 @@ class BinaryOperation1, class BinaryOperation2> T inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init, - BinaryOperation1 binary_op1, - BinaryOperation2 binary_op2); + BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); // \ref{transform.reduce}, transform reduce template T transform_reduce(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, - T init); + InputIterator2 first2, T init); template T transform_reduce(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, - T init, - BinaryOperation1 binary_op1, - BinaryOperation2 binary_op2); + InputIterator2 first2, T init, + BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); template - T transform_reduce(InputIterator first, InputIterator last, - T init, + T transform_reduce(InputIterator first, InputIterator last, T init, BinaryOperation binary_op, UnaryOperation unary_op); template - T transform_reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + T transform_reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, - T init); + ForwardIterator2 first2, T init); template - T transform_reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + T transform_reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, - T init, - BinaryOperation1 binary_op1, - BinaryOperation2 binary_op2); - template - T transform_reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator first, ForwardIterator last, - T init, + T transform_reduce(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator first, ForwardIterator last, T init, BinaryOperation binary_op, UnaryOperation unary_op); // \ref{partial.sum}, partial sum template - OutputIterator partial_sum(InputIterator first, - InputIterator last, - OutputIterator result); + OutputIterator + partial_sum(InputIterator first, InputIterator last, + OutputIterator result); template - OutputIterator partial_sum(InputIterator first, - InputIterator last, - OutputIterator result, - BinaryOperation binary_op); + OutputIterator + partial_sum(InputIterator first, InputIterator last, + OutputIterator result, BinaryOperation binary_op); // \ref{exclusive.scan}, exclusive scan template - OutputIterator exclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, - T init); + OutputIterator + exclusive_scan(InputIterator first, InputIterator last, + OutputIterator result, T init); template - OutputIterator exclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, - T init, BinaryOperation binary_op); + OutputIterator + exclusive_scan(InputIterator first, InputIterator last, + OutputIterator result, T init, BinaryOperation binary_op); template - ForwardIterator2 exclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, - T init); + ForwardIterator2 + exclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, T init); template - ForwardIterator2 exclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, - T init, BinaryOperation binary_op); + ForwardIterator2 + exclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, T init, BinaryOperation binary_op); // \ref{inclusive.scan}, inclusive scan template - OutputIterator inclusive_scan(InputIterator first, InputIterator last, - OutputIterator result); + OutputIterator + inclusive_scan(InputIterator first, InputIterator last, + OutputIterator result); template - OutputIterator inclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, - BinaryOperation binary_op); + OutputIterator + inclusive_scan(InputIterator first, InputIterator last, + OutputIterator result, BinaryOperation binary_op); template - OutputIterator inclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, - BinaryOperation binary_op, T init); + OutputIterator + inclusive_scan(InputIterator first, InputIterator last, + OutputIterator result, BinaryOperation binary_op, T init); template - ForwardIterator2 inclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result); + ForwardIterator2 + inclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result); template - ForwardIterator2 inclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, - BinaryOperation binary_op); + ForwardIterator2 + inclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, BinaryOperation binary_op); template - ForwardIterator2 inclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, - BinaryOperation binary_op, T init); + ForwardIterator2 + inclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, BinaryOperation binary_op, T init); // \ref{transform.exclusive.scan}, transform exclusive scan template - OutputIterator transform_exclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, - T init, - BinaryOperation binary_op, - UnaryOperation unary_op); - template - ForwardIterator2 transform_exclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, - T init, - BinaryOperation binary_op, - UnaryOperation unary_op); + ForwardIterator2 + transform_exclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, T init, + BinaryOperation binary_op, UnaryOperation unary_op); // \ref{transform.inclusive.scan}, transform inclusive scan template - OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, - BinaryOperation binary_op, - UnaryOperation unary_op); + OutputIterator + transform_inclusive_scan(InputIterator first, InputIterator last, + OutputIterator result, + BinaryOperation binary_op, UnaryOperation unary_op); template - OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, - BinaryOperation binary_op, - UnaryOperation unary_op, - T init); - template - ForwardIterator2 transform_inclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, - BinaryOperation binary_op, - UnaryOperation unary_op); - template - ForwardIterator2 transform_inclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, - BinaryOperation binary_op, - UnaryOperation unary_op, - T init); + ForwardIterator2 + transform_inclusive_scan(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, + BinaryOperation binary_op, UnaryOperation unary_op, T init); // \ref{adjacent.difference}, adjacent difference template - OutputIterator adjacent_difference(InputIterator first, - InputIterator last, - OutputIterator result); + OutputIterator + adjacent_difference(InputIterator first, InputIterator last, + OutputIterator result); template - OutputIterator adjacent_difference(InputIterator first, - InputIterator last, - OutputIterator result, - BinaryOperation binary_op); + OutputIterator + adjacent_difference(InputIterator first, InputIterator last, + OutputIterator result, BinaryOperation binary_op); template - ForwardIterator2 adjacent_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, - ForwardIterator1 last, - ForwardIterator2 result); + ForwardIterator2 + adjacent_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result); template - ForwardIterator2 adjacent_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} - ForwardIterator1 first, - ForwardIterator1 last, - ForwardIterator2 result, - BinaryOperation binary_op); + ForwardIterator2 + adjacent_difference(ExecutionPolicy&& exec, // see \ref{algorithms.parallel.overloads} + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, BinaryOperation binary_op); // \ref{numeric.iota}, iota template @@ -8806,7 +8790,7 @@ \rSec2[accumulate]{Accumulate} -\indexlibrary{\idxcode{accumulate}}% +\indexlibraryglobal{accumulate}% \begin{itemdecl} template T accumulate(InputIterator first, InputIterator last, T init); @@ -8842,7 +8826,7 @@ \rSec2[reduce]{Reduce} -\indexlibrary{\idxcode{reduce}}% +\indexlibraryglobal{reduce}% \begin{itemdecl} template typename iterator_traits::value_type @@ -8851,14 +8835,15 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return reduce(first, last, typename iterator_traits::value_type{}); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{reduce}}% +\indexlibraryglobal{reduce}% \begin{itemdecl} template typename iterator_traits::value_type @@ -8868,7 +8853,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return reduce(std::forward(exec), first, last, typename iterator_traits::value_type{}); @@ -8876,7 +8862,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{reduce}}% +\indexlibraryglobal{reduce}% \begin{itemdecl} template T reduce(InputIterator first, InputIterator last, T init); @@ -8884,13 +8870,14 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return reduce(first, last, init, plus<>()); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{reduce}}% +\indexlibraryglobal{reduce}% \begin{itemdecl} template T reduce(ExecutionPolicy&& exec, @@ -8899,14 +8886,15 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return reduce(std::forward(exec), first, last, init, plus<>()); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{reduce}}% +\indexlibraryglobal{reduce}% \begin{itemdecl} template T reduce(InputIterator first, InputIterator last, T init, @@ -8953,7 +8941,7 @@ \rSec2[inner.product]{Inner product} -\indexlibrary{\idxcode{inner_product}}% +\indexlibraryglobal{inner_product}% \begin{itemdecl} template T inner_product(InputIterator1 first1, InputIterator1 last1, @@ -8991,7 +8979,7 @@ \end{itemdescr} \rSec2[transform.reduce]{Transform reduce} -\indexlibrary{\idxcode{transform_reduce}}% +\indexlibraryglobal{transform_reduce}% \begin{itemdecl} template T transform_reduce(InputIterator1 first1, InputIterator1 last1, @@ -9008,7 +8996,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{transform_reduce}}% +\indexlibraryglobal{transform_reduce}% \begin{itemdecl} template @@ -9028,7 +9016,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{transform_reduce}}% +\indexlibraryglobal{transform_reduce}% \begin{itemdecl} template @@ -9082,7 +9070,7 @@ of \tcode{binary_op1} and \tcode{binary_op2}. \end{itemdescr} -\indexlibrary{\idxcode{transform_reduce}}% +\indexlibraryglobal{transform_reduce}% \begin{itemdecl} template @@ -9136,7 +9124,7 @@ \rSec2[partial.sum]{Partial sum} -\indexlibrary{\idxcode{partial_sum}}% +\indexlibraryglobal{partial_sum}% \begin{itemdecl} template OutputIterator partial_sum( @@ -9190,7 +9178,7 @@ \rSec2[exclusive.scan]{Exclusive scan} -\indexlibrary{\idxcode{exclusive_scan}}% +\indexlibraryglobal{exclusive_scan}% \begin{itemdecl} template OutputIterator exclusive_scan(InputIterator first, InputIterator last, @@ -9199,13 +9187,14 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return exclusive_scan(first, last, result, init, plus<>()); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{exclusive_scan}}% +\indexlibraryglobal{exclusive_scan}% \begin{itemdecl} template ForwardIterator2 exclusive_scan(ExecutionPolicy&& exec, @@ -9215,14 +9204,15 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return exclusive_scan(std::forward(exec), first, last, result, init, plus<>()); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{exclusive_scan}}% +\indexlibraryglobal{exclusive_scan}% \begin{itemdecl} template OutputIterator exclusive_scan(InputIterator first, InputIterator last, @@ -9285,7 +9275,7 @@ \rSec2[inclusive.scan]{Inclusive scan} -\indexlibrary{\idxcode{inclusive_scan}}% +\indexlibraryglobal{inclusive_scan}% \begin{itemdecl} template OutputIterator inclusive_scan(InputIterator first, InputIterator last, OutputIterator result); @@ -9293,13 +9283,14 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return inclusive_scan(first, last, result, plus<>()); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{inclusive_scan}}% +\indexlibraryglobal{inclusive_scan}% \begin{itemdecl} template ForwardIterator2 inclusive_scan(ExecutionPolicy&& exec, @@ -9309,13 +9300,14 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return inclusive_scan(std::forward(exec), first, last, result, plus<>()); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{inclusive_scan}}% +\indexlibraryglobal{inclusive_scan}% \begin{itemdecl} template OutputIterator inclusive_scan(InputIterator first, InputIterator last, @@ -9396,7 +9388,7 @@ \rSec2[transform.exclusive.scan]{Transform exclusive scan} -\indexlibrary{\idxcode{transform_exclusive_scan}}% +\indexlibraryglobal{transform_exclusive_scan}% \begin{itemdecl} template @@ -9469,7 +9461,7 @@ \rSec2[transform.inclusive.scan]{Transform inclusive scan} -\indexlibrary{\idxcode{transform_inclusive_scan}}% +\indexlibraryglobal{transform_inclusive_scan}% \begin{itemdecl} template @@ -9564,7 +9556,7 @@ \rSec2[adjacent.difference]{Adjacent difference} -\indexlibrary{\idxcode{adjacent_difference}}% +\indexlibraryglobal{adjacent_difference}% \begin{itemdecl} template OutputIterator @@ -9655,7 +9647,7 @@ \rSec2[numeric.iota]{Iota} -\indexlibrary{\idxcode{iota}}% +\indexlibraryglobal{iota}% \begin{itemdecl} template void iota(ForwardIterator first, ForwardIterator last, T value); @@ -9682,7 +9674,7 @@ \rSec2[numeric.ops.gcd]{Greatest common divisor} -\indexlibrary{\idxcode{gcd}}% +\indexlibraryglobal{gcd}% \begin{itemdecl} template constexpr common_type_t gcd(M m, N n); @@ -9716,7 +9708,7 @@ \rSec2[numeric.ops.lcm]{Least common multiple} -\indexlibrary{\idxcode{lcm}}% +\indexlibraryglobal{lcm}% \begin{itemdecl} template constexpr common_type_t lcm(M m, N n); @@ -9747,7 +9739,7 @@ \rSec2[numeric.ops.midpoint]{Midpoint} -\indexlibrary{\idxcode{midpoint}}% +\indexlibraryglobal{midpoint}% \begin{itemdecl} template constexpr T midpoint(T a, T b) noexcept; @@ -9769,7 +9761,7 @@ If \tcode{T} is a floating-point type, at most one inexact operation occurs. \end{itemdescr} -\indexlibrary{\idxcode{midpoint}}% +\indexlibraryglobal{midpoint}% \begin{itemdecl} template constexpr T* midpoint(T* a, T* b); @@ -9801,14 +9793,13 @@ \rSec1[alg.c.library]{C library algorithms} \pnum -\indexhdr{cstdlib}% \begin{note} -The header \tcode{}\iref{cstdlib.syn} +The header \libheaderref{cstdlib} declares the functions described in this subclause. \end{note} -\indexlibrary{\idxcode{bsearch}}% -\indexlibrary{\idxcode{qsort}}% +\indexlibraryglobal{bsearch}% +\indexlibraryglobal{qsort}% \begin{itemdecl} void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, @\placeholder{c-compare-pred}@* compar); diff --git a/source/atomics.tex b/source/atomics.tex index 101a09b4e6..871bcb1111 100644 --- a/source/atomics.tex +++ b/source/atomics.tex @@ -25,7 +25,7 @@ \rSec1[atomics.syn]{Header \tcode{} synopsis} -\indexhdr{atomic}% +\indexheader{atomic}% \begin{codeblock} namespace std { // \ref{atomics.order}, order and consistency @@ -294,52 +294,52 @@ \end{codeblock} \rSec1[atomics.alias]{Type aliases} -\indexlibrary{\idxcode{atomic_bool}}% -\indexlibrary{\idxcode{atomic_char}}% -\indexlibrary{\idxcode{atomic_schar}}% -\indexlibrary{\idxcode{atomic_uchar}}% -\indexlibrary{\idxcode{atomic_short}}% -\indexlibrary{\idxcode{atomic_ushort}}% -\indexlibrary{\idxcode{atomic_int}}% -\indexlibrary{\idxcode{atomic_uint}}% -\indexlibrary{\idxcode{atomic_long}}% -\indexlibrary{\idxcode{atomic_ulong}}% -\indexlibrary{\idxcode{atomic_llong}}% -\indexlibrary{\idxcode{atomic_ullong}}% -\indexlibrary{\idxcode{atomic_char8_t}}% -\indexlibrary{\idxcode{atomic_char16_t}}% -\indexlibrary{\idxcode{atomic_char32_t}}% -\indexlibrary{\idxcode{atomic_wchar_t}}% -\indexlibrary{\idxcode{atomic_int8_t}}% -\indexlibrary{\idxcode{atomic_uint8_t}}% -\indexlibrary{\idxcode{atomic_int16_t}}% -\indexlibrary{\idxcode{atomic_uint16_t}}% -\indexlibrary{\idxcode{atomic_int32_t}}% -\indexlibrary{\idxcode{atomic_uint32_t}}% -\indexlibrary{\idxcode{atomic_int64_t}}% -\indexlibrary{\idxcode{atomic_uint64_t}}% -\indexlibrary{\idxcode{atomic_int_least8_t}}% -\indexlibrary{\idxcode{atomic_uint_least8_t}}% -\indexlibrary{\idxcode{atomic_int_least16_t}}% -\indexlibrary{\idxcode{atomic_uint_least16_t}}% -\indexlibrary{\idxcode{atomic_int_least32_t}}% -\indexlibrary{\idxcode{atomic_uint_least32_t}}% -\indexlibrary{\idxcode{atomic_int_least64_t}}% -\indexlibrary{\idxcode{atomic_uint_least64_t}}% -\indexlibrary{\idxcode{atomic_int_fast8_t}}% -\indexlibrary{\idxcode{atomic_uint_fast8_t}}% -\indexlibrary{\idxcode{atomic_int_fast16_t}}% -\indexlibrary{\idxcode{atomic_uint_fast16_t}}% -\indexlibrary{\idxcode{atomic_int_fast32_t}}% -\indexlibrary{\idxcode{atomic_uint_fast32_t}}% -\indexlibrary{\idxcode{atomic_int_fast64_t}}% -\indexlibrary{\idxcode{atomic_uint_fast64_t}}% -\indexlibrary{\idxcode{atomic_intptr_t}}% -\indexlibrary{\idxcode{atomic_uintptr_t}}% -\indexlibrary{\idxcode{atomic_size_t}}% -\indexlibrary{\idxcode{atomic_ptrdiff_t}}% -\indexlibrary{\idxcode{atomic_intmax_t}}% -\indexlibrary{\idxcode{atomic_uintmax_t}}% +\indexlibraryglobal{atomic_bool}% +\indexlibraryglobal{atomic_char}% +\indexlibraryglobal{atomic_schar}% +\indexlibraryglobal{atomic_uchar}% +\indexlibraryglobal{atomic_short}% +\indexlibraryglobal{atomic_ushort}% +\indexlibraryglobal{atomic_int}% +\indexlibraryglobal{atomic_uint}% +\indexlibraryglobal{atomic_long}% +\indexlibraryglobal{atomic_ulong}% +\indexlibraryglobal{atomic_llong}% +\indexlibraryglobal{atomic_ullong}% +\indexlibraryglobal{atomic_char8_t}% +\indexlibraryglobal{atomic_char16_t}% +\indexlibraryglobal{atomic_char32_t}% +\indexlibraryglobal{atomic_wchar_t}% +\indexlibraryglobal{atomic_int8_t}% +\indexlibraryglobal{atomic_uint8_t}% +\indexlibraryglobal{atomic_int16_t}% +\indexlibraryglobal{atomic_uint16_t}% +\indexlibraryglobal{atomic_int32_t}% +\indexlibraryglobal{atomic_uint32_t}% +\indexlibraryglobal{atomic_int64_t}% +\indexlibraryglobal{atomic_uint64_t}% +\indexlibraryglobal{atomic_int_least8_t}% +\indexlibraryglobal{atomic_uint_least8_t}% +\indexlibraryglobal{atomic_int_least16_t}% +\indexlibraryglobal{atomic_uint_least16_t}% +\indexlibraryglobal{atomic_int_least32_t}% +\indexlibraryglobal{atomic_uint_least32_t}% +\indexlibraryglobal{atomic_int_least64_t}% +\indexlibraryglobal{atomic_uint_least64_t}% +\indexlibraryglobal{atomic_int_fast8_t}% +\indexlibraryglobal{atomic_uint_fast8_t}% +\indexlibraryglobal{atomic_int_fast16_t}% +\indexlibraryglobal{atomic_uint_fast16_t}% +\indexlibraryglobal{atomic_int_fast32_t}% +\indexlibraryglobal{atomic_uint_fast32_t}% +\indexlibraryglobal{atomic_int_fast64_t}% +\indexlibraryglobal{atomic_uint_fast64_t}% +\indexlibraryglobal{atomic_intptr_t}% +\indexlibraryglobal{atomic_uintptr_t}% +\indexlibraryglobal{atomic_size_t}% +\indexlibraryglobal{atomic_ptrdiff_t}% +\indexlibraryglobal{atomic_intmax_t}% +\indexlibraryglobal{atomic_uintmax_t}% \pnum The type aliases \tcode{atomic_int$N$_t}, \tcode{atomic_uint$N$_t}, \tcode{atomic_intptr_t}, and \tcode{atomic_uintptr_t} @@ -349,8 +349,8 @@ are defined, respectively. \pnum -\indexlibrary{\idxcode{atomic_signed_lock_free}}% -\indexlibrary{\idxcode{atomic_unsigned_lock_free}}% +\indexlibraryglobal{atomic_signed_lock_free}% +\indexlibraryglobal{atomic_unsigned_lock_free}% The type aliases \tcode{atomic_signed_lock_free} and \tcode{atomic_unsigned_lock_free} name specializations of \tcode{atomic} @@ -365,19 +365,19 @@ are most efficient. \rSec1[atomics.order]{Order and consistency} -\indexlibrary{\idxcode{memory_order}}% +\indexlibraryglobal{memory_order}% \indexlibrarymember{relaxed}{memory_order}% \indexlibrarymember{consume}{memory_order}% \indexlibrarymember{acquire}{memory_order}% \indexlibrarymember{release}{memory_order}% \indexlibrarymember{acq_rel}{memory_order}% \indexlibrarymember{seq_cst}{memory_order}% -\indexlibrary{\idxcode{memory_order_relaxed}}% -\indexlibrary{\idxcode{memory_order_consume}}% -\indexlibrary{\idxcode{memory_order_acquire}}% -\indexlibrary{\idxcode{memory_order_release}}% -\indexlibrary{\idxcode{memory_order_acq_rel}}% -\indexlibrary{\idxcode{memory_order_seq_cst}}% +\indexlibraryglobal{memory_order_relaxed}% +\indexlibraryglobal{memory_order_consume}% +\indexlibraryglobal{memory_order_acquire}% +\indexlibraryglobal{memory_order_release}% +\indexlibraryglobal{memory_order_acq_rel}% +\indexlibraryglobal{memory_order_seq_cst}% \begin{codeblock} namespace std { @@ -408,20 +408,24 @@ \item \tcode{memory_order::consume}: a load operation performs a consume operation on the affected memory location. -\begin{note} Prefer \tcode{memory_order::acquire}, which provides stronger guarantees +\begin{note} +Prefer \tcode{memory_order::acquire}, which provides stronger guarantees than \tcode{memory_order::consume}. Implementations have found it infeasible to provide performance better than that of \tcode{memory_order::acquire}. -Specification revisions are under consideration. \end{note} +Specification revisions are under consideration. +\end{note} \item \tcode{memory_order::acquire}, \tcode{memory_order::acq_rel}, and \tcode{memory_order::seq_cst}: a load operation performs an acquire operation on the affected memory location. \end{itemize} -\begin{note} Atomic operations specifying \tcode{memory_order::relaxed} are relaxed +\begin{note} +Atomic operations specifying \tcode{memory_order::relaxed} are relaxed with respect to memory ordering. Implementations must still guarantee that any given atomic access to a particular atomic object be indivisible with respect -to all other atomic accesses to that object. \end{note} +to all other atomic accesses to that object. +\end{note} \pnum An atomic operation \placeholder{A} that performs a release operation on an atomic @@ -519,8 +523,8 @@ Implementations should ensure that no ``out-of-thin-air'' values are computed that circularly depend on their own computation. -\begin{note} For example, with \tcode{x} and \tcode{y} initially zero, - +\begin{note} +For example, with \tcode{x} and \tcode{y} initially zero, \begin{codeblock} // Thread 1: r1 = y.load(memory_order::relaxed); @@ -532,7 +536,6 @@ r2 = x.load(memory_order::relaxed); y.store(r2, memory_order::relaxed); \end{codeblock} - should not produce \tcode{r1 == r2 == 42}, since the store of 42 to \tcode{y} is only possible if the store to \tcode{x} stores \tcode{42}, which circularly depends on the store to \tcode{y} storing \tcode{42}. Note that without this restriction, such an @@ -540,7 +543,8 @@ \end{note} \pnum -\begin{note} The recommendation similarly disallows \tcode{r1 == r2 == 42} in the +\begin{note} +The recommendation similarly disallows \tcode{r1 == r2 == 42} in the following example, with \tcode{x} and \tcode{y} again initially zero: \begin{codeblock} @@ -554,7 +558,6 @@ r2 = y.load(memory_order::relaxed); if (r2 == 42) x.store(42, memory_order::relaxed); \end{codeblock} - \end{note} \pnum @@ -566,7 +569,7 @@ Implementations should make atomic stores visible to atomic loads within a reasonable amount of time. -\indexlibrary{\idxcode{kill_dependency}}% +\indexlibraryglobal{kill_dependency}% \begin{itemdecl} template T kill_dependency(T y) noexcept; @@ -574,27 +577,29 @@ \begin{itemdescr} \pnum -\effects The argument does not carry a dependency to the return +\effects +The argument does not carry a dependency to the return value\iref{intro.multithread}. \pnum -\returns \tcode{y}. +\returns +\tcode{y}. \end{itemdescr} \rSec1[atomics.lockfree]{Lock-free property} -\indexlibrary{\idxcode{ATOMIC_BOOL_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_CHAR_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_CHAR8_T_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_CHAR16_T_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_CHAR32_T_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_WCHAR_T_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_SHORT_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_INT_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_LONG_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_LLONG_LOCK_FREE}}% -\indexlibrary{\idxcode{ATOMIC_POINTER_LOCK_FREE}}% +\indexlibraryglobal{ATOMIC_BOOL_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_CHAR_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_CHAR8_T_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_CHAR16_T_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_CHAR32_T_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_WCHAR_T_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_SHORT_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_INT_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_LONG_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_LLONG_LOCK_FREE}% +\indexlibraryglobal{ATOMIC_POINTER_LOCK_FREE}% \indeximpldef{values of various \tcode{ATOMIC_..._LOCK_FREE} macros} \begin{codeblock} #define ATOMIC_BOOL_LOCK_FREE @\unspec@ @@ -638,18 +643,20 @@ block\iref{intro.progress}. \pnum -\begin{note} Operations that are lock-free should also be address-free. That is, +\begin{note} +Operations that are lock-free should also be address-free. That is, atomic operations on the same memory location via two different addresses will communicate atomically. The implementation should not depend on any per-process state. This restriction enables communication by memory that is mapped into a process more than once and by memory that is shared between two -processes. \end{note} +processes. +\end{note} \rSec1[atomics.wait]{Waiting and notifying} \pnum -\defnx{Atomic waiting operations}{atomic waiting operation} -and \defnx{atomic notifying operations}{atomic notifying operation} +\defnx{Atomic waiting operations}{atomic!waiting operation} +and \defnx{atomic notifying operations}{atomic!notifying operation} provide a mechanism to wait for the value of an atomic object to change more efficiently than can be achieved with polling. An atomic waiting operation may block until it is unblocked @@ -684,6 +691,7 @@ \end{itemize} \end{note} +\indextext{atomic!waiting operation!eligible to be unblocked}% \pnum A call to an atomic waiting operation on an atomic object \tcode{M} is \defn{eligible to be unblocked} @@ -697,7 +705,7 @@ \rSec1[atomics.ref.generic]{Class template \tcode{atomic_ref}} -\indexlibrary{\idxcode{atomic_ref}}% +\indexlibraryglobal{atomic_ref}% \indexlibrarymember{value_type}{atomic_ref}% \begin{codeblock} namespace std { @@ -706,20 +714,20 @@ T* ptr; // \expos public: using value_type = T; - static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic_ref} type's operations are always lock free}@; static constexpr size_t required_alignment = @\impdefx{required alignment for \tcode{atomic_ref} type's operations}@; - atomic_ref& operator=(const atomic_ref&) = delete; + 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(T&); atomic_ref(const atomic_ref&) noexcept; + atomic_ref& operator=(const atomic_ref&) = delete; + void store(T, memory_order = memory_order_seq_cst) const noexcept; T operator=(T) const noexcept; + T load(memory_order = memory_order_seq_cst) const noexcept; operator T() const noexcept; - bool is_lock_free() const noexcept; - void store(T, memory_order = memory_order_seq_cst) const noexcept; - T load(memory_order = memory_order_seq_cst) const noexcept; T exchange(T, memory_order = memory_order_seq_cst) const noexcept; bool compare_exchange_weak(T&, T, memory_order, memory_order) const noexcept; @@ -729,6 +737,7 @@ memory_order = memory_order_seq_cst) const noexcept; bool compare_exchange_strong(T&, T, memory_order = memory_order_seq_cst) const noexcept; + void wait(T, memory_order = memory_order::seq_cst) const noexcept; void notify_one() noexcept; void notify_all() noexcept; @@ -767,22 +776,7 @@ to enable atomic operations to be applied to the referenced object. \end{note} -\rSec2[atomics.ref.operations]{Operations} - -\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}>}% -\begin{itemdecl} -static constexpr bool is_always_lock_free; -\end{itemdecl} - -\begin{itemdescr} -\pnum -The static data member \tcode{is_always_lock_free} is \tcode{true} -if the \tcode{atomic_ref} type's operations are always lock-free, -and \tcode{false} otherwise. -\end{itemdescr} +\rSec2[atomics.ref.ops]{Operations} \indexlibrarymember{required_alignment}{atomic_ref}% \indexlibrarymember{required_alignment}{atomic_ref}% @@ -810,81 +804,70 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{atomic_ref}!constructor}% -\indexlibrary{\idxcode{atomic_ref}!constructor}% -\indexlibrary{\idxcode{atomic_ref<\placeholder{integral}>}!constructor}% -\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point}>}!constructor}% +\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}>}% \begin{itemdecl} -atomic_ref(T& obj); +static constexpr bool is_always_lock_free; \end{itemdecl} \begin{itemdescr} \pnum -\requires The referenced object shall be aligned to \tcode{required_alignment}. - -\pnum -\effects Constructs an atomic reference that references the object. - -\pnum -\throws Nothing. +The static data member \tcode{is_always_lock_free} is \tcode{true} +if the \tcode{atomic_ref} type's operations are always lock-free, +and \tcode{false} otherwise. \end{itemdescr} -\indexlibrary{\idxcode{atomic_ref}!constructor}% -\indexlibrary{\idxcode{atomic_ref}!constructor}% -\indexlibrary{\idxcode{atomic_ref<\placeholder{integral}>}!constructor}% -\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point}>}!constructor}% +\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}>}% \begin{itemdecl} -atomic_ref(const atomic_ref& ref) noexcept; +bool is_lock_free() const noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an atomic reference -that references the object referenced by \tcode{ref}. +\returns +\tcode{true} if the object's operations are lock-free, +\tcode{false} otherwise. \end{itemdescr} -\indexlibrarymember{operator=}{atomic_ref}% -\indexlibrarymember{operator=}{atomic_ref}% -\indexlibrarymember{operator=}{atomic_ref<\placeholder{integral}>}% -\indexlibrarymember{operator=}{atomic_ref<\placeholder{floating-point}>}% +\indexlibraryctor{atomic_ref}% +\indexlibraryctor{atomic_ref}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{integral}>}!constructor}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point}>}!constructor}% \begin{itemdecl} -T operator=(T desired) const noexcept; +atomic_ref(T& obj); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: -\begin{codeblock} -store(desired); -return desired; -\end{codeblock} -\end{itemdescr} +\requires The referenced object shall be aligned to \tcode{required_alignment}. -\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}>}% -\begin{itemdecl} -operator T() const noexcept; -\end{itemdecl} +\pnum +\effects +Constructs an atomic reference that references the object. -\begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return load();} +\throws +Nothing. \end{itemdescr} -\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}>}% +\indexlibraryctor{atomic_ref}% +\indexlibraryctor{atomic_ref}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{integral}>}!constructor}% +\indexlibrary{\idxcode{atomic_ref<\placeholder{floating-point}>}!constructor}% \begin{itemdecl} -bool is_lock_free() const noexcept; +atomic_ref(const atomic_ref& ref) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{true} if the object's operations are lock-free, -\tcode{false} otherwise. +\effects +Constructs an atomic reference +that references the object referenced by \tcode{ref}. \end{itemdescr} \indexlibrarymember{store}{atomic_ref}% @@ -903,11 +886,30 @@ \tcode{memory_order_acq_rel}. \pnum -\effects Atomically replaces the value referenced by \tcode{*ptr} +\effects +Atomically replaces the value referenced by \tcode{*ptr} with the value of \tcode{desired}. Memory is affected according to the value of \tcode{order}. \end{itemdescr} +\indexlibrarymember{operator=}{atomic_ref}% +\indexlibrarymember{operator=}{atomic_ref}% +\indexlibrarymember{operator=}{atomic_ref<\placeholder{integral}>}% +\indexlibrarymember{operator=}{atomic_ref<\placeholder{floating-point}>}% +\begin{itemdecl} +T operator=(T desired) const noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Equivalent to: +\begin{codeblock} +store(desired); +return desired; +\end{codeblock} +\end{itemdescr} + \indexlibrarymember{load}{atomic_ref}% \indexlibrarymember{load}{atomic_ref}% \indexlibrarymember{load}{atomic_ref<\placeholder{integral}>}% @@ -922,10 +924,26 @@ \tcode{memory_order_release} nor \tcode{memory_order_acq_rel}. \pnum -\effects Memory is affected according to the value of \tcode{order}. +\effects +Memory is affected according to the value of \tcode{order}. \pnum -\returns Atomically returns the value referenced by \tcode{*ptr}. +\returns +Atomically returns the value referenced by \tcode{*ptr}. +\end{itemdescr} + +\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}>}% +\begin{itemdecl} +operator T() const noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\effects +Equivalent to: \tcode{return load();} \end{itemdescr} \indexlibrarymember{exchange}{atomic_ref}% @@ -938,13 +956,15 @@ \begin{itemdescr} \pnum -\effects Atomically replaces the value referenced by \tcode{*ptr} +\effects +Atomically replaces the value referenced by \tcode{*ptr} with \tcode{desired}. Memory is affected according to the value of \tcode{order}. This operation is an atomic read-modify-write operation\iref{intro.multithread}. \pnum -\returns Atomically returns the value referenced by \tcode{*ptr} +\returns +Atomically returns the value referenced by \tcode{*ptr} immediately before the effects. \end{itemdescr} @@ -976,7 +996,8 @@ \tcode{memory_order_release} nor \tcode{memory_order_acq_rel}. \pnum -\effects Retrieves the value in \tcode{expected}. +\effects +Retrieves the value in \tcode{expected}. It then atomically compares the value representation of the value referenced by \tcode{*ptr} for equality with that previously retrieved from \tcode{expected}, @@ -1004,10 +1025,12 @@ Otherwise, these operations are atomic load operations on that memory. \pnum -\returns The result of the comparison. +\returns +The result of the comparison. \pnum -\remarks A weak compare-and-exchange operation may fail spuriously. +\remarks +A weak compare-and-exchange operation may fail spuriously. That is, even when the contents of memory referred to by \tcode{expected} and \tcode{ptr} are equal, it may return \tcode{false} and @@ -1063,7 +1086,7 @@ \begin{itemdescr} \pnum -\expects +\effects Unblocks the execution of at least one atomic waiting operation on \tcode{*ptr} that is eligible to be unblocked\iref{atomics.wait} by this call, if any such atomic waiting operations exist. @@ -1081,7 +1104,7 @@ \begin{itemdescr} \pnum -\expects +\effects Unblocks the execution of all atomic waiting operations on \tcode{*ptr} that are eligible to be unblocked\iref{atomics.wait} by this call. @@ -1112,7 +1135,7 @@ \tcode{char16_t}, \tcode{char32_t}, \tcode{wchar_t}, -and any other types needed by the typedefs in the header \tcode{}. +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 additional atomic operations appropriate to integral types. @@ -1128,20 +1151,20 @@ public: using value_type = @\placeholder{integral}@; using difference_type = value_type; - static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic_ref} type's operations are always lock free}@; static constexpr size_t required_alignment = @\impdefx{required alignment for \tcode{atomic_ref} type's operations}@; - atomic_ref& operator=(const atomic_ref&) = delete; + 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}@&); 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; - bool is_lock_free() const noexcept; - void store(@\placeholdernc{integral}@, memory_order = memory_order_seq_cst) const noexcept; - @\placeholdernc{integral}@ load(memory_order = memory_order_seq_cst) const noexcept; @\placeholdernc{integral}@ exchange(@\placeholdernc{integral}@, memory_order = memory_order_seq_cst) const noexcept; bool compare_exchange_weak(@\placeholder{integral}@&, @\placeholder{integral}@, @@ -1164,10 +1187,6 @@ @\placeholdernc{integral}@ fetch_xor(@\placeholdernc{integral}@, memory_order = memory_order_seq_cst) const noexcept; - void wait(@\placeholdernc{integral}@, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() noexcept; - void notify_all() noexcept; - @\placeholdernc{integral}@ operator++(int) const noexcept; @\placeholdernc{integral}@ operator--(int) const noexcept; @\placeholdernc{integral}@ operator++() const noexcept; @@ -1177,6 +1196,10 @@ @\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; + void notify_one() noexcept; + void notify_all() noexcept; }; } \end{codeblock} @@ -1201,19 +1224,22 @@ \begin{itemdescr} \pnum -\effects Atomically replaces the value referenced by \tcode{*ptr} with +\effects +Atomically replaces the value referenced by \tcode{*ptr} with the result of the computation applied to the value referenced by \tcode{*ptr} and the given operand. Memory is affected according to the value of \tcode{order}. These operations are atomic read-modify-write operations\iref{intro.races}. \pnum -\returns Atomically, the value referenced by \tcode{*ptr} +\returns +Atomically, the value referenced by \tcode{*ptr} immediately before the effects. \pnum \indextext{signed integer representation!two's complement}% -\remarks For signed integer types, +\remarks +For signed integer types, the result is as if the object value and parameters were converted to their corresponding unsigned types, the computation performed on those types, and @@ -1234,7 +1260,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return fetch_\placeholdernc{key}(operand) \placeholder{op} operand;} \end{itemdescr} @@ -1259,20 +1286,20 @@ public: using value_type = @\placeholder{floating-point}@; using difference_type = value_type; - static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic_ref} type's operations are always lock free}@; static constexpr size_t required_alignment = @\impdefx{required alignment for \tcode{atomic_ref} type's operations}@; - atomic_ref& operator=(const atomic_ref&) = delete; + 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}@&); 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}@) noexcept; + @\placeholder{floating-point}@ load(memory_order = memory_order_seq_cst) const noexcept; operator @\placeholdernc{floating-point}@() const noexcept; - bool is_lock_free() const noexcept; - void store(@\placeholdernc{floating-point}@, memory_order = memory_order_seq_cst) const noexcept; - @\placeholder{floating-point}@ load(memory_order = memory_order_seq_cst) 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}@, @@ -1289,12 +1316,12 @@ @\placeholder{floating-point}@ fetch_sub(@\placeholdernc{floating-point}@, 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; + void wait(@\placeholdernc{floating-point}@, memory_order = memory_order::seq_cst) const noexcept; void notify_one() noexcept; void notify_all() noexcept; - - @\placeholder{floating-point}@ operator+=(@\placeholder{floating-point}@) const noexcept; - @\placeholder{floating-point}@ operator-=(@\placeholder{floating-point}@) const noexcept; }; } \end{codeblock} @@ -1317,18 +1344,21 @@ \begin{itemdescr} \pnum -\effects Atomically replaces the value referenced by \tcode{*ptr} with +\effects +Atomically replaces the value referenced by \tcode{*ptr} with the result of the computation applied to the value referenced by \tcode{*ptr} and the given operand. Memory is affected according to the value of \tcode{order}. These operations are atomic read-modify-write operations\iref{intro.races}. \pnum -\returns Atomically, the value referenced by \tcode{*ptr} +\returns +Atomically, the value referenced by \tcode{*ptr} immediately before the effects. \pnum -\remarks If the result is not a representable value for its type\iref{expr.pre}, +\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 @@ -1346,35 +1376,36 @@ \end{itemdecl} \begin{itemdescr} -\effects Equivalent to: +\effects +Equivalent to: \tcode{return fetch_\placeholder{key}(operand) \placeholdernc{op} operand;} \end{itemdescr} \rSec2[atomics.ref.pointer]{Partial specialization for pointers} -\indexlibrary{\idxcode{atomic_ref}}% +\indexlibraryglobal{atomic_ref}% \begin{codeblock} namespace std { template struct atomic_ref { private: - T** ptr; // \expos + T** ptr; // \expos public: using value_type = T*; using difference_type = ptrdiff_t; - static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic_ref} type's operations are always lock free}@; static constexpr size_t required_alignment = @\impdefx{required alignment for \tcode{atomic_ref} type's operations}@; - atomic_ref& operator=(const atomic_ref&) = delete; + 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(T*&); atomic_ref(const atomic_ref&) noexcept; + atomic_ref& operator=(const atomic_ref&) = delete; + void store(T*, memory_order = memory_order_seq_cst) const noexcept; T* operator=(T*) const noexcept; + T* load(memory_order = memory_order_seq_cst) const noexcept; operator T*() const noexcept; - bool is_lock_free() const noexcept; - void store(T*, memory_order = memory_order_seq_cst) const noexcept; - T* load(memory_order = memory_order_seq_cst) const noexcept; T* exchange(T*, memory_order = memory_order_seq_cst) const noexcept; bool compare_exchange_weak(T*&, T*, memory_order, memory_order) const noexcept; @@ -1388,16 +1419,16 @@ T* fetch_add(difference_type, memory_order = memory_order_seq_cst) const noexcept; T* fetch_sub(difference_type, memory_order = memory_order_seq_cst) const noexcept; - void wait(T*, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() noexcept; - void notify_all() noexcept; - T* operator++(int) const noexcept; T* operator--(int) const noexcept; T* operator++() const noexcept; T* operator--() const noexcept; T* operator+=(difference_type) const noexcept; T* operator-=(difference_type) const noexcept; + + void wait(T*, memory_order = memory_order::seq_cst) const noexcept; + void notify_one() noexcept; + void notify_all() noexcept; }; } \end{codeblock} @@ -1423,18 +1454,21 @@ otherwise the program is ill-formed. \pnum -\effects Atomically replaces the value referenced by \tcode{*ptr} with +\effects +Atomically replaces the value referenced by \tcode{*ptr} with the result of the computation applied to the value referenced by \tcode{*ptr} and the given operand. Memory is affected according to the value of \tcode{order}. These operations are atomic read-modify-write operations\iref{intro.races}. \pnum -\returns Atomically, the value referenced by \tcode{*ptr} +\returns +Atomically, the value referenced by \tcode{*ptr} immediately before the effects. \pnum -\remarks The result may be an undefined address, +\remarks +The result may be an undefined address, but the operations otherwise have no undefined behavior. \end{itemdescr} @@ -1446,7 +1480,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return fetch_\placeholder{key}(operand) \placeholdernc{op} operand;} \end{itemdescr} @@ -1461,7 +1496,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_add(1);} +\effects +Equivalent to: \tcode{return fetch_add(1);} \end{itemdescr} \indexlibrarymember{operator\dcr}{atomic_ref}% @@ -1472,7 +1508,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_sub(1);} +\effects +Equivalent to: \tcode{return fetch_sub(1);} \end{itemdescr} \indexlibrarymember{operator++}{atomic_ref}% @@ -1483,7 +1520,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_add(1) + 1;} +\effects +Equivalent to: \tcode{return fetch_add(1) + 1;} \end{itemdescr} \indexlibrarymember{operator\dcr}{atomic_ref}% @@ -1494,26 +1532,38 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_sub(1) - 1;} +\effects +Equivalent to: \tcode{return fetch_sub(1) - 1;} \end{itemdescr} \rSec1[atomics.types.generic]{Class template \tcode{atomic}} -\indexlibrary{\idxcode{atomic}}% +\indexlibraryglobal{atomic}% \indexlibrarymember{value_type}{atomic}% \begin{codeblock} namespace std { template struct atomic { using value_type = T; + static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic} type's operations are always lock free}@; bool is_lock_free() const volatile noexcept; bool is_lock_free() const noexcept; - void store(T, memory_order = memory_order::seq_cst) volatile noexcept; - void store(T, memory_order = memory_order::seq_cst) noexcept; + + atomic() noexcept = default; + constexpr atomic(T) noexcept; + atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; + atomic& operator=(const atomic&) volatile = delete; + T load(memory_order = memory_order::seq_cst) const volatile noexcept; T load(memory_order = memory_order::seq_cst) const noexcept; operator T() const volatile noexcept; operator T() const noexcept; + void store(T, memory_order = memory_order::seq_cst) volatile noexcept; + void store(T, memory_order = memory_order::seq_cst) noexcept; + T operator=(T) volatile noexcept; + T operator=(T) noexcept; + T exchange(T, memory_order = memory_order::seq_cst) volatile noexcept; T exchange(T, memory_order = memory_order::seq_cst) noexcept; bool compare_exchange_weak(T&, T, memory_order, memory_order) volatile noexcept; @@ -1531,19 +1581,11 @@ void notify_one() noexcept; void notify_all() volatile noexcept; void notify_all() noexcept; - - atomic() noexcept = default; - constexpr atomic(T) noexcept; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - T operator=(T) volatile noexcept; - T operator=(T) noexcept; }; } \end{codeblock} -\indexlibrary{\idxcode{atomic}}% +\indexlibraryglobal{atomic}% \pnum The template argument for \tcode{T} shall meet the \oldconcept{CopyConstructible} and \oldconcept{CopyAssignable} requirements. @@ -1556,8 +1598,10 @@ \item \tcode{is_move_assignable_v} \end{itemize} is \tcode{false}. -\begin{note} Type arguments that are -not also statically initializable may be difficult to use. \end{note} +\begin{note} +Type arguments that are +not also statically initializable may be difficult to use. +\end{note} \pnum The specialization \tcode{atomic} is a standard-layout struct. @@ -1572,13 +1616,38 @@ \rSec2[atomics.types.operations]{Operations on atomic types} \pnum -\begin{note} Many operations are volatile-qualified. The ``volatile as device register'' +\begin{note} +Many operations are volatile-qualified. The ``volatile as device register'' semantics have not changed in the standard. This qualification means that volatility is preserved when applying these operations to volatile objects. It does not mean that -operations on non-volatile objects become volatile. \end{note} +operations on non-volatile objects become volatile. +\end{note} -\indexlibrary{\idxcode{atomic}!constructor}% -\indexlibrary{\idxcode{atomic}!constructor}% +\indexlibraryglobal{ATOMIC_VAR_INIT}% +\begin{itemdecl} +#define ATOMIC_VAR_INIT(value) @\seebelow@ +\end{itemdecl} + +\begin{itemdescr} +\pnum +The macro expands to a token sequence suitable for +constant initialization of +an atomic variable of static storage duration of a type that is +initialization-compatible with \tcode{value}. +\begin{note} +This operation may need to initialize locks. +\end{note} +Concurrent access to the variable being initialized, even via an atomic operation, +constitutes a data race. +\begin{example} +\begin{codeblock} +atomic v = ATOMIC_VAR_INIT(5); +\end{codeblock} +\end{example} +\end{itemdescr} + +\indexlibraryctor{atomic}% +\indexlibraryctor{atomic}% \indexlibrary{\idxcode{atomic<\placeholder{integral}>}!constructor}% \indexlibrary{\idxcode{atomic<\placeholder{floating-point}>}!constructor}% \begin{itemdecl} @@ -1594,8 +1663,8 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{atomic}!constructor}% -\indexlibrary{\idxcode{atomic}!constructor}% +\indexlibraryctor{atomic}% +\indexlibraryctor{atomic}% \indexlibrary{\idxcode{atomic<\placeholder{integral}>}!constructor}% \indexlibrary{\idxcode{atomic<\placeholder{floating-point}>}!constructor}% \begin{itemdecl} @@ -1604,34 +1673,17 @@ \begin{itemdescr} \pnum -\effects Initializes the object with the value \tcode{desired}. +\effects +Initializes the object with the value \tcode{desired}. Initialization is not an atomic operation\iref{intro.multithread}. -\begin{note} It is possible to have an access to an atomic object \tcode{A} +\begin{note} +It is possible to have an access to an atomic object \tcode{A} race with its construction, for example by communicating the address of the just-constructed object \tcode{A} to another thread via \tcode{memory_order::relaxed} operations on a suitable atomic pointer variable, and then immediately accessing \tcode{A} in the receiving thread. -This results in undefined behavior. \end{note} -\end{itemdescr} - -\indexlibrary{\idxcode{ATOMIC_VAR_INIT}}% -\begin{itemdecl} -#define ATOMIC_VAR_INIT(value) @\seebelow@ -\end{itemdecl} - -\begin{itemdescr} -\pnum -The macro expands to a token sequence suitable for -constant initialization of -an atomic variable of static storage duration of a type that is -initialization-compatible with \tcode{value}. -\begin{note} This operation may need to initialize locks. \end{note} -Concurrent access to the variable being initialized, even via an atomic operation, -constitutes a data race. \begin{example} -\begin{codeblock} -atomic v = ATOMIC_VAR_INIT(5); -\end{codeblock} -\end{example} +This results in undefined behavior. +\end{note} \end{itemdescr} \indexlibrarymember{is_always_lock_free}{atomic}% @@ -1652,7 +1704,7 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{atomic_is_lock_free}}% +\indexlibraryglobal{atomic_is_lock_free}% \indexlibrarymember{is_lock_free}{atomic}% \indexlibrarymember{is_lock_free}{atomic}% \indexlibrarymember{is_lock_free}{atomic<\placeholder{integral}>}% @@ -1664,15 +1716,16 @@ \begin{itemdescr} \pnum -\returns \tcode{true} if the object's operations are lock-free, \tcode{false} otherwise. +\returns +\tcode{true} if the object's operations are lock-free, \tcode{false} otherwise. \begin{note} The return value of the \tcode{is_lock_free} member function is consistent with the value of \tcode{is_always_lock_free} for the same type. \end{note} \end{itemdescr} -\indexlibrary{\idxcode{atomic_store}}% -\indexlibrary{\idxcode{atomic_store_explicit}}% +\indexlibraryglobal{atomic_store}% +\indexlibraryglobal{atomic_store_explicit}% \indexlibrarymember{store}{atomic}% \indexlibrarymember{store}{atomic}% \indexlibrarymember{store}{atomic<\placeholder{integral}>}% @@ -1688,7 +1741,8 @@ \tcode{memory_order::acquire}, nor \tcode{memory_order::acq_rel}. \pnum -\effects Atomically replaces the value pointed to by \tcode{this} +\effects +Atomically replaces the value pointed to by \tcode{this} with the value of \tcode{desired}. Memory is affected according to the value of \tcode{order}. \end{itemdescr} @@ -1704,14 +1758,16 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{store(desired)}. +\effects +Equivalent to \tcode{store(desired)}. \pnum -\returns \tcode{desired}. +\returns +\tcode{desired}. \end{itemdescr} -\indexlibrary{\idxcode{atomic_load}}% -\indexlibrary{\idxcode{atomic_load_explicit}}% +\indexlibraryglobal{atomic_load}% +\indexlibraryglobal{atomic_load_explicit}% \indexlibrarymember{load}{atomic}% \indexlibrarymember{load}{atomic}% \indexlibrarymember{load}{atomic<\placeholder{integral}>}% @@ -1726,10 +1782,12 @@ \requires The \tcode{order} argument shall not be \tcode{memory_order::release} nor \tcode{memory_order::acq_rel}. \pnum -\effects Memory is affected according to the value of \tcode{order}. +\effects +Memory is affected according to the value of \tcode{order}. \pnum -\returns Atomically returns the value pointed to by \tcode{this}. +\returns +Atomically returns the value pointed to by \tcode{this}. \end{itemdescr} \indexlibrarymember{operator \placeholder{type}}{atomic}% @@ -1743,12 +1801,13 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return load();} +\effects +Equivalent to: \tcode{return load();} \end{itemdescr} -\indexlibrary{\idxcode{atomic_exchange}}% -\indexlibrary{\idxcode{atomic_exchange_explicit}}% +\indexlibraryglobal{atomic_exchange}% +\indexlibraryglobal{atomic_exchange_explicit}% \indexlibrarymember{exchange}{atomic}% \indexlibrarymember{exchange}{atomic}% \indexlibrarymember{exchange}{atomic<\placeholder{integral}>}% @@ -1760,19 +1819,21 @@ \begin{itemdescr} \pnum -\effects Atomically replaces the value pointed to by \tcode{this} +\effects +Atomically replaces the value pointed to by \tcode{this} with \tcode{desired}. Memory is affected according to the value of \tcode{order}. These operations are atomic read-modify-write operations\iref{intro.multithread}. \pnum -\returns Atomically returns the value pointed to by \tcode{this} immediately before the effects. +\returns +Atomically returns the value pointed to by \tcode{this} immediately before the effects. \end{itemdescr} -\indexlibrary{\idxcode{atomic_compare_exchange_weak}}% -\indexlibrary{\idxcode{atomic_compare_exchange_strong}}% -\indexlibrary{\idxcode{atomic_compare_exchange_weak_explicit}}% -\indexlibrary{\idxcode{atomic_compare_exchange_strong_explicit}}% +\indexlibraryglobal{atomic_compare_exchange_weak}% +\indexlibraryglobal{atomic_compare_exchange_strong}% +\indexlibraryglobal{atomic_compare_exchange_weak_explicit}% +\indexlibraryglobal{atomic_compare_exchange_strong_explicit}% \indexlibrarymember{compare_exchange_weak}{atomic}% \indexlibrarymember{compare_exchange_weak}{atomic}% \indexlibrarymember{compare_exchange_weak}{atomic<\placeholder{integral}>}% @@ -1830,7 +1891,8 @@ Otherwise, these operations are atomic load operations on that memory. \pnum -\returns The result of the comparison. +\returns +The result of the comparison. \pnum \begin{note} @@ -1844,7 +1906,8 @@ memcpy(expected, this, sizeof(*this)); \end{codeblock} \end{note} -\begin{example} The expected use of the compare-and-exchange operations is as follows. The +\begin{example} +The expected use of the compare-and-exchange operations is as follows. The compare-and-exchange operations will update \tcode{expected} when another iteration of the loop is needed. \begin{codeblock} @@ -1854,14 +1917,15 @@ } while (!current.compare_exchange_weak(expected, desired)); \end{codeblock} \end{example} -\begin{example} Because the expected value is updated only on failure, +\begin{example} +Because the expected value is updated only on failure, code releasing the memory containing the \tcode{expected} value on success will work. For example, list head insertion will act atomically and would not introduce a data race in the following code: \begin{codeblock} do { - p->next = head; // make new list node point to the current head -} while (!head.compare_exchange_weak(p->next, p)); // try to insert + p->next = head; // make new list node point to the current head +} while (!head.compare_exchange_weak(p->next, p)); // try to insert \end{codeblock} \end{example} @@ -1877,7 +1941,8 @@ the contents of memory referred to by \tcode{expected} and \tcode{this} are equal, it may return \tcode{false} and store back to \tcode{expected} the same memory contents that were originally there. -\begin{note} This +\begin{note} +This spurious failure enables implementation of compare-and-exchange on a broader class of machines, e.g., load-locked store-conditional machines. A consequence of spurious failure is that nearly all uses of weak compare-and-exchange @@ -1926,7 +1991,7 @@ \begin{codeblock} union pony { double celestia = 0.; - short luna; // padded + short luna; // padded }; atomic princesses = ATOMIC_VAR_INIT({}); @@ -2033,7 +2098,7 @@ \tcode{char16_t}, \tcode{char32_t}, \tcode{wchar_t}, -and any other types needed by the typedefs in the header \tcode{}. +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. \begin{note} @@ -2045,15 +2110,26 @@ template<> struct atomic<@\placeholder{integral}@> { using value_type = @\placeholder{integral}@; 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}@; bool is_lock_free() const volatile noexcept; bool is_lock_free() const noexcept; + + atomic() noexcept = default; + constexpr atomic(@\placeholdernc{integral}@) 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}@, @@ -2072,6 +2148,7 @@ memory_order = memory_order::seq_cst) volatile noexcept; bool compare_exchange_strong(@\placeholder{integral}@&, @\placeholdernc{integral}@, 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; @@ -2083,21 +2160,6 @@ @\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; - 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; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; - - atomic() noexcept = default; - constexpr atomic(@\placeholdernc{integral}@) noexcept; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - @\placeholdernc{integral}@ operator=(@\placeholdernc{integral}@) volatile noexcept; - @\placeholdernc{integral}@ operator=(@\placeholdernc{integral}@) noexcept; - @\placeholdernc{integral}@ operator++(int) volatile noexcept; @\placeholdernc{integral}@ operator++(int) noexcept; @\placeholdernc{integral}@ operator--(int) volatile noexcept; @@ -2116,6 +2178,13 @@ @\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; + void notify_one() volatile noexcept; + void notify_one() noexcept; + void notify_all() volatile noexcept; + void notify_all() noexcept; }; } \end{codeblock} @@ -2158,16 +2227,16 @@ bitwise and &&&\\\hline \end{floattable} -\indexlibrary{\idxcode{atomic_fetch_add}}% -\indexlibrary{\idxcode{atomic_fetch_and}}% -\indexlibrary{\idxcode{atomic_fetch_or}}% -\indexlibrary{\idxcode{atomic_fetch_sub}}% -\indexlibrary{\idxcode{atomic_fetch_xor}}% -\indexlibrary{\idxcode{atomic_fetch_add_explicit}}% -\indexlibrary{\idxcode{atomic_fetch_and_explicit}}% -\indexlibrary{\idxcode{atomic_fetch_or_explicit}}% -\indexlibrary{\idxcode{atomic_fetch_sub_explicit}}% -\indexlibrary{\idxcode{atomic_fetch_xor_explicit}}% +\indexlibraryglobal{atomic_fetch_add}% +\indexlibraryglobal{atomic_fetch_and}% +\indexlibraryglobal{atomic_fetch_or}% +\indexlibraryglobal{atomic_fetch_sub}% +\indexlibraryglobal{atomic_fetch_xor}% +\indexlibraryglobal{atomic_fetch_add_explicit}% +\indexlibraryglobal{atomic_fetch_and_explicit}% +\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}>}% @@ -2180,18 +2249,21 @@ \begin{itemdescr} \pnum -\effects Atomically replaces the value pointed to by +\effects +Atomically replaces the value pointed to by \tcode{this} with the result of the computation applied to the value pointed to by \tcode{this} and the given \tcode{operand}. Memory is affected according to the value of \tcode{order}. These operations are atomic read-modify-write operations\iref{intro.multithread}. \pnum -\returns Atomically, the value pointed to by \tcode{this} immediately before the effects. +\returns +Atomically, the value pointed to by \tcode{this} immediately before the effects. \pnum \indextext{signed integer representation!two's complement}% -\remarks For signed integer types, +\remarks +For signed integer types, the result is as if the object value and parameters were converted to their corresponding unsigned types, the computation performed on those types, and @@ -2216,7 +2288,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_\placeholder{key}(operand) \placeholder{op} operand;} +\effects +Equivalent to: \tcode{return fetch_\placeholder{key}(operand) \placeholder{op} operand;} \end{itemdescr} \rSec2[atomics.types.float]{Specializations for floating-point types} @@ -2237,15 +2310,26 @@ template<> struct atomic<@\placeholder{floating-point}@> { using value_type = @\placeholdernc{floating-point}@; 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}@; bool is_lock_free() const volatile noexcept; bool is_lock_free() const noexcept; + + atomic() noexcept = default; + constexpr atomic(@\placeholder{floating-point}@) 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; + @\placeholdernc{floating-point}@ exchange(@\placeholdernc{floating-point}@, memory_order = memory_order_seq_cst) volatile noexcept; @\placeholdernc{floating-point}@ exchange(@\placeholdernc{floating-point}@, @@ -2276,25 +2360,17 @@ @\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; void notify_one() volatile noexcept; void notify_one() noexcept; void notify_all() volatile noexcept; void notify_all() noexcept; - - atomic() noexcept = default; - constexpr atomic(@\placeholder{floating-point}@) noexcept; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - @\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; - @\placeholdernc{floating-point}@ operator-=(@\placeholder{floating-point}@) volatile noexcept; - @\placeholdernc{floating-point}@ operator-=(@\placeholder{floating-point}@) noexcept; }; } \end{codeblock} @@ -2313,10 +2389,10 @@ The key, operator, and computation correspondence are identified in \tref{atomic.types.int.comp}. -\indexlibrary{\idxcode{atomic_fetch_add}}% -\indexlibrary{\idxcode{atomic_fetch_sub}}% -\indexlibrary{\idxcode{atomic_fetch_add_explicit}}% -\indexlibrary{\idxcode{atomic_fetch_sub_explicit}}% +\indexlibraryglobal{atomic_fetch_add}% +\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}>}% \begin{itemdecl} @@ -2376,22 +2452,33 @@ \end{itemdescr} \rSec2[atomics.types.pointer]{Partial specialization for pointers} -\indexlibrary{\idxcode{atomic}}% +\indexlibraryglobal{atomic}% \begin{codeblock} namespace std { template struct atomic { using value_type = T*; using difference_type = ptrdiff_t; + static constexpr bool is_always_lock_free = @\impdefx{whether a given \tcode{atomic} type's operations are always lock free}@; bool is_lock_free() const volatile noexcept; bool is_lock_free() const noexcept; + + atomic() noexcept = default; + constexpr atomic(T*) noexcept; + atomic(const atomic&) = delete; + atomic& operator=(const atomic&) = delete; + atomic& operator=(const atomic&) volatile = delete; + void store(T*, memory_order = memory_order::seq_cst) volatile noexcept; void store(T*, memory_order = memory_order::seq_cst) noexcept; + T* operator=(T*) volatile noexcept; + T* operator=(T*) noexcept; T* load(memory_order = memory_order::seq_cst) const volatile noexcept; T* load(memory_order = memory_order::seq_cst) const noexcept; operator T*() const volatile noexcept; operator T*() const noexcept; + T* exchange(T*, memory_order = memory_order::seq_cst) volatile noexcept; T* exchange(T*, memory_order = memory_order::seq_cst) noexcept; bool compare_exchange_weak(T*&, T*, memory_order, memory_order) volatile noexcept; @@ -2412,21 +2499,6 @@ T* fetch_sub(ptrdiff_t, memory_order = memory_order::seq_cst) volatile noexcept; T* fetch_sub(ptrdiff_t, memory_order = memory_order::seq_cst) noexcept; - void wait(T*, memory_order = memory_order::seq_cst) const volatile noexcept; - void wait(T*, memory_order = memory_order::seq_cst) const noexcept; - void notify_one() volatile noexcept; - void notify_one() noexcept; - void notify_all() volatile noexcept; - void notify_all() noexcept; - - atomic() noexcept = default; - constexpr atomic(T*) noexcept; - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - T* operator=(T*) volatile noexcept; - T* operator=(T*) noexcept; - T* operator++(int) volatile noexcept; T* operator++(int) noexcept; T* operator--(int) volatile noexcept; @@ -2439,11 +2511,18 @@ T* operator+=(ptrdiff_t) noexcept; T* operator-=(ptrdiff_t) volatile noexcept; T* operator-=(ptrdiff_t) noexcept; + + void wait(T*, memory_order = memory_order::seq_cst) const volatile noexcept; + void wait(T*, memory_order = memory_order::seq_cst) const noexcept; + void notify_one() volatile noexcept; + void notify_one() noexcept; + void notify_all() volatile noexcept; + void notify_all() noexcept; }; } \end{codeblock} -\indexlibrary{\idxcode{atomic}}% +\indexlibraryglobal{atomic}% \pnum There is a partial specialization of the \tcode{atomic} class template for pointers. Specializations of this partial specialization are standard-layout structs. @@ -2473,10 +2552,10 @@ subtraction \\ \hline \end{floattable} -\indexlibrary{\idxcode{atomic_fetch_add}}% -\indexlibrary{\idxcode{atomic_fetch_sub}}% -\indexlibrary{\idxcode{atomic_fetch_add_explicit}}% -\indexlibrary{\idxcode{atomic_fetch_sub_explicit}}% +\indexlibraryglobal{atomic_fetch_add}% +\indexlibraryglobal{atomic_fetch_sub}% +\indexlibraryglobal{atomic_fetch_add_explicit}% +\indexlibraryglobal{atomic_fetch_sub_explicit}% \indexlibrarymember{fetch_add}{atomic}% \indexlibrarymember{fetch_sub}{atomic}% \begin{itemdecl} @@ -2487,20 +2566,25 @@ \begin{itemdescr} \pnum \requires T shall be an object type, otherwise the program is ill-formed. -\begin{note} Pointer arithmetic on \tcode{void*} or function pointers is ill-formed. \end{note} +\begin{note} +Pointer arithmetic on \tcode{void*} or function pointers is ill-formed. +\end{note} \pnum -\effects Atomically replaces the value pointed to by +\effects +Atomically replaces the value pointed to by \tcode{this} with the result of the computation applied to the value pointed to by \tcode{this} and the given \tcode{operand}. Memory is affected according to the value of \tcode{order}. These operations are atomic read-modify-write operations\iref{intro.multithread}. \pnum -\returns Atomically, the value pointed to by \tcode{this} immediately before the effects. +\returns +Atomically, the value pointed to by \tcode{this} immediately before the effects. \pnum -\remarks The result may be an undefined address, +\remarks +The result may be an undefined address, but the operations otherwise have no undefined behavior. \end{itemdescr} @@ -2513,7 +2597,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_\placeholder{key}(operand) \placeholder{op} operand;} +\effects +Equivalent to: \tcode{return fetch_\placeholder{key}(operand) \placeholder{op} operand;} \end{itemdescr} \rSec2[atomics.types.memop]{Member operators common to integers and pointers to objects} @@ -2527,7 +2612,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_add(1);} +\effects +Equivalent to: \tcode{return fetch_add(1);} \end{itemdescr} \indexlibrarymember{operator\dcr}{atomic}% @@ -2539,7 +2625,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_sub(1);} +\effects +Equivalent to: \tcode{return fetch_sub(1);} \end{itemdescr} \indexlibrarymember{operator++}{atomic}% @@ -2551,7 +2638,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_add(1) + 1;} +\effects +Equivalent to: \tcode{return fetch_add(1) + 1;} \end{itemdescr} \indexlibrarymember{operator\dcr}{atomic}% @@ -2563,7 +2651,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return fetch_sub(1) - 1;} +\effects +Equivalent to: \tcode{return fetch_sub(1) - 1;} \end{itemdescr} @@ -2579,7 +2668,7 @@ passed to the member function call. If no such member function exists, the program is ill-formed. -\indexlibrary{\idxcode{atomic_init}}% +\indexlibraryglobal{atomic_init}% \begin{itemdecl} template void atomic_init(volatile atomic* object, typename atomic::value_type desired) noexcept; @@ -2589,7 +2678,8 @@ \begin{itemdescr} \pnum -\effects Non-atomically +\effects +Non-atomically initializes \tcode{*object} with value \tcode{desired}. This function shall only be applied to objects that have been default constructed, and then only once. \begin{note} @@ -2612,6 +2702,11 @@ \begin{codeblock} namespace std { struct atomic_flag { + atomic_flag() noexcept = default; + atomic_flag(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) volatile = delete; + bool test(memory_order = memory_order::seq_cst) const volatile noexcept; bool test(memory_order = memory_order::seq_cst) const noexcept; bool test_and_set(memory_order = memory_order::seq_cst) volatile noexcept; @@ -2625,11 +2720,6 @@ void notify_one() noexcept; void notify_all() volatile noexcept; void notify_all() noexcept; - - atomic_flag() noexcept = default; - atomic_flag(const atomic_flag&) = delete; - atomic_flag& operator=(const atomic_flag&) = delete; - atomic_flag& operator=(const atomic_flag&) volatile = delete; }; } \end{codeblock} @@ -2638,14 +2728,17 @@ The \tcode{atomic_flag} type provides the classic test-and-set functionality. It has two states, set and clear. \pnum -Operations on an object of type \tcode{atomic_flag} shall be lock-free. \begin{note} Hence -the operations should also be address-free. \end{note} +Operations on an object of type \tcode{atomic_flag} shall be lock-free. +\begin{note} +Hence +the operations should also be address-free. +\end{note} \pnum The \tcode{atomic_flag} type is a standard-layout struct. It has a trivial default constructor and a trivial destructor. -\indexlibrary{\idxcode{ATOMIC_FLAG_INIT}}% +\indexlibraryglobal{ATOMIC_FLAG_INIT}% \begin{itemdecl} #define ATOMIC_FLAG_INIT @\seebelow@ \end{itemdecl} @@ -2664,8 +2757,8 @@ \tcode{atomic_flag} object has an initial state of set or clear. \end{itemdescr} -\indexlibrary{\idxcode{atomic_flag_test}}% -\indexlibrary{\idxcode{atomic_flag_test_explicit}}% +\indexlibraryglobal{atomic_flag_test}% +\indexlibraryglobal{atomic_flag_test_explicit}% \indexlibrarymember{test}{atomic_flag}% \begin{itemdecl} bool atomic_flag_test(const volatile atomic_flag* object) noexcept; @@ -2696,8 +2789,8 @@ Atomically returns the value pointed to by \tcode{object} or \tcode{this}. \end{itemdescr} -\indexlibrary{\idxcode{atomic_flag_test_and_set}}% -\indexlibrary{\idxcode{atomic_flag_test_and_set_explicit}}% +\indexlibraryglobal{atomic_flag_test_and_set}% +\indexlibraryglobal{atomic_flag_test_and_set_explicit}% \indexlibrarymember{test_and_set}{atomic_flag}% \begin{itemdecl} bool atomic_flag_test_and_set(volatile atomic_flag* object) noexcept; @@ -2710,15 +2803,17 @@ \begin{itemdescr} \pnum -\effects Atomically sets the value pointed to by \tcode{object} or by \tcode{this} to \tcode{true}. Memory is affected according to the value of +\effects +Atomically sets the value pointed to by \tcode{object} or by \tcode{this} to \tcode{true}. Memory is affected according to the value of \tcode{order}. These operations are atomic read-modify-write operations\iref{intro.multithread}. \pnum -\returns Atomically, the value of the object immediately before the effects. +\returns +Atomically, the value of the object immediately before the effects. \end{itemdescr} -\indexlibrary{\idxcode{atomic_flag_clear}}% -\indexlibrary{\idxcode{atomic_flag_clear_explicit}}% +\indexlibraryglobal{atomic_flag_clear}% +\indexlibraryglobal{atomic_flag_clear_explicit}% \indexlibrarymember{clear}{atomic_flag}% \begin{itemdecl} void atomic_flag_clear(volatile atomic_flag* object) noexcept; @@ -2735,12 +2830,13 @@ \tcode{memory_order::acquire}, nor \tcode{memory_order::acq_rel}. \pnum -\effects Atomically sets the value pointed to by \tcode{object} or by \tcode{this} to +\effects +Atomically sets the value pointed to by \tcode{object} or by \tcode{this} to \tcode{false}. Memory is affected according to the value of \tcode{order}. \end{itemdescr} -\indexlibrary{\idxcode{atomic_flag_wait}}% -\indexlibrary{\idxcode{atomic_flag_wait_explicit}}% +\indexlibraryglobal{atomic_flag_wait}% +\indexlibraryglobal{atomic_flag_wait_explicit}% \indexlibrarymember{wait}{atomic_flag}% \begin{itemdecl} void atomic_flag_wait(const volatile atomic_flag* object, bool old) noexcept; @@ -2853,15 +2949,15 @@ and reads the value written by \placeholder{A} or a value written by any side effect in the release sequence headed by \placeholder{A}. -\indexlibrary{\idxcode{atomic_thread_fence}}% +\indexlibraryglobal{atomic_thread_fence}% \begin{itemdecl} extern "C" void atomic_thread_fence(memory_order order) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Depending on the value of \tcode{order}, this operation: - +\effects +Depending on the value of \tcode{order}, this operation: \begin{itemize} \item has no effects, if \tcode{order == memory_order::relaxed}; @@ -2875,14 +2971,15 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{atomic_signal_fence}}% +\indexlibraryglobal{atomic_signal_fence}% \begin{itemdecl} extern "C" void atomic_signal_fence(memory_order order) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to \tcode{atomic_thread_fence(order)}, except that +\effects +Equivalent to \tcode{atomic_thread_fence(order)}, except that the resulting ordering constraints are established only between a thread and a signal handler executed in the same thread. diff --git a/source/back.tex b/source/back.tex index 739b11ff7c..511d3f9a26 100644 --- a/source/back.tex +++ b/source/back.tex @@ -65,7 +65,8 @@ \chapter{Bibliography} } \clearpage -\renewcommand{\preindexhook}{} +\renewcommand{\preindexhook}{The bold page number for each entry refers to +the page where the synopsis of the header is shown.\\} \renewcommand{\indexname}{Index of library headers} \renewcommand{\leftmark}{\indexname} { @@ -82,6 +83,17 @@ \chapter{Bibliography} \printindex[libraryindex] } +\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.\\} +\renewcommand{\indexname}{Index of library concepts} +\renewcommand{\leftmark}{\indexname} +{ +\raggedright +\printindex[conceptindex] +} + \clearpage \renewcommand{\preindexhook}{The entries in this index are rough descriptions; exact specifications are at the indicated page in the general text.\\} diff --git a/source/basic.tex b/source/basic.tex index 553516a7b2..17b96864d6 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3,8 +3,11 @@ \gramSec[gram.basic]{Basics} +\rSec1[basic.pre]{Preamble} + \pnum -\begin{note} This Clause presents the basic concepts of the \Cpp{} language. +\begin{note} +This Clause presents the basic concepts of the \Cpp{} language. It explains the difference between an object and a name and how they relate to the value categories for expressions. It introduces the concepts of a @@ -13,12 +16,15 @@ storage duration. The mechanisms for starting and terminating a program are discussed. Finally, this Clause presents the fundamental types of the language and lists the ways of constructing -compound types from these.\end{note} +compound types from these. +\end{note} \pnum -\begin{note} This Clause does not cover concepts that affect only a single +\begin{note} +This Clause does not cover concepts that affect only a single part of the language. Such concepts are discussed in the relevant -Clauses. \end{note} +Clauses. +\end{note} \pnum \indextext{type}% @@ -178,13 +184,19 @@ \item it is a \grammarterm{using-enum-declaration}\iref{enum.udecl}, \item it is +a \grammarterm{template-declaration}\iref{temp} +whose \grammarterm{template-head} is not followed by +either a \grammarterm{concept-definition} or a \grammarterm{declaration} +that defines a function, a class, a variable, or a static data member. +\item it is an explicit instantiation declaration\iref{temp.explicit}, or \item it is an explicit specialization\iref{temp.expl.spec} whose \grammarterm{declaration} is not a definition. \end{itemize} A declaration is said to be a \defn{definition} of each entity that it defines. -\begin{example} All but one of the following are definitions: +\begin{example} +All but one of the following are definitions: \begin{codeblock} int a; // defines \tcode{a} extern const int c = 1; // defines \tcode{c} @@ -223,7 +235,8 @@ copy assignment operator, move assignment operator\iref{class.copy.assign}, or destructor\iref{class.dtor} member functions. \end{note} -\begin{example} Given +\begin{example} +Given \begin{codeblock} #include @@ -346,7 +359,8 @@ the expression is not an \grammarterm{id-expression} naming the function with an explicitly qualified name or the expression forms a pointer to member\iref{expr.unary.op}. - \begin{note} This covers + \begin{note} +This covers taking the address of functions~(\ref{conv.func}, \ref{expr.unary.op}), calls to named functions\iref{expr.call}, operator overloading\iref{over}, @@ -355,7 +369,8 @@ non-default initialization\iref{dcl.init}. A constructor selected to copy or move an object of class type is considered to be named by an expression or conversion - even if the call is actually elided by the implementation\iref{class.copy.elision}. \end{note} + even if the call is actually elided by the implementation\iref{class.copy.elision}. +\end{note} \item A deallocation function for a class is named by a \grammarterm{new-expression} @@ -425,7 +440,6 @@ \pnum A local entity\iref{basic} is \defn{odr-usable} in a declarative region\iref{basic.scope.declarative} if: - \begin{itemize} \item either the local entity is not \tcode{*this}, or an enclosing class or non-lambda function parameter scope exists and, @@ -495,16 +509,17 @@ \indextext{type!incomplete}% A definition of a class is required to be reachable in every context in which the class is used in a way that requires the class type to be complete. -\begin{example} The following complete translation unit is well-formed, +\begin{example} +The following complete translation unit is well-formed, even though it never defines \tcode{X}: - \begin{codeblock} struct X; // declare \tcode{X} as a struct type struct X* x1; // use \tcode{X} in pointer formation X* x2; // use \tcode{X} in pointer formation \end{codeblock} \end{example} -\begin{note} The rules for declarations and expressions +\begin{note} +The rules for declarations and expressions describe in which contexts complete class types are required. A class type \tcode{T} must be complete if: \begin{itemize} @@ -572,7 +587,7 @@ \begin{itemize} \item each definition of \tcode{D} shall consist of the same sequence of tokens, -for which the definition of a closure type +where the definition of a closure type is considered to consist of the sequence of tokens of the corresponding \grammarterm{lambda-expression}; and \item in each definition of \tcode{D}, corresponding names, looked up @@ -625,7 +640,6 @@ implicit definition in every translation unit shall call the same constructor for a subobject of \tcode{D}. \begin{example} - \begin{codeblock} // translation unit 1: struct X { @@ -742,7 +756,6 @@ \pnum \begin{example} In - \begin{codeblock} int j = 24; int main() { @@ -750,7 +763,6 @@ j = 42; } \end{codeblock} - the identifier \tcode{j} is declared twice as a name (and used twice). The declarative region of the first \tcode{j} includes the entire example. The potential scope of the first \tcode{j} begins immediately @@ -790,7 +802,8 @@ must be unique in its declarative region. \end{note} \end{itemize} -\begin{note} These restrictions apply to the declarative region into which +\begin{note} +These restrictions apply to the declarative region into which a name is introduced, which is not necessarily the same as the region in which the declaration occurs. In particular, \grammarterm{elaborated-type-specifier}{s}\iref{dcl.type.elab} and @@ -799,7 +812,8 @@ that region. Local extern declarations\iref{basic.link} may introduce a name into the declarative region where the declaration appears and also introduce a (possibly not visible) name into an enclosing -namespace; these restrictions apply to both regions. \end{note} +namespace; these restrictions apply to both regions. +\end{note} \pnum For a given declarative region \placeholder{R} @@ -810,7 +824,8 @@ that are or enclose \placeholder{R} and do not enclose \placeholder{P}. \pnum -\begin{note} The name lookup rules are summarized in~\ref{basic.lookup}. +\begin{note} +The name lookup rules are summarized in~\ref{basic.lookup}. \end{note} \rSec2[basic.scope.pdecl]{Point of declaration} @@ -822,28 +837,29 @@ \indextext{point of!declaration|see{declaration, point of}}% The \defnx{point of declaration}{declaration!point of} for a name is immediately after its complete declarator\iref{dcl.decl} and before its -\grammarterm{initializer} (if any), except as noted below. \begin{example} - +\grammarterm{initializer} (if any), except as noted below. +\begin{example} \begin{codeblock} unsigned char x = 12; { unsigned char x = x; } \end{codeblock} - Here the second \tcode{x} is initialized with its own (indeterminate) -value. \end{example} +value. +\end{example} \pnum \begin{note} \indextext{name hiding}% A name from an outer scope remains visible up -to the point of declaration of the name that hides it. \begin{example} - +to the point of declaration of the name that hides it. +\begin{example} \begin{codeblock} const int i = 2; { int i[i]; } \end{codeblock} - -declares a block-scope array of two integers. \end{example} \end{note} +declares a block-scope array of two integers. +\end{example} +\end{note} \pnum The point of declaration for a class or class template first declared by a @@ -864,22 +880,22 @@ \pnum \indextext{declaration!enumerator point of}% The point of declaration for an enumerator is immediately after its -\grammarterm{enumerator-definition}. \begin{example} - +\grammarterm{enumerator-definition}. +\begin{example} \begin{codeblock} const int x = 12; { enum { x = x }; } \end{codeblock} - Here, the enumerator \tcode{x} is initialized with the value of the -constant \tcode{x}, namely 12. \end{example} +constant \tcode{x}, namely 12. +\end{example} \pnum After the point of declaration of a class member, the member name can be -looked up in the scope of its class. \begin{note} +looked up in the scope of its class. +\begin{note} \indextext{type!incomplete}% This is true even if the class is an incomplete class. For example, - \begin{codeblock} struct X { enum E { z = 16 }; @@ -893,20 +909,16 @@ \grammarterm{elaborated-type-specifier} is as follows: \begin{itemize} \item for a declaration of the form - \begin{ncbnf} class-key \opt{attribute-specifier-seq} identifier \terminal{;} \end{ncbnf} - the \grammarterm{identifier} is declared to be a \grammarterm{class-name} in the scope that contains the declaration, otherwise \item for an \grammarterm{elaborated-type-specifier} of the form - \begin{ncbnf} class-key identifier \end{ncbnf} - if the \grammarterm{elaborated-type-specifier} is used in the \grammarterm{decl-specifier-seq} or \grammarterm{parameter-declaration-clause} @@ -914,11 +926,16 @@ declared as a \grammarterm{class-name} in the namespace that contains the declaration; otherwise, except as a friend declaration, the \grammarterm{identifier} is declared in the smallest namespace or block -scope that contains the declaration. \begin{note} -These rules also apply within templates. \end{note} \begin{note} Other +scope that contains the declaration. +\begin{note} +These rules also apply within templates. +\end{note} +\begin{note} +Other forms of \grammarterm{elaborated-type-specifier} do not declare a new name, and therefore must refer to an existing \grammarterm{type-name}. -See~\ref{basic.lookup.elab} and~\ref{dcl.type.elab}. \end{note} +See~\ref{basic.lookup.elab} and~\ref{dcl.type.elab}. +\end{note} \end{itemize} \pnum @@ -944,19 +961,20 @@ \pnum The point of declaration for a template parameter is immediately after its complete -\grammarterm{template-parameter}. \begin{example} - +\grammarterm{template-parameter}. +\begin{example} \begin{codeblock} typedef unsigned char T; template struct A { }; \end{codeblock} \end{example} \pnum -\begin{note} Friend declarations refer to functions or classes that are +\begin{note} +Friend declarations refer to functions or classes that are members of the nearest enclosing namespace, but they do not introduce new names into that namespace\iref{namespace.memdef}. Function declarations at block scope and variable declarations with the @@ -968,7 +986,7 @@ \pnum \begin{note} For point of instantiation of a template, see~\ref{temp.point}. -\end{note}% +\end{note} \indextext{scope!declarations and|)}% \indextext{declaration!point of|)} @@ -1060,7 +1078,6 @@ of the potential scope of the \grammarterm{using-directive} that follows the member's point of declaration. \begin{example} - \begin{codeblock} namespace N { int i; @@ -1234,8 +1251,8 @@ parameter names belong to this declarative region; any other kind of name introduced by the \grammarterm{declaration} of a \grammarterm{template-declaration} is instead introduced into the same declarative region where it would be introduced as a result of -a non-template declaration of the same name. \begin{example} - +a non-template declaration of the same name. +\begin{example} \begin{codeblock} namespace N { template struct A { }; // \#1 @@ -1245,7 +1262,6 @@ }; } \end{codeblock} - The declarative regions of \tcode{T}, \tcode{U} and \tcode{V} are the \grammarterm{template-declaration}{s} on lines \#1, \#2, and \#3, respectively. But the names \tcode{A}, \tcode{f}, \tcode{g} and \tcode{C} all belong to @@ -1257,11 +1273,11 @@ \pnum The potential scope of a template parameter name begins at its point of declaration\iref{basic.scope.pdecl} and ends at the end of its declarative region. -\begin{note} This implies that a \grammarterm{template-parameter} can be used in the +\begin{note} +This implies that a \grammarterm{template-parameter} can be used in the declaration of subsequent \grammarterm{template-parameter}{s} and their default arguments but cannot be used in preceding \grammarterm{template-parameter}{s} or their default arguments. For example, - \begin{codeblock} template class X { @\commentellip@ }; template void f(T* p = new T); @@ -1269,36 +1285,39 @@ This also implies that a \grammarterm{template-parameter} can be used in the specification of base classes. For example, - \begin{codeblock} template class X : public Array { @\commentellip@ }; template class Y : public T { @\commentellip@ }; \end{codeblock} - The use of a template parameter as a base class implies that a class used as a template argument must be defined and not just declared when the class template is instantiated. \end{note} \pnum The declarative region of the name of a template parameter is nested within the -immediately-enclosing declarative region. \begin{note} As a result, a +immediately-enclosing declarative region. +\begin{note} +As a result, a \grammarterm{template-parameter} hides any entity with the same name in an enclosing -scope\iref{basic.scope.hiding}. \begin{example} - +scope\iref{basic.scope.hiding}. +\begin{example} \begin{codeblock} typedef int N; template class T> struct A; \end{codeblock} - Here, \tcode{X} is a non-type template parameter of type \tcode{int} and \tcode{Y} is a non-type template parameter of the same type as the second template parameter of -\tcode{A}. \end{example}\end{note} +\tcode{A}. +\end{example} +\end{note} \pnum -\begin{note} Because the name of a template parameter cannot be redeclared within its +\begin{note} +Because the name of a template parameter cannot be redeclared within its potential scope\iref{temp.local}, a template parameter's scope is often its potential scope. However, it is still possible for a template parameter name to be hidden; -see~\ref{temp.local}. \end{note} +see~\ref{temp.local}. +\end{note} \rSec2[basic.scope.hiding]{Name hiding} @@ -1376,9 +1395,11 @@ and lookup. \pnum -\begin{note} \ref{basic.link} discusses linkage issues. The notions of +\begin{note} +\ref{basic.link} discusses linkage issues. The notions of scope, point of declaration and name hiding are discussed -in~\ref{basic.scope}. \end{note} +in~\ref{basic.scope}. +\end{note} \rSec2[basic.lookup.unqual]{Unqualified name lookup} @@ -1402,7 +1423,9 @@ \pnum The lookup for an unqualified name used as the \grammarterm{postfix-expression} of a function call is described -in~\ref{basic.lookup.argdep}. \begin{note} For purposes of determining +in~\ref{basic.lookup.argdep}. +\begin{note} +For purposes of determining (during parsing) whether an expression is a \grammarterm{postfix-expression} for a function call, the usual name lookup rules apply. @@ -1428,7 +1451,6 @@ The rules in~\ref{basic.lookup.argdep} have no effect on the syntactic interpretation of an expression. For example, - \begin{codeblock} typedef int f; namespace N { @@ -1441,10 +1463,10 @@ }; } \end{codeblock} - Because the expression is not a function call, the argument-dependent name lookup\iref{basic.lookup.argdep} does not apply and the friend -function \tcode{f} is not found. \end{note} +function \tcode{f} is not found. +\end{note} \pnum A name used in global scope, outside of any function, class or @@ -1469,7 +1491,6 @@ use in namespace \tcode{N} or, if \tcode{N} is a nested namespace, shall be declared before its use in one of \tcode{N}'s enclosing namespaces. \begin{example} - \begin{codeblock} namespace A { namespace N { @@ -1545,7 +1566,10 @@ When looking for a prior declaration of a class or function introduced by a friend declaration, scopes outside of the innermost enclosing namespace scope are not considered; -see~\ref{namespace.memdef}. \end{note} \begin{note} \ref{basic.scope.class} +see~\ref{namespace.memdef}. +\end{note} +\begin{note} +\ref{basic.scope.class} further describes the restrictions on the use of names in a class definition. \ref{class.nest} further describes the restrictions on the use of names in nested class definitions. \ref{class.local} further @@ -1613,12 +1637,15 @@ // 5) scope of namespace \tcode{M} // 6) global scope, before the definition of \tcode{M::N::X::f} \end{codeblock} -\end{example} \begin{note} \ref{class.mfct} and~\ref{class.static} further +\end{example} +\begin{note} +\ref{class.mfct} and~\ref{class.static} further describe the restrictions on the use of names in member function definitions. \ref{class.nest} further describes the restrictions on the use of names in the scope of nested classes. \ref{class.local} further describes the restrictions on the use of names in local class -definitions. \end{note} +definitions. +\end{note} \pnum Name lookup for a name used in the definition of a friend @@ -1638,8 +1665,8 @@ \grammarterm{template-argument} in the \grammarterm{declarator-id}, the look up is as described for unqualified names in the definition of the class -granting friendship. \begin{example} - +granting friendship. +\begin{example} \begin{codeblock} struct A { typedef int AT; @@ -1650,9 +1677,9 @@ struct B { typedef char AT; typedef float BT; - friend void A::f1(AT); // parameter type is \tcode{A::AT} - friend void A::f2(BT); // parameter type is \tcode{B::BT} - friend void A::f3(); // template argument is \tcode{B::AT} + friend void A::f1(AT); // parameter type is \tcode{A::AT} + friend void A::f2(BT); // parameter type is \tcode{B::BT} + friend void A::f3(); // template argument is \tcode{B::AT} }; \end{codeblock} \end{example} @@ -1664,7 +1691,8 @@ \grammarterm{expression} of a \grammarterm{mem-initializer} for a constructor\iref{class.base.init}, the function parameter names are visible and hide the names of entities declared in the block, class or -namespace scopes containing the function declaration. \begin{note} +namespace scopes containing the function declaration. +\begin{note} \ref{dcl.fct.default} further describes the restrictions on the use of names in default arguments. \ref{class.base.init} further describes the restrictions on the use of names in a \grammarterm{ctor-initializer}. @@ -1681,9 +1709,12 @@ A name used in the definition of a \tcode{static} data member of class \tcode{X}\iref{class.static.data} (after the \grammarterm{qualified-id} of the static member) is looked up as if the name was used in a member -function of \tcode{X}. \begin{note} \ref{class.static.data} further +function of \tcode{X}. +\begin{note} +\ref{class.static.data} further describes the restrictions on the use of names in the definition of a -\tcode{static} data member. \end{note} +\tcode{static} data member. +\end{note} \pnum If a variable member of a namespace is defined outside of the scope of @@ -1691,7 +1722,6 @@ member (after the \grammarterm{declarator-id}) is looked up as if the definition of the member occurred in its namespace. \begin{example} - \begin{codeblock} namespace N { int i = 4; @@ -1712,12 +1742,17 @@ \grammarterm{exception-declaration} nor in the outermost block of a handler for the \grammarterm{function-try-block}. Names declared in the outermost block of the function definition are not found when looked up in the -scope of a handler for the \grammarterm{function-try-block}. \begin{note} But -function parameter names are found. \end{note} +scope of a handler for the \grammarterm{function-try-block}. +\begin{note} +But +function parameter names are found. +\end{note} \pnum -\begin{note} The rules for name lookup in template definitions are -described in~\ref{temp.res}. \end{note} +\begin{note} +The rules for name lookup in template definitions are +described in~\ref{temp.res}. +\end{note} \rSec2[basic.lookup.argdep]{Argument-dependent name lookup}% \indextext{lookup!argument-dependent} @@ -1839,11 +1874,13 @@ then \placeholder{Y} is empty. Otherwise \placeholder{Y} is the set of declarations found in the namespaces associated with the argument types as described below. The set of declarations found by the lookup of the name is the -union of \placeholder{X} and \placeholder{Y}. \begin{note} The namespaces and entities +union of \placeholder{X} and \placeholder{Y}. +\begin{note} +The namespaces and entities associated with the argument types can include namespaces and entities -already considered by the ordinary unqualified lookup. \end{note} +already considered by the ordinary unqualified lookup. +\end{note} \begin{example} - \begin{codeblock} namespace NS { class T { }; @@ -1956,8 +1993,8 @@ lookup of the name preceding that \tcode{::} considers only namespaces, types, and templates whose specializations are types. If the name found does not designate a namespace or a class, enumeration, or dependent type, -the program is ill-formed. \begin{example} - +the program is ill-formed. +\begin{example} \begin{codeblock} class A { public: @@ -1972,17 +2009,19 @@ \end{example} \pnum -\begin{note} Multiply qualified names, such as \tcode{N1::N2::N3::n}, can +\begin{note} +Multiply qualified names, such as \tcode{N1::N2::N3::n}, can be used to refer to members of nested classes\iref{class.nest} or -members of nested namespaces. \end{note} +members of nested namespaces. +\end{note} \pnum In a declaration in which the \grammarterm{declarator-id} is a \grammarterm{qualified-id}, names used before the \grammarterm{qualified-id} being declared are looked up in the defining namespace scope; names following the \grammarterm{qualified-id} are looked up in the scope of the -member's class or namespace. \begin{example} - +member's class or namespace. +\begin{example} \begin{codeblock} class X { }; class C { @@ -2040,7 +2079,8 @@ } \end{codeblock} \end{example} -\begin{note} \ref{basic.lookup.classref} describes how name +\begin{note} +\ref{basic.lookup.classref} describes how name lookup proceeds after the \tcode{.} and \tcode{->} operators. \end{note} @@ -2053,9 +2093,13 @@ \grammarterm{nested-name-specifier} is looked up in the scope of the class\iref{class.member.lookup}, except for the cases listed below. The name shall represent one or more members of that class or of one of -its base classes\iref{class.derived}. \begin{note} A class member +its base classes\iref{class.derived}. +\begin{note} +A class member can be referred to using a \grammarterm{qualified-id} at any point in its -potential scope\iref{basic.scope.class}. \end{note} The exceptions to +potential scope\iref{basic.scope.class}. +\end{note} +The exceptions to the name lookup rule above are the following: \begin{itemize} \item the lookup for a destructor is as specified @@ -2068,7 +2112,7 @@ \item the names in a \grammarterm{template-argument} of a \grammarterm{template-id} are looked up in the context in which the entire -\grammarterm{postfix-expression} occurs. +\grammarterm{postfix-expression} occurs; \item the lookup for a name specified in a \grammarterm{using-declaration}\iref{namespace.udecl} also finds class or @@ -2093,10 +2137,14 @@ \grammarterm{template-name} in the last component of the \grammarterm{nested-name-specifier}, \end{itemize} the name is instead considered to name the -constructor of class \tcode{C}. \begin{note} For example, the constructor +constructor of class \tcode{C}. +\begin{note} +For example, the constructor is not an acceptable lookup result in an \grammarterm{elaborated-type-specifier} so the constructor would not be -used in place of the injected-class-name. \end{note} Such a constructor +used in place of the injected-class-name. +\end{note} +Such a constructor name shall be used only in the \grammarterm{declarator-id} of a declaration that names a constructor or in a \grammarterm{using-declaration}. \begin{example} @@ -2154,8 +2202,8 @@ is the required set of declarations of \tcode{m}. Otherwise if the use of \tcode{m} is not one that allows a unique declaration to be chosen from -$S(X, m)$, the program is ill-formed. \begin{example} - +$S(X, m)$, the program is ill-formed. +\begin{example} \begin{codeblock} int x; namespace Y { @@ -2258,7 +2306,6 @@ \begin{example} Because each referenced namespace is searched at most once, the following is well-defined: - \begin{codeblock} namespace B { int b; @@ -2292,7 +2339,6 @@ only if the declarations are from the same namespace; otherwise (the declarations are from different namespaces), the program is ill-formed. \begin{example} - \begin{codeblock} namespace A { struct x { }; @@ -2317,17 +2363,14 @@ In a declaration for a namespace member in which the \grammarterm{declarator-id} is a \grammarterm{qualified-id}, given that the \grammarterm{qualified-id} for the namespace member has the form - \begin{ncbnf} nested-name-specifier unqualified-id \end{ncbnf} - the \grammarterm{unqualified-id} shall name a member of the namespace designated by the \grammarterm{nested-name-specifier} or of an element of the inline namespace set\iref{namespace.def} of that namespace. \begin{example} - \begin{codeblock} namespace A { namespace B { @@ -2337,12 +2380,12 @@ } void A::f1(int){ } // ill-formed, \tcode{f1} is not a member of \tcode{A} \end{codeblock} - -\end{example} However, in such namespace member declarations, the +\end{example} +However, in such namespace member declarations, the \grammarterm{nested-name-specifier} may rely on \grammarterm{using-directive}{s} to implicitly provide the initial part of the -\grammarterm{nested-name-specifier}. \begin{example} - +\grammarterm{nested-name-specifier}. +\begin{example} \begin{codeblock} namespace A { namespace B { @@ -2378,11 +2421,9 @@ \grammarterm{nested-name-specifier}, and unless the \grammarterm{elaborated-type-specifier} appears in a declaration with the following form: - \begin{ncbnf} class-key \opt{attribute-specifier-seq} identifier \terminal{;} \end{ncbnf} - the \grammarterm{identifier} is looked up according to~\ref{basic.lookup.unqual} but ignoring any non-type names that have been declared. If the \grammarterm{elaborated-type-specifier} is introduced @@ -2393,11 +2434,9 @@ declared \grammarterm{type-name}, or if the \grammarterm{elaborated-type-specifier} appears in a declaration with the form: - \begin{ncbnf} class-key \opt{attribute-specifier-seq} identifier \terminal{;} \end{ncbnf} - the \grammarterm{elaborated-type-specifier} is a declaration that introduces the \grammarterm{class-name} as described in~\ref{basic.scope.pdecl}. @@ -2440,7 +2479,7 @@ struct Base::Datum; // error: \tcode{Datum} undefined struct Base::Data* pBase; // OK: refers to nested \tcode{Data} \end{codeblock} -\end{example} % +\end{example} \indextext{lookup!elaborated type specifier|)}% \rSec2[basic.lookup.classref]{Class member access} @@ -2471,8 +2510,8 @@ \grammarterm{postfix-expression}. If the type \tcode{T} of the object expression is of a class type \tcode{C}, the \grammarterm{type-name} is also looked up in the scope of class \tcode{C}. At least one of the -lookups shall find a name that refers to \cv{}~\tcode{T}. \begin{example} - +lookups shall find a name that refers to \cv{}~\tcode{T}. +\begin{example} \begin{codeblock} struct A { }; @@ -2484,7 +2523,8 @@ void B::f(::A* a) { a->~A(); // OK: lookup in \tcode{*a} finds the injected-class-name } -\end{codeblock}\end{example} +\end{codeblock} +\end{example} \pnum If the \grammarterm{id-expression} in a class member access is a @@ -2497,9 +2537,12 @@ first looked up in the class of the object expression\iref{class.member.lookup} and the name, if found, is used. Otherwise it is looked up in the context of the entire -\grammarterm{postfix-expression}. \begin{note} See~\ref{basic.lookup.qual}, which +\grammarterm{postfix-expression}. +\begin{note} +See~\ref{basic.lookup.qual}, which describes the lookup of a name before \tcode{::}, which will only find a type -or namespace name. \end{note} +or namespace name. +\end{note} \pnum If the \grammarterm{qualified-id} has the form @@ -2733,7 +2776,6 @@ } } \end{codeblock} - Without the declaration at line \#2, the declaration at line \#3 would link with the declaration at line \#1. Because the declaration with internal linkage is hidden, however, @@ -2744,8 +2786,8 @@ When a block scope declaration of an entity with linkage is not found to refer to some other declaration, then that entity is a member of the innermost enclosing namespace. However such a declaration does not -introduce the member name in its namespace scope. \begin{example} - +introduce the member name in its namespace scope. +\begin{example} \begin{codeblock} namespace X { void p() { @@ -2844,8 +2886,10 @@ identity does not require a diagnostic. \pnum -\begin{note} Linkage to non-\Cpp{} declarations can be achieved using a -\grammarterm{linkage-specification}\iref{dcl.link}. \end{note}% +\begin{note} +Linkage to non-\Cpp{} declarations can be achieved using a +\grammarterm{linkage-specification}\iref{dcl.link}. +\end{note} \indextext{linkage|)} \rSec1[basic.memobj]{Memory and objects} @@ -2862,7 +2906,7 @@ and the eight-bit code units of the Unicode UTF-8 encoding form and is composed of a contiguous sequence of bits,\footnote{The number of bits in a byte is reported by the macro -\tcode{CHAR_BIT} in the header \tcode{}.} +\tcode{CHAR_BIT} in the header \libheaderref{climits}.} the number of which is \impldef{bits in a byte}. The least significant bit is called the \defn{low-order bit}; the most significant bit is called the \defn{high-order bit}. The memory @@ -2870,31 +2914,39 @@ contiguous bytes. Every byte has a unique address. \pnum -\begin{note} The representation of types is described -in~\ref{basic.types}. \end{note} +\begin{note} +The representation of types is described +in~\ref{basic.types}. +\end{note} \pnum A \defn{memory location} is either an object of scalar type or a maximal -sequence of adjacent bit-fields all having nonzero width. \begin{note} Various +sequence of adjacent bit-fields all having nonzero width. +\begin{note} +Various features of the language, such as references and virtual functions, might involve additional memory locations that are not accessible to programs but are -managed by the implementation. \end{note} Two or more threads of +managed by the implementation. +\end{note} +Two or more threads of execution\iref{intro.multithread} can access separate memory locations without interfering with each other. \pnum -\begin{note} Thus a bit-field and an adjacent non-bit-field are in separate memory +\begin{note} +Thus a bit-field and an adjacent non-bit-field are in separate memory locations, and therefore can be concurrently updated by two threads of execution without interference. The same applies to two bit-fields, if one is declared inside a nested struct declaration and the other is not, or if the two are separated by a zero-length bit-field declaration, or if they are separated by a non-bit-field declaration. It is not safe to concurrently update two bit-fields in the same struct if all fields between them are also bit-fields of nonzero -width. \end{note} +width. +\end{note} \pnum -\begin{example} A class declared as - +\begin{example} +A class declared as \begin{codeblock} struct { char a; @@ -2905,13 +2957,13 @@ struct {int ee:8;} e; } \end{codeblock} - contains four separate memory locations: The member \tcode{a} and bit-fields \tcode{d} and \tcode{e.ee} are each separate memory locations, and can be modified concurrently without interfering with each other. The bit-fields \tcode{b} and \tcode{c} together constitute the fourth memory location. The bit-fields \tcode{b} and \tcode{c} cannot be concurrently modified, but -\tcode{b} and \tcode{a}, for example, can be. \end{example}% +\tcode{b} and \tcode{a}, for example, can be. +\end{example} \indextext{memory model|)} \rSec2[intro.object]{Object model} @@ -2931,8 +2983,10 @@ throughout its lifetime\iref{basic.life}, and in its period of destruction\iref{class.cdtor}. -\begin{note} A function is not an object, regardless of whether or not it -occupies storage in the way that objects do. \end{note} +\begin{note} +A function is not an object, regardless of whether or not it +occupies storage in the way that objects do. +\end{note} The properties of an object are determined when the object is created. An object can have a name\iref{basic}. An object has a storage @@ -3021,7 +3075,7 @@ int *p = new (au.data) int; // OK, \tcode{au.data} provides storage char *c = new (au.data) char(); // OK, ends lifetime of \tcode{*p} char *d = new (au.data + 1) char(); - return *c + *d; // OK + return *c + *d; // OK } struct A { unsigned char a[32]; }; @@ -3136,7 +3190,7 @@ \begin{note} \Cpp{} provides a variety of fundamental types and several ways of composing new types from existing types\iref{basic.types}. -\end{note}% +\end{note} \indextext{object model|)} \rSec2[basic.life]{Object and reference lifetime} @@ -3175,12 +3229,15 @@ The lifetime of a reference ends as if it were a scalar object requiring storage. \pnum -\begin{note} \ref{class.base.init} -describes the lifetime of base and member subobjects. \end{note} +\begin{note} +\ref{class.base.init} +describes the lifetime of base and member subobjects. +\end{note} \pnum The properties ascribed to objects and references throughout this document -apply for a given object or reference only during its lifetime. \begin{note} +apply for a given object or reference only during its lifetime. +\begin{note} In particular, before the lifetime of an object starts and after its lifetime ends there are significant restrictions on the use of the object, as described below, in~\ref{class.base.init} and @@ -3188,7 +3245,8 @@ and destruction might not be the same as the behavior of an object whose lifetime has started and not ended. \ref{class.base.init} and~\ref{class.cdtor} describe the behavior of objects during the -construction and destruction phases. \end{note} +construction and destruction phases. +\end{note} \pnum A program may end the lifetime of any object by reusing the storage @@ -3357,8 +3415,8 @@ the program must ensure that an object of the original type occupies that same storage location when the implicit destructor call takes place; otherwise the behavior of the program is undefined. This is true -even if the block is exited with an exception. \begin{example} - +even if the block is exited with an exception. +\begin{example} \begin{codeblock} class T { }; struct B { @@ -3395,9 +3453,12 @@ \pnum In this subclause, ``before'' and ``after'' refer to the ``happens before'' -relation\iref{intro.multithread}. \begin{note} Therefore, undefined behavior results +relation\iref{intro.multithread}. +\begin{note} +Therefore, undefined behavior results if an object that is being constructed in one thread is referenced from another -thread without adequate synchronization. \end{note}% +thread without adequate synchronization. +\end{note} \indextext{object lifetime|)} \rSec2[basic.indet]{Indeterminate values} @@ -3461,12 +3522,12 @@ \end{itemize} \begin{example} \begin{codeblock} - int f(bool b) { - unsigned char c; - unsigned char d = c; // OK, \tcode{d} has an indeterminate value - int e = d; // undefined behavior - return b ? d : 0; // undefined behavior if \tcode{b} is \tcode{true} - } +int f(bool b) { + unsigned char c; + unsigned char d = c; // OK, \tcode{d} has an indeterminate value + int e = d; // undefined behavior + return b ? d : 0; // undefined behavior if \tcode{b} is \tcode{true} +} \end{codeblock} \end{example} @@ -3478,7 +3539,6 @@ potential lifetime of the storage containing the object. The storage duration is determined by the construct used to create the object and is one of the following: - \begin{itemize} \item static storage duration \item thread storage duration @@ -3533,9 +3593,12 @@ \pnum \indextext{object!local static@local \tcode{static}}% The keyword \tcode{static} can be used to declare a local variable with -static storage duration. \begin{note} \ref{stmt.dcl} describes the +static storage duration. +\begin{note} +\ref{stmt.dcl} describes the initialization of local \tcode{static} variables; \ref{basic.start.term} -describes the destruction of local \tcode{static} variables. \end{note} +describes the destruction of local \tcode{static} variables. +\end{note} \pnum \indextext{member!class static@class \tcode{static}}% @@ -3628,19 +3691,23 @@ These implicit declarations introduce only the function names \tcode{operator} \tcode{new}, \tcode{operator} \tcode{new[]}, \tcode{op\-er\-a\-tor} \tcode{delete}, and \tcode{operator} -\tcode{delete[]}. \begin{note} The implicit declarations do not introduce +\tcode{delete[]}. +\begin{note} +The implicit declarations do not introduce the names \tcode{std}, \tcode{std::size_t}, \tcode{std::align_val_t}, or any other names that the library uses to declare these names. Thus, a \grammarterm{new-expression}, \grammarterm{delete-expression} or function call that refers to one of -these functions without including the header \tcode{} is +these functions without including the header \libheaderref{new} is well-formed. However, referring to \tcode{std} or \tcode{std::size_t} or \tcode{std::align_val_t} is ill-formed unless the name has been declared -by including the appropriate header. \end{note} Allocation and/or +by including the appropriate header. +\end{note} +Allocation and/or deallocation functions may also be declared and defined for any class\iref{class.free}. @@ -3722,7 +3789,8 @@ \indextext{\idxcode{new_handler}}% A program-supplied allocation function can obtain the address of the currently installed \tcode{new_handler} using the -\tcode{std::get_new_handler} function\iref{get.new.handler}. \end{note} +\tcode{std::get_new_handler} function\iref{get.new.handler}. +\end{note} An allocation function that has a non-throwing exception specification\iref{except.spec} indicates failure by returning @@ -3739,7 +3807,9 @@ syntax\iref{expr.call}, or called indirectly to allocate storage for a coroutine state\iref{dcl.fct.def.coroutine}, or called indirectly through calls to the -functions in the \Cpp{} standard library. \begin{note} In particular, a +functions in the \Cpp{} standard library. +\begin{note} +In particular, a global allocation function is not called to allocate storage for objects with static storage duration\iref{basic.stc.static}, for objects or references with thread storage duration\iref{basic.stc.thread}, for objects of @@ -3830,8 +3900,9 @@ \end{itemize} \pnum -A pointer value is a \defn{safely-derived pointer} to a dynamic object only if it -has an object pointer type and it is one of the following: +A pointer value is a \defn{safely-derived pointer} to an object with dynamic storage duration +only if the pointer value has an object pointer type +and is one of the following: \begin{itemize} \item the value returned by a call to the \Cpp{} standard library implementation of \tcode{::operator new(std::\brk{}size_t)} or @@ -3850,7 +3921,8 @@ value; \item the result of a well-defined pointer -conversion~(\ref{conv.ptr}, \ref{expr.cast}) of a safely-derived pointer value; +conversion~(\ref{conv.ptr}, \ref{expr.type.conv}, \ref{expr.static.cast}, +\ref{expr.cast}) of a safely-derived pointer value; \item the result of a \tcode{reinterpret_cast} of a safely-derived pointer value; @@ -3868,7 +3940,6 @@ An integer value is an \defnx{integer representation of a safely-derived pointer}{safely-derived pointer!integer representation} only if its type is at least as large as \tcode{std::intptr_t} and it is one of the following: - \begin{itemize} \item the result of a \tcode{reinterpret_cast} of a safely-derived pointer value; @@ -3893,11 +3964,14 @@ storage duration that is not a safely-derived pointer value is an invalid pointer value unless the referenced complete object has previously been declared -reachable\iref{util.dynamic.safety}. \begin{note} +reachable\iref{util.dynamic.safety}. +\begin{note} The effect of using an invalid pointer value (including passing it to a deallocation function) is undefined, see~\ref{basic.stc}. This is true even if the unsafely-derived pointer value might compare equal to -some safely-derived pointer value. \end{note} It is +some safely-derived pointer value. +\end{note} +It is \impldef{whether an implementation has relaxed or strict pointer safety} whether an implementation has relaxed or strict pointer safety.% \indextext{pointer!safely-derived|)}% @@ -3929,7 +4003,8 @@ all contexts, which is equal to \tcode{alignof(std::max_align_t)}\iref{support.types}. The alignment required for a type might be different when it is used as the type -of a complete object and when it is used as the type of a subobject. \begin{example} +of a complete object and when it is used as the type of a subobject. +\begin{example} \begin{codeblock} struct B { long double d; }; struct D : virtual B { char c; }; @@ -3940,7 +4015,8 @@ If \tcode{D} appears as a subobject of another object that also has \tcode{B} as a virtual base class, the \tcode{B} subobject might be part of a different subobject, reducing the alignment requirements on the \tcode{D} subobject. -\end{example} The result of the \tcode{alignof} operator reflects the alignment +\end{example} +The result of the \tcode{alignof} operator reflects the alignment requirement of the type in the complete-object case. \pnum @@ -3951,7 +4027,8 @@ greater than \tcode{alignof(std::max_align_t)}. It is \impldef{support for extended alignments} whether any extended alignments are supported and the contexts in which they are supported\iref{dcl.align}. A type having an extended alignment -requirement is an \defnadj{over-aligned}{type}. \begin{note} +requirement is an \defnadj{over-aligned}{type}. +\begin{note} Every over-aligned type is or contains a class type to which extended alignment applies (possibly through a non-static data member). \end{note} @@ -3977,8 +4054,10 @@ \tcode{alignof} expression\iref{expr.alignof}. Furthermore, the narrow character types\iref{basic.fundamental} shall have the weakest alignment requirement. -\begin{note} This enables the ordinary character types to be used as the -underlying type for an aligned memory area\iref{dcl.align}.\end{note} +\begin{note} +This enables the ordinary character types to be used as the +underlying type for an aligned memory area\iref{dcl.align}. +\end{note} \pnum Comparing alignments is meaningful and provides the obvious results: @@ -3990,7 +4069,8 @@ \end{itemize} \pnum -\begin{note} The runtime pointer alignment function\iref{ptr.align} +\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. \end{note} @@ -4054,7 +4134,8 @@ when a prvalue that has type other than \cv{}~\tcode{void} appears as a discarded-value expression\iref{expr.prop}. \end{itemize} \end{note} -\begin{example} Consider the following code: +\begin{example} +Consider the following code: \begin{codeblock} class X { public: @@ -4094,7 +4175,7 @@ requires a temporary for the result of \tcode{f(a)}, which is materialized so that the reference parameter -of \tcode{A::operator=(const A\&)} can bind to it. +of \tcode{X::operator=(const X\&)} can bind to it. \end{example} \pnum @@ -4206,10 +4287,10 @@ template using id = T; int i = 1; -int&& a = id{1, 2, 3}[i]; // temporary array has same lifetime as \tcode{a} -const int& b = static_cast(0); // temporary \tcode{int} has same lifetime as \tcode{b} +int&& a = id{1, 2, 3}[i]; // temporary array has same lifetime as \tcode{a} +const int& b = static_cast(0); // temporary \tcode{int} has same lifetime as \tcode{b} int&& c = cond ? id{1, 2, 3}[i] : static_cast(0); - // exactly one of the two temporaries is lifetime-extended + // exactly one of the two temporaries is lifetime-extended \end{codeblock} \end{example} \begin{note} @@ -4219,7 +4300,7 @@ covered above. \begin{example} \begin{codeblock} -const int& x = (const int&)1; // temporary for value 1 has same lifetime as x +const int& x = (const int&)1; // temporary for value 1 has same lifetime as x \end{codeblock} \end{example} \end{note} @@ -4231,7 +4312,7 @@ struct S { const int& m; }; -const S& s = S{1}; // both \tcode{S} and \tcode{int} temporaries have lifetime of \tcode{s} +const S& s = S{1}; // both \tcode{S} and \tcode{int} temporaries have lifetime of \tcode{s} \end{codeblock} \end{example} \end{note} @@ -4250,12 +4331,14 @@ \item The lifetime of a temporary bound to the returned value in a function \tcode{return} statement\iref{stmt.return} is not extended; the temporary is destroyed at the end of the full-expression in the \tcode{return} statement. \item A temporary bound to a reference in a \grammarterm{new-initializer}\iref{expr.new} persists until the completion of the full-expression containing the \grammarterm{new-initializer}. -\begin{note} This may introduce a dangling reference. \end{note} +\begin{note} +This may introduce a dangling reference. +\end{note} \begin{example} \begin{codeblock} struct S { int mi; const std::pair& mp; }; S a { 1, {2,3} }; -S* p = new S{ 1, {2,3} }; // creates dangling reference +S* p = new S{ 1, {2,3} }; // creates dangling reference \end{codeblock} \end{example} \end{itemize} @@ -4395,7 +4478,8 @@ functions\iref{headers} \tcode{std::memcpy} or \tcode{std::memmove}.} If the content of that array is copied back into the object, the object shall -subsequently hold its original value. \begin{example} +subsequently hold its original value. +\begin{example} \begin{codeblock} #define N sizeof(T) char buf[N]; @@ -4413,8 +4497,8 @@ \tcode{obj1} are copied into \tcode{obj2},\footnote{By using, for example, the library functions\iref{headers} \tcode{std::memcpy} or \tcode{std::memmove}.} \tcode{obj2} shall subsequently hold the same value as -\tcode{obj1}. \begin{example} - +\tcode{obj1}. +\begin{example} \begin{codeblock} T* t1p; T* t2p; @@ -4423,7 +4507,7 @@ // at this point, every subobject of trivially copyable type in \tcode{*t1p} contains // the same value as the corresponding subobject in \tcode{*t2p} \end{codeblock} -\end{example}% +\end{example} \indextext{object!byte copying and|)} \pnum @@ -4470,8 +4554,8 @@ 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 \tcode{typedef} declaration to -be an array of unknown bound, cannot be completed. \begin{example} - +be an array of unknown bound, cannot be completed. +\begin{example} \indextext{type!example of incomplete}% \begin{codeblock} class X; // \tcode{X} is an incomplete type @@ -4501,8 +4585,10 @@ \end{example} \pnum -\begin{note} The rules for declarations and expressions describe in which -contexts incomplete types are prohibited. \end{note} +\begin{note} +The rules for declarations and expressions describe in which +contexts incomplete types are prohibited. +\end{note} \pnum An \defn{object type} is a (possibly cv-qualified) type that is not @@ -4760,7 +4846,7 @@ \indextext{type!underlying!\idxcode{char32_t}}% Types \tcode{char16_t} and \tcode{char32_t} denote distinct types whose underlying types are \tcode{uint_least16_t} and \tcode{uint_least32_t}, -respectively, in \tcode{}. +respectively, in \libheaderref{cstdint}. \pnum \indextext{Boolean type}% @@ -4829,7 +4915,8 @@ is an incomplete type that cannot be completed; such a type has an empty set of values. It is used as the return type for functions that do not return a value. Any expression can be -explicitly converted to type \cv{}~\tcode{void}\iref{expr.cast}. +explicitly converted to type \cv{}~\tcode{void}~(\ref{expr.type.conv}, +\ref{expr.static.cast}, \ref{expr.cast}). An expression of type \cv{}~\tcode{void} shall be used only as an expression statement\iref{stmt.expr}, as an operand of a comma expression\iref{expr.comma}, as a second or third operand @@ -4913,14 +5000,21 @@ \pnum \indextext{terminology!pointer}% The type of a pointer to \cv{}~\tcode{void} or a pointer to an object type is -called an \defn{object pointer type}. \begin{note} A pointer to \tcode{void} +called an \defn{object pointer type}. +\begin{note} +A pointer to \tcode{void} does not have a pointer-to-object type, however, because \tcode{void} is not -an object type. \end{note} The type of a pointer that can designate a function +an object type. +\end{note} +The type of a pointer that can designate a function is called a \defn{function pointer type}. A pointer to objects of type \tcode{T} is referred to as a ``pointer to -\tcode{T}''. \begin{example} A pointer to an object of type \tcode{int} is +\tcode{T}''. +\begin{example} +A pointer to an object of type \tcode{int} is referred to as ``pointer to \tcode{int}'' and a pointer to an object of -class \tcode{X} is called a ``pointer to \tcode{X}''. \end{example} +class \tcode{X} is called a ``pointer to \tcode{X}''. +\end{example} Except for pointers to static members, text referring to ``pointers'' does not apply to pointers to members. Pointers to incomplete types are allowed although there are restrictions on what can be done with @@ -4970,9 +5064,11 @@ layout-compatible types shall have the same value representation and alignment requirements\iref{basic.align}. -\begin{note} Pointers to over-aligned types\iref{basic.align} have no special +\begin{note} +Pointers to over-aligned types\iref{basic.align} have no special representation, but their range of valid values is restricted by the extended -alignment requirement.\end{note} +alignment requirement. +\end{note} \pnum Two objects \placeholder{a} and \placeholder{b} are \defn{pointer-interconvertible} if: @@ -5116,7 +5212,7 @@ The type of both \tcode{arr1} and \tcode{arr2} is ``array of 5 \tcode{const char}'', and the array type is considered to be const-qualified. -\end{example}% +\end{example} \indextext{type|)} \rSec2[conv.rank]{Integer conversion rank}% @@ -5173,7 +5269,7 @@ The integer conversion rank is used in the definition of the integral promotions\iref{conv.prom} and the usual arithmetic conversions\iref{expr.prop}. -\end{note}% +\end{note} \rSec1[basic.exec]{Program execution} @@ -5298,12 +5394,14 @@ \end{example} \pnum -\begin{note} The evaluation of a full-expression can include the +\begin{note} +The evaluation of a full-expression can include the evaluation of subexpressions that are not lexically part of the full-expression. For example, subexpressions involved in evaluating default arguments\iref{dcl.fct.default} are considered to be created in the expression that calls the function, not the expression -that defines the default argument. \end{note} +that defines the default argument. +\end{note} \pnum \indextext{value computation|(}% @@ -5331,12 +5429,18 @@ then the execution of \placeholder{A} shall precede the execution of \placeholder{B}. If \placeholder{A} is not sequenced before \placeholder{B} and \placeholder{B} is not sequenced before \placeholder{A}, then \placeholder{A} and -\placeholder{B} are \defn{unsequenced}. \begin{note} The execution of unsequenced -evaluations can overlap. \end{note} Evaluations \placeholder{A} and \placeholder{B} are +\placeholder{B} are \defn{unsequenced}. +\begin{note} +The execution of unsequenced +evaluations can overlap. +\end{note} +Evaluations \placeholder{A} and \placeholder{B} are \defn{indeterminately sequenced} when either \placeholder{A} is sequenced before \placeholder{B} or \placeholder{B} is sequenced before \placeholder{A}, but it is unspecified which. -\begin{note} Indeterminately sequenced evaluations cannot overlap, but either -could be executed first. \end{note} +\begin{note} +Indeterminately sequenced evaluations cannot overlap, but either +could be executed first. +\end{note} An expression \placeholder{X} is said to be sequenced before an expression \placeholder{Y} if @@ -5361,11 +5465,14 @@ \pnum \indextext{evaluation!unspecified order of}% Except where noted, evaluations of operands of individual operators and -of subexpressions of individual expressions are unsequenced. \begin{note} +of subexpressions of individual expressions are unsequenced. +\begin{note} In an expression that is evaluated more than once during the execution of a program, unsequenced and indeterminately sequenced evaluations of its subexpressions need not be performed consistently in different -evaluations. \end{note} The value computations of the operands of an +evaluations. +\end{note} +The value computations of the operands of an operator are sequenced before the value computation of the result of the operator. If a \indextext{side effects}% @@ -5380,7 +5487,6 @@ \end{note} \begin{example} - \begin{codeblock} void g(int i) { i = 7, i++, i++; // \tcode{i} becomes \tcode{9} @@ -5432,7 +5538,8 @@ If a signal handler is executed as a result of a call to the \tcode{std::raise} function, then the execution of the handler is sequenced after the invocation of the \tcode{std::raise} function and before its return. -\begin{note} When a signal is received for another reason, the execution of the +\begin{note} +When a signal is received for another reason, the execution of the signal handler is usually unsequenced with respect to the rest of the program. \end{note} \indextext{program execution|)} @@ -5441,13 +5548,17 @@ \pnum \indextext{threads!multiple|(}% -\indextext{operation!atomic|(}% +\indextext{atomic!operation|(}% A \defn{thread of execution} (also known as a \defn{thread}) is a single flow of control within a program, including the initial invocation of a specific top-level function, and recursively including every function invocation -subsequently executed by the thread. \begin{note} When one thread creates another, +subsequently executed by the thread. +\begin{note} +When one thread creates another, the initial call to the top-level function of the new thread is executed by the -new thread, not by the creating thread. \end{note} Every thread in a program can +new thread, not by the creating thread. +\end{note} +Every thread in a program can potentially access every object and function in a program.\footnote{An object with automatic or thread storage duration\iref{basic.stc} is associated with one specific thread, and can be accessed by a different thread only indirectly @@ -5455,10 +5566,14 @@ implementation, a \Cpp{} program can have more than one thread running concurrently. The execution of each thread proceeds as defined by the remainder of this document. The execution of the entire program consists of an execution -of all of its threads. \begin{note} Usually the execution can be viewed as an +of all of its threads. +\begin{note} +Usually the execution can be viewed as an interleaving of all its threads. However, some kinds of atomic operations, for example, allow executions inconsistent with a simple interleaving, as described -below. \end{note} Under a freestanding implementation, it is \impldef{number of +below. +\end{note} +Under a freestanding implementation, it is \impldef{number of threads in a program under a freestanding implementation} whether a program can have more than one thread of execution. @@ -5473,10 +5588,12 @@ The value of an object visible to a thread \placeholder{T} at a particular point is the initial value of the object, a value assigned to the object by \placeholder{T}, or a value assigned to the object by another thread, according to the rules below. -\begin{note} In some cases, there may instead be undefined behavior. Much of this +\begin{note} +In some cases, there may instead be undefined behavior. Much of this subclause is motivated by the desire to support atomic operations with explicit and detailed visibility constraints. However, it also implicitly supports a -simpler view for more restricted programs. \end{note} +simpler view for more restricted programs. +\end{note} \pnum Two expression evaluations \defn{conflict} if one of them modifies a memory @@ -5494,7 +5611,9 @@ acquire fence, a release fence, or both an acquire and release fence. In addition, there are relaxed atomic operations, which are not synchronization operations, and atomic read-modify-write operations, which have special -characteristics. \begin{note} For example, a call that acquires a mutex will +characteristics. +\begin{note} +For example, a call that acquires a mutex will perform an acquire operation on the locations comprising the mutex. Correspondingly, a call that releases the same mutex will perform a release operation on those same locations. Informally, performing a release operation on @@ -5509,7 +5628,8 @@ \pnum All modifications to a particular atomic object \placeholder{M} occur in some particular total order, called the \defn{modification order} of \placeholder{M}. -\begin{note} There is a separate order for each +\begin{note} +There is a separate order for each atomic object. There is no requirement that these can be combined into a single total order for all objects. In general this will be impossible since different threads may observe modifications to different objects in inconsistent orders. @@ -5528,17 +5648,21 @@ Certain library calls \defn{synchronize with} other library calls performed by another thread. For example, an atomic store-release synchronizes with a load-acquire that takes its value from the store\iref{atomics.order}. -\begin{note} Except in the specified cases, reading a later value does not +\begin{note} +Except in the specified cases, reading a later value does not necessarily ensure visibility as described below. Such a requirement would -sometimes interfere with efficient implementation. \end{note} \begin{note} The +sometimes interfere with efficient implementation. +\end{note} +\begin{note} +The specifications of the synchronization operations define when one reads the value written by another. For atomic objects, the definition is clear. All operations on a given mutex occur in a single total order. Each mutex acquisition ``reads -the value written'' by the last mutex release. \end{note} +the value written'' by the last mutex release. +\end{note} \pnum An evaluation \placeholder{A} \defn{carries a dependency} to an evaluation \placeholder{B} if - \begin{itemize} \item the value of \placeholder{A} is used as an operand of \placeholder{B}, unless: @@ -5563,8 +5687,10 @@ for some evaluation \placeholder{X}, \placeholder{A} carries a dependency to \placeholder{X}, and \placeholder{X} carries a dependency to \placeholder{B}. \end{itemize} -\begin{note} ``Carries a dependency to'' is a subset of ``is sequenced before'', -and is similarly strictly intra-thread. \end{note} +\begin{note} +``Carries a dependency to'' is a subset of ``is sequenced before'', +and is similarly strictly intra-thread. +\end{note} \pnum An evaluation \placeholder{A} is \defn{dependency-ordered before} an evaluation @@ -5580,7 +5706,8 @@ \placeholder{X} carries a dependency to \placeholder{B}. \end{itemize} -\begin{note} The relation ``is dependency-ordered before'' is analogous to +\begin{note} +The relation ``is dependency-ordered before'' is analogous to ``synchronizes with'', but uses release/consume in place of release/acquire. \end{note} @@ -5606,7 +5733,8 @@ inter-thread happens before \placeholder{B}. \end{itemize} \end{itemize} -\begin{note} The ``inter-thread happens before'' relation describes arbitrary +\begin{note} +The ``inter-thread happens before'' relation describes arbitrary concatenations of ``sequenced before'', ``synchronizes with'' and ``dependency-ordered before'' relationships, with two exceptions. The first exception is that a concatenation is not permitted to end with @@ -5620,7 +5748,8 @@ permitted to consist entirely of ``sequenced before''. The reasons for this limitation are (1) to permit ``inter-thread happens before'' to be transitively closed and (2) the ``happens before'' relation, defined below, provides for -relationships consisting entirely of ``sequenced before''. \end{note} +relationships consisting entirely of ``sequenced before''. +\end{note} \pnum An evaluation \placeholder{A} \defn{happens before} an evaluation \placeholder{B} @@ -5630,8 +5759,11 @@ \item \placeholder{A} inter-thread happens before \placeholder{B}. \end{itemize} The implementation shall ensure that no program execution demonstrates a cycle -in the ``happens before'' relation. \begin{note} This cycle would otherwise be -possible only through the use of consume operations. \end{note} +in the ``happens before'' relation. +\begin{note} +This cycle would otherwise be +possible only through the use of consume operations. +\end{note} \pnum An evaluation \placeholder{A} \defn{simply happens before} an evaluation \placeholder{B} @@ -5685,13 +5817,19 @@ evaluation \placeholder{B}, shall be the value stored by the \indextext{side effects!visible}% visible side effect -\placeholder{A}. \begin{note} If there is ambiguity about which side effect to a +\placeholder{A}. +\begin{note} +If there is ambiguity about which side effect to a non-atomic object or bit-field is visible, then the behavior is either -unspecified or undefined. \end{note} \begin{note} This states that operations on +unspecified or undefined. +\end{note} +\begin{note} +This states that operations on ordinary objects are not visibly reordered. This is not actually detectable without data races, but it is necessary to ensure that data races, as defined below, and with suitable restrictions on the use of atomics, correspond to data -races in a simple interleaved (sequentially consistent) execution. \end{note} +races in a simple interleaved (sequentially consistent) execution. +\end{note} \pnum The value of an @@ -5708,8 +5846,11 @@ \indextext{coherence!write-write}% If an operation \placeholder{A} that modifies an atomic object \placeholder{M} happens before an operation \placeholder{B} that modifies \placeholder{M}, then \placeholder{A} shall be earlier -than \placeholder{B} in the modification order of \placeholder{M}. \begin{note} This requirement -is known as write-write coherence. \end{note} +than \placeholder{B} in the modification order of \placeholder{M}. +\begin{note} +This requirement +is known as write-write coherence. +\end{note} \pnum \indextext{coherence!read-read}% @@ -5722,7 +5863,9 @@ \indextext{side effects}% side effect \placeholder{Y} on \placeholder{M}, where \placeholder{Y} follows \placeholder{X} in the modification order of \placeholder{M}. -\begin{note} This requirement is known as read-read coherence. \end{note} +\begin{note} +This requirement is known as read-read coherence. +\end{note} \pnum \indextext{coherence!read-write}% @@ -5731,8 +5874,11 @@ value computation \placeholder{A} of an atomic object \placeholder{M} happens before an operation \placeholder{B} that modifies \placeholder{M}, then \placeholder{A} shall take its value from a side effect \placeholder{X} on \placeholder{M}, where \placeholder{X} precedes \placeholder{B} in the -modification order of \placeholder{M}. \begin{note} This requirement is known as -read-write coherence. \end{note} +modification order of \placeholder{M}. +\begin{note} +This requirement is known as +read-write coherence. +\end{note} \pnum \indextext{coherence!write-read}% @@ -5743,23 +5889,29 @@ value from \placeholder{X} or from a \indextext{side effects}% side effect \placeholder{Y} that follows \placeholder{X} in the -modification order of \placeholder{M}. \begin{note} This requirement is known as -write-read coherence. \end{note} +modification order of \placeholder{M}. +\begin{note} +This requirement is known as +write-read coherence. +\end{note} \pnum -\begin{note} The four preceding coherence requirements effectively disallow +\begin{note} +The four preceding coherence requirements effectively disallow compiler reordering of atomic operations to a single object, even if both operations are relaxed loads. This effectively makes the cache coherence guarantee provided by most hardware available to \Cpp{} atomic operations. \end{note} \pnum -\begin{note} The value observed by a load of an atomic depends on the ``happens +\begin{note} +The value observed by a load of an atomic depends on the ``happens before'' relation, which depends on the values observed by loads of atomics. The intended reading is that there must exist an association of atomic loads with modifications they observe that, together with suitably chosen modification orders and the ``happens before'' relation derived -as described above, satisfy the resulting constraints as imposed here. \end{note} +as described above, satisfy the resulting constraints as imposed here. +\end{note} \pnum Two actions are \defn{potentially concurrent} if @@ -5773,7 +5925,9 @@ and neither happens before the other, except for the special case for signal handlers described below. Any such data race results in undefined -behavior. \begin{note} It can be shown that programs that correctly use mutexes +behavior. +\begin{note} +It can be shown that programs that correctly use mutexes and \tcode{memory_order::seq_cst} operations to prevent all data races and use no other synchronization operations behave as if the operations executed by their constituent threads were simply interleaved, with each @@ -5787,7 +5941,8 @@ programs cannot observe most program transformations that do not change single-threaded program semantics. In fact, most single-threaded program transformations continue to be allowed, since any program that behaves -differently as a result must perform an undefined operation. \end{note} +differently as a result must perform an undefined operation. +\end{note} \pnum Two accesses to the same object of type \tcode{volatile std::sig_atomic_t} do not @@ -5802,7 +5957,8 @@ in \placeholder{B}. \pnum -\begin{note} Compiler transformations that introduce assignments to a potentially +\begin{note} +Compiler transformations that introduce assignments to a potentially shared memory location that would not be modified by the abstract machine are generally precluded by this document, since such an assignment might overwrite another assignment by a different thread in cases in which an abstract machine @@ -5810,16 +5966,19 @@ of data member assignment that overwrite adjacent members in separate memory locations. Reordering of atomic loads in cases in which the atomics in question may alias is also generally precluded, since this may violate the coherence -rules. \end{note} +rules. +\end{note} \pnum -\begin{note} Transformations that introduce a speculative read of a potentially +\begin{note} +Transformations that introduce a speculative read of a potentially shared memory location may not preserve the semantics of the \Cpp{} program as defined in this document, since they potentially introduce a data race. However, they are typically valid in the context of an optimizing compiler that targets a specific machine with well-defined semantics for data races. They would be invalid for a hypothetical machine that is not tolerant of races or provides -hardware race detection. \end{note} +hardware race detection. +\end{note} \rSec3[intro.progress]{Forward progress} @@ -5832,8 +5991,10 @@ \item perform an access through a volatile glvalue, or \item perform a synchronization operation or an atomic operation. \end{itemize} -\begin{note} This is intended to allow compiler transformations such as removal of -empty loops, even when termination cannot be proven. \end{note} +\begin{note} +This is intended to allow compiler transformations such as removal of +empty loops, even when termination cannot be proven. +\end{note} \pnum Executions of atomic functions @@ -6022,7 +6183,7 @@ An implementation should ensure that the last value (in modification order) assigned by an atomic or synchronization operation will become visible to all other threads in a finite period of time.% -\indextext{operation!atomic|)}% +\indextext{atomic!operation|)}% \indextext{threads!multiple|)} \rSec2[basic.start]{Start and termination} @@ -6040,11 +6201,14 @@ might be initialized\iref{basic.start.static} and destroyed\iref{basic.start.term}. It is \impldef{defining \tcode{main} in freestanding environment} whether a program in a freestanding environment is required to define a \tcode{main} -function. \begin{note} In a freestanding environment, start-up and termination is +function. +\begin{note} +In a freestanding environment, start-up and termination is \impldef{start-up and termination in freestanding environment}; start-up contains the execution of constructors for objects of namespace scope with static storage duration; termination contains the execution of destructors for objects with static storage -duration. \end{note} +duration. +\end{note} \pnum An implementation shall not predefine the \tcode{main} function. This @@ -6057,7 +6221,6 @@ \item a function of \tcode{()} returning \tcode{int} and \item a function of \tcode{(int}, pointer to pointer to \tcode{char)} returning \tcode{int} \end{itemize} - \indextext{\idxcode{argc}}% \indextext{\idxcode{argv}}% as the type of \tcode{main}\iref{dcl.fct}. @@ -6074,9 +6237,12 @@ and \tcode{argv[0]} shall be the pointer to the initial character of a \ntmbs{} that represents the name used to invoke the program or \tcode{""}. The value of \tcode{argc} shall be -non-negative. The value of \tcode{argv[argc]} shall be 0. \begin{note} It +non-negative. The value of \tcode{argv[argc]} shall be 0. +\begin{note} +It is recommended that any further (optional) parameters be added after -\tcode{argv}. \end{note} +\tcode{argv}. +\end{note} \pnum The function \tcode{main} shall not be used within @@ -6094,13 +6260,16 @@ or that declares the name \tcode{main} with C language linkage (in any namespace) is ill-formed. The name \tcode{main} is -not otherwise reserved. \begin{example} Member functions, classes, and +not otherwise reserved. +\begin{example} +Member functions, classes, and enumerations can be called \tcode{main}, as can entities in other -namespaces. \end{example} +namespaces. +\end{example} \pnum \indextext{\idxcode{exit}}% -\indexlibrary{\idxcode{exit}}% +\indexlibraryglobal{exit}% \indextext{termination!program}% Terminating the program without leaving the current block (e.g., by calling the function @@ -6148,9 +6317,11 @@ all other initialization is \defn{dynamic initialization}. All static initialization strongly happens before\iref{intro.races} any dynamic initialization. -\begin{note} The dynamic initialization of non-local variables is described +\begin{note} +The dynamic initialization of non-local variables is described in~\ref{basic.start.dynamic}; that of local static variables is described -in~\ref{stmt.dcl}. \end{note} +in~\ref{stmt.dcl}. +\end{note} \pnum An implementation is permitted to perform the initialization of a @@ -6197,8 +6368,10 @@ specialization, is partially-ordered if the variable is an inline variable that is not an implicitly or explicitly instantiated specialization, and otherwise is ordered. -\begin{note} An explicitly specialized non-inline static data member or -variable template specialization has ordered initialization.\end{note} +\begin{note} +An explicitly specialized non-inline static data member or +variable template specialization has ordered initialization. +\end{note} \pnum Dynamic initialization of non-local variables \tcode{V} and \tcode{W} @@ -6304,7 +6477,8 @@ initialized before it is odr-used by the initialization of \tcode{a}, that is, before \tcode{A::A} is called. If, however, \tcode{a} is initialized at some point after the first statement of \tcode{main}, \tcode{b} will -be initialized prior to its use in \tcode{A::A}. \end{example} +be initialized prior to its use in \tcode{A::A}. +\end{example} \pnum It is \impldef{dynamic initialization of static inline variables before \tcode{main}} @@ -6348,7 +6522,7 @@ and functions registered with \tcode{std::atexit} are called as part of a call to \indextext{\idxcode{exit}}% -\indexlibrary{\idxcode{exit}}% +\indexlibraryglobal{exit}% \tcode{std::exit}\iref{support.start.term}. The call to \tcode{std::exit} is sequenced before the destructions and the registered functions. @@ -6391,10 +6565,10 @@ \pnum \indextext{\idxcode{atexit}}% -\indexlibrary{\idxcode{atexit}}% +\indexlibraryglobal{atexit}% If the completion of the initialization of an object with static storage duration strongly happens before a call to \tcode{std::atexit}~(see -\tcode{}, \ref{support.start.term}), the call to the function passed to +\libheader{cstdlib}, \ref{support.start.term}), the call to the function passed to \tcode{std::atexit} is sequenced before the call to the destructor for the object. If a call to \tcode{std::atexit} strongly happens before the completion of the initialization of an object with static storage duration, the call to the destructor for the @@ -6408,19 +6582,21 @@ handlers\iref{support.runtime} that does not happen before\iref{intro.multithread} completion of destruction of objects with static storage duration and execution of \tcode{std::atexit} registered functions\iref{support.start.term}, the program has -undefined behavior. \begin{note} If there is a use of an object with static storage +undefined behavior. +\begin{note} +If there is a use of an object with static storage duration that does not happen before the object's destruction, the program has undefined behavior. Terminating every thread before a call to \tcode{std::exit} or the exit from \tcode{main} is sufficient, but not necessary, to satisfy these requirements. These -requirements permit thread managers as static-storage-duration objects. \end{note} +requirements permit thread managers as static-storage-duration objects. +\end{note} \pnum \indextext{\idxcode{abort}}% -\indexlibrary{\idxcode{abort}}% +\indexlibraryglobal{abort}% \indextext{termination!program}% Calling the function \tcode{std::abort()} declared in -\indexhdr{cstdlib}% -\tcode{} terminates the program without executing any destructors +\libheaderref{cstdlib} terminates the program without executing any destructors and without calling the functions passed to \tcode{std::atexit()} or \tcode{std::at_quick_exit()}.% \indextext{program!termination|)} diff --git a/source/classes.tex b/source/classes.tex index 7c14167ec5..42afe0785a 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -6,6 +6,8 @@ \indextext{class!member function|see{member function, class}} +\rSec1[class.pre]{Preamble} + \pnum \indextext{\idxcode{\{\}}!class declaration}% \indextext{\idxcode{\{\}}!class definition}% @@ -61,8 +63,11 @@ a partial specialization\iref{temp.class.spec}. A \grammarterm{class-specifier} whose \grammarterm{class-head} omits the -\grammarterm{class-head-name} defines an unnamed class. \begin{note} An unnamed class thus can't -be \tcode{final}. \end{note} +\grammarterm{class-head-name} defines an unnamed class. +\begin{note} +An unnamed class thus can't +be \tcode{final}. +\end{note} \pnum A \grammarterm{class-name} is inserted into the scope in which it is @@ -100,7 +105,8 @@ the program is ill-formed. Whenever a \grammarterm{class-key} is followed by a \grammarterm{class-head-name}, the \grammarterm{identifier} \tcode{final}, and a colon or left brace, \tcode{final} is -interpreted as a \grammarterm{class-virt-specifier}. \begin{example} +interpreted as a \grammarterm{class-virt-specifier}. +\begin{example} \begin{codeblock} struct A; struct A final {}; // OK: definition of \tcode{struct A}, @@ -144,7 +150,6 @@ \pnum A \defnadj{trivially copyable}{class} is a class: - \begin{itemize} \item that has at least one eligible copy constructor, move constructor, @@ -159,8 +164,10 @@ A \defnadj{trivial}{class} is a class that is trivially copyable and has one or more eligible default constructors\iref{class.default.ctor}, all of which are trivial. -\begin{note} In particular, a trivially copyable or trivial class does not have -virtual functions or virtual base classes.\end{note} +\begin{note} +In particular, a trivially copyable or trivial class does not have +virtual functions or virtual base classes. +\end{note} \pnum A class \tcode{S} is a \defnadj{standard-layout}{class} if it: @@ -187,8 +194,10 @@ This ensures that two subobjects that have the same class type and that belong to the same most derived object are not allocated at the same address\iref{expr.eq}.} -\begin{note} $M(\mathtt{X})$ is the set of the types of all non-base-class subobjects -that may be at a zero offset in \tcode{X}. \end{note} +\begin{note} +$M(\mathtt{X})$ is the set of the types of all non-base-class subobjects +that may be at a zero offset in \tcode{X}. +\end{note} \begin{itemize} \item If \tcode{X} is a non-union class type with no (possibly @@ -219,15 +228,15 @@ \pnum \begin{example} \begin{codeblock} - struct B { int i; }; // standard-layout class - struct C : B { }; // standard-layout class - struct D : C { }; // standard-layout class - struct E : D { char : 4; }; // not a standard-layout class +struct B { int i; }; // standard-layout class +struct C : B { }; // standard-layout class +struct D : C { }; // standard-layout class +struct E : D { char : 4; }; // not a standard-layout class - struct Q {}; - struct S : Q { }; - struct T : Q { }; - struct U : S, T { }; // not a standard-layout class +struct Q {}; +struct S : Q { }; +struct T : Q { }; +struct U : S, T { }; // not a standard-layout class \end{codeblock} \end{example} @@ -240,9 +249,11 @@ \grammarterm{class-key} \tcode{union}. \pnum -\begin{note} Standard-layout classes are useful for communicating with +\begin{note} +Standard-layout classes are useful for communicating with code written in other programming languages. Their layout is specified -in~\ref{class.mem}.\end{note} +in~\ref{class.mem}. +\end{note} \pnum \begin{example} @@ -280,7 +291,6 @@ \pnum A class definition introduces a new type. \begin{example} - \begin{codeblock} struct X { int a; }; struct Y { int a; }; @@ -288,30 +298,23 @@ Y a2; int a3; \end{codeblock} - declares three variables of three different types. This implies that - \begin{codeblock} a1 = a2; // error: \tcode{Y} assigned to \tcode{X} a1 = a3; // error: \tcode{int} assigned to \tcode{X} \end{codeblock} - are type mismatches, and that - \begin{codeblock} int f(X); int f(Y); \end{codeblock} - \indextext{overloading}% declare an overloaded\iref{over} function \tcode{f()} and not simply a single function \tcode{f()} twice. For the same reason, - \begin{codeblock} struct S { int a; }; struct S { int a; }; // error, double definition \end{codeblock} - is ill-formed because it defines \tcode{S} twice. \end{example} @@ -392,7 +395,6 @@ name is in scope the elaborated name will refer to it. \end{note} \begin{example} - \begin{codeblock} struct s { int a; }; @@ -409,11 +411,9 @@ The declaration of a class name takes effect immediately after the \grammarterm{identifier} is seen in the class definition or \grammarterm{elaborated-type-specifier}. For example, - \begin{codeblock} class A * A; \end{codeblock} - first specifies \tcode{A} to be the name of a class and then redefines it as the name of a pointer to an object of that class. This means that the elaborated form \tcode{class} \tcode{A} must be used to refer to the @@ -538,8 +538,10 @@ Any other data member or member function is a \defn{non-static member} (a \defn{non-static data member} or \defn{non-static member function}~(\ref{class.mfct.non-static}), respectively). -\begin{note} A non-static data member of non-reference -type is a member subobject of a class object\iref{intro.object}.\end{note} +\begin{note} +A non-static data member of non-reference +type is a member subobject of a class object\iref{intro.object}. +\end{note} \pnum A member shall not be declared twice in the @@ -607,12 +609,12 @@ int a; const int b = 0; struct S { - int x1 : 8 = 42; // OK, \tcode{"= 42"} is \grammarterm{brace-or-equal-initializer} - int x2 : 8 { 42 }; // OK, \tcode{"\{ 42 \}"} is \grammarterm{brace-or-equal-initializer} - int y1 : true ? 8 : a = 42; // OK, \grammarterm{brace-or-equal-initializer} is absent - int y2 : true ? 8 : b = 42; // error: cannot assign to \tcode{const int} - int y3 : (true ? 8 : b) = 42; // OK, \tcode{"= 42"} is \grammarterm{brace-or-equal-initializer} - int z : 1 || new int { 0 }; // OK, \grammarterm{brace-or-equal-initializer} is absent + int x1 : 8 = 42; // OK, \tcode{"= 42"} is \grammarterm{brace-or-equal-initializer} + int x2 : 8 { 42 }; // OK, \tcode{"\{ 42 \}"} is \grammarterm{brace-or-equal-initializer} + int y1 : true ? 8 : a = 42; // OK, \grammarterm{brace-or-equal-initializer} is absent + int y2 : true ? 8 : b = 42; // error: cannot assign to \tcode{const int} + int y3 : (true ? 8 : b) = 42; // OK, \tcode{"= 42"} is \grammarterm{brace-or-equal-initializer} + int z : 1 || new int { 0 }; // OK, \grammarterm{brace-or-equal-initializer} is absent }; \end{codeblock} \end{example} @@ -686,7 +688,6 @@ \pnum \begin{example} A simple example of a class definition is - \begin{codeblock} struct tnode { char tword[20]; @@ -695,15 +696,12 @@ tnode* right; }; \end{codeblock} - which contains an array of twenty characters, an integer, and two pointers to objects of the same type. Once this definition has been given, the declaration - \begin{codeblock} tnode s, *sp; \end{codeblock} - declares \tcode{s} to be a \tcode{tnode} and \tcode{sp} to be a pointer to a \tcode{tnode}. With these declarations, \tcode{sp->count} refers to the \tcode{count} member of the object to which \tcode{sp} points; @@ -733,7 +731,6 @@ \pnum If \tcode{T} is the name of a class, then each of the following shall have a name different from \tcode{T}: - \begin{itemize} \item every static data member of class \tcode{T}; @@ -741,7 +738,8 @@ \begin{note} This restriction does not apply to constructors, which do not have names\iref{class.ctor} -\end{note}; +\end{note}% +; \item every member of class \tcode{T} that is itself a type; @@ -772,11 +770,11 @@ or neither is a bit-field. \begin{example} \begin{codeblock} - struct A { int a; char b; }; - struct B { const int b1; volatile char b2; }; - struct C { int c; unsigned : 0; char b; }; - struct D { int d; char b : 4; }; - struct E { unsigned int e; char b; }; +struct A { int a; char b; }; +struct B { const int b1; volatile char b2; }; +struct C { int c; unsigned : 0; char b; }; +struct D { int d; char b : 4; }; +struct E { unsigned int e; char b; }; \end{codeblock} The common initial sequence of \tcode{A} and \tcode{B} comprises all members of either class. The common initial sequence of \tcode{A} and \tcode{C} and @@ -881,7 +879,6 @@ as described in~\ref{basic.lookup}. \end{note} \begin{example} - \begin{codeblock} struct X { typedef int T; @@ -986,7 +983,6 @@ These transformations do not apply in the template definition context\iref{temp.dep.type}. \begin{example} - \begin{codeblock} struct tnode { char tword[20]; @@ -1018,7 +1014,7 @@ \tcode{n1.tword}, and in the call \tcode{n2.set("def",0,0)}, it refers to \tcode{n2.tword}. The functions \tcode{strlen}, \tcode{perror}, and \tcode{strcpy} are not members of the class \tcode{tnode} and should be -declared elsewhere.\footnote{See, for example, \tcode{}\iref{c.strings}.} +declared elsewhere.\footnote{See, for example, \libheaderref{cstring}.} \end{example} \pnum @@ -1035,7 +1031,6 @@ member function declared \tcode{const} \tcode{volatile} is a \defn{const volatile member function}. \begin{example} - \begin{codeblock} struct X { void g() const; @@ -1072,10 +1067,11 @@ \tcode{this} is \tcode{volatile} \tcode{X*}, and if the member function is declared \tcode{const} \tcode{volatile}, the type of \tcode{this} is \tcode{const} \tcode{volatile} \tcode{X*}. -\begin{note} Thus in a const member function, the object for which the function is -called is accessed through a const access path. \end{note} +\begin{note} +Thus in a const member function, the object for which the function is +called is accessed through a const access path. +\end{note} \begin{example} - \begin{codeblock} struct s { int a; @@ -1104,7 +1100,6 @@ object-expression\iref{expr.ref} only if the object-expression is as cv-qualified or less-cv-qualified than the member function. \begin{example} - \begin{codeblock} void k(s& x, const s& y) { x.f(); @@ -1152,7 +1147,8 @@ copy assignment operators, move assignment operators\iref{class.copy.assign}, and prospective destructors\iref{class.dtor} are \term{special member functions}. -\begin{note} The implementation will implicitly declare these member functions for some class +\begin{note} +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{basic.def.odr} or @@ -1227,16 +1223,13 @@ A \defn{constructor} is introduced by a declaration whose \grammarterm{declarator} is a function declarator\iref{dcl.fct} of the form - \begin{ncbnf} ptr-declarator \terminal{(} parameter-declaration-clause \terminal{)} \opt{noexcept-specifier} \opt{attribute-specifier-seq} \end{ncbnf} - where the \grammarterm{ptr-declarator} consists solely of an \grammarterm{id-expression}, an optional \grammarterm{attribute-specifier-seq}, and optional surrounding parentheses, and the \grammarterm{id-expression} has one of the following forms: - \begin{itemize} \item in a \grammarterm{member-declaration} that belongs to the @@ -1255,7 +1248,6 @@ \grammarterm{decl-specifier-seq} shall be \tcode{friend}, \tcode{inline}, \tcode{constexpr}, or an \grammarterm{explicit-specifier}. \begin{example} - \begin{codeblock} struct S { S(); // declares the constructor @@ -1352,7 +1344,6 @@ \pnum A defaulted default constructor for class \tcode{X} is defined as deleted if: - \begin{itemize} \item \tcode{X} is a union that has a variant member with a non-trivial default constructor and @@ -1368,7 +1359,7 @@ \item any non-variant non-static data member of const-qualified type (or array thereof) with no \grammarterm{brace-or-equal-initializer} -is not const-default-constructible\iref{dcl.init}. +is not const-default-constructible\iref{dcl.init}, \item \tcode{X} is a union and all of its variant members are of const-qualified type (or array thereof), @@ -1393,7 +1384,6 @@ A default constructor is \defnx{trivial}{constructor!default!trivial} if it is not user-provided and if: - \begin{itemize} \item its class has no virtual functions\iref{class.virtual} and no virtual base @@ -1435,7 +1425,7 @@ Before the defaulted default constructor for a class is implicitly defined, all the non-user-provided default constructors for its base classes and -its non-static data members shall have been implicitly defined. +its non-static data members are implicitly defined. \begin{note} An implicitly-declared default constructor has an exception specification\iref{except.spec}. @@ -1510,7 +1500,8 @@ \tcode{volatile X\&\&}, or \tcode{const volatile X\&\&}, and either there are no other parameters or else all other parameters have default arguments\iref{dcl.fct.default}. -\begin{example} \tcode{Y::Y(Y\&\&)} is a move constructor. +\begin{example} +\tcode{Y::Y(Y\&\&)} is a move constructor. \begin{codeblock} struct Y { Y(const Y&); @@ -1526,7 +1517,6 @@ \begin{note} All forms of copy/move constructor may be declared for a class. \begin{example} - \begin{codeblock} struct X { X(const X&); @@ -1555,7 +1545,6 @@ cv-qualified) \tcode{X}. \begin{example} - \begin{codeblock} struct X { X(); // default constructor @@ -1606,11 +1595,9 @@ The implicitly-declared copy constructor for a class \tcode{X} will have the form - \begin{codeblock} X::X(const X&) \end{codeblock} - if each potentially constructed subobject of a class type \tcode{M} (or array thereof) @@ -1626,7 +1613,6 @@ \tcode{volatile} lvalue; see~\ref{diff.class}.} Otherwise, the implicitly-declared copy constructor will have the form - \begin{codeblock} X::X(X&) \end{codeblock} @@ -1636,7 +1622,6 @@ If the definition of a class \tcode{X} does not explicitly declare a move constructor, a non-explicit one will be implicitly declared as defaulted if and only if - \begin{itemize} \item \tcode{X} does not have a user-declared copy constructor, @@ -1651,9 +1636,11 @@ \tcode{X} does not have a user-declared destructor. \end{itemize} -\begin{note} When the move constructor is not implicitly declared or explicitly supplied, +\begin{note} +When the move constructor is not implicitly declared or explicitly supplied, expressions that otherwise would have invoked the move constructor may instead invoke -a copy constructor. \end{note} +a copy constructor. +\end{note} \pnum The implicitly-declared move constructor for class \tcode{X} will have the form @@ -1700,7 +1687,6 @@ is trivial if it is not user-provided and if: - \begin{itemize} \item class @@ -1745,7 +1731,7 @@ implicitly defined, all non-user-provided copy/move constructors for its potentially constructed subobjects -shall have been implicitly defined. +are implicitly defined. \begin{note} An implicitly-declared copy/move constructor has an implied exception specification\iref{except.spec}. @@ -1755,14 +1741,15 @@ The implicitly-defined copy/move constructor for a non-union class \tcode{X} performs a memberwise copy/move of its bases and members. -\begin{note} Default member initializers of non-static data members are ignored. See also the example in~\ref{class.base.init}. \end{note} +\begin{note} +Default member initializers of non-static data members are ignored. See also the example in~\ref{class.base.init}. +\end{note} The order of initialization is the same as the order of initialization of bases and members in a user-defined constructor (see~\ref{class.base.init}). Let \tcode{x} be either the parameter of the constructor or, for the move constructor, an xvalue referring to the parameter. Each base or non-static data member is copied/moved in the manner appropriate to its type: - \begin{itemize} \item if the member is an array, each element is @@ -1823,7 +1810,6 @@ cannot be assigned to an object of type \tcode{X}. \begin{example} - \begin{codeblock} struct X { X(); @@ -1850,13 +1836,10 @@ The implicitly-declared copy assignment operator for a class \tcode{X} will have the form - \begin{codeblock} X& X::operator=(const X&) \end{codeblock} - if - \begin{itemize} \item each direct base class \tcode{B} of \tcode{X} @@ -1874,7 +1857,6 @@ Otherwise, the implicitly-declared copy assignment operator will have the form - \begin{codeblock} X& X::operator=(X&) \end{codeblock} @@ -1883,17 +1865,22 @@ A user-declared move assignment operator \tcode{X::operator=} is a non-static non-template member function of class \tcode{X} with exactly one parameter of type \tcode{X\&\&}, \tcode{const X\&\&}, \tcode{volatile X\&\&}, or -\tcode{const volatile X\&\&}. \begin{note} An overloaded assignment operator must be -declared to have only one parameter; see~\ref{over.ass}. \end{note}{} -\begin{note} More -than one form of move assignment operator may be declared for a class. \end{note} +\tcode{const volatile X\&\&}. +\begin{note} +An overloaded assignment operator must be +declared to have only one parameter; see~\ref{over.ass}. +\end{note} +{} +\begin{note} +More +than one form of move assignment operator may be declared for a class. +\end{note} \pnum \indextext{assignment operator!move!implicitly declared}% If the definition of a class \tcode{X} does not explicitly declare a move assignment operator, one will be implicitly declared as defaulted if and only if - \begin{itemize} \item \tcode{X} does not have a user-declared copy constructor, @@ -1908,14 +1895,14 @@ \tcode{X} does not have a user-declared destructor. \end{itemize} -\begin{example} The class definition +\begin{example} +The class definition \begin{codeblock} struct S { int a; S& operator=(const S&) = default; }; \end{codeblock} - will not have a default move assignment operator implicitly declared because the copy assignment operator has been user-declared. The move assignment operator may be explicitly defaulted. @@ -1996,7 +1983,6 @@ is trivial if it is not user-provided and if: - \begin{itemize} \item class @@ -2013,7 +1999,6 @@ that is of class type (or array thereof), the assignment operator selected to copy/move that member is trivial; \end{itemize} - \indextext{assignment operator!move!non-trivial}% otherwise the copy/move assignment operator is \defnx{non-trivial}{assignment operator!copy!non-trivial}. @@ -2050,7 +2035,7 @@ implicitly defined, all non-user-provided copy/move assignment operators for its direct base classes and -its non-static data members shall have been implicitly defined. +its non-static data members are implicitly defined. \begin{note} An implicitly-declared copy/move assignment operator has an implied exception specification\iref{except.spec}. @@ -2066,7 +2051,6 @@ Let \tcode{x} be either the parameter of the function or, for the move operator, an xvalue referring to the parameter. Each subobject is assigned in the manner appropriate to its type: - \begin{itemize} \item if the subobject is of class type, @@ -2087,7 +2071,6 @@ are assigned more than once by the implicitly-defined copy/move assignment operator. \begin{example} - \begin{codeblock} struct V { }; struct A : virtual V { }; @@ -2115,16 +2098,13 @@ A \defnadj{prospective}{destructor} is introduced by a declaration whose \grammarterm{declarator} is a function declarator\iref{dcl.fct} of the form - \begin{ncbnf} ptr-declarator \terminal{(} parameter-declaration-clause \terminal{)} \opt{noexcept-specifier} \opt{attribute-specifier-seq} \end{ncbnf} - where the \grammarterm{ptr-declarator} consists solely of an \grammarterm{id-expression}, an optional \grammarterm{attribute-specifier-seq}, and optional surrounding parentheses, and the \grammarterm{id-expression} has one of the following forms: - \begin{itemize} \item in a \grammarterm{member-declaration} that belongs to the @@ -2226,7 +2206,6 @@ \pnum A destructor is trivial if it is not user-provided and if: - \begin{itemize} \item the destructor is not \tcode{virtual}, @@ -2257,9 +2236,29 @@ \pnum Before a defaulted destructor for a class is implicitly defined, all the non-user-provided -destructors for its base classes and its non-static data members shall have been +destructors for its base classes and its non-static data members are implicitly defined. +\pnum +\indextext{destructor!virtual}% +\indextext{destructor!pure virtual}% +A prospective destructor can be declared +\tcode{virtual}\iref{class.virtual} +or pure +\tcode{virtual}\iref{class.abstract}. +If the destructor of a class is virtual and +any objects of that class or any derived class are created in the program, +the destructor shall be defined. +If a class has a base class with a virtual destructor, its destructor +(whether user- or implicitly-declared) is virtual. + +\pnum +\begin{note} +\indextext{member function!destructor and}% +Some language constructs have special semantics when used during destruction; +see~\ref{class.cdtor}. +\end{note} + \pnum \indextext{order of execution!destructor}% \indextext{order of execution!base class destructor}% @@ -2292,33 +2291,11 @@ Destructors for elements of an array are called in reverse order of their construction (see~\ref{class.init}). -\pnum -\indextext{destructor!virtual}% -\indextext{destructor!pure virtual}% -A prospective destructor can be declared -\tcode{virtual}\iref{class.virtual} -or pure -\tcode{virtual}\iref{class.abstract}. -If the destructor of a class is virtual and -any objects of that class or any derived class are created in the program, -the destructor shall be defined. -If a class has a base class with a virtual destructor, its destructor -(whether user- or implicitly-declared) is virtual. - -\pnum -\begin{note} -\indextext{member function!destructor and}% -Some language constructs have special semantics when used during destruction; -see~\ref{class.cdtor}. -\end{note} - \pnum \indextext{destructor!implicit call}% \indextext{destructor!program termination and}% A destructor is invoked implicitly - \begin{itemize} - \item for a constructed object with static storage duration\iref{basic.stc.static} at program termination\iref{basic.start.term}, \item for a constructed object with thread storage duration\iref{basic.stc.thread} at thread exit, @@ -2335,8 +2312,10 @@ \grammarterm{delete-expression}\iref{expr.delete} for a constructed object allocated by a \grammarterm{new-expression}\iref{expr.new}; the context of the invocation is the \grammarterm{delete-expression}. -\begin{note} An array of class type contains several subobjects for each of which -the destructor is invoked. \end{note} +\begin{note} +An array of class type contains several subobjects for each of which +the destructor is invoked. +\end{note} A destructor can also be invoked explicitly. A destructor is \term{potentially invoked} if it is invoked or as specified in~\ref{expr.new}, \ref{dcl.init.aggr}, \ref{class.base.init}, and~\ref{except.throw}. @@ -2369,10 +2348,11 @@ not of a class derived from the destructor's class type (including when the destructor is invoked via a null pointer value), the program has undefined behavior. -\begin{note} Invoking \tcode{delete} on a null pointer does not call the -destructor; see \ref{expr.delete}. \end{note} +\begin{note} +Invoking \tcode{delete} on a null pointer does not call the +destructor; see \ref{expr.delete}. +\end{note} \begin{example} - \begin{codeblock} struct B { virtual ~B() { } @@ -2472,7 +2452,8 @@ \defnx{user-defined conversions}{conversion!user-defined} and are used for implicit type conversions\iref{conv}, for initialization\iref{dcl.init}, -and for explicit type conversions~(\ref{expr.cast}, \ref{expr.static.cast}). +and for explicit type conversions~(\ref{expr.type.conv}, \ref{expr.cast}, +\ref{expr.static.cast}). \pnum User-defined conversions are applied only where they are unambiguous~(\ref{class.member.lookup}, \ref{class.conv.fct}). @@ -2540,7 +2521,6 @@ Such a constructor is called a \defnadj{converting}{constructor}. \begin{example} - \indextext{Jessie}% \begin{codeblock} struct X { @@ -2605,7 +2585,6 @@ \pnum A member function of a class \tcode{X} having no parameters with a name of the form - \begin{bnf} \nontermdef{conversion-function-id}\br \keyword{operator} conversion-type-id @@ -2620,7 +2599,6 @@ \nontermdef{conversion-declarator}\br ptr-operator \opt{conversion-declarator} \end{bnf} - specifies a conversion from \tcode{X} to the type specified by the @@ -2744,7 +2722,6 @@ referred to using the class member access syntax, in which case the object expression is evaluated. \begin{example} - \begin{codeblock} struct process { static void reschedule(); @@ -2766,7 +2743,6 @@ \grammarterm{nested-name-specifier} of the \grammarterm{qualified-id} naming the class scope from which the static member is referenced. \begin{example} - \begin{codeblock} int g(); struct X { @@ -2852,7 +2828,6 @@ static data member is in the scope of its class\iref{basic.scope.class}. \begin{example} - \begin{codeblock} class process { static process* run_chain; @@ -2927,11 +2902,9 @@ \pnum A \grammarterm{member-declarator} of the form - \begin{ncsimplebnf} \opt{identifier} \opt{attribute-specifier-seq} \terminal{:} constant-expression \opt{brace-or-equal-initializer} \end{ncsimplebnf} - \indextext{\idxcode{:}!bit-field declaration}% \indextext{declaration!bit-field}% specifies a bit-field. @@ -3007,7 +2980,6 @@ enough to hold all the values of that enumeration type\iref{dcl.enum}, the original value and the value of the bit-field compare equal. \begin{example} - \begin{codeblock} enum BOOL { FALSE=0, TRUE=1 }; struct A { @@ -3127,7 +3099,7 @@ X::Y d; // OK X::I e; // OK \end{codeblock} -\end{example}% +\end{example} \indextext{class|)} \rSec1[class.union]{Unions}% @@ -3141,7 +3113,9 @@ At most one of the non-static data members of an object of union type can be active at any time, that is, the value of at most one of the non-static data members can be -stored in a union at any time. \begin{note} One special guarantee is made in order to +stored in a union at any time. +\begin{note} +One special guarantee is made in order to simplify the use of unions: If a standard-layout union contains several standard-layout structs that share a common initial sequence\iref{class.mem}, and if a non-static data member of an object of this standard-layout union type @@ -3173,17 +3147,20 @@ \indextext{restriction!\idxcode{union}}% If a union contains a non-static data member of reference type the program is ill-formed. -\begin{note} Absent default member initializers\iref{class.mem}, +\begin{note} +Absent default member initializers\iref{class.mem}, if any non-static data member of a union has a non-trivial default constructor\iref{class.default.ctor}, copy constructor, move constructor\iref{class.copy.ctor}, copy assignment operator, move assignment operator\iref{class.copy.assign}, or destructor\iref{class.dtor}, the corresponding member function of the union must be user-provided or it will -be implicitly deleted\iref{dcl.fct.def.delete} for the union. \end{note} +be implicitly deleted\iref{dcl.fct.def.delete} for the union. +\end{note} \pnum -\begin{example} Consider the following union: +\begin{example} +Consider the following union: \begin{codeblock} union U { @@ -3198,7 +3175,8 @@ copy/move constructor, copy/move assignment operator, and destructor. To use \tcode{U}, some or all of these member functions -must be user-provided.\end{example} +must be user-provided. +\end{example} \pnum When the left operand of an assignment operator @@ -3268,8 +3246,10 @@ \end{example} \pnum -\begin{note} In general, one must use explicit destructor calls and placement -\grammarterm{new-expression} to change the active member of a union. \end{note} +\begin{note} +In general, one must use explicit destructor calls and placement +\grammarterm{new-expression} to change the active member of a union. +\end{note} \begin{example} Consider an object \tcode{u} of a \tcode{union} type \tcode{U} having non-static data members \tcode{m} of type \tcode{M} and \tcode{n} of type \tcode{N}. If \tcode{M} has a non-trivial @@ -3288,11 +3268,9 @@ \pnum A union of the form - \begin{ncsimplebnf} \keyword{union} \terminal{\{} member-specification \terminal{\}} \terminal{;} \end{ncsimplebnf} - is called an \defn{anonymous union}; it defines an unnamed type and an unnamed object of that type called an \defn{anonymous union object}. Each \grammarterm{member-declaration} in the \grammarterm{member-specification} @@ -3309,7 +3287,6 @@ been defined in the scope in which the anonymous union is declared. \indextext{initialization!\idxcode{union}}% \begin{example} - \begin{codeblock} void f() { union { int a; const char* p; }; @@ -3339,7 +3316,6 @@ \pnum A union for which objects, pointers, or references are declared is not an anonymous union. \begin{example} - \begin{codeblock} void f() { union { int aa; char* p; } obj, *ptr = &obj; @@ -3773,7 +3749,9 @@ semantics).} \begin{note} Virtual functions support dynamic binding and object-oriented -programming. \end{note} A class that declares or inherits a virtual function is +programming. +\end{note} +A class that declares or inherits a virtual function is called a \defnadj{polymorphic}{class}.\footnote{If all virtual functions are immediate functions, the class is still polymorphic even though @@ -3813,8 +3791,8 @@ void foo() { C c; - c.f(); // calls \tcode{B::f}, the final overrider - c.C::f(); // calls \tcode{A::f} because of the using-declaration + c.f(); // calls \tcode{B::f}, the final overrider + c.C::f(); // calls \tcode{A::f} because of the using-declaration } \end{codeblock} \end{example} @@ -3824,8 +3802,8 @@ struct A { virtual void f(); }; struct B : A { }; struct C : A { void f(); }; -struct D : B, C { }; // OK: \tcode{A::f} and \tcode{C::f} are the final overriders - // for the \tcode{B} and \tcode{C} subobjects, respectively +struct D : B, C { }; // OK: \tcode{A::f} and \tcode{C::f} are the final overriders + // for the \tcode{B} and \tcode{C} subobjects, respectively \end{codeblock} \end{example} @@ -3856,29 +3834,31 @@ \pnum If a virtual function \tcode{f} in some class \tcode{B} is marked with the \grammarterm{virt-specifier} \tcode{final} and in a class \tcode{D} derived from \tcode{B} -a function \tcode{D::f} overrides \tcode{B::f}, the program is ill-formed. \begin{example} +a function \tcode{D::f} overrides \tcode{B::f}, the program is ill-formed. +\begin{example} \begin{codeblock} struct B { virtual void f() const final; }; struct D : B { - void f() const; // error: \tcode{D::f} attempts to override \tcode{final} \tcode{B::f} + void f() const; // error: \tcode{D::f} attempts to override \tcode{final} \tcode{B::f} }; \end{codeblock} \end{example} \pnum If a virtual function is marked with the \grammarterm{virt-specifier} \tcode{override} and -does not override a member function of a base class, the program is ill-formed. \begin{example} +does not override a member function of a base class, the program is ill-formed. +\begin{example} \begin{codeblock} struct B { virtual void f(int); }; struct D : B { - virtual void f(long) override; // error: wrong signature overriding \tcode{B::f} - virtual void f(int) override; // OK + virtual void f(long) override; // error: wrong signature overriding \tcode{B::f} + virtual void f(int) override; // OK }; \end{codeblock} \end{example} @@ -3888,7 +3868,7 @@ \begin{example} \begin{codeblock} struct A { - virtual void f() requires true; // error: virtual function cannot be constrained\iref{temp.constr.decl} + virtual void f() requires true; // error: virtual function cannot be constrained\iref{temp.constr.decl} }; \end{codeblock} \end{example} @@ -4162,7 +4142,7 @@ \end{example} \begin{note} A function declaration cannot provide both a \grammarterm{pure-specifier} -and a definition +and a definition. \end{note} \begin{example} \begin{codeblock} @@ -4460,7 +4440,8 @@ \begin{note} Even if the result of name lookup is unambiguous, use of a name found in multiple subobjects might still be -ambiguous~(\ref{conv.mem}, \ref{expr.ref}, \ref{class.access.base}).\end{note} +ambiguous~(\ref{conv.mem}, \ref{expr.ref}, \ref{class.access.base}). +\end{note} \begin{example} \begin{codeblock} struct B1 { @@ -4485,7 +4466,8 @@ int D::* mpD = &D::i; // Ambiguous conversion } }; -\end{codeblock}\end{example} +\end{codeblock} +\end{example} \rSec1[class.access]{Member access control}% \indextext{access control|(} @@ -4535,7 +4517,6 @@ \tcode{struct} or \tcode{union} are public by default. \begin{example} - \begin{codeblock} class X { int a; // \tcode{X::a} is private by default @@ -4597,8 +4578,10 @@ entity, including parts of the declaration preceding the name of the entity being declared and, if the entity is a class, the definitions of members of the class appearing outside the class's \grammarterm{member-specification}{.} -\begin{note} This access also applies to implicit references to constructors, -conversion functions, and destructors. \end{note} +\begin{note} +This access also applies to implicit references to constructors, +conversion functions, and destructors. +\end{note} \pnum \begin{example} @@ -4659,7 +4642,8 @@ \pnum The names in a default \grammarterm{template-argument}\iref{temp.param} have their access checked in the context in which they appear rather than at any -points of use of the default \grammarterm{template-argument}. \begin{example} +points of use of the default \grammarterm{template-argument}. +\begin{example} \begin{codeblock} class B { }; template class C { @@ -4693,7 +4677,6 @@ \grammarterm{access-specifier} is encountered. \begin{example} - \begin{codeblock} class X { int a; // \tcode{X::a} is private by default: \tcode{class} used @@ -4707,7 +4690,6 @@ \pnum Any number of access specifiers is allowed and no particular order is required. \begin{example} - \begin{codeblock} struct S { int a; // \tcode{S::a} is public by default: \tcode{struct} used @@ -4722,22 +4704,23 @@ \end{example} \pnum -\begin{note} The effect of access control on the order of allocation -of data members is described in~\ref{class.mem}.\end{note} +\begin{note} +The effect of access control on the order of allocation +of data members is described in~\ref{class.mem}. +\end{note} \pnum When a member is redeclared within its class definition, the access specified at its redeclaration shall be the same as at its initial declaration. \begin{example} - \begin{codeblock} struct S { class A; enum E : int; private: - class A { }; // error: cannot change access - enum E: int { e0 }; // error: cannot change access + class A { }; // error: cannot change access + enum E: int { e0 }; // error: cannot change access }; \end{codeblock} \end{example} @@ -4805,7 +4788,6 @@ defined with the \grammarterm{class-key} \tcode{class}. \begin{example} - \begin{codeblock} class B { @\commentellip@ }; class D1 : private B { @\commentellip@ }; @@ -4840,7 +4822,9 @@ \begin{note} A member of a private base class might be inaccessible as an inherited member name, but accessible directly. -Because of the rules on pointer conversions\iref{conv.ptr} and explicit casts\iref{expr.cast}, a conversion from a pointer to a derived class to a pointer +Because of the rules on pointer conversions\iref{conv.ptr} and +explicit casts~(\ref{expr.type.conv}, \ref{expr.static.cast}, \ref{expr.cast}), +a conversion from a pointer to a derived class to a pointer to an inaccessible base class might be ill-formed if an implicit conversion is used, but well-formed if an explicit cast is used. For example, @@ -5030,7 +5014,6 @@ when named in class \tcode{B}. \begin{example} - \begin{codeblock} class B; class A { @@ -5099,8 +5082,8 @@ Declaring a class to be a friend implies that the names of private and protected members from the class granting friendship can be accessed in the \grammarterm{base-specifier}{s} and member declarations of the befriended -class. \begin{example} - +class. +\begin{example} \begin{codeblock} class A { class B { }; @@ -5116,7 +5099,6 @@ \end{codeblock} \end{example} \begin{example} - \begin{codeblock} class X { enum { a=100 }; @@ -5133,7 +5115,8 @@ \end{codeblock} \end{example} -A class shall not be defined in a friend declaration. \begin{example} +A class shall not be defined in a friend declaration. +\begin{example} \begin{codeblock} class A { friend class B { }; // error: cannot define class in friend declaration @@ -5151,13 +5134,16 @@ \keyword{friend} typename-specifier \terminal{;} \end{ncsimplebnf} -\begin{note} A friend declaration may be the +\begin{note} +A friend declaration may be the \grammarterm{declaration} in a \grammarterm{template-declaration} -(\ref{temp}, \ref{temp.friend}).\end{note} If the +(\ref{temp}, \ref{temp.friend}). +\end{note} +If the type specifier in a \tcode{friend} declaration designates a (possibly cv-qualified) class type, that class is declared as a friend; otherwise, the -friend declaration is ignored. \begin{example} - +friend declaration is ignored. +\begin{example} \begin{codeblock} class C; typedef C Ct; @@ -5199,7 +5185,6 @@ \tcode{Y}. \indextext{member function!friend}% \begin{example} - \begin{codeblock} class Y { friend char* X::foo(int); @@ -5215,7 +5200,6 @@ class is a non-local class\iref{class.local}, the function name is unqualified, and the function has namespace scope. \begin{example} - \begin{codeblock} class M { friend void f() { } // definition of global \tcode{f}, a friend of \tcode{M}, @@ -5250,7 +5234,6 @@ \indextext{friend!inheritance and}% Friendship is neither inherited nor transitive. \begin{example} - \begin{codeblock} class A { friend class B; @@ -5291,7 +5274,6 @@ until a matching declaration is provided in the innermost enclosing non-class scope. \begin{example} - \begin{codeblock} class X; void a(); @@ -5329,7 +5311,6 @@ expression\iref{expr.ref}. In this case, the class of the object expression shall be \tcode{C} or a class derived from \tcode{C}. \begin{example} - \begin{codeblock} class B { protected: @@ -5382,7 +5363,6 @@ The access rules\iref{class.access} for a virtual function are determined by its declaration and are not affected by the rules for a function that later overrides it. \begin{example} - \begin{codeblock} class B { public: @@ -5421,7 +5401,6 @@ If a name can be reached by several paths through a multiple inheritance graph, the access is that of the path that gives most access. \begin{example} - \begin{codeblock} class W { public: void f(); }; class A : private virtual W { }; @@ -5467,7 +5446,7 @@ } }; \end{codeblock} -\end{example}% +\end{example} \indextext{access control|)} \rSec1[class.init]{Initialization}% @@ -5547,8 +5526,8 @@ \indextext{constructor!array of class objects and}% An object of class type can also be initialized by a \grammarterm{braced-init-list}. List-initialization semantics apply; -see~\ref{dcl.init} and~\ref{dcl.init.list}. \begin{example} - +see~\ref{dcl.init} and~\ref{dcl.init.list}. +\begin{example} \begin{codeblock} complex v[6] = { 1, complex(1,2), complex(), 2 }; \end{codeblock} @@ -5676,7 +5655,6 @@ \grammarterm{mem-initializer-list} can initialize a base class using any \grammarterm{class-or-decltype} that denotes that base class type. \begin{example} - \begin{codeblock} struct A { A(); }; typedef A global_A; @@ -5694,7 +5672,6 @@ \grammarterm{mem-initializer} is ill-formed. \begin{example} - \begin{codeblock} struct A { A(); }; struct B: public virtual A { }; @@ -5728,8 +5705,8 @@ The target constructor is selected by overload resolution. Once the target constructor returns, the body of the delegating constructor is executed. If a constructor delegates to itself directly or indirectly, -the program is ill-formed, no diagnostic required. \begin{example} - +the program is ill-formed, no diagnostic required. +\begin{example} \begin{codeblock} struct C { C( int ) { } // \#1: non-delegating constructor @@ -5800,11 +5777,9 @@ because the constructor has no \grammarterm{ctor-initializer}), then - \begin{itemize} \item if the entity is a non-static data member that has a default member initializer\iref{class.mem} and either - \begin{itemize} \item the constructor's class is a union\iref{class.union}, and no other variant member of that union is designated by a \grammarterm{mem-initializer-id} or @@ -5813,7 +5788,6 @@ anonymous union, no other member of that union is designated by a \grammarterm{mem-initializer-id}, \end{itemize} - the entity is initialized from its default member initializer as specified in~\ref{dcl.init}; @@ -5822,9 +5796,11 @@ \item otherwise, the entity is default-initialized\iref{dcl.init}. \end{itemize} -\begin{note} An abstract class\iref{class.abstract} is never a most derived +\begin{note} +An abstract class\iref{class.abstract} is never a most derived class, thus its constructors never initialize virtual base classes, therefore the -corresponding \grammarterm{mem-initializer}{s} may be omitted. \end{note} +corresponding \grammarterm{mem-initializer}{s} may be omitted. +\end{note} An attempt to initialize more than one non-static data member of a union renders the program ill-formed. \indextext{initialization!const member}% @@ -5867,7 +5843,8 @@ and a \grammarterm{mem-initializer}, the initialization specified by the \grammarterm{mem-initializer} is performed, and the non-static data member's default member initializer is ignored. -\begin{example} Given +\begin{example} +Given % The comment below is misrendered with an overly large space before 'effects' % if left to listings (see NB US-26 (C++17 CD)) (possibly due to the ff % ligature), so we fix it up manually. @@ -5878,7 +5855,6 @@ // ... }; \end{codeblock} - the \tcode{A(int)} constructor will simply initialize \tcode{i} to the value of \tcode{arg}, and the \indextext{side effects}% @@ -5904,8 +5880,10 @@ \pnum In a non-delegating constructor, the destructor for each potentially constructed subobject of class type is potentially invoked\iref{class.dtor}. -\begin{note} This provision ensures that destructors can be called for fully-constructed -subobjects in case an exception is thrown\iref{except.ctor}. \end{note} +\begin{note} +This provision ensures that destructors can be called for fully-constructed +subobjects in case an exception is thrown\iref{except.ctor}. +\end{note} \pnum In a non-delegating constructor, initialization @@ -5988,7 +5966,6 @@ \grammarterm{mem-initializer} is specified. \begin{example} - \begin{codeblock} class X { int a; @@ -6094,8 +6071,8 @@ A \grammarterm{mem-initializer} followed by an ellipsis is a pack expansion\iref{temp.variadic} that initializes the base classes specified by a pack expansion in the \grammarterm{base-specifier-list} -for the class. \begin{example} - +for the class. +\begin{example} \begin{codeblock} template class X : public Mixins... { @@ -6264,7 +6241,6 @@ \tcode{this} pointer, the value of the object or subobject thus obtained is unspecified. \begin{example} - \begin{codeblock} struct C; void no_opt(C*); @@ -6359,7 +6335,6 @@ but not \tcode{x} or one of its base class subobjects, the behavior is undefined. \begin{example} - \begin{codeblock} struct V { virtual void f(); @@ -6500,7 +6475,6 @@ is permitted in the following circumstances (which may be combined to eliminate multiple copies): - \begin{itemize} \item in a \tcode{return} statement in a function with a class return type, when the \grammarterm{expression} is the name of a non-volatile @@ -6533,8 +6507,10 @@ object if the meaning of the program will be unchanged except for the execution of constructors and destructors for the object declared by the \grammarterm{exception-declaration}. -\begin{note} There cannot be a move from the exception object because it is -always an lvalue. \end{note} +\begin{note} +There cannot be a move from the exception object because it is +always an lvalue. +\end{note} \end{itemize} Copy elision is not permitted where an expression is evaluated in a context @@ -6569,12 +6545,12 @@ }; constexpr A g() { - A a; - return a; + A loc; + return loc; } constexpr A a; // well-formed, \tcode{a.p} points to \tcode{a} -constexpr A b = g(); // well-formed, \tcode{b.p} points to \tcode{b} +constexpr A b = g(); // error: \tcode{b.p} would be dangling\iref{expr.const} void h() { A c = g(); // well-formed, \tcode{c.p} may point to \tcode{c} or to an ephemeral temporary @@ -6852,7 +6828,7 @@ \begin{itemize} \item If overload resolution for \tcode{a <=> b} -finds a usable function\iref{over.match}, +results in a usable function\iref{over.match}, \tcode{static_cast(a <=> b)}. \item @@ -6871,7 +6847,7 @@ \item Otherwise, if \tcode{R} is \tcode{weak_ordering}, then \begin{codeblock} -a == b ? weak_ordering::equal : +a == b ? weak_ordering::equivalent : a < b ? weak_ordering::less : weak_ordering::greater \end{codeblock} @@ -6997,7 +6973,6 @@ \pnum The operator function with parameters \tcode{x} and \tcode{y} is defined as deleted if - \begin{itemize} \item overload resolution\iref{over.match}, diff --git a/source/compatibility.tex b/source/compatibility.tex index 69ab2d722c..6805c68a2b 100644 --- a/source/compatibility.tex +++ b/source/compatibility.tex @@ -11,7 +11,8 @@ \rSec2[diff.lex]{\ref{lex}: lexical conventions} \diffref{lex.key} -\change New Keywords\\ +\change +New Keywords\\ New keywords are added to \Cpp{}; see \ref{lex.key}. \rationale @@ -30,7 +31,8 @@ Common. \diffref{lex.ccon} -\change Type of character literal is changed from \tcode{int} to \tcode{char}. +\change +Type of character literal is changed from \tcode{int} to \tcode{char}. \rationale This is needed for improved overloaded function argument type matching. @@ -60,7 +62,8 @@ Programs which depend upon \tcode{sizeof('x')} are probably rare. \diffref{lex.string} -\change String literals made const.\\ +\change +String literals made const.\\ The type of a string literal is changed from ``array of \tcode{char}'' to ``array of \tcode{const char}''. @@ -100,20 +103,18 @@ \rSec2[diff.basic]{\ref{basic}: basics} \diffref{basic.def} -\change \Cpp{} does not have ``tentative definitions'' as in C.\\ +\change +\Cpp{} does not have ``tentative definitions'' as in C.\\ E.g., at file scope, - \begin{codeblock} int i; int i; \end{codeblock} - is valid in C, invalid in \Cpp{}. This makes it impossible to define mutually referential file-local static objects, if initializers are restricted to the syntactic forms of C\@. For example, - \begin{codeblock} struct X { int i; struct X* next; }; @@ -136,7 +137,8 @@ Seldom. \diffref{basic.scope} -\change A \tcode{struct} is a scope in \Cpp{}, not in C. +\change +A \tcode{struct} is a scope in \Cpp{}, not in C. \rationale Class scope is crucial to \Cpp{}, and a struct is a class. \effect @@ -150,7 +152,8 @@ The latter is probably rare. \diffref{basic.link} [also \ref{dcl.type}] -\change A name of file scope that is explicitly declared \tcode{const}, and not explicitly +\change +A name of file scope that is explicitly declared \tcode{const}, and not explicitly declared \tcode{extern}, has internal linkage, while in C it would have external linkage. \rationale Because const objects may be used as values during translation in @@ -166,7 +169,8 @@ Seldom. \diffref{basic.start.main} -\change The \tcode{main} function cannot be called recursively and cannot have its address taken. +\change +The \tcode{main} function cannot be called recursively and cannot have its address taken. \rationale The \tcode{main} function may require special actions. \effect @@ -178,7 +182,8 @@ Seldom. \diffref{basic.types} -\change C allows ``compatible types'' in several places, \Cpp{} does not.\\ +\change +C allows ``compatible types'' in several places, \Cpp{} does not.\\ For example, otherwise-identical \tcode{struct} types with different tag names are ``compatible'' in C but are distinctly different types @@ -201,7 +206,8 @@ \rSec2[diff.expr]{\ref{expr}: expressions} \diffref{conv.ptr} -\change Converting \tcode{void*} to a pointer-to-object type requires casting. +\change +Converting \tcode{void*} to a pointer-to-object type requires casting. \begin{codeblock} char a[10]; @@ -224,7 +230,6 @@ The fix is to add a cast. For example: - \begin{codeblock} char* c = (char*) b; \end{codeblock} @@ -236,7 +241,8 @@ if the cast is not used. \diffref{expr.call} -\change Implicit declaration of functions is not allowed. +\change +Implicit declaration of functions is not allowed. \rationale The type-safe nature of \Cpp{}. \effect @@ -252,13 +258,17 @@ \diffref{expr.post.incr,expr.pre.incr} \change Decrement operator is not allowed with \tcode{bool} operand. -\rationale Feature with surprising semantics. -\effect A valid ISO C expression utilizing the decrement operator on -a \tcode{bool} lvalue (for instance, via the C typedef in \tcode{}) +\rationale +Feature with surprising semantics. +\effect +A valid ISO C expression utilizing the decrement operator on +a \tcode{bool} lvalue +(for instance, via the C typedef in \libdeprheaderref{stdbool.h}) is ill-formed in this International Standard. \diffref{expr.sizeof,expr.cast} -\change Types must be defined in declarations, not in expressions.\\ +\change +Types must be defined in declarations, not in expressions.\\ In C, a sizeof expression or cast expression may define a new type. For example, \begin{codeblock} @@ -279,7 +289,8 @@ \indextext{conversion!lvalue-to-rvalue}% \indextext{rvalue!lvalue conversion to}% \indextext{lvalue}% -\change The result of a conditional expression, an assignment expression, or a comma expression may be an lvalue. +\change +The result of a conditional expression, an assignment expression, or a comma expression may be an lvalue. \rationale \Cpp{} is an object-oriented language, placing relatively more emphasis on lvalues. For example, function calls may @@ -307,7 +318,8 @@ \rSec2[diff.stat]{\ref{stmt.stmt}: statements} \diffref{stmt.switch,stmt.goto} -\change It is now invalid to jump past a declaration with explicit or implicit initializer (except across entire block not entered). +\change +It is now invalid to jump past a declaration with explicit or implicit initializer (except across entire block not entered). \rationale Constructors used in initializers may allocate resources which need to be de-allocated upon leaving the @@ -327,7 +339,8 @@ Seldom. \diffref{stmt.return} -\change It is now invalid to return (explicitly or implicitly) from a function which is +\change +It is now invalid to return (explicitly or implicitly) from a function which is declared to return a value without actually returning a value. \rationale The caller and callee may assume fairly elaborate @@ -353,12 +366,12 @@ \rSec2[diff.dcl]{\ref{dcl.dcl}: declarations} \diffref{dcl.stc} -\change In \Cpp{}, the \tcode{static} or \tcode{extern} specifiers can only be applied to names of objects or functions.\\ +\change +In \Cpp{}, the \tcode{static} or \tcode{extern} specifiers can only be applied to names of objects or functions.\\ Using these specifiers with type declarations is illegal in \Cpp{}. In C, these specifiers are ignored when used on type declarations. Example: - \begin{codeblock} static struct S { // valid C, invalid in \Cpp{} int i; @@ -380,7 +393,8 @@ Seldom. \diffref{dcl.stc} -\change In \Cpp{}, \tcode{register} is not a storage class specifier. +\change +In \Cpp{}, \tcode{register} is not a storage class specifier. \rationale The storage class specifier had no effect in \Cpp{}. \effect @@ -391,7 +405,8 @@ Common. \diffref{dcl.typedef} -\change A \Cpp{} typedef name must be different from any class type name declared +\change +A \Cpp{} typedef name must be different from any class type name declared in the same scope (except if the typedef is a synonym of the class name with the same name). In C, a typedef name and a struct tag name declared in the same scope can have the same name (because they have different name spaces). @@ -423,7 +438,8 @@ Seldom. \diffref{dcl.type} [see also \ref{basic.link}] -\change Const objects must be initialized in \Cpp{} but can be left uninitialized in C. +\change +Const objects must be initialized in \Cpp{} but can be left uninitialized in C. \rationale A const object cannot be assigned to so it must be initialized to hold a useful value. @@ -435,7 +451,8 @@ Seldom. \diffref{dcl.type} -\change Banning implicit \tcode{int}. +\change +Banning implicit \tcode{int}. In \Cpp{} a \grammarterm{decl-specifier-seq} @@ -477,19 +494,24 @@ \begin{codeblock} void f() { - auto int x; // valid C, invalid \Cpp{} + auto int x; // valid C, invalid \Cpp{} } \end{codeblock} -\rationale Allowing the use of \tcode{auto} to deduce the type +\rationale +Allowing the use of \tcode{auto} to deduce the type of a variable from its initializer results in undesired interpretations of \tcode{auto} as a storage class specifier in certain contexts. -\effect Deletion of semantically well-defined feature. -\difficulty Syntactic transformation. -\howwide Rare. +\effect +Deletion of semantically well-defined feature. +\difficulty +Syntactic transformation. +\howwide +Rare. \diffref{dcl.fct} -\change In \Cpp{}, a function declared with an empty parameter list takes no arguments. +\change +In \Cpp{}, a function declared with an empty parameter list takes no arguments. In C, an empty parameter list means that the number and type of the function arguments are unknown. Example: @@ -516,7 +538,8 @@ Common. \diffref{dcl.fct} [see \ref{expr.sizeof}] -\change In \Cpp{}, types may not be defined in return or parameter types. +\change +In \Cpp{}, types may not be defined in return or parameter types. In C, these type definitions are allowed. Example: @@ -542,7 +565,8 @@ This style of type definition is seen as poor coding style. \diffref{dcl.fct.def} -\change In \Cpp{}, the syntax for function definition excludes the ``old-style'' C function. +\change +In \Cpp{}, the syntax for function definition excludes the ``old-style'' C function. In C, ``old-style'' syntax is allowed, but deprecated as ``obsolescent''. \rationale Prototypes are essential to type safety. @@ -567,7 +591,6 @@ cannot be mixed in the same initializer list. Example: - \begin{codeblock} struct A { int x, y; }; struct B { struct A a; }; @@ -591,13 +614,13 @@ The other features are seldom used. \diffref{dcl.init.string} -\change In \Cpp{}, when initializing an array of character with a string, the number of +\change +In \Cpp{}, when initializing an array of character with a string, the number of characters in the string (including the terminating \tcode{'\textbackslash 0'}) must not exceed the number of elements in the array. In C, an array can be initialized with a string even if the array is not large enough to contain the string-terminating \tcode{'\textbackslash 0'}. Example: - \begin{codeblock} char array[4] = "abcd"; // valid C, invalid \Cpp{} \end{codeblock} @@ -615,7 +638,8 @@ This style of array initialization is seen as poor coding style. \diffref{dcl.enum} -\change \Cpp{} objects of enumeration type can only be assigned values of the same enumeration type. +\change +\Cpp{} objects of enumeration type can only be assigned values of the same enumeration type. In C, objects of enumeration type can be assigned values of any integral type. Example: @@ -636,10 +660,10 @@ Common. \diffref{dcl.enum} -\change In \Cpp{}, the type of an enumerator is its enumeration. In C, the type of an enumerator is \tcode{int}. +\change +In \Cpp{}, the type of an enumerator is its enumeration. In C, the type of an enumerator is \tcode{int}. Example: - \begin{codeblock} enum e { A }; sizeof(A) == sizeof(int) // in C @@ -663,13 +687,13 @@ \rSec2[diff.class]{\ref{class}: classes} \diffref{class.name} [see also \ref{dcl.typedef}] -\change In \Cpp{}, a class declaration introduces the class name into the scope where it is +\change +In \Cpp{}, a class declaration introduces the class name into the scope where it is declared and hides any object, function or other declaration of that name in an enclosing scope. In C, an inner scope declaration of a struct tag name never hides the name of an object or function in an outer scope. Example: - \begin{codeblock} int x[99]; void f() { @@ -702,13 +726,13 @@ Seldom. \diffref{class.copy.ctor} -\change Copying volatile objects. +\change +Copying volatile objects. The implicitly-declared copy constructor and implicitly-declared copy assignment operator cannot make a copy of a volatile lvalue. For example, the following is valid in ISO C: - \begin{codeblock} struct X { int i; }; volatile struct X x1 = {0}; @@ -764,11 +788,11 @@ Seldom. \diffref{class.nest} -\change In \Cpp{}, the name of a nested class is local to its enclosing class. In C +\change +In \Cpp{}, the name of a nested class is local to its enclosing class. In C the name of the nested class belongs to the same scope as the name of the outermost enclosing class. Example: - \begin{codeblock} struct X { struct Y { @\commentellip@ } y; @@ -793,7 +817,6 @@ struct, the struct tag could be declared in the scope of the enclosing struct, before the enclosing struct is defined. Example: - \begin{codeblock} struct Y; // \tcode{struct Y} and \tcode{struct X} are at the same scope struct X { @@ -810,15 +833,15 @@ Seldom. \diffref{class.nested.type} -\change In \Cpp{}, a typedef name may not be redeclared in a class definition after being used in that definition. +\change +In \Cpp{}, a typedef name may not be redeclared in a class definition after being used in that definition. Example: - \begin{codeblock} typedef int I; struct S { I i; - int I; // valid C, invalid \Cpp{} + int I; // valid C, invalid \Cpp{} }; \end{codeblock} \rationale @@ -836,7 +859,8 @@ \rSec2[diff.cpp]{\ref{cpp}: preprocessing directives} \diffref{cpp.predefined} -\change Whether \mname{STDC} is defined and if so, what its value is, are +\change +Whether \mname{STDC} is defined and if so, what its value is, are \impldef{definition and meaning of \mname{STDC}}. \rationale \Cpp{} is not identical to ISO C\@. @@ -863,31 +887,33 @@ \rSec2[diff.cpp03.lex]{\ref{lex}: lexical conventions} \diffref{lex.pptoken} -\change New kinds of string literals. -\rationale Required for new features. +\change +New kinds of string literals. +\rationale +Required for new features. \effect Valid \CppIII{} code may fail to compile or produce different results in this International Standard. Specifically, macros named \tcode{R}, \tcode{u8}, \tcode{u8R}, \tcode{u}, \tcode{uR}, \tcode{U}, \tcode{UR}, or \tcode{LR} will not be expanded when adjacent to a string literal but will be interpreted as part of the string literal. For example: - \begin{codeblock} #define u8 "abc" const char* s = u8"def"; // Previously \tcode{"abcdef"}, now \tcode{"def"} \end{codeblock} \diffref{lex.pptoken} -\change User-defined literal string support. -\rationale Required for new features. +\change +User-defined literal string support. +\rationale +Required for new features. \effect Valid \CppIII{} code may fail to compile or produce different results in this International Standard. For example: - \begin{codeblock} #define _x "there" -"hello"_x // \#1 +"hello"_x // \#1 \end{codeblock} Previously, \#1 would have consisted of two separate preprocessing tokens and @@ -895,8 +921,10 @@ \#1 consists of a single preprocessing token, so the macro is not expanded. \diffref{lex.key} -\change New keywords. -\rationale Required for new features. +\change +New keywords. +\rationale +Required for new features. \effect Added to \tref{lex.key}, the following identifiers are new keywords: \tcode{alignas}, @@ -914,8 +942,10 @@ Standard. \diffref{lex.icon} -\change Type of integer literals. -\rationale C99 compatibility. +\change +Type of integer literals. +\rationale +C99 compatibility. \effect Certain integer literals larger than can be represented by \tcode{long} could change from an unsigned integer type to \tcode{signed long long}. @@ -923,48 +953,55 @@ \rSec2[diff.cpp03.expr]{\ref{expr}: expressions} \diffref{conv.ptr} -\change Only literals are integer null pointer constants. -\rationale Removing surprising interactions with templates and constant +\change +Only literals are integer null pointer constants. +\rationale +Removing surprising interactions with templates and constant expressions. -\effect Valid \CppIII{} code may fail to compile or produce different results in +\effect +Valid \CppIII{} code may fail to compile or produce different results in this International Standard. For example: - \begin{codeblock} -void f(void *); // \#1 -void f(...); // \#2 +void f(void *); // \#1 +void f(...); // \#2 template void g() { - f(0*N); // calls \#2; used to call \#1 + f(0*N); // calls \#2; used to call \#1 } \end{codeblock} \diffref{expr.mul} -\change Specify rounding for results of integer \tcode{/} and \tcode{\%}. -\rationale Increase portability, C99 compatibility. +\change +Specify rounding for results of integer \tcode{/} and \tcode{\%}. +\rationale +Increase portability, C99 compatibility. \effect Valid \CppIII{} code that uses integer division rounds the result toward 0 or toward negative infinity, whereas this International Standard always rounds the result toward 0. \diffref{expr.log.and} -\change \tcode{\&\&} is valid in a \grammarterm{type-name}. -\rationale Required for new features. +\change +\tcode{\&\&} is valid in a \grammarterm{type-name}. +\rationale +Required for new features. \effect Valid \CppIII{} code may fail to compile or produce different results in this International Standard. For example: - \begin{codeblock} -bool b1 = new int && false; // previously \tcode{false}, now ill-formed +bool b1 = new int && false; // previously \tcode{false}, now ill-formed struct S { operator int(); }; -bool b2 = &S::operator int && false; // previously \tcode{false}, now ill-formed +bool b2 = &S::operator int && false; // previously \tcode{false}, now ill-formed \end{codeblock} \rSec2[diff.cpp03.dcl.dcl]{\ref{dcl.dcl}: declarations} \diffref{dcl.spec} -\change Remove \tcode{auto} as a storage class specifier. -\rationale New feature. +\change +Remove \tcode{auto} as a storage class specifier. +\rationale +New feature. \effect Valid \CppIII{} code that uses the keyword \tcode{auto} as a storage class specifier may be invalid in this International Standard. In this International @@ -972,14 +1009,15 @@ from its initializer expression. \diffref{dcl.init.list} -\change Narrowing restrictions in aggregate initializers. -\rationale Catches bugs. +\change +Narrowing restrictions in aggregate initializers. +\rationale +Catches bugs. \effect Valid \CppIII{} code may fail to compile in this International Standard. For example, the following code is valid in \CppIII{} but invalid in this International Standard because \tcode{double} to \tcode{int} is a narrowing conversion: - \begin{codeblock} int x[] = { 2.0 }; \end{codeblock} @@ -987,17 +1025,21 @@ \rSec2[diff.cpp03.class]{\ref{class}: classes} \diffref{class.default.ctor,class.dtor,class.copy.ctor,class.copy.assign} -\change Implicitly-declared special member functions are defined as deleted +\change +Implicitly-declared special member functions are defined as deleted when the implicit definition would have been ill-formed. -\rationale Improves template argument deduction failure. +\rationale +Improves template argument deduction failure. \effect A valid \CppIII{} program that uses one of these special member functions in a context where the definition is not required (e.g., in an expression that is not potentially evaluated) becomes ill-formed. \diffref{class.dtor} -\change User-declared destructors have an implicit exception specification. -\rationale Clarification of destructor requirements. +\change +User-declared destructors have an implicit exception specification. +\rationale +Clarification of destructor requirements. \effect Valid \CppIII{} code may execute differently in this International Standard. In particular, destructors that throw exceptions will call \tcode{std::terminate} @@ -1007,16 +1049,20 @@ \rSec2[diff.cpp03.temp]{\ref{temp}: templates} \diffref{temp.param} -\change Remove \tcode{export}. -\rationale No implementation consensus. +\change +Remove \tcode{export}. +\rationale +No implementation consensus. \effect A valid \CppIII{} declaration containing \tcode{export} is ill-formed in this International Standard. \diffref{temp.arg} -\change Remove whitespace requirement for nested closing template right angle +\change +Remove whitespace requirement for nested closing template right angle brackets. -\rationale Considered a persistent but minor annoyance. Template aliases +\rationale +Considered a persistent but minor annoyance. Template aliases representing non-class types would exacerbate whitespace issues. \effect Change to semantics of well-defined expression. A valid \CppIII{} expression @@ -1033,17 +1079,22 @@ \end{codeblock} \diffref{temp.dep.candidate} -\change Allow dependent calls of functions with internal linkage. -\rationale Overly constrained, simplify overload resolution rules. +\change +Allow dependent calls of functions with internal linkage. +\rationale +Overly constrained, simplify overload resolution rules. \effect A valid \CppIII{} program could get a different result than this International Standard. \rSec2[diff.cpp03.library]{\ref{library}: library introduction} -\pnum\textbf{Affected:} \ref{library} -- \ref{\lastlibchapter} -\change New reserved identifiers. -\rationale Required by new features. +\pnum +\textbf{Affected:} \ref{library} -- \ref{\lastlibchapter} +\change +New reserved identifiers. +\rationale +Required by new features. \effect Valid \CppIII{} code that uses any identifiers added to the \Cpp{} standard library by this International Standard may fail to compile or produce different @@ -1052,57 +1103,66 @@ International Standard. \diffref{headers} -\change New headers. -\rationale New functionality. +\change +New headers. +\rationale +New functionality. \effect The following \Cpp{} headers are new: -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{},\\ -\tcode{}, +\libheaderref{array}, +\libheaderrefx{atomic}{atomics.syn}, +\libheaderrefx{chrono}{time.syn}, +\libdeprheaderref{codecvt}, +\libheaderrefx{condition_variable}{condition.variable.syn}, +\libheaderrefx{forward_list}{forward.list.syn}, +\libheaderref{future}, +\libheaderrefx{initializer_list}{initializer.list.syn}, +\libheaderref{mutex}, +\libheaderrefx{random}{rand.synopsis}, +\libheaderref{ratio}, +\libheaderrefx{regex}{re.syn}, +\libheaderrefx{scoped_allocator}{allocator.adaptor.syn}, +\libheaderrefx{system_error}{system.error.syn}, +\libheaderref{thread}, +\libheaderref{tuple}, +\libheaderrefx{typeindex}{type.index.synopsis}, +\libheaderrefx{type_traits}{meta.type.synop}, +\libheaderrefx{unordered_map}{unord.map.syn}, and -\tcode{}. +\libheaderrefx{unordered_set}{unord.set.syn}. In addition the following C compatibility headers are new: -\tcode{}, -\tcode{}, -\tcode{}, +\libheaderref{cfenv}, +\libheaderref{cinttypes}, +\libheaderref{cstdint}, and -\tcode{}. +\libheaderref{cuchar}. Valid \CppIII{} code that \tcode{\#include}{s} headers with these names may be invalid in this International Standard. \diffref{swappable.requirements} -\effect Function \tcode{swap} moved to a different header -\rationale Remove dependency on \tcode{} for \tcode{swap}. -\effect Valid \CppIII{} code that has been compiled expecting swap to be in -\tcode{} may have to instead include \tcode{}. +\effect +Function \tcode{swap} moved to a different header +\rationale +Remove dependency on \libheaderref{algorithm} for \tcode{swap}. +\effect +Valid \CppIII{} code that has been compiled expecting swap to be in +\libheaderref{algorithm} may have to instead include \libheaderref{utility}. \diffref{namespace.posix} -\change New reserved namespace. -\rationale New functionality. +\change +New reserved namespace. +\rationale +New functionality. \effect The global namespace \tcode{posix} is now reserved for standardization. Valid \CppIII{} code that uses a top-level namespace \tcode{posix} may be invalid in this International Standard. \diffref{res.on.macro.definitions} -\change Additional restrictions on macro names. -\rationale Avoid hard to diagnose or non-portable constructs. +\change +Additional restrictions on macro names. +\rationale +Avoid hard to diagnose or non-portable constructs. \effect Names of attribute identifiers may not be used as macro names. Valid \CppIII{} code that defines \tcode{override}, \tcode{final}, @@ -1113,9 +1173,11 @@ language support library} \diffref{new.delete.single} -\change \tcode{operator new} may throw exceptions other than +\change +\tcode{operator new} may throw exceptions other than \tcode{std::bad_alloc}. -\rationale Consistent application of \tcode{noexcept}. +\rationale +Consistent application of \tcode{noexcept}. \effect Valid \CppIII{} code that assumes that global \tcode{operator new} only throws \tcode{std::bad_alloc} may execute differently in this International @@ -1128,26 +1190,33 @@ \rSec2[diff.cpp03.diagnostics]{\ref{diagnostics}: diagnostics library} \diffref{errno} -\change Thread-local error numbers. -\rationale Support for new thread facilities. -\effect Valid but implementation-specific \CppIII{} code that relies on +\change +Thread-local error numbers. +\rationale +Support for new thread facilities. +\effect +Valid but implementation-specific \CppIII{} code that relies on \tcode{errno} being the same across threads may change behavior in this International Standard. \rSec2[diff.cpp03.utilities]{\ref{utilities}: general utilities library} \diffref{util.dynamic.safety} -\change Minimal support for garbage-collected regions. -\rationale Required by new feature. +\change +Minimal support for garbage-collected regions. +\rationale +Required by new feature. \effect Valid \CppIII{} code, compiled without traceable pointer support, that interacts with newer \Cpp{} code using regions declared reachable may have different runtime behavior. \diffref{refwrap,arithmetic.operations,comparisons,logical.operations,bitwise.operations} -\change Standard function object types no longer derived from +\change +Standard function object types no longer derived from \tcode{std::unary_function} or \tcode{std::binary_function}. -\rationale Superseded by new feature; \tcode{unary_function} and +\rationale +Superseded by new feature; \tcode{unary_function} and \tcode{binary_function} are no longer defined. \effect Valid \CppIII{} code that depends on function object types being derived from @@ -1157,16 +1226,20 @@ \rSec2[diff.cpp03.strings]{\ref{strings}: strings library} \diffref{string.classes} -\change \tcode{basic_string} requirements no longer allow reference-counted +\change +\tcode{basic_string} requirements no longer allow reference-counted strings. -\rationale Invalidation is subtly different with reference-counted strings. +\rationale +Invalidation is subtly different with reference-counted strings. This change regularizes behavior for this International Standard. \effect Valid \CppIII{} code may execute differently in this International Standard. \diffref{string.require} -\change Loosen \tcode{basic_string} invalidation rules. -\rationale Allow small-string optimization. +\change +Loosen \tcode{basic_string} invalidation rules. +\rationale +Allow small-string optimization. \effect Valid \CppIII{} code may execute differently in this International Standard. Some \tcode{const} member functions, such as \tcode{data} and \tcode{c_str}, @@ -1175,8 +1248,10 @@ \rSec2[diff.cpp03.containers]{\ref{containers}: containers library} \diffref{container.requirements} -\change Complexity of \tcode{size()} member functions now constant. -\rationale Lack of specification of complexity of \tcode{size()} resulted in +\change +Complexity of \tcode{size()} member functions now constant. +\rationale +Lack of specification of complexity of \tcode{size()} resulted in divergent implementations with inconsistent performance characteristics. \effect Some container implementations that conform to \CppIII{} may not conform to the @@ -1185,8 +1260,10 @@ incompatible changes. \diffref{container.requirements} -\change Requirements change: relaxation. -\rationale Clarification. +\change +Requirements change: relaxation. +\rationale +Clarification. \effect Valid \CppIII{} code that attempts to meet the specified container requirements may now be over-specified. Code that attempted to be portable across containers @@ -1199,15 +1276,19 @@ \end{itemize} \diffref{container.requirements} -\change Requirements change: default constructible. -\rationale Clarification of container requirements. +\change +Requirements change: default constructible. +\rationale +Clarification of container requirements. \effect Valid \CppIII{} code that attempts to explicitly instantiate a container using a user-defined type with no default constructor may fail to compile. \diffref{sequence.reqmts,associative.reqmts} -\change Signature changes: from \tcode{void} return types. -\rationale Old signature threw away useful information that may be expensive +\change +Signature changes: from \tcode{void} return types. +\rationale +Old signature threw away useful information that may be expensive to recalculate. \effect The following member functions have changed: @@ -1223,9 +1304,11 @@ of these functions) will fail to compile with this International Standard. \diffref{sequence.reqmts,associative.reqmts} -\change Signature changes: from \tcode{iterator} to \tcode{const_iterator} +\change +Signature changes: from \tcode{iterator} to \tcode{const_iterator} parameters. -\rationale Overspecification. +\rationale +Overspecification. \effect The signatures of the following member functions changed from taking an \tcode{iterator} to taking a \tcode{const_iterator}: @@ -1244,8 +1327,10 @@ International Standard. \diffref{sequence.reqmts,associative.reqmts} -\change Signature changes: \tcode{resize}. -\rationale Performance, compatibility with move semantics. +\change +Signature changes: \tcode{resize}. +\rationale +Performance, compatibility with move semantics. \effect For \tcode{vector}, \tcode{deque}, and \tcode{list} the fill value passed to \tcode{resize} is now passed by reference instead of @@ -1256,8 +1341,10 @@ \rSec2[diff.cpp03.algorithms]{\ref{algorithms}: algorithms library} \diffref{algorithms.general} -\change Result state of inputs after application of some algorithms. -\rationale Required by new feature. +\change +Result state of inputs after application of some algorithms. +\rationale +Required by new feature. \effect A valid \CppIII{} program may detect that an object with a valid but unspecified state has a different valid but unspecified state with this @@ -1268,8 +1355,10 @@ \rSec2[diff.cpp03.numerics]{\ref{numerics}: numerics library} \diffref{complex.numbers} -\change Specified representation of complex numbers. -\rationale Compatibility with C99. +\change +Specified representation of complex numbers. +\rationale +Compatibility with C99. \effect Valid \CppIII{} code that uses implementation-specific knowledge about the binary representation of the required template specializations of @@ -1278,8 +1367,10 @@ \rSec2[diff.cpp03.input.output]{\ref{input.output}: input/output library} \diffref{istream.sentry,ostream.sentry,iostate.flags} -\change Specify use of \tcode{explicit} in existing boolean conversion functions. -\rationale Clarify intentions, avoid workarounds. +\change +Specify use of \tcode{explicit} in existing boolean conversion functions. +\rationale +Clarify intentions, avoid workarounds. \effect Valid \CppIII{} code that relies on implicit boolean conversions will fail to compile with this International Standard. Such conversions occur in the @@ -1294,8 +1385,10 @@ \end{itemize} \diffref{ios.failure} -\change Change base class of \tcode{std::ios_base::failure}. -\rationale More detailed error messages. +\change +Change base class of \tcode{std::ios_base::failure}. +\rationale +More detailed error messages. \effect \tcode{std::ios_base::failure} is no longer derived directly from \tcode{std::exception}, but is now derived from \tcode{std::system_error}, @@ -1304,14 +1397,15 @@ \tcode{std::exception} may execute differently in this International Standard. \diffref{ios.base} -\change Flag types in \tcode{std::ios_base} are now bitmasks with values +\change +Flag types in \tcode{std::ios_base} are now bitmasks with values defined as constexpr static members. -\rationale Required for new features. +\rationale +Required for new features. \effect Valid \CppIII{} code that relies on \tcode{std::ios_base} flag types being represented as \tcode{std::bitset} or as an integer type may fail to compile with this International Standard. For example: - \begin{codeblock} #include @@ -1332,9 +1426,12 @@ \rSec2[diff.cpp11.lex]{\ref{lex}: lexical conventions} \diffref{lex.ppnumber} -\change \grammarterm{pp-number} can contain one or more single quotes. -\rationale Necessary to enable single quotes as digit separators. -\effect Valid \CppXI{} code may fail to compile or may change meaning in this +\change +\grammarterm{pp-number} can contain one or more single quotes. +\rationale +Necessary to enable single quotes as digit separators. +\effect +Valid \CppXI{} code may fail to compile or may change meaning in this International Standard. For example, the following code is valid both in \CppXI{} and in this International Standard, but the macro invocation produces different outcomes because the single quotes delimit a character literal in \CppXI{}, whereas they are digit @@ -1350,11 +1447,13 @@ \rSec2[diff.cpp11.basic]{\ref{basic}: basics} \diffref{basic.stc.dynamic.deallocation} -\change New usual (non-placement) deallocator. -\rationale Required for sized deallocation. -\effect Valid \CppXI{} code could declare a global placement allocation function and +\change +New usual (non-placement) deallocator. +\rationale +Required for sized deallocation. +\effect +Valid \CppXI{} code could declare a global placement allocation function and deallocation function as follows: - \begin{codeblock} void* operator new(std::size_t, std::size_t); void operator delete(void*, std::size_t) noexcept; @@ -1369,13 +1468,16 @@ \rSec2[diff.cpp11.expr]{\ref{expr}: expressions} \diffref{expr.cond} -\change A conditional expression with a throw expression as its second or third +\change +A conditional expression with a throw expression as its second or third operand keeps the type and value category of the other operand. -\rationale Formerly mandated conversions (lvalue-to-rvalue\iref{conv.lval}, +\rationale +Formerly mandated conversions (lvalue-to-rvalue\iref{conv.lval}, array-to-pointer\iref{conv.array}, and function-to-pointer\iref{conv.func} standard conversions), especially the creation of the temporary due to lvalue-to-rvalue conversion, were considered gratuitous and surprising. -\effect Valid \CppXI{} code that relies on the conversions may behave differently +\effect +Valid \CppXI{} code that relies on the conversions may behave differently in this International Standard: \begin{codeblock} @@ -1403,16 +1505,17 @@ \rSec2[diff.cpp11.dcl.dcl]{\ref{dcl.dcl}: declarations} \diffref{dcl.constexpr} -\change \tcode{constexpr} non-static member functions are not implicitly +\change +\tcode{constexpr} non-static member functions are not implicitly \tcode{const} member functions. -\rationale Necessary to allow \tcode{constexpr} member functions to mutate +\rationale +Necessary to allow \tcode{constexpr} member functions to mutate the object. \effect Valid \CppXI{} code may fail to compile in this International Standard. For example, the following code is valid in \CppXI{} but invalid in this International Standard because it declares the same member function twice with different return types: - \begin{codeblock} struct S { constexpr const int &f(); @@ -1421,14 +1524,16 @@ \end{codeblock} \diffref{dcl.init.aggr} -\change Classes with default member initializers can be aggregates. -\rationale Necessary to allow default member initializers to be used +\change +Classes with default member initializers can be aggregates. +\rationale +Necessary to allow default member initializers to be used by aggregate initialization. \effect Valid \CppXI{} code may fail to compile or may change meaning in this International Standard. For example: \begin{codeblock} -struct S { // Aggregate in \CppXIV{} onwards. +struct S { // Aggregate in \CppXIV{} onwards. int m = 1; }; struct X { @@ -1436,25 +1541,29 @@ operator S(); }; X a{}; -S b{a}; // uses copy constructor in \CppXI{}, - // performs aggregate initialization in this International Standard +S b{a}; // uses copy constructor in \CppXI{}, + // performs aggregate initialization in this International Standard \end{codeblock} \rSec2[diff.cpp11.library]{\ref{library}: library introduction} \diffref{headers} -\change New header. -\rationale New functionality. +\change +New header. +\rationale +New functionality. \effect -The \Cpp{} header \tcode{} is new. +The \Cpp{} header \libheaderrefx{shared_mutex}{shared.mutex.syn} is new. Valid \CppXI{} code that \tcode{\#include}{s} a header with that name may be invalid in this International Standard. \rSec2[diff.cpp11.input.output]{\ref{input.output}: input/output library} \diffref{c.files} -\change \tcode{gets} is not defined. -\rationale Use of \tcode{gets} is considered dangerous. +\change +\tcode{gets} is not defined. +\rationale +Use of \tcode{gets} is considered dangerous. \effect Valid \CppXI{} code that uses the \tcode{gets} function may fail to compile in this International Standard. @@ -1471,8 +1580,10 @@ \diffref{lex.phases} \indextext{trigraph sequence}% -\change Removal of trigraph support as a required feature. -\rationale Prevents accidental uses of trigraphs in non-raw string literals and comments. +\change +Removal of trigraph support as a required feature. +\rationale +Prevents accidental uses of trigraphs in non-raw string literals and comments. \effect Valid \CppXIV{} code that uses trigraphs may not be valid or may have different semantics in this International Standard. Implementations may choose to @@ -1482,16 +1593,17 @@ the basic source character set. \diffref{lex.ppnumber} -\change \grammarterm{pp-number} can contain \tcode{p} \grammarterm{sign} and +\change +\grammarterm{pp-number} can contain \tcode{p} \grammarterm{sign} and \tcode{P} \grammarterm{sign}. -\rationale Necessary to enable hexadecimal floating literals. +\rationale +Necessary to enable hexadecimal floating-point literals. \effect Valid \CppXIV{} code may fail to compile or produce different results in this International Standard. Specifically, character sequences like \tcode{0p+0} and \tcode{0e1_p+0} are three separate tokens each in \CppXIV{}, but one single token in this International Standard. For example: - \begin{codeblock} #define F(a) b ## a int b0p = F(0p+0); // ill-formed; equivalent to ``\tcode{int b0p = b0p + 0;}\!'' in \CppXIV{} @@ -1502,16 +1614,21 @@ \diffref{expr.post.incr,expr.pre.incr} \change Remove increment operator with \tcode{bool} operand. -\rationale Obsolete feature with occasionally surprising semantics. -\effect A valid \CppXIV{} expression utilizing the increment operator on +\rationale +Obsolete feature with occasionally surprising semantics. +\effect +A valid \CppXIV{} expression utilizing the increment operator on a \tcode{bool} lvalue is ill-formed in this International Standard. Note that this might occur when the lvalue has a type given by a template parameter. \diffref{expr.new,expr.delete} -\change Dynamic allocation mechanism for over-aligned types. -\rationale Simplify use of over-aligned types. -\effect In \CppXIV{} code that uses a \grammarterm{new-expression} +\change +Dynamic allocation mechanism for over-aligned types. +\rationale +Simplify use of over-aligned types. +\effect +In \CppXIV{} code that uses a \grammarterm{new-expression} to allocate an object with an over-aligned class type, where that class has no allocation functions of its own, \tcode{::operator new(std::size_t)} @@ -1524,43 +1641,50 @@ \diffref{dcl.stc} \indextext{\idxcode{register} storage class}% -\change Removal of \tcode{register} \grammarterm{storage-class-specifier}. -\rationale Enable repurposing of deprecated keyword in future revisions of this International Standard. +\change +Removal of \tcode{register} \grammarterm{storage-class-specifier}. +\rationale +Enable repurposing of deprecated keyword in future revisions of this International Standard. \effect A valid \CppXIV{} declaration utilizing the \tcode{register} \grammarterm{storage-class-specifier} is ill-formed in this International Standard. The specifier can simply be removed to retain the original meaning. \diffref{dcl.spec.auto} -\change \tcode{auto} deduction from \grammarterm{braced-init-list}. -\rationale More intuitive deduction behavior. +\change +\tcode{auto} deduction from \grammarterm{braced-init-list}. +\rationale +More intuitive deduction behavior. \effect Valid \CppXIV{} code may fail to compile or may change meaning in this International Standard. For example: \begin{codeblock} -auto x1{1}; // was \tcode{std::initializer_list}, now \tcode{int} -auto x2{1, 2}; // was \tcode{std::initializer_list}, now ill-formed +auto x1{1}; // was \tcode{std::initializer_list}, now \tcode{int} +auto x2{1, 2}; // was \tcode{std::initializer_list}, now ill-formed \end{codeblock} \diffref{dcl.fct} -\change Make exception specifications be part of the type system. -\rationale Improve type-safety. +\change +Make exception specifications be part of the type system. +\rationale +Improve type-safety. \effect Valid \CppXIV{} code may fail to compile or change meaning in this International Standard. For example: - \begin{codeblock} void g1() noexcept; void g2(); template int f(T *, T *); -int x = f(g1, g2); // ill-formed; previously well-formed +int x = f(g1, g2); // ill-formed; previously well-formed \end{codeblock} \diffref{dcl.init.aggr} -\change Definition of an aggregate is extended +\change +Definition of an aggregate is extended to apply to user-defined types with base classes. -\rationale To increase convenience of aggregate initialization. +\rationale +To increase convenience of aggregate initialization. \effect Valid \CppXIV{} code may fail to compile or produce different results in this International Standard; initialization from an empty initializer list will @@ -1602,20 +1726,23 @@ using A::A; B(int); }; -B b(42L); // now calls \tcode{B(int)}, used to call \tcode{B(long)}, - // which called \tcode{A(int)} due to substitution failure - // in \tcode{A(long)}. +B b(42L); // now calls \tcode{B(int)}, used to call \tcode{B(long)}, + // which called \tcode{A(int)} due to substitution failure + // in \tcode{A(long)}. \end{codeblock} \rSec2[diff.cpp14.temp]{\ref{temp}: templates} \diffref{temp.deduct.type} -\change Allowance to deduce from the type of a non-type template argument. -\rationale In combination with the ability to declare +\change +Allowance to deduce from the type of a non-type template argument. +\rationale +In combination with the ability to declare non-type template arguments with placeholder types, allows partial specializations to decompose from the type deduced for the non-type template argument. -\effect Valid \CppXIV{} code may fail to compile +\effect +Valid \CppXIV{} code may fail to compile or produce different results in this International Standard. For example: \begin{codeblock} @@ -1623,15 +1750,17 @@ template int foo(A *) = delete; void foo(void *); void bar(A<0> *p) { - foo(p); // ill-formed; previously well-formed + foo(p); // ill-formed; previously well-formed } \end{codeblock} \rSec2[diff.cpp14.except]{\ref{except}: exception handling} \diffref{except.spec} -\change Remove dynamic exception specifications. -\rationale Dynamic exception specifications were a deprecated feature +\change +Remove dynamic exception specifications. +\rationale +Dynamic exception specifications were a deprecated feature that was complex and brittle in use. They interacted badly with the type system, which became a more significant issue in this International Standard @@ -1651,25 +1780,29 @@ \rSec2[diff.cpp14.library]{\ref{library}: library introduction} \diffref{headers} -\change New headers. -\rationale New functionality. +\change +New headers. +\rationale +New functionality. \effect The following \Cpp{} headers are new: -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, +\libheaderrefx{any}{any.synop}, +\libheaderref{charconv}, +\libheaderref{execution}, +\libheaderrefx{filesystem}{fs.filesystem.syn}, +\libheaderrefx{memory_resource}{mem.res.syn}, +\libheaderref{optional},\\ +\libheaderrefx{string_view}{string.view.synop}, and -\tcode{}. +\libheaderref{variant}. Valid \CppXIV{} code that \tcode{\#include}{s} headers with these names may be invalid in this International Standard. \diffref{namespace.future} -\change New reserved namespaces. -\rationale Reserve namespaces for future revisions of the standard library +\change +New reserved namespaces. +\rationale +Reserve namespaces for future revisions of the standard library that might otherwise be incompatible with existing programs. \effect The global namespaces \tcode{std} @@ -1681,8 +1814,10 @@ \rSec2[diff.cpp14.utilities]{\ref{utilities}: general utilities library} \diffref{func.wrap} -\change Constructors taking allocators removed. -\rationale No implementation consensus. +\change +Constructors taking allocators removed. +\rationale +No implementation consensus. \effect Valid \CppXIV{} code may fail to compile or may change meaning in this International Standard. Specifically, constructing a \tcode{std::function} with @@ -1690,25 +1825,28 @@ allocator to \tcode{std::function} constructors in this International Standard. \diffref{util.smartptr.shared} -\change Different constraint on conversions from \tcode{unique_ptr}. -\rationale Adding array support to \tcode{shared_ptr}, +\change +Different constraint on conversions from \tcode{unique_ptr}. +\rationale +Adding array support to \tcode{shared_ptr}, via the syntax \tcode{shared_ptr} and \tcode{shared_ptr}. \effect Valid \CppXIV{} code may fail to compile or may change meaning in this International Standard. For example: - \begin{codeblock} #include std::unique_ptr arr(new int[1]); -std::shared_ptr ptr(std::move(arr)); // error: \tcode{int(*)[]} is not compatible with \tcode{int*} +std::shared_ptr ptr(std::move(arr)); // error: \tcode{int(*)[]} is not compatible with \tcode{int*} \end{codeblock} \rSec2[diff.cpp14.string]{\ref{strings}: strings library} \diffref{basic.string} -\change Non-const \tcode{.data()} member added. -\rationale The lack of a non-const \tcode{.data()} +\change +Non-const \tcode{.data()} member added. +\rationale +The lack of a non-const \tcode{.data()} differed from the similar member of \tcode{std::vector}. This change regularizes behavior for this International Standard. \effect @@ -1722,19 +1860,20 @@ int f(char *) = delete; int f(const char *); string s; -int x = f(s.data()); // ill-formed; previously well-formed +int x = f(s.data()); // ill-formed; previously well-formed \end{codeblock} \rSec2[diff.cpp14.containers]{\ref{containers}: containers library} \diffref{associative.reqmts} -\change Requirements change: -\rationale Increase portability, clarification of associative container requirements. +\change +Requirements change: +\rationale +Increase portability, clarification of associative container requirements. \effect Valid \CppXIV{} code that attempts to use associative containers having a comparison object with non-const function call operator may fail to compile in this International Standard: - \begin{codeblock} #include @@ -1769,16 +1908,20 @@ \tcode{bind1st}, and \tcode{bind2nd} are not defined. -\rationale Superseded by new features. -\effect Valid \CppXIV{} code that uses these class templates +\rationale +Superseded by new features. +\effect +Valid \CppXIV{} code that uses these class templates and function templates may fail to compile in this International Standard. \nodiffref \change Remove old iostreams members [depr.ios.members]. -\rationale Redundant feature for compatibility with pre-standard code +\rationale +Redundant feature for compatibility with pre-standard code has served its time. -\effect A valid \CppXIV{} program using these identifiers +\effect +A valid \CppXIV{} program using these identifiers may be ill-formed in this International Standard. \rSec1[diff.cpp17]{\Cpp{} and ISO \CppXVII{}} @@ -1792,9 +1935,12 @@ \rSec2[diff.cpp17.lex]{\ref{lex}: lexical conventions} \diffref{lex.header} -\change \grammarterm{header-name} tokens are formed in more contexts. -\rationale Required for new features. -\effect When the identifier \tcode{import} +\change +\grammarterm{header-name} tokens are formed in more contexts. +\rationale +Required for new features. +\effect +When the identifier \tcode{import} is followed by a \tcode{<} character, a \grammarterm{header-name} token may be formed. \begin{example} @@ -1806,8 +1952,10 @@ \end{example} \diffref{lex.key} -\change New keywords. -\rationale Required for new features. +\change +New keywords. +\rationale +Required for new features. \begin{itemize} \item The \tcode{char8_t} keyword is added to differentiate @@ -1834,14 +1982,18 @@ \tcode{char8_t}, \tcode{concept}, \tcode{consteval}, +\tcode{constinit}, \tcode{co_await}, \tcode{co_yield}, \tcode{co_return}, or \tcode{requires} as an identifier is not valid in this International Standard. \diffref{lex.operators} -\change New operator \tcode{<=>}. -\rationale Necessary for new functionality. -\effect Valid \CppXVII{} code that contains a \tcode{<=} token +\change +New operator \tcode{<=>}. +\rationale +Necessary for new functionality. +\effect +Valid \CppXVII{} code that contains a \tcode{<=} token immediately followed by a \tcode{>} token may be ill-formed or have different semantics in this International Standard: \begin{codeblock} @@ -1854,11 +2006,14 @@ \end{codeblock} \diffref{lex.literal} -\change Type of UTF-8 string and character literals. -\rationale Required for new features. +\change +Type of UTF-8 string and character literals. +\rationale +Required for new features. The changed types enable function overloading, template specialization, and type deduction to distinguish ordinary and UTF-8 string and character literals. -\effect Valid ISO \CppXVII{} code that depends on +\effect +Valid ISO \CppXVII{} code that depends on UTF-8 string literals having type ``array of \tcode{const char}'' and UTF-8 character literals having type ``char'' is not valid in this International Standard. @@ -1884,9 +2039,12 @@ \rSec2[diff.cpp17.basic]{\ref{basic}: basics} \diffref{basic.link,module.unit,module.import} -\change New identifiers with special meaning. -\rationale Required for new features. -\effect Top-level declarations beginning with +\change +New identifiers with special meaning. +\rationale +Required for new features. +\effect +Top-level declarations beginning with \tcode{module} or \tcode{import} may be either ill-formed or interpreted differently in this International Standard. @@ -1903,10 +2061,13 @@ \end{example} \diffref{intro.races} -\change Except for the initial release operation, +\change +Except for the initial release operation, a release sequence consists solely of atomic read-modify-write operations. -\rationale Removal of rarely used and confusing feature. -\effect If a \tcode{memory_order_release} atomic store is followed +\rationale +Removal of rarely used and confusing feature. +\effect +If a \tcode{memory_order_release} atomic store is followed by a \tcode{memory_order_relaxed} store to the same variable by the same thread, then reading the latter value with a \tcode{memory_order_acquire} load no longer provides any ``happens before'' guarantees, @@ -1915,9 +2076,12 @@ \rSec2[diff.cpp17.expr]{\ref{expr}: expressions} \diffref{expr.prim.lambda.capture} -\change Implicit lambda capture may capture additional entities. -\rationale Rule simplification, necessary to resolve interactions with constexpr if. -\effect Lambdas with a \grammarterm{capture-default} +\change +Implicit lambda capture may capture additional entities. +\rationale +Rule simplification, necessary to resolve interactions with constexpr if. +\effect +Lambdas with a \grammarterm{capture-default} may capture local entities that were not captured in \CppXVII{} if those entities are only referenced in contexts @@ -1926,10 +2090,13 @@ \rSec2[diff.cpp17.dcl.dcl]{\ref{dcl.dcl}: declarations} \diffref{dcl.typedef} -\change Unnamed classes with a typedef name for linkage purposes +\change +Unnamed classes with a typedef name for linkage purposes can contain only C-compatible constructs. -\rationale Necessary for implementability. -\effect Valid C++ 2017 code may be ill-formed in this International Standard. +\rationale +Necessary for implementability. +\effect +Valid C++ 2017 code may be ill-formed in this International Standard. \begin{codeblock} typedef struct { void f() {} // ill-formed; previously well-formed @@ -1937,10 +2104,13 @@ \end{codeblock} \diffref{dcl.fct.default} -\change A function cannot have different default arguments +\change +A function cannot have different default arguments in different translation units. -\rationale Required for modules support. -\effect Valid C++ 2017 code may be ill-formed in this International Standard, +\rationale +Required for modules support. +\effect +Valid C++ 2017 code may be ill-formed in this International Standard, with no diagnostic required. \begin{codeblock} // Translation unit 1 @@ -1954,10 +2124,13 @@ \end{codeblock} \diffref{dcl.init.aggr} -\change A class that has user-declared constructors is never an aggregate. -\rationale Remove potentially error-prone aggregate initialization +\change +A class that has user-declared constructors is never an aggregate. +\rationale +Remove potentially error-prone aggregate initialization which may apply notwithstanding the declared constructors of a class. -\effect Valid \CppXVII{} code that aggregate-initializes +\effect +Valid \CppXVII{} code that aggregate-initializes a type with a user-declared constructor may be ill-formed or have different semantics in this International Standard. @@ -2029,9 +2202,9 @@ \begin{codeblock} template struct A { - A(); // error: \grammarterm{simple-template-id} not allowed for constructor - A(int); // OK, injected-class-name used - ~A(); // error: \grammarterm{simple-template-id} not allowed for destructor + A(); // error: \grammarterm{simple-template-id} not allowed for constructor + A(int); // OK, injected-class-name used + ~A(); // error: \grammarterm{simple-template-id} not allowed for destructor }; \end{codeblock} @@ -2145,7 +2318,8 @@ \rSec2[diff.cpp17.except]{\ref{except}: exception handling} \diffref{except.spec} -\change Remove \tcode{throw()} exception specification. +\change +Remove \tcode{throw()} exception specification. \rationale Removal of obsolete feature that has been replaced by \tcode{noexcept}. \effect @@ -2165,55 +2339,58 @@ \rSec2[diff.cpp17.library]{\ref{library}: library introduction} \diffref{headers} -\change New headers. -\rationale New functionality. +\change +New headers. +\rationale +New functionality. \effect The following \Cpp{} headers are new: -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, and -\tcode{}. +\libheaderref{barrier}, +\libheaderref{bit}, +\libheaderref{charconv}, +\libheaderref{compare}, +\libheaderref{concepts}, +\libheaderref{coroutine}, +\libheaderref{format}, +\libheaderref{latch}, +\libheaderref{numbers}, +\libheaderref{ranges}, +\libheaderref{semaphore}, +\libheaderrefx{source_location}{source.location.syn}, +\libheaderref{span}, +\libheaderrefx{stop_token}{thread.stoptoken.syn}, +\libheaderref{syncstream}, and +\libheaderrefx{version}{support.limits.general}. Valid \CppXVII{} code that \tcode{\#include}{s} headers with these names may be invalid in this International Standard. \diffref{headers} -\change Remove vacuous \Cpp{} header files. +\change +Remove vacuous \Cpp{} header files. \rationale The empty headers implied a false requirement to achieve C compatibility with the \Cpp{} headers. \effect A valid \CppXVII{} program that \tcode{\#include}{s} any of the following headers may fail to compile: -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, and -\tcode{}. +\libnoheader{ccomplex}, +\libnoheader{ciso646}, +\libnoheader{cstdalign}, +\libnoheader{cstdbool}, and +\libnoheader{ctgmath}. To retain the same behavior: \begin{itemize} \item -a \tcode{\#include} of \tcode{} can be replaced by -a \tcode{\#include} of \tcode{}\iref{complex.syn}, +a \tcode{\#include} of \libnoheader{ccomplex} can be replaced by +a \tcode{\#include} of \libheaderref{complex}, \item -a \tcode{\#include} of \tcode{} can be replaced by -a \tcode{\#include} of \tcode{}\iref{cmath.syn} and -a \tcode{\#include} of \tcode{}, +a \tcode{\#include} of \libnoheader{ctgmath} can be replaced by +a \tcode{\#include} of \libheaderref{cmath} and +a \tcode{\#include} of \libheader{complex}, and \item a \tcode{\#include} of -\tcode{}, -\tcode{}, or -\tcode{} +\libnoheader{ciso646}, +\libnoheader{cstdalign}, or +\libnoheader{cstdbool} can simply be removed. \end{itemize} @@ -2223,7 +2400,8 @@ \change Return types of \tcode{remove}, \tcode{remove_if}, and \tcode{unique} changed from \tcode{void} to \tcode{container::size_type}. -\rationale Improve efficiency and convenience of finding number of removed elements. +\rationale +Improve efficiency and convenience of finding number of removed elements. \effect Code that depends on the return types might have different semantics in this International Standard. Translation units compiled against this version of \Cpp{} may be incompatible with @@ -2235,7 +2413,8 @@ \change The number and order of deducible template parameters for algorithm declarations is now unspecified, instead of being as-declared. -\rationale Increase implementor freedom and allow some function templates +\rationale +Increase implementor freedom and allow some function templates to be implemented as function objects with templated call operators. \effect A valid \CppXVII{} program that passes explicit template arguments to @@ -2247,14 +2426,15 @@ \diffref{istream.extractors} \change Character array extraction only takes array types. -\rationale Increase safety via preventing buffer overflow at compile time. +\rationale +Increase safety via preventing buffer overflow at compile time. \effect Valid \CppXVII{} code may fail to compile in this International Standard: \begin{codeblock} auto p = new char[100]; char q[100]; -std::cin >> std::setw(20) >> p; // ill-formed; previously well-formed -std::cin >> std::setw(20) >> q; // OK +std::cin >> std::setw(20) >> p; // ill-formed; previously well-formed +std::cin >> std::setw(20) >> q; // OK \end{codeblock} \diffref{ostream.inserters.character} @@ -2310,7 +2490,8 @@ \rSec2[diff.cpp17.depr]{\ref{depr}: compatibility features} \nodiffref -\change Remove \tcode{uncaught_exception}. +\change +Remove \tcode{uncaught_exception}. \rationale The function did not have a clear specification when multiple exceptions were active, and has been superseded by \tcode{uncaught_exceptions}. @@ -2320,7 +2501,8 @@ for clear and portable semantics. \nodiffref -\change Remove support for adaptable function API. +\change +Remove support for adaptable function API. \rationale The deprecated support relied on a limited convention that could not be extended to support the general case or new language features. It has been @@ -2335,7 +2517,8 @@ compile. \nodiffref -\change Remove redundant members from \tcode{std::allocator}. +\change +Remove redundant members from \tcode{std::allocator}. \rationale \tcode{std::allocator} was overspecified, encouraging direct usage in user containers rather than relying on \tcode{std::allocator_traits}, leading to poor containers. @@ -2347,7 +2530,8 @@ \tcode{allocate} with an additional hint argument, may fail to compile. \nodiffref -\change Remove \tcode{raw_storage_iterator}. +\change +Remove \tcode{raw_storage_iterator}. \rationale The iterator encouraged use of algorithms that might throw exceptions, but did not return the number of elements successfully constructed that might need to @@ -2356,7 +2540,8 @@ A valid \CppXVII{} program that uses this iterator class may fail to compile. \nodiffref -\change Remove temporary buffers API. +\change +Remove temporary buffers API. \rationale The temporary buffer facility was intended to provide an efficient optimization for small memory requests, but there is little evidence this was achieved in @@ -2367,7 +2552,8 @@ \tcode{return_temporary_buffer} may fail to compile. \nodiffref -\change Remove \tcode{shared_ptr::unique}. +\change +Remove \tcode{shared_ptr::unique}. \rationale The result of a call to this member function is not reliable in the presence of multiple threads and weak pointers. The member function \tcode{use_count} is @@ -2378,7 +2564,8 @@ object may fail to compile. \diffref{depr.meta.types} -\change Remove deprecated type traits. +\change +Remove deprecated type traits. \rationale The traits had unreliable or awkward interfaces. The \tcode{is_literal_type} trait provided no way to detect which subset of constructors and member @@ -2409,14 +2596,14 @@ \pnum There are no \Cpp{} headers for the C standard library's headers -\tcode{}\indextext{\idxhdr{stdatomic.h}!absence thereof}, -\tcode{}\indextext{\idxhdr{stdnoreturn.h}!absence thereof}, -and \tcode{}\indextext{\idxhdr{threads.h}!absence thereof}, +\libnoheader{stdatomic.h}, +\libnoheader{stdnoreturn.h}, +and \libnoheader{threads.h}, nor are these headers from the C standard library headers themselves part of \Cpp{}. \pnum -The C headers \tcode{}\indexhdr{complex.h} and -\tcode{}\indexhdr{tgmath.h} do not contain any of the content from +The C headers \libheader{complex.h} and +\libheader{tgmath.h} do not contain any of the content from the C standard library and instead merely include other headers from the \Cpp{} standard library. @@ -2429,8 +2616,8 @@ are distinct types rather than typedefs to existing integral types. The tokens \tcode{char16_t} and \tcode{char32_t} are keywords in this International Standard\iref{lex.key}. -They do not appear as macro names defined in -\tcode{}\indexhdr{cuchar}\iref{cuchar.syn}. +They do not appear as macro or type names defined in +\libheaderref{cuchar}. \rSec3[diff.wchar.t]{Type \tcode{wchar_t}} @@ -2439,10 +2626,10 @@ existing integral type. The token \tcode{wchar_t} is a keyword in this International Standard\iref{lex.key}. -It does not appear as a type name defined in any of -\tcode{}\iref{cstddef.syn}\indexhdr{cstddef}, -\tcode{}\iref{cstdlib.syn}\indexhdr{cstdlib}, -or \tcode{}\iref{cwchar.syn}\indexhdr{cwchar}. +It does not appear as a macro or type name defined in any of +\libheaderref{cstddef}, +\libheaderref{cstdlib}, +or \libheaderref{cwchar}. \rSec3[diff.header.assert.h]{Header \tcode{}} \indexhdr{assert.h}% @@ -2450,10 +2637,9 @@ \pnum The token \tcode{static_assert} is a keyword in this International Standard\iref{lex.key}. It does not appear as a macro name defined -in \tcode{}\indexhdr{cassert}\iref{cassert.syn}. +in \libheaderref{cassert}. \rSec3[diff.header.iso646.h]{Header \tcode{}} -\indexhdr{iso646.h}% \pnum The tokens @@ -2462,8 +2648,8 @@ \tcode{bitand}, \tcode{bitor}, \tcode{compl}, -\tcode{not_eq}, \tcode{not}, +\tcode{not_eq}, \tcode{or}, \tcode{or_eq}, \tcode{xor}, @@ -2472,7 +2658,7 @@ are keywords in this International Standard\iref{lex.key}, and are not introduced as macros -by \tcode{}\iref{depr.iso646.h.syn}. +by \libdeprheaderref{iso646.h}. \rSec3[diff.header.stdalign.h]{Header \tcode{}} \indexhdr{stdalign.h}% @@ -2481,7 +2667,7 @@ The token \tcode{alignas} is a keyword in this International Standard\iref{lex.key}, and is not introduced as a macro -by \tcode{}\iref{depr.stdalign.h.syn}. +by \libdeprheaderref{stdalign.h}. \rSec3[diff.header.stdbool.h]{Header \tcode{}} \indexhdr{stdbool.h}% @@ -2490,7 +2676,7 @@ The tokens \tcode{bool}, \tcode{true}, and \tcode{false} are keywords in this International Standard\iref{lex.key}, and are not introduced as macros -by \tcode{}\iref{depr.stdbool.h.syn}. +by \libdeprheaderref{stdbool.h}. \rSec3[diff.null]{Macro \tcode{NULL}} @@ -2498,20 +2684,20 @@ The macro \tcode{NULL}, defined in any of -\tcode{}\iref{c.locales}\indexhdr{clocale}, -\tcode{}\iref{cstddef.syn}\indexhdr{cstddef}, -\tcode{}\iref{cstdio.syn}\indexhdr{cstdio}, -\tcode{}\iref{cstdlib.syn}\indexhdr{cstdlib}, -\tcode{}\iref{cstring.syn}\indexhdr{cstring}, -\tcode{}\iref{ctime.syn}\indexhdr{ctime}, -or \tcode{}\iref{cwchar.syn}\indexhdr{cwchar}, +\libheaderref{clocale}, +\libheaderref{cstddef}, +\libheaderref{cstdio}, +\libheaderref{cstdlib}, +\libheaderref{cstring}, +\libheaderref{ctime}, +or \libheaderref{cwchar}, is an \impldef{definition of \tcode{NULL}} \Cpp{} null pointer constant in this International Standard\iref{support.types}. \rSec2[diff.mods.to.declarations]{Modifications to declarations} \pnum -Header \tcode{}\iref{cstring.syn}\indexhdr{cstring}: +Header \libheaderref{cstring}: The following functions have different declarations: \begin{itemize} @@ -2525,7 +2711,7 @@ Subclause \ref{cstring.syn} describes the changes. \pnum -Header \tcode{}\iref{cwchar.syn}\indexhdr{cwchar}: +Header \libheaderref{cwchar}: The following functions have different declarations: \begin{itemize} @@ -2539,14 +2725,14 @@ Subclause \ref{cwchar.syn} describes the changes. \pnum -Header \tcode{}\iref{cstddef.syn}\indexhdr{cstddef} +Header \libheaderref{cstddef} declares the name \tcode{nullptr_t} in addition to the names declared in -\tcode{} in the C standard library. +\libheaderrefx{stddef.h}{depr.c.headers} in the C standard library. \rSec2[diff.mods.to.behavior]{Modifications to behavior} \pnum -Header \tcode{}\iref{cstdlib.syn}\indexhdr{cstdlib}: +Header \libheaderref{cstdlib}: The following functions have different behavior: \begin{itemize} @@ -2558,9 +2744,8 @@ Subclause \ref{support.start.term} describes the changes. \pnum -Header \tcode{}\iref{csetjmp.syn}\indexhdr{csetjmp}: +Header \libheaderref{csetjmp}: The following functions have different behavior: - \begin{itemize} \item \tcode{longjmp} \end{itemize} @@ -2568,11 +2753,11 @@ Subclause \ref{csetjmp.syn} describes the changes. \rSec3[diff.offsetof]{Macro \tcode{offsetof(\placeholder{type}, \placeholder{member-designator})}} -\indexlibrary{\idxcode{offsetof}}% +\indexlibraryglobal{offsetof}% \pnum The macro \tcode{offsetof}, defined in -\tcode{}\iref{cstddef.syn}\indexhdr{cstddef}, +\libheaderref{cstddef}, accepts a restricted set of \tcode{\placeholder{type}} arguments in this International Standard. Subclause \ref{support.types.layout} describes the change. @@ -2580,10 +2765,10 @@ \pnum The functions -\indexlibrary{\idxcode{aligned_alloc}}\tcode{aligned_alloc}, -\indexlibrary{\idxcode{calloc}}\tcode{calloc}, -\indexlibrary{\idxcode{malloc}}\tcode{malloc}, +\indexlibraryglobal{aligned_alloc}\tcode{aligned_alloc}, +\indexlibraryglobal{calloc}\tcode{calloc}, +\indexlibraryglobal{malloc}\tcode{malloc}, and -\indexlibrary{\idxcode{realloc}}\tcode{realloc} +\indexlibraryglobal{realloc}\tcode{realloc} are restricted in this International Standard. Subclause \ref{c.malloc} describes the changes. diff --git a/source/concepts.tex b/source/concepts.tex index b94f4cce6f..125053e4b6 100644 --- a/source/concepts.tex +++ b/source/concepts.tex @@ -143,7 +143,7 @@ \rSec1[concepts.syn]{Header \tcode{} synopsis} -\indexlibrary{\idxhdr{concepts}}% +\indexheader{concepts}% \begin{codeblock} namespace std { // \ref{concepts.lang}, language-related concepts @@ -273,13 +273,12 @@ \rSec2[concept.same]{Concept \libconcept{same_as}} -\indexlibrary{\idxcode{same_as}}% \begin{itemdecl} template - concept @\placeholdernc{same-as-impl}@ = is_same_v; // \expos + concept @\defexposconcept{same-as-impl}@ = is_same_v; // \expos template - concept same_as = @\placeholdernc{same-as-impl}@ && @\placeholdernc{same-as-impl}@; + concept @\deflibconcept{same_as}@ = @\exposconcept{same-as-impl}@ && @\exposconcept{same-as-impl}@; \end{itemdecl} \begin{itemdescr} @@ -292,10 +291,9 @@ \rSec2[concept.derived]{Concept \libconcept{derived_from}} -\indexlibrary{\idxcode{derived_from}}% \begin{itemdecl} template - concept derived_from = + concept @\deflibconcept{derived_from}@ = is_base_of_v && is_convertible_v; \end{itemdecl} @@ -317,10 +315,9 @@ other type. The implicit and explicit conversions are required to produce equal results. -\indexlibrary{\idxcode{convertible_to}}% \begin{itemdecl} template - concept convertible_to = + concept @\deflibconcept{convertible_to}@ = is_convertible_v && requires(From (&f)()) { static_cast(f()); @@ -378,10 +375,9 @@ different type. \tcode{C} may be a reference type. \end{note} -\indexlibrary{\idxcode{common_reference_with}}% \begin{itemdecl} template - concept common_reference_with = + concept @\deflibconcept{common_reference_with}@ = same_as, common_reference_t> && convertible_to> && convertible_to>; @@ -422,10 +418,9 @@ different type. \tcode{C} might not be unique. \end{note} -\indexlibrary{\idxcode{common_with}}% \begin{itemdecl} template - concept common_with = + concept @\deflibconcept{common_with}@ = same_as, common_type_t> && requires { static_cast>(declval()); @@ -468,40 +463,36 @@ \rSec2[concepts.arithmetic]{Arithmetic concepts} -\indexlibrary{\idxcode{integral}}% -\indexlibrary{\idxcode{signed_integral}}% -\indexlibrary{\idxcode{unsigned_integral}}% \begin{itemdecl} template - concept integral = is_integral_v; + concept @\deflibconcept{integral}@ = is_integral_v; template - concept signed_integral = integral && is_signed_v; + concept @\deflibconcept{signed_integral}@ = integral && is_signed_v; template - concept unsigned_integral = integral && !signed_integral; + concept @\deflibconcept{unsigned_integral}@ = integral && !signed_integral; template - concept floating_point = is_floating_point_v; + concept @\deflibconcept{floating_point}@ = is_floating_point_v; \end{itemdecl} \begin{itemdescr} \pnum \begin{note} \libconcept{signed_integral} can be modeled even by types that are -not signed integral types\iref{basic.fundamental}; for example, \tcode{char}. +not signed integer types\iref{basic.fundamental}; for example, \tcode{char}. \end{note} \pnum \begin{note} \libconcept{unsigned_integral} can be modeled even by types that are -not unsigned integral types\iref{basic.fundamental}; for example, \tcode{bool}. +not unsigned integer types\iref{basic.fundamental}; for example, \tcode{bool}. \end{note} \end{itemdescr} \rSec2[concept.assignable]{Concept \libconcept{assignable_from}} -\indexlibrary{\idxcode{assignable_from}}% \begin{itemdecl} template - concept assignable_from = + concept @\deflibconcept{assignable_from}@ = is_lvalue_reference_v && common_reference_with&, const remove_reference_t&> && requires(LHS lhs, RHS&& rhs) { @@ -574,7 +565,7 @@ \end{itemize} \pnum -\indexlibrary{\idxcode{ranges::swap}}% +\indexlibraryglobal{ranges::swap}% The name \tcode{ranges::swap} denotes a customization point object\iref{customization.point.object}. The expression \tcode{ranges::swap(E1, E2)} for some subexpressions \tcode{E1} @@ -588,8 +579,8 @@ has class or enumeration type\iref{basic.compound} and that expression is valid, with overload resolution performed in a context that includes the declaration \begin{codeblock} - template - void swap(T&, T&) = delete; +template + void swap(T&, T&) = delete; \end{codeblock} and does not include a declaration of \tcode{ranges::swap}. If the function selected by overload resolution does not @@ -622,7 +613,6 @@ T t1(std::move(E1)); T t2(std::move(E2)); \end{codeblock} - are constant subexpressions. \end{itemize} \tcode{noexcept(S)} is equal to @@ -643,16 +633,14 @@ \tcode{E1} and \tcode{E2} and has type \tcode{void}. \end{note} -\indexlibrary{\idxcode{swappable}}% \begin{itemdecl} template - concept swappable = requires(T& a, T& b) { ranges::swap(a, b); }; + concept @\deflibconcept{swappable}@ = requires(T& a, T& b) { ranges::swap(a, b); }; \end{itemdecl} -\indexlibrary{\idxcode{swappable_with}}% \begin{itemdecl} template - concept swappable_with = + concept @\deflibconcept{swappable_with}@ = common_reference_with&, const remove_reference_t&> && requires(T&& t, U&& u) { ranges::swap(std::forward(t), std::forward(t)); @@ -719,10 +707,9 @@ instances of which can be destroyed at the end of their lifetime, or reference types. -\indexlibrary{\idxcode{destructible}}% \begin{itemdecl} template - concept destructible = is_nothrow_destructible_v; + concept @\deflibconcept{destructible}@ = is_nothrow_destructible_v; \end{itemdecl} \begin{itemdescr} @@ -740,26 +727,23 @@ The \libconcept{constructible_from} concept constrains the initialization of a variable of a given type with a particular set of argument types. -\indexlibrary{\idxcode{constructible_from}}% \begin{itemdecl} template - concept constructible_from = destructible && is_constructible_v; + concept @\deflibconcept{constructible_from}@ = destructible && is_constructible_v; \end{itemdecl} \rSec2[concept.defaultconstructible]{Concept \libconcept{default_constructible}} -\indexlibrary{\idxcode{default_constructible}}% \begin{itemdecl} template - concept default_constructible = constructible_from; + concept @\deflibconcept{default_constructible}@ = constructible_from; \end{itemdecl} \rSec2[concept.moveconstructible]{Concept \libconcept{move_constructible}} -\indexlibrary{\idxcode{move_constructible}}% \begin{itemdecl} template - concept move_constructible = constructible_from && convertible_to; + concept @\deflibconcept{move_constructible}@ = constructible_from && convertible_to; \end{itemdecl} \begin{itemdescr} @@ -780,10 +764,9 @@ \rSec2[concept.copyconstructible]{Concept \libconcept{copy_constructible}} -\indexlibrary{\idxcode{copy_constructible}}% \begin{itemdecl} template - concept copy_constructible = + concept @\deflibconcept{copy_constructible}@ = move_constructible && constructible_from && convertible_to && constructible_from && convertible_to && @@ -816,12 +799,11 @@ \pnum The \libconcept{boolean} concept specifies the requirements on a type that is -usable in Boolean contexts. +usable as a truth value. -\indexlibrary{\idxcode{boolean}}% \begin{itemdecl} template - concept boolean = + concept @\deflibconcept{boolean}@ = movable> && // (see \ref{concepts.object}) requires(const remove_reference_t& b1, const remove_reference_t& b2, const bool a) { @@ -877,7 +859,7 @@ \begin{itemdecl} template - concept @\placeholder{weakly-equality-comparable-with}@ = // \expos + concept @\defexposconcept{weakly-equality-comparable-with}@ = // \expos requires(const remove_reference_t& t, const remove_reference_t& u) { { t == u } -> boolean; @@ -904,10 +886,9 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{equality_comparable}}% \begin{itemdecl} template - concept equality_comparable = @\placeholder{weakly-equality-comparable-with}@; + concept @\deflibconcept{equality_comparable}@ = @\exposconcept{weakly-equality-comparable-with}@; \end{itemdecl} \begin{itemdescr} @@ -924,17 +905,16 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{equality_comparable_with}}% \begin{itemdecl} template - concept equality_comparable_with = + concept @\deflibconcept{equality_comparable_with}@ = equality_comparable && equality_comparable && common_reference_with&, const remove_reference_t&> && equality_comparable< common_reference_t< const remove_reference_t&, const remove_reference_t&>> && - @\placeholder{weakly-equality-comparable-with}@; + @\exposconcept{weakly-equality-comparable-with}@; \end{itemdecl} \begin{itemdescr} @@ -953,10 +933,9 @@ \rSec2[concept.totallyordered]{Concept \libconcept{totally_ordered}} -\indexlibrary{\idxcode{totally_ordered}}% \begin{itemdecl} template - concept totally_ordered = + concept @\deflibconcept{totally_ordered}@ = equality_comparable && requires(const remove_reference_t& a, const remove_reference_t& b) { @@ -987,7 +966,7 @@ \begin{itemdecl} template - concept totally_ordered_with = + concept @\deflibconcept{totally_ordered_with}@ = totally_ordered && totally_ordered && common_reference_with&, const remove_reference_t&> && totally_ordered< @@ -1038,20 +1017,16 @@ This subclause describes concepts that specify the basis of the value-oriented programming style on which the library is based. -\indexlibrary{\idxcode{movable}}% -\indexlibrary{\idxcode{copyable}}% -\indexlibrary{\idxcode{semiregular}}% -\indexlibrary{\idxcode{regular}}% \begin{itemdecl} template - concept movable = is_object_v && move_constructible && + concept @\deflibconcept{movable}@ = is_object_v && move_constructible && assignable_from && swappable; template - concept copyable = copy_constructible && movable && assignable_from; + concept @\deflibconcept{copyable}@ = copy_constructible && movable && assignable_from; template - concept semiregular = copyable && default_constructible; + concept @\deflibconcept{semiregular}@ = copyable && default_constructible; template - concept regular = semiregular && equality_comparable; + concept @\deflibconcept{regular}@ = semiregular && equality_comparable; \end{itemdecl} \begin{itemdescr} @@ -1085,10 +1060,9 @@ type\iref{func.def} \tcode{F} and a set of argument types \tcode{Args...} which can be evaluated by the library function \tcode{invoke}\iref{func.invoke}. -\indexlibrary{\idxcode{invocable}}% \begin{itemdecl} template - concept invocable = requires(F&& f, Args&&... args) { + concept @\deflibconcept{invocable}@ = requires(F&& f, Args&&... args) { invoke(std::forward(f), std::forward(args)...); // not required to be equality-preserving }; \end{itemdecl} @@ -1104,10 +1078,9 @@ \rSec2[concept.regularinvocable]{Concept \libconcept{regular_invocable}} -\indexlibrary{\idxcode{regular_invocable}}% \begin{itemdecl} template - concept regular_invocable = invocable; + concept @\deflibconcept{regular_invocable}@ = invocable; \end{itemdecl} \begin{itemdescr} @@ -1134,28 +1107,25 @@ \rSec2[concept.predicate]{Concept \libconcept{predicate}} -\indexlibrary{\idxcode{predicate}}% \begin{itemdecl} template - concept predicate = regular_invocable && boolean>; + concept @\deflibconcept{predicate}@ = regular_invocable && boolean>; \end{itemdecl} \rSec2[concept.relation]{Concept \libconcept{relation}} -\indexlibrary{\idxcode{relation}}% \begin{itemdecl} template - concept relation = + concept @\deflibconcept{relation}@ = predicate && predicate && predicate && predicate; \end{itemdecl} \rSec2[concept.strictweakorder]{Concept \libconcept{strict_weak_order}} -\indexlibrary{\idxcode{strict_weak_order}}% \begin{itemdecl} template - concept strict_weak_order = relation; + concept @\deflibconcept{strict_weak_order}@ = relation; \end{itemdecl} \begin{itemdescr} diff --git a/source/config.tex b/source/config.tex index 6e6488607d..ddc04b7589 100644 --- a/source/config.tex +++ b/source/config.tex @@ -1,8 +1,8 @@ %!TEX root = std.tex %%-------------------------------------------------- %% Version numbers -\newcommand{\docno}{N4830} -\newcommand{\prevdocno}{N4820} +\newcommand{\docno}{N4835} +\newcommand{\prevdocno}{N4830} \newcommand{\cppver}{201703L} %% Release date diff --git a/source/containers.tex b/source/containers.tex index 24b4216aaf..62a4b4727e 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -62,7 +62,9 @@ where \tcode{U} is either \tcode{allocator_type::value_type} or an internal type used by the container. These functions are called only for the -container's element type, not for internal types used by the container. \begin{note} This +container's element type, not for internal types used by the container. +\begin{note} +This means, for example, that a node-based container might need to construct nodes containing aligned buffers and call \tcode{construct} to place the element into the buffer. \end{note} @@ -311,11 +313,13 @@ \pnum Unless otherwise specified, all containers defined in this clause obtain memory using an allocator (see~\ref{allocator.requirements}). -\begin{note} In particular, containers and iterators do not store references +\begin{note} +In particular, containers and iterators do not store references to allocated elements other than through the allocator's pointer type, i.e., as objects of type \tcode{P} or \tcode{pointer_traits

::template re\-bind<\unspec>}, -where \tcode{P} is \tcode{allocator_traits::pointer}. \end{note} +where \tcode{P} is \tcode{allocator_traits::pointer}. +\end{note} Copy constructors for these container types obtain an allocator by calling \tcode{allocator_traits::select_on_container_copy_construction} on the allocator belonging to the container being copied. @@ -324,7 +328,8 @@ exception. All other constructors for these container types take a \tcode{const allocator_type\&} argument. -\begin{note} If an invocation of a constructor uses the default value of an optional +\begin{note} +If an invocation of a constructor uses the default value of an optional allocator argument, then the allocator type must support value-initialization. \end{note} A copy of this allocator is used for any memory allocation and element construction @@ -448,7 +453,10 @@ \tcode{swap()} function invalidates any references, pointers, or iterators referring to the elements -of the containers being swapped. \begin{note} The \tcode{end()} iterator does not refer to any element, so it may be invalidated. \end{note} +of the containers being swapped. +\begin{note} +The \tcode{end()} iterator does not refer to any element, so it may be invalidated. +\end{note} \end{itemize} \pnum @@ -553,7 +561,9 @@ \end{codeblock} and its evaluation causes the following postcondition to hold: The value of \tcode{*p} is equivalent to the value of \tcode{rv} before the evaluation. -\begin{note} \tcode{rv} remains a valid object. Its state is unspecified \end{note} +\begin{note} +\tcode{rv} remains a valid object. Its state is unspecified +\end{note} \item \tcode{T} is \defnx{\oldconcept{CopyInsertable} into \tcode{X}} @@ -639,7 +649,8 @@ \tcode{X(m)} & & -\ensures \tcode{u.empty()} returns \tcode{true}, & +\ensures +\tcode{u.empty()} returns \tcode{true}, & constant \\ \tcode{X u(m);} & & @@ -649,8 +660,10 @@ \tcode{X(t, m)}\br \tcode{X u(t, m);} & & -\expects \tcode{T} is \oldconcept{CopyInsertable} into \tcode{X}.\br -\ensures \tcode{u == t}, \tcode{u.get_allocator() == m} & +\expects +\tcode{T} is \oldconcept{CopyInsertable} into \tcode{X}.\br +\ensures +\tcode{u == t}, \tcode{u.get_allocator() == m} & linear \\ \rowsep \tcode{X(rv)}\br @@ -735,7 +748,8 @@ container, excepting \tcode{vector}, are modified concurrently. \pnum -\begin{note} For a \tcode{vector x} with a size greater than one, \tcode{x[1] = 5} +\begin{note} +For a \tcode{vector x} with a size greater than one, \tcode{x[1] = 5} and \tcode{*x.begin() = 10} can be executed concurrently without a data race, but \tcode{x[0] = 5} and \tcode{*x.begin() = 10} executed concurrently may result in a data race. @@ -862,8 +876,10 @@ \oldconcept{MoveInsertable} into \tcode{X} and \oldconcept{MoveAssignable}.\br \effects Inserts an object of type \tcode{T} constructed with \tcode{std::forward<\brk{}Args\brk{}>(\brk{}args)...} before \tcode{p}. - \begin{note} \tcode{args} may directly or indirectly refer to - a value in \tcode{a}. \end{note} + \begin{note} +\tcode{args} may directly or indirectly refer to + a value in \tcode{a}. +\end{note} \\ \rowsep \tcode{a.insert(p,t)} & @@ -1301,7 +1317,8 @@ \begin{itemdescr} \pnum -\effects Constructs a \tcode{\placeholder{node-handle}} object initializing +\effects +Constructs a \tcode{\placeholder{node-handle}} object initializing \tcode{ptr_} with \tcode{nh.ptr_}. Move constructs \tcode{alloc_} with \tcode{nh.alloc_}. Assigns \tcode{nullptr} to \tcode{nh.ptr_} and assigns \tcode{nullopt} to \tcode{nh.alloc_}. @@ -1313,7 +1330,8 @@ \begin{itemdescr} \pnum -\expects Either \tcode{!alloc_}, or +\expects +Either \tcode{!alloc_}, or \tcode{ator_traits::propagate_on_container_move_assignment::value} is \tcode{true}, or \tcode{alloc_ == nh.alloc_}. @@ -1337,9 +1355,13 @@ \tcode{nh.alloc_}. \end{itemize} -\pnum \returns \tcode{*this}. +\pnum +\returns +\tcode{*this}. -\pnum \throws Nothing. +\pnum +\throws +Nothing. \end{itemdescr} \rSec3[container.node.dtor]{Destructor} @@ -1350,7 +1372,8 @@ \begin{itemdescr} \pnum -\effects If \tcode{ptr_ != nullptr}, destroys the \tcode{value_type} subobject +\effects +If \tcode{ptr_ != nullptr}, destroys the \tcode{value_type} subobject in the \tcode{container_node_type} object pointed to by \tcode{ptr_} by calling \tcode{ator_traits::destroy}, then deallocates \tcode{ptr_} by calling \tcode{ator_traits::template rebind_traits::deallocate}. @@ -1364,14 +1387,17 @@ \begin{itemdescr} \pnum -\expects \tcode{empty() == false}. +\expects +\tcode{empty() == false}. \pnum -\returns A reference to the \tcode{value_type} subobject in the +\returns +A reference to the \tcode{value_type} subobject in the \tcode{container_node_type} object pointed to by \tcode{ptr_}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \begin{itemdecl} @@ -1380,18 +1406,22 @@ \begin{itemdescr} \pnum -\expects \tcode{empty() == false}. +\expects +\tcode{empty() == false}. \pnum -\returns A non-const reference to the \tcode{key_type} member of the +\returns +A non-const reference to the \tcode{key_type} member of the \tcode{value_type} subobject in the \tcode{contain\-er_node_type} object pointed to by \tcode{ptr_}. \pnum -\throws Nothing. +\throws +Nothing. \pnum -\remarks Modifying the key through the returned reference is permitted. +\remarks +Modifying the key through the returned reference is permitted. \end{itemdescr} \begin{itemdecl} @@ -1400,15 +1430,18 @@ \begin{itemdescr} \pnum -\expects \tcode{empty() == false}. +\expects +\tcode{empty() == false}. \pnum -\returns A reference to the \tcode{mapped_type} member of the +\returns +A reference to the \tcode{mapped_type} member of the \tcode{value_type} subobject in the \tcode{container_node_type} object pointed to by \tcode{ptr_}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} @@ -1418,13 +1451,16 @@ \begin{itemdescr} \pnum -\expects \tcode{empty() == false}. +\expects +\tcode{empty() == false}. \pnum -\returns \tcode{*alloc_}. +\returns +\tcode{*alloc_}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \begin{itemdecl} @@ -1433,7 +1469,8 @@ \begin{itemdescr} \pnum -\returns \tcode{ptr_ != nullptr}. +\returns +\tcode{ptr_ != nullptr}. \end{itemdescr} \begin{itemdecl} @@ -1442,7 +1479,8 @@ \begin{itemdescr} \pnum -\returns \tcode{ptr_ == nullptr}. +\returns +\tcode{ptr_ == nullptr}. \end{itemdescr} \rSec3[container.node.modifiers]{Modifiers} @@ -1455,12 +1493,14 @@ \begin{itemdescr} \pnum -\expects \tcode{!alloc_}, or \tcode{!nh.alloc_}, or +\expects +\tcode{!alloc_}, or \tcode{!nh.alloc_}, or \tcode{ator_traits::propagate_on_container_swap::value} is \tcode{true}, or \tcode{alloc_ == nh.alloc_}. \pnum -\effects Calls \tcode{swap(ptr_, nh.ptr_)}. If \tcode{!alloc_}, or +\effects +Calls \tcode{swap(ptr_, nh.ptr_)}. If \tcode{!alloc_}, or \tcode{!nh.alloc_}, or \tcode{ator_traits::propagate_on_container_swap::value} is \tcode{true} calls \tcode{swap(alloc_, nh.alloc_)}. \end{itemdescr} @@ -1568,17 +1608,22 @@ and \tcode{const_iterator} are the same type. -\begin{note} \tcode{iterator} and \tcode{const_iterator} have identical semantics in this case, and \tcode{iterator} is convertible to \tcode{const_iterator}. Users can avoid violating the one-definition rule by always using \tcode{const_iterator} in their function parameter lists. \end{note} +\begin{note} +\tcode{iterator} and \tcode{const_iterator} have identical semantics in this case, and \tcode{iterator} is convertible to \tcode{const_iterator}. Users can avoid violating the one-definition rule by always using \tcode{const_iterator} in their function parameter lists. +\end{note} \pnum The associative containers meet all the requirements of Allocator-aware containers\iref{container.requirements.general}, except that for \tcode{map} and \tcode{multimap}, the requirements placed on \tcode{value_type} in \tref{container.alloc.req} apply instead to \tcode{key_type} -and \tcode{mapped_type}. \begin{note} For example, in some cases \tcode{key_type} and \tcode{mapped_type} +and \tcode{mapped_type}. +\begin{note} +For example, in some cases \tcode{key_type} and \tcode{mapped_type} are required to be \oldconcept{CopyAssignable} even though the associated \tcode{value_type}, \tcode{pair}, is not -\oldconcept{CopyAssignable}. \end{note} +\oldconcept{CopyAssignable}. +\end{note} \pnum In \tref{container.assoc.req}, @@ -1688,10 +1733,10 @@ see~\ref{container.node} & compile time \\ \rowsep -\indexlibrary{\idxcode{set}!constructor}% -\indexlibrary{\idxcode{map}!constructor}% -\indexlibrary{\idxcode{multiset}!constructor}% -\indexlibrary{\idxcode{multimap}!constructor}% +\indexlibraryctor{set}% +\indexlibraryctor{map}% +\indexlibraryctor{multiset}% +\indexlibraryctor{multimap}% \tcode{X(c)}\br \tcode{X u(c);} & & @@ -2185,9 +2230,11 @@ \tcode{true} when passed those values. If \tcode{k1} and \tcode{k2} are equivalent, the container's hash function shall return the same value for both. -\begin{note} Thus, when an unordered associative container is instantiated with +\begin{note} +Thus, when an unordered associative container is instantiated with a non-default \tcode{Pred} parameter it usually needs a non-default \tcode{Hash} -parameter as well. \end{note} +parameter as well. +\end{note} For any two keys \tcode{k1} and \tcode{k2} in the same container, calling \tcode{pred(k1, k2)} shall always return the same value. For any key \tcode{k} in a container, calling \tcode{hash(k)} @@ -2220,7 +2267,8 @@ type, both \tcode{iterator} and \tcode{const_iterator} are constant iterators. It is unspecified whether or not \tcode{iterator} and \tcode{const_iterator} are the same type. -\begin{note} \tcode{iterator} and \tcode{const_iterator} have identical +\begin{note} +\tcode{iterator} and \tcode{const_iterator} have identical semantics in this case, and \tcode{iterator} is convertible to \tcode{const_iterator}. Users can avoid violating the one-definition rule by always using \tcode{const_iterator} in their function parameter lists. @@ -2245,10 +2293,13 @@ containers\iref{container.requirements.general}, except that for \tcode{unordered_map} and \tcode{unordered_multimap}, the requirements placed on \tcode{value_type} in \tref{container.alloc.req} apply instead to \tcode{key_type} -and \tcode{mapped_type}. \begin{note} For example, \tcode{key_type} and \tcode{mapped_type} +and \tcode{mapped_type}. +\begin{note} +For example, \tcode{key_type} and \tcode{mapped_type} are sometimes required to be \oldconcept{CopyAssignable} even though the associated \tcode{value_type}, \tcode{pair}, is not -\oldconcept{CopyAssignable}. \end{note} +\oldconcept{CopyAssignable}. +\end{note} \pnum \indextext{unordered associative containers}% @@ -2390,10 +2441,10 @@ see~\ref{container.node} & compile time \\ \rowsep % -\indexlibrary{\idxcode{unordered_set}!constructor}% -\indexlibrary{\idxcode{unordered_map}!constructor}% -\indexlibrary{\idxcode{unordered_multiset}!constructor}% -\indexlibrary{\idxcode{unordered_multimap}!constructor}% +\indexlibraryctor{unordered_set}% +\indexlibraryctor{unordered_map}% +\indexlibraryctor{unordered_multiset}% +\indexlibraryctor{unordered_multimap}% \tcode{X(n, hf, eq)}\br \tcode{X a(n, hf, eq);} & \tcode{X} & \effects\ Constructs an empty container with at least \tcode{n} buckets, @@ -3052,9 +3103,13 @@ \rSec2[sequences.general]{In general} \pnum -The headers \tcode{}, \tcode{}, \tcode{}, -\tcode{}, and \tcode{} define class templates that meet the -requirements for sequence containers. +The headers +\libheaderref{array}, +\libheaderref{deque}, +\libheaderrefx{forward_list}{forward.list.syn}, +\libheaderref{list}, and +\libheaderref{vector} +define class templates that meet the requirements for sequence containers. \pnum The following exposition-only alias template may appear in deduction guides for sequence containers: @@ -3066,7 +3121,7 @@ \rSec2[array.syn]{Header \tcode{} synopsis} -\indexhdr{array}% +\indexheader{array}% \begin{codeblock} #include @@ -3103,8 +3158,7 @@ \rSec2[deque.syn]{Header \tcode{} synopsis} -\indexhdr{deque}% - +\indexheader{deque}% \begin{codeblock} #include @@ -3136,8 +3190,7 @@ \rSec2[forward.list.syn]{Header \tcode{} synopsis} -\indexhdr{forward_list}% - +\indexheader{forward_list}% \begin{codeblock} #include @@ -3169,8 +3222,7 @@ \rSec2[list.syn]{Header \tcode{} synopsis} -\indexhdr{list}% - +\indexheader{list}% \begin{codeblock} #include @@ -3202,8 +3254,7 @@ \rSec2[vector.syn]{Header \tcode{} synopsis} -\indexhdr{vector}% - +\indexheader{vector}% \begin{codeblock} #include @@ -3241,13 +3292,13 @@ \end{codeblock} \rSec2[array]{Class template \tcode{array}} -\indexlibrary{\idxcode{array}}% +\indexlibraryglobal{array}% \rSec3[array.overview]{Overview} \pnum \indextext{\idxcode{array}!contiguous storage}% -The header \tcode{} defines a class template for storing fixed-size +The header \libheader{array} defines a class template for storing fixed-size sequences of objects. An \tcode{array} is a contiguous container\iref{container.requirements.general}. An instance of \tcode{array} stores \tcode{N} elements of type \tcode{T}, @@ -3276,7 +3327,7 @@ The types \tcode{iterator} and \tcode{const_iterator} meet the constexpr iterator requirements\iref{iterator.requirements.general}. -\indexlibrary{\idxcode{array}}% +\indexlibraryglobal{array}% \indexlibrarymember{array}{begin}% \indexlibrarymember{array}{end}% \indexlibrarymember{array}{size}% @@ -3367,7 +3418,8 @@ \end{itemdecl} \begin{itemdescr} \pnum -\mandates \tcode{(is_same_v \&\& ...)} is \tcode{true}. +\mandates +\tcode{(is_same_v \&\& ...)} is \tcode{true}. \end{itemdescr} \rSec3[array.members]{Member functions} @@ -3378,7 +3430,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{N}. +\pnum +\returns +\tcode{N}. \end{itemdescr} \indexlibrarymember{array}{data}% @@ -3388,7 +3442,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum \returns +\pnum +\returns A pointer such that \range{data()}{data() + size()} is a valid range. For a non-empty array, \tcode{data()} \tcode{==} \tcode{addressof(front())}. \end{itemdescr} @@ -3400,7 +3455,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{fill_n(begin(), N, u)}. +\effects +As if by \tcode{fill_n(begin(), N, u)}. \end{itemdescr} \indexlibrarymember{array}{swap}% @@ -3410,7 +3466,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{swap_ranges(begin(), end(), y.begin())}. +\effects +Equivalent to \tcode{swap_ranges(begin(), end(), y.begin())}. \pnum \begin{note} @@ -3432,19 +3489,23 @@ \pnum \constraints \tcode{N == 0} or \tcode{is_swappable_v} is \tcode{true}. -\pnum\effects +\pnum +\effects As if by \tcode{x.swap(y)}. \pnum -\complexity Linear in \tcode{N}. +\complexity +Linear in \tcode{N}. \end{itemdescr} \rSec3[array.zero]{Zero-sized arrays} \indextext{\idxcode{array}!zero sized}% -\pnum\tcode{array} shall provide support for the special case \tcode{N == 0}. +\pnum +\tcode{array} shall provide support for the special case \tcode{N == 0}. -\pnum In the case that \tcode{N == 0}, \tcode{begin() == end() ==} unique value. +\pnum +In the case that \tcode{N == 0}, \tcode{begin() == end() ==} unique value. The return value of \tcode{data()} is unspecified. \pnum @@ -3458,7 +3519,7 @@ \rSec3[array.creation]{Array creation functions} \indextext{\idxcode{array}!creation}% -\indexlibrary{\idxcode{to_array}}% +\indexlibraryglobal{to_array}% \begin{itemdecl} template constexpr array, N> to_array(T (&a)[N]); @@ -3475,10 +3536,11 @@ \tcode{T} meets the \oldconcept{CopyConstructible} requirements. \pnum -\returns \tcode{\{\{ a[0], $\dotsc$, a[N - 1] \}\}}. +\returns +\tcode{\{\{ a[0], $\dotsc$, a[N - 1] \}\}}. \end{itemdescr} -\indexlibrary{\idxcode{to_array}}% +\indexlibraryglobal{to_array}% \begin{itemdecl} template constexpr array, N> to_array(T (&&a)[N]); @@ -3495,20 +3557,21 @@ \tcode{T} meets the \oldconcept{MoveConstructible} requirements. \pnum -\returns \tcode{\{\{ std::move(a[0]), $\dotsc$, std::move(a[N - 1]) \}\}}. +\returns +\tcode{\{\{ std::move(a[0]), $\dotsc$, std::move(a[N - 1]) \}\}}. \end{itemdescr} \rSec3[array.tuple]{Tuple interface} -\indexlibrary{\idxcode{array}}% -\indexlibrary{\idxcode{tuple}}% +\indexlibraryglobal{array}% +\indexlibraryglobal{tuple}% \indextext{\idxcode{array}!tuple interface to}% -\indexlibrary{\idxcode{tuple_size}}% +\indexlibraryglobal{tuple_size}% \begin{itemdecl} template struct tuple_size> : integral_constant { }; \end{itemdecl} -\indexlibrary{\idxcode{tuple_element}}% +\indexlibraryglobal{tuple_element}% \begin{itemdecl} template struct tuple_element> { @@ -3540,7 +3603,8 @@ \tcode{I < N} is \tcode{true}. \pnum -\returns A reference to the $\tcode{I}^\text{th}$ element of \tcode{a}, +\returns +A reference to the $\tcode{I}^\text{th}$ element of \tcode{a}, where indexing is zero-based. \end{itemdescr} @@ -3550,7 +3614,7 @@ \pnum A -\indexlibrary{\idxcode{deque}}% +\indexlibraryglobal{deque}% \tcode{deque} is a sequence container that supports random access iterators\iref{random.access.iterators}. In addition, it supports constant time insert and erase operations at the beginning or the end; @@ -3685,7 +3749,7 @@ \rSec3[deque.cons]{Constructors, copy, and assignment} -\indexlibrary{\idxcode{deque}!constructor}% +\indexlibraryctor{deque}% \begin{itemdecl} explicit deque(const Allocator&); \end{itemdecl} @@ -3702,14 +3766,15 @@ Constant. \end{itemdescr} -\indexlibrary{\idxcode{deque}!constructor}% +\indexlibraryctor{deque}% \begin{itemdecl} explicit deque(size_type n, const Allocator& = Allocator()); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs a \tcode{deque} with +\effects +Constructs a \tcode{deque} with \tcode{n} default-inserted elements using the specified allocator. \pnum @@ -3717,10 +3782,11 @@ \tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. \pnum -\complexity Linear in \tcode{n}. +\complexity +Linear in \tcode{n}. \end{itemdescr} -\indexlibrary{\idxcode{deque}!constructor}% +\indexlibraryctor{deque}% \begin{itemdecl} deque(size_type n, const T& value, const Allocator& = Allocator()); \end{itemdecl} @@ -3742,7 +3808,7 @@ Linear in \tcode{n}. \end{itemdescr} -\indexlibrary{\idxcode{deque}!constructor}% +\indexlibraryctor{deque}% \begin{itemdecl} template deque(InputIterator first, InputIterator last, const Allocator& = Allocator()); @@ -3758,12 +3824,13 @@ using the specified allocator. \pnum -\complexity Linear in \tcode{distance(first, last)}. +\complexity +Linear in \tcode{distance(first, last)}. \end{itemdescr} \rSec3[deque.capacity]{Capacity} -\indexlibrary{\idxcode{resize}!\idxcode{deque}}% +\indexlibrarymember{resize}{deque}% \begin{itemdecl} void resize(size_type sz); \end{itemdecl} @@ -3774,12 +3841,13 @@ \tcode{T} is \oldconcept{MoveInsertable} and \oldconcept{DefaultInsertable} into \tcode{*this}. \pnum -\effects If \tcode{sz < size()}, erases the last \tcode{size() - sz} elements +\effects +If \tcode{sz < size()}, erases the last \tcode{size() - sz} elements from the sequence. Otherwise, appends \tcode{sz - size()} default-inserted elements to the sequence. \end{itemdescr} -\indexlibrary{\idxcode{resize}!\idxcode{deque}}% +\indexlibrarymember{resize}{deque}% \begin{itemdecl} void resize(size_type sz, const T& c); \end{itemdecl} @@ -3790,7 +3858,8 @@ \tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. \pnum -\effects If \tcode{sz < size()}, erases the last \tcode{size() - sz} elements +\effects +If \tcode{sz < size()}, erases the last \tcode{size() - sz} elements from the sequence. Otherwise, appends \tcode{sz - size()} copies of \tcode{c} to the sequence. \end{itemdescr} @@ -3806,10 +3875,13 @@ \tcode{T} is \oldconcept{MoveInsertable} into \tcode{*this}. \pnum -\effects \tcode{shrink_to_fit} is a non-binding request to reduce memory use +\effects +\tcode{shrink_to_fit} is a non-binding request to reduce memory use but does not change the size of the sequence. -\begin{note} The request is non-binding to allow latitude for -implementation-specific optimizations. \end{note} +\begin{note} +The request is non-binding to allow latitude for +implementation-specific optimizations. +\end{note} If the size is equal to the old capacity, or if an exception is thrown other than by the move constructor of a non-\oldconcept{CopyInsertable} \tcode{T}, @@ -3831,10 +3903,10 @@ \rSec3[deque.modifiers]{Modifiers} -\indexlibrary{\idxcode{insert}!\idxcode{deque}}% -\indexlibrary{\idxcode{push_front}!\idxcode{deque}}% -\indexlibrary{\idxcode{push_back}!\idxcode{deque}}% -\indexlibrary{\idxcode{emplace}!\idxcode{deque}}% +\indexlibrarymember{insert}{deque}% +\indexlibrarymember{push_front}{deque}% +\indexlibrarymember{push_back}{deque}% +\indexlibrarymember{emplace}{deque}% \begin{itemdecl} iterator insert(const_iterator position, const T& x); iterator insert(const_iterator position, T&& x); @@ -3884,7 +3956,7 @@ \tcode{T}. \end{itemdescr} -\indexlibrary{\idxcode{erase}!\idxcode{deque}}% +\indexlibrarymember{erase}{deque}% \begin{itemdecl} iterator erase(const_iterator position); iterator erase(const_iterator first, const_iterator last); @@ -3901,7 +3973,9 @@ and references to the erased elements. An erase operation that erases neither the first element nor the last element of a deque invalidates the past-the-end iterator and all iterators and references to all the elements of the deque. -\begin{note} \tcode{pop_front} and \tcode{pop_back} are erase operations. \end{note} +\begin{note} +\tcode{pop_front} and \tcode{pop_back} are erase operations. +\end{note} \pnum \complexity @@ -3917,7 +3991,7 @@ \rSec3[deque.erasure]{Erasure} -\indexlibrary{\idxcode{erase}!\idxcode{deque}}% +\indexlibrarymember{erase}{deque}% \begin{itemdecl} template void erase(deque& c, const U& value); @@ -3929,7 +4003,7 @@ Equivalent to: \tcode{c.erase(remove(c.begin(), c.end(), value), c.end());} \end{itemdescr} -\indexlibrary{\idxcode{erase_if}!\idxcode{deque}}% +\indexlibrarymember{erase_if}{deque}% \begin{itemdecl} template void erase_if(deque& c, Predicate pred); @@ -3949,9 +4023,11 @@ A \tcode{forward_list} is a container that supports forward iterators and allows constant time insert and erase operations anywhere within the sequence, with storage management handled automatically. Fast random access to list elements is not supported. -\begin{note} It is intended that \tcode{forward_list} have zero space or time overhead +\begin{note} +It is intended that \tcode{forward_list} have zero space or time overhead relative to a hand-written C-style singly linked list. Features that would conflict with -that goal have been omitted.\end{note} +that goal have been omitted. +\end{note} \pnum A \tcode{forward_list} meets all of the requirements of a container @@ -3967,10 +4043,12 @@ is additional semantic information. \pnum -\begin{note} Modifying any list requires access to the element preceding the first element +\begin{note} +Modifying any list requires access to the element preceding the first element of interest, but in a \tcode{forward_list} there is no constant-time way to access a preceding element. For this reason, ranges that are modified, such as those supplied to -\tcode{erase} and \tcode{splice}, must be open at the beginning. \end{note} +\tcode{erase} and \tcode{splice}, must be open at the beginning. +\end{note} \begin{codeblock} namespace std { @@ -4103,53 +4181,61 @@ \rSec3[forwardlist.cons]{Constructors, copy, and assignment} -\indexlibrary{\idxcode{forward_list}!constructor}% +\indexlibraryctor{forward_list}% \begin{itemdecl} explicit forward_list(const Allocator&); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an empty \tcode{forward_list} object using the specified allocator. +\effects +Constructs an empty \tcode{forward_list} object using the specified allocator. \pnum -\complexity Constant. +\complexity +Constant. \end{itemdescr} -\indexlibrary{\idxcode{forward_list}!constructor}% +\indexlibraryctor{forward_list}% \begin{itemdecl} explicit forward_list(size_type n, const Allocator& = Allocator()); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. \pnum -\effects Constructs a \tcode{forward_list} object with \tcode{n} +\effects +Constructs a \tcode{forward_list} object with \tcode{n} default-inserted elements using the specified allocator. \pnum -\complexity Linear in \tcode{n}. +\complexity +Linear in \tcode{n}. \end{itemdescr} -\indexlibrary{\idxcode{forward_list}!constructor}% +\indexlibraryctor{forward_list}% \begin{itemdecl} forward_list(size_type n, const T& value, const Allocator& = Allocator()); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. \pnum -\effects Constructs a \tcode{forward_list} object with \tcode{n} copies of \tcode{value} using the specified allocator. +\effects +Constructs a \tcode{forward_list} object with \tcode{n} copies of \tcode{value} using the specified allocator. \pnum -\complexity Linear in \tcode{n}. +\complexity +Linear in \tcode{n}. \end{itemdescr} -\indexlibrary{\idxcode{forward_list}!constructor}% +\indexlibraryctor{forward_list}% \begin{itemdecl} template forward_list(InputIterator first, InputIterator last, const Allocator& = Allocator()); @@ -4157,10 +4243,12 @@ \begin{itemdescr} \pnum -\effects Constructs a \tcode{forward_list} object equal to the range \range{first}{last}. +\effects +Constructs a \tcode{forward_list} object equal to the range \range{first}{last}. \pnum -\complexity Linear in \tcode{distance(first, last)}. +\complexity +Linear in \tcode{distance(first, last)}. \end{itemdescr} \rSec3[forwardlist.iter]{Iterators} @@ -4175,15 +4263,18 @@ \begin{itemdescr} \pnum -\returns A non-dereferenceable iterator that, when incremented, is equal to the iterator +\returns +A non-dereferenceable iterator that, when incremented, is equal to the iterator returned by \tcode{begin()}. \pnum -\effects \tcode{cbefore_begin()} is equivalent to +\effects +\tcode{cbefore_begin()} is equivalent to \tcode{const_cast(*this).before_begin()}. \pnum -\remarks \tcode{before_begin() == end()} shall equal \tcode{false}. +\remarks +\tcode{before_begin() == end()} shall equal \tcode{false}. \end{itemdescr} \rSec3[forwardlist.access]{Element access} @@ -4196,7 +4287,8 @@ \begin{itemdescr} \pnum -\returns \tcode{*begin()} +\returns +\tcode{*begin()} \end{itemdescr} \rSec3[forwardlist.modifiers]{Modifiers} @@ -4218,7 +4310,8 @@ \begin{itemdescr} \pnum -\effects Inserts an object of type \tcode{value_type} constructed with +\effects +Inserts an object of type \tcode{value_type} constructed with \tcode{value_type(std::forward(\brk{}args)...)} at the beginning of the list. \end{itemdescr} @@ -4230,7 +4323,8 @@ \begin{itemdescr} \pnum -\effects Inserts a copy of \tcode{x} at the beginning of the list. +\effects +Inserts a copy of \tcode{x} at the beginning of the list. \end{itemdescr} @@ -4241,7 +4335,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{erase_after(before_begin())}. +\effects +As if by \tcode{erase_after(before_begin())}. \end{itemdescr} \indexlibrarymember{insert_after}{forward_list}% @@ -4252,14 +4347,17 @@ \begin{itemdescr} \pnum -\expects \tcode{position} is \tcode{before_begin()} or is a dereferenceable +\expects +\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}. +\effects +Inserts a copy of \tcode{x} after \tcode{position}. \pnum -\returns An iterator pointing to the copy of \tcode{x}. +\returns +An iterator pointing to the copy of \tcode{x}. \end{itemdescr} \indexlibrarymember{insert_after}{forward_list}% @@ -4269,11 +4367,13 @@ \begin{itemdescr} \pnum -\expects \tcode{position} is \tcode{before_begin()} or is a dereferenceable +\expects +\tcode{position} is \tcode{before_begin()} or is a dereferenceable iterator in the range \range{begin()}{end()}. \pnum -\effects Inserts \tcode{n} copies of \tcode{x} after \tcode{position}. +\effects +Inserts \tcode{n} copies of \tcode{x} after \tcode{position}. \pnum \returns @@ -4288,12 +4388,14 @@ \begin{itemdescr} \pnum -\expects \tcode{position} is \tcode{before_begin()} or is a dereferenceable +\expects +\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}. \pnum -\effects Inserts copies of elements in \range{first}{last} after \tcode{position}. +\effects +Inserts copies of elements in \range{first}{last} after \tcode{position}. \pnum \returns @@ -4307,7 +4409,8 @@ \begin{itemdescr} \pnum -\effects \tcode{insert_after(p, il.begin(), il.end())}. +\effects +\tcode{insert_after(p, il.begin(), il.end())}. \pnum \returns @@ -4323,15 +4426,18 @@ \begin{itemdescr} \pnum -\expects \tcode{position} is \tcode{before_begin()} or is a dereferenceable +\expects +\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 +\effects +Inserts an object of type \tcode{value_type} constructed with \tcode{value_type(std::forward(\brk{}args)...)} after \tcode{position}. \pnum -\returns An iterator pointing to the new object. +\returns +An iterator pointing to the new object. \end{itemdescr} \indexlibrarymember{erase_after}{forward_list}% @@ -4341,17 +4447,21 @@ \begin{itemdescr} \pnum -\expects The iterator following \tcode{position} is dereferenceable. +\expects +The iterator following \tcode{position} is dereferenceable. \pnum -\effects Erases the element pointed to by the iterator following \tcode{position}. +\effects +Erases the element pointed to by the iterator following \tcode{position}. \pnum -\returns An iterator pointing to the element following the one that was +\returns +An iterator pointing to the element following the one that was erased, or \tcode{end()} if no such element exists. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \begin{itemdecl} @@ -4360,16 +4470,20 @@ \begin{itemdescr} \pnum -\expects All iterators in the range \orange{position}{last} are dereferenceable. +\expects +All iterators in the range \orange{position}{last} are dereferenceable. \pnum -\effects Erases the elements in the range \orange{position}{last}. +\effects +Erases the elements in the range \orange{position}{last}. \pnum -\returns \tcode{last}. +\returns +\tcode{last}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{resize}{forward_list}% @@ -4379,10 +4493,12 @@ \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. \pnum -\effects If \tcode{sz < distance(begin(), end())}, erases the last \tcode{distance(begin(), +\effects +If \tcode{sz < distance(begin(), end())}, erases the last \tcode{distance(begin(), end()) - sz} elements from the list. Otherwise, inserts \tcode{sz - distance(begin(), end())} default-inserted elements at the end of the list. \end{itemdescr} @@ -4393,10 +4509,12 @@ \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. \pnum -\effects If \tcode{sz < distance(begin(), end())}, erases the last \tcode{distance(begin(), +\effects +If \tcode{sz < distance(begin(), end())}, erases the last \tcode{distance(begin(), end()) - sz} elements from the list. Otherwise, inserts \tcode{sz - distance(begin(), end())} copies of \tcode{c} at the end of the list. \end{itemdescr} @@ -4409,10 +4527,12 @@ \begin{itemdescr} \pnum -\effects Erases all elements in the range \range{begin()}{end()}. +\effects +Erases all elements in the range \range{begin()}{end()}. \pnum -\remarks Does not invalidate past-the-end iterators. +\remarks +Does not invalidate past-the-end iterators. \end{itemdescr} \rSec3[forwardlist.ops]{Operations} @@ -4433,23 +4553,27 @@ \begin{itemdescr} \pnum -\expects \tcode{position} is \tcode{before_begin()} or is a dereferenceable +\expects +\tcode{position} is \tcode{before_begin()} or is a dereferenceable iterator in the range \range{begin()}{end()}. \tcode{get_allocator() == x.get_allocator()} is \tcode{true}. \tcode{addressof(x) != this} is \tcode{true}. \pnum -\effects Inserts the contents of \tcode{x} after +\effects +Inserts the contents of \tcode{x} after \tcode{position}, and \tcode{x} becomes empty. Pointers and references to the moved elements of \tcode{x} now refer to those same elements but as members of \tcode{*this}. Iterators referring to the moved elements will continue to refer to their elements, but they now behave as iterators into \tcode{*this}, not into \tcode{x}. \pnum -\throws Nothing. +\throws +Nothing. \pnum -\complexity \bigoh{\tcode{distance(x.begin(), x.end())}} +\complexity +\bigoh{\tcode{distance(x.begin(), x.end())}} \end{itemdescr} \indexlibrarymember{splice_after}{forward_list}% @@ -4460,13 +4584,15 @@ \begin{itemdescr} \pnum -\expects \tcode{position} is \tcode{before_begin()} or is a dereferenceable +\expects +\tcode{position} is \tcode{before_begin()} or is a dereferenceable iterator in the range \range{begin()}{end()}. The iterator following \tcode{i} is a dereferenceable iterator in \tcode{x}. \tcode{get_allocator() == x.get_allocator()} is \tcode{true}. \pnum -\effects Inserts the element following \tcode{i} into \tcode{*this}, following +\effects +Inserts the element following \tcode{i} into \tcode{*this}, following \tcode{position}, and removes it from \tcode{x}. The result is unchanged if \tcode{position == i} or \tcode{position == ++i}. Pointers and references to \tcode{*++i} continue to refer to the same element but as a member of @@ -4474,10 +4600,12 @@ the same element, but now behave as iterators into \tcode{*this}, not into \tcode{x}. \pnum -\throws Nothing. +\throws +Nothing. \pnum -\complexity \bigoh{1} +\complexity +\bigoh{1} \end{itemdescr} \indexlibrarymember{splice_after}{forward_list}% @@ -4490,21 +4618,24 @@ \begin{itemdescr} \pnum -\expects \tcode{position} is \tcode{before_begin()} or is a +\expects +\tcode{position} is \tcode{before_begin()} or is a dereferenceable iterator in the range \range{begin()}{end()}. \orange{first}{last} is a valid range in \tcode{x}, and all iterators in the range \orange{first}{last} are dereferenceable. \tcode{position} is not an iterator in the range \orange{first}{last}. \tcode{get_allocator() == x.get_allocator()} is \tcode{true}. \pnum -\effects Inserts elements in the range \orange{first}{last} after \tcode{position} and +\effects +Inserts elements in the range \orange{first}{last} after \tcode{position} and removes the elements from \tcode{x}. Pointers and references to the moved elements of \tcode{x} now refer to those same elements but as members of \tcode{*this}. Iterators referring to the moved elements will continue to refer to their elements, but they now behave as iterators into \tcode{*this}, not into \tcode{x}. \pnum -\complexity \bigoh{\tcode{distance(first, last)}} +\complexity +\bigoh{\tcode{distance(first, last)}} \end{itemdescr} \indexlibrarymember{remove}{forward_list}% @@ -4516,23 +4647,28 @@ \begin{itemdescr} \pnum -\effects Erases all the elements in the list referred to by a list iterator \tcode{i} for +\effects +Erases all the elements in the list referred to by a list iterator \tcode{i} for which the following conditions hold: \tcode{*i == value} (for \tcode{remove()}), \tcode{pred(*i)} is \tcode{true} (for \tcode{remove_if()}). Invalidates only the iterators and references to the erased elements. \pnum -\returns The number of elements erased. +\returns +The number of elements erased. \pnum -\throws Nothing unless an exception is thrown by the equality comparison or the +\throws +Nothing unless an exception is thrown by the equality comparison or the predicate. \pnum -\remarks Stable\iref{algorithm.stable}. +\remarks +Stable\iref{algorithm.stable}. \pnum -\complexity Exactly \tcode{distance(begin(), end())} applications of the corresponding +\complexity +Exactly \tcode{distance(begin(), end())} applications of the corresponding predicate. \end{itemdescr} @@ -4544,20 +4680,24 @@ \begin{itemdescr} \pnum -\effects Erases all but the first element from every consecutive +\effects +Erases all but the first element from every consecutive group of equal elements referred to by the iterator \tcode{i} in the range \range{first + 1}{last} for which \tcode{*i == *(i-1)} (for the version with no arguments) or \tcode{pred(*i, *(i - 1))} (for the version with a predicate argument) holds. Invalidates only the iterators and references to the erased elements. \pnum -\returns The number of elements erased. +\returns +The number of elements erased. \pnum -\throws Nothing unless an exception is thrown by the equality comparison or the predicate. +\throws +Nothing unless an exception is thrown by the equality comparison or the predicate. \pnum -\complexity If the range \range{first}{last} is not empty, exactly \tcode{(last - first) - 1} applications of the corresponding predicate, otherwise no applications of the predicate. +\complexity +If the range \range{first}{last} is not empty, exactly \tcode{(last - first) - 1} applications of the corresponding predicate, otherwise no applications of the predicate. \end{itemdescr} \indexlibrarymember{merge}{forward_list}% @@ -4570,13 +4710,15 @@ \begin{itemdescr} \pnum -\expects \tcode{*this} and \tcode{x} are both sorted with respect to +\expects +\tcode{*this} and \tcode{x} are both sorted with respect to the comparator \tcode{operator<} (for the first two overloads) or \tcode{comp} (for the last two overloads), and \tcode{get_allocator() == x.get_allocator()} is \tcode{true}. \pnum -\effects Merges the two sorted ranges \tcode{[begin(), end())} and +\effects +Merges the two sorted ranges \tcode{[begin(), end())} and \tcode{[x.begin(), x.end())}. \tcode{x} is empty after the merge. If an exception is thrown other than by a comparison there are no effects. Pointers and references to the moved elements of \tcode{x} now refer to those same elements @@ -4585,10 +4727,12 @@ \tcode{x}. \pnum -\remarks Stable\iref{algorithm.stable}. +\remarks +Stable\iref{algorithm.stable}. \pnum -\complexity At most \tcode{distance(begin(), +\complexity +At most \tcode{distance(begin(), end()) + distance(x.begin(), x.end()) - 1} comparisons. \end{itemdescr} @@ -4600,15 +4744,18 @@ \begin{itemdescr} \pnum -\effects Sorts the list according to the \tcode{operator<} or the \tcode{comp} function object. +\effects +Sorts the list according to the \tcode{operator<} or the \tcode{comp} function object. If an exception is thrown, the order of the elements in \tcode{*this} is unspecified. Does not affect the validity of iterators and references. \pnum -\remarks Stable\iref{algorithm.stable}. +\remarks +Stable\iref{algorithm.stable}. \pnum -\complexity Approximately $N \log N$ comparisons, where $N$ is \tcode{distance(begin(), end())}. +\complexity +Approximately $N \log N$ comparisons, where $N$ is \tcode{distance(begin(), end())}. \end{itemdescr} \indexlibrarymember{reverse}{forward_list}% @@ -4618,16 +4765,18 @@ \begin{itemdescr} \pnum -\effects Reverses the order of the elements in the list. +\effects +Reverses the order of the elements in the list. Does not affect the validity of iterators and references. \pnum -\complexity Linear time. +\complexity +Linear time. \end{itemdescr} \rSec3[forward.list.erasure]{Erasure} -\indexlibrary{\idxcode{erase}!\idxcode{forward_list}}% +\indexlibrarymember{erase}{forward_list}% \begin{itemdecl} template void erase(forward_list& c, const U& value); @@ -4639,7 +4788,7 @@ Equivalent to: \tcode{erase_if(c, [\&](auto\& elem) \{ return elem == value; \});} \end{itemdescr} -\indexlibrary{\idxcode{erase_if}!\idxcode{forward_list}}% +\indexlibrarymember{erase_if}{forward_list}% \begin{itemdecl} template void erase_if(forward_list& c, Predicate pred); @@ -4656,7 +4805,7 @@ \rSec3[list.overview]{Overview} \pnum -\indexlibrary{\idxcode{list}}% +\indexlibraryglobal{list}% A \tcode{list} is a sequence container that supports @@ -4825,7 +4974,7 @@ \rSec3[list.cons]{Constructors, copy, and assignment} -\indexlibrary{\idxcode{list}!constructor}% +\indexlibraryctor{list}% \begin{itemdecl} explicit list(const Allocator&); \end{itemdecl} @@ -4840,17 +4989,19 @@ Constant. \end{itemdescr} -\indexlibrary{\idxcode{list}!constructor}% +\indexlibraryctor{list}% \begin{itemdecl} explicit list(size_type n, const Allocator& = Allocator()); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. \pnum -\effects Constructs a \tcode{list} with +\effects +Constructs a \tcode{list} with \tcode{n} default-inserted elements using the specified allocator. \pnum @@ -4859,14 +5010,15 @@ \tcode{n}. \end{itemdescr} -\indexlibrary{\idxcode{list}!constructor}% +\indexlibraryctor{list}% \begin{itemdecl} list(size_type n, const T& value, const Allocator& = Allocator()); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. \pnum \effects @@ -4884,7 +5036,7 @@ \tcode{n}. \end{itemdescr} -\indexlibrary{\idxcode{list}!constructor}% +\indexlibraryctor{list}% \begin{itemdecl} template list(InputIterator first, InputIterator last, const Allocator& = Allocator()); @@ -4906,14 +5058,15 @@ \rSec3[list.capacity]{Capacity} -\indexlibrary{\idxcode{resize}!\idxcode{list}}% +\indexlibrarymember{resize}{list}% \begin{itemdecl} void resize(size_type sz); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. \pnum \effects @@ -4929,14 +5082,15 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{resize}!\idxcode{list}}% +\indexlibrarymember{resize}{list}% \begin{itemdecl} void resize(size_type sz, const T& c); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. \pnum \effects @@ -4956,7 +5110,7 @@ \rSec3[list.modifiers]{Modifiers} -\indexlibrary{\idxcode{insert}!\idxcode{list}}% +\indexlibrarymember{insert}{list}% \begin{itemdecl} iterator insert(const_iterator position, const T& x); iterator insert(const_iterator position, T&& x); @@ -4991,7 +5145,7 @@ to the number of elements inserted. \end{itemdescr} -\indexlibrary{\idxcode{erase}!\idxcode{list}}% +\indexlibrarymember{erase}{list}% \begin{itemdecl} iterator erase(const_iterator position); iterator erase(const_iterator first, const_iterator last); @@ -5007,7 +5161,8 @@ Invalidates only the iterators and references to the erased elements. \pnum -\throws Nothing. +\throws +Nothing. \pnum \complexity @@ -5038,7 +5193,7 @@ another. The behavior of splice operations is undefined if \tcode{get_allocator() != x.get_allocator()}. -\indexlibrary{\idxcode{splice}!\idxcode{list}}% +\indexlibrarymember{splice}{list}% \begin{itemdecl} void splice(const_iterator position, list& x); void splice(const_iterator position, list&& x); @@ -5069,7 +5224,8 @@ \tcode{x}. \pnum -\throws Nothing. +\throws +Nothing. \pnum \complexity @@ -5114,7 +5270,8 @@ \tcode{x}. \pnum -\throws Nothing. +\throws +Nothing. \pnum \complexity @@ -5154,7 +5311,8 @@ \tcode{x}. \pnum -\throws Nothing. +\throws +Nothing. \pnum \complexity @@ -5163,7 +5321,7 @@ otherwise, linear time. \end{itemdescr} -\indexlibrary{\idxcode{remove}!\idxcode{list}}% +\indexlibrarymember{remove}{list}% \begin{itemdecl} size_type remove(const T& value); template size_type remove_if(Predicate pred); @@ -5177,7 +5335,8 @@ Invalidates only the iterators and references to the erased elements. \pnum -\returns The number of elements erased. +\returns +The number of elements erased. \pnum \throws @@ -5187,7 +5346,8 @@ \tcode{pred(*i) != false}. \pnum -\remarks Stable\iref{algorithm.stable}. +\remarks +Stable\iref{algorithm.stable}. \pnum \complexity @@ -5196,7 +5356,7 @@ applications of the corresponding predicate. \end{itemdescr} -\indexlibrary{\idxcode{unique}!\idxcode{list}}% +\indexlibrarymember{unique}{list}% \begin{itemdecl} size_type unique(); template size_type unique(BinaryPredicate binary_pred); @@ -5213,7 +5373,8 @@ Invalidates only the iterators and references to the erased elements. \pnum -\returns The number of elements erased. +\returns +The number of elements erased. \pnum \throws @@ -5232,7 +5393,7 @@ otherwise no applications of the predicate. \end{itemdescr} -\indexlibrary{\idxcode{merge}!\idxcode{list}}% +\indexlibrarymember{merge}{list}% \begin{itemdecl} void merge(list& x); void merge(list&& x); @@ -5246,8 +5407,8 @@ Both the list and the argument list shall be sorted with respect to the comparator \tcode{operator<} (for the first two overloads) or -\tcode{comp} (for the last two overloads). -\tcode{get_allocator() != x.get_allocator()} is \tcode{true}. +\tcode{comp} (for the last two overloads), and +\tcode{get_allocator() == x.get_allocator()} is \tcode{true}. \pnum \effects @@ -5262,7 +5423,8 @@ \tcode{x}. \pnum -\remarks Stable\iref{algorithm.stable}. If \tcode{addressof(x) != this}, the range \tcode{[x.begin(), x.end())} +\remarks +Stable\iref{algorithm.stable}. If \tcode{addressof(x) != this}, the range \tcode{[x.begin(), x.end())} is empty after the merge. No elements are copied by this operation. @@ -5276,7 +5438,7 @@ If an exception is thrown other than by a comparison there are no effects. \end{itemdescr} -\indexlibrary{\idxcode{reverse}!\idxcode{list}}% +\indexlibrarymember{reverse}{list}% \begin{itemdecl} void reverse() noexcept; \end{itemdecl} @@ -5292,7 +5454,7 @@ Linear time. \end{itemdescr} -\indexlibrary{\idxcode{sort}!\idxcode{list}}% +\indexlibrarymember{sort}{list}% \begin{itemdecl} void sort(); template void sort(Compare comp); @@ -5307,7 +5469,8 @@ Does not affect the validity of iterators and references. \pnum -\remarks Stable\iref{algorithm.stable}. +\remarks +Stable\iref{algorithm.stable}. \pnum \complexity @@ -5319,7 +5482,7 @@ \rSec3[list.erasure]{Erasure} -\indexlibrary{\idxcode{erase}!\idxcode{list}}% +\indexlibrarymember{erase}{list}% \begin{itemdecl} template void erase(list& c, const U& value); @@ -5331,7 +5494,7 @@ Equivalent to: \tcode{erase_if(c, [\&](auto\& elem) \{ return elem == value; \});} \end{itemdescr} -\indexlibrary{\idxcode{erase_if}!\idxcode{list}}% +\indexlibrarymember{erase_if}{list}% \begin{itemdecl} template void erase_if(list& c, Predicate pred); @@ -5348,7 +5511,7 @@ \rSec3[vector.overview]{Overview} \pnum -\indexlibrary{\idxcode{vector}}% +\indexlibraryglobal{vector}% A \tcode{vector} is a sequence container that supports @@ -5489,8 +5652,8 @@ noexcept(noexcept(x.swap(y))); } \end{codeblock}% -\indexlibrary{\idxcode{vector}!\idxcode{operator==}}% -\indexlibrary{\idxcode{vector}!\idxcode{operator<}} +\indexlibrarymember{vector}{operator==}% +\indexlibrarymember{vector}{operator<} \pnum An incomplete type \tcode{T} may be used when instantiating \tcode{vector} @@ -5501,38 +5664,43 @@ \rSec3[vector.cons]{Constructors, copy, and assignment} -\indexlibrary{\idxcode{vector}!constructor} +\indexlibraryctor{vector} \begin{itemdecl} constexpr explicit vector(const Allocator&) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an empty \tcode{vector}, using the +\effects +Constructs an empty \tcode{vector}, using the specified allocator. \pnum -\complexity Constant. +\complexity +Constant. \end{itemdescr} -\indexlibrary{\idxcode{vector}!constructor} +\indexlibraryctor{vector} \begin{itemdecl} constexpr explicit vector(size_type n, const Allocator& = Allocator()); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{DefaultInsertable} into \tcode{*this}. \pnum -\effects Constructs a \tcode{vector} with \tcode{n} +\effects +Constructs a \tcode{vector} with \tcode{n} default-inserted elements using the specified allocator. \pnum -\complexity Linear in \tcode{n}. +\complexity +Linear in \tcode{n}. \end{itemdescr} -\indexlibrary{\idxcode{vector}!constructor} +\indexlibraryctor{vector} \begin{itemdecl} constexpr vector(size_type n, const T& value, const Allocator& = Allocator()); @@ -5540,18 +5708,21 @@ \begin{itemdescr} \pnum -\expects \tcode{T} is +\expects +\tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. \pnum -\effects Constructs a \tcode{vector} with \tcode{n} +\effects +Constructs a \tcode{vector} with \tcode{n} copies of \tcode{value}, using the specified allocator. \pnum -\complexity Linear in \tcode{n}. +\complexity +Linear in \tcode{n}. \end{itemdescr} -\indexlibrary{\idxcode{vector}!constructor} +\indexlibraryctor{vector} \begin{itemdecl} template constexpr vector(InputIterator first, InputIterator last, @@ -5561,7 +5732,8 @@ \begin{itemdescr} \pnum -\effects Constructs a \tcode{vector} equal to the +\effects +Constructs a \tcode{vector} equal to the range \range{first}{last}, using the specified allocator. \pnum @@ -5586,7 +5758,7 @@ \rSec3[vector.capacity]{Capacity} -\indexlibrary{\idxcode{capacity}!\idxcode{vector}}% +\indexlibrarymember{capacity}{vector}% \begin{itemdecl} constexpr size_type capacity() const noexcept; \end{itemdecl} @@ -5598,17 +5770,19 @@ without requiring reallocation. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} -\indexlibrary{\idxcode{reserve}!\idxcode{vector}}% +\indexlibrarymember{reserve}{vector}% \begin{itemdecl} constexpr void reserve(size_type n); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{MoveInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{MoveInsertable} into \tcode{*this}. \pnum \effects @@ -5653,20 +5827,24 @@ greater than the value of \tcode{capacity()}. \end{itemdescr} -\indexlibrary{\idxcode{shrink_to_fit}!\idxcode{vector}}% +\indexlibrarymember{shrink_to_fit}{vector}% \begin{itemdecl} constexpr void shrink_to_fit(); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is \oldconcept{MoveInsertable} into \tcode{*this}. +\expects +\tcode{T} is \oldconcept{MoveInsertable} into \tcode{*this}. \pnum -\effects \tcode{shrink_to_fit} is a non-binding request to reduce +\effects +\tcode{shrink_to_fit} is a non-binding request to reduce \tcode{capacity()} to \tcode{size()}. -\begin{note} The request is non-binding to allow latitude for -implementation-specific optimizations. \end{note} +\begin{note} +The request is non-binding to allow latitude for +implementation-specific optimizations. +\end{note} It does not increase \tcode{capacity()}, but may reduce \tcode{capacity()} by causing reallocation. If an exception is thrown other than by the move constructor @@ -5678,14 +5856,15 @@ linear in the size of the sequence. \pnum -\remarks Reallocation invalidates all the references, pointers, and iterators +\remarks +Reallocation invalidates all the references, pointers, and iterators referring to the elements in the sequence as well as the past-the-end iterator. \begin{note} If no reallocation happens, they remain valid. \end{note} \end{itemdescr} -\indexlibrary{\idxcode{swap}!\idxcode{vector}}% +\indexlibrarymember{swap}{vector}% \begin{itemdecl} constexpr void swap(vector& x) noexcept(allocator_traits::propagate_on_container_swap::value || @@ -5706,27 +5885,30 @@ Constant time. \end{itemdescr} -\indexlibrary{\idxcode{resize}!\idxcode{vector}}% +\indexlibrarymember{resize}{vector}% \begin{itemdecl} constexpr void resize(size_type sz); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{T} is +\expects +\tcode{T} is \oldconcept{MoveInsertable} and \oldconcept{DefaultInsertable} into \tcode{*this}. \pnum -\effects If \tcode{sz < size()}, erases the last \tcode{size() - sz} elements +\effects +If \tcode{sz < size()}, erases the last \tcode{size() - sz} elements from the sequence. Otherwise, appends \tcode{sz - size()} default-inserted elements to the sequence. \pnum -\remarks If an exception is thrown other than by the move constructor of a non-\oldconcept{CopyInsertable} +\remarks +If an exception is thrown other than by the move constructor of a non-\oldconcept{CopyInsertable} \tcode{T} there are no effects. \end{itemdescr} -\indexlibrary{\idxcode{resize}!\idxcode{vector}}% +\indexlibrarymember{resize}{vector}% \begin{itemdecl} constexpr void resize(size_type sz, const T& c); \end{itemdecl} @@ -5734,20 +5916,23 @@ \begin{itemdescr} \pnum \pnum -\expects \tcode{T} is +\expects +\tcode{T} is \oldconcept{CopyInsertable} into \tcode{*this}. -\effects If \tcode{sz < size()}, erases the last \tcode{size() - sz} elements +\effects +If \tcode{sz < size()}, erases the last \tcode{size() - sz} elements from the sequence. Otherwise, appends \tcode{sz - size()} copies of \tcode{c} to the sequence. \pnum -\remarks If an exception is thrown there are no effects. +\remarks +If an exception is thrown there are no effects. \end{itemdescr} \rSec3[vector.data]{Data} -\indexlibrary{\idxcode{data}!\idxcode{vector}}% +\indexlibrarymember{data}{vector}% \begin{itemdecl} constexpr T* data() noexcept; constexpr const T* data() const noexcept; @@ -5766,7 +5951,7 @@ \rSec3[vector.modifiers]{Modifiers} -\indexlibrary{\idxcode{insert}!\idxcode{vector}}% +\indexlibrarymember{insert}{vector}% \begin{itemdecl} constexpr iterator insert(const_iterator position, const T& x); constexpr iterator insert(const_iterator position, T&& x); @@ -5813,7 +5998,7 @@ to the end of the vector. \end{itemdescr} -\indexlibrary{\idxcode{erase}!\idxcode{vector}}% +\indexlibrarymember{erase}{vector}% \begin{itemdecl} constexpr iterator erase(const_iterator position); constexpr iterator erase(const_iterator first, const_iterator last); @@ -5841,7 +6026,7 @@ \rSec3[vector.erasure]{Erasure} -\indexlibrary{\idxcode{erase}!\idxcode{vector}}% +\indexlibrarymember{erase}{vector}% \begin{itemdecl} template constexpr void erase(vector& c, const U& value); @@ -5853,7 +6038,7 @@ Equivalent to: \tcode{c.erase(remove(c.begin(), c.end(), value), c.end());} \end{itemdescr} -\indexlibrary{\idxcode{erase_if}!\idxcode{vector}}% +\indexlibrarymember{erase_if}{vector}% \begin{itemdecl} template constexpr void erase_if(vector& c, Predicate pred); @@ -5868,7 +6053,7 @@ \rSec2[vector.bool]{Class \tcode{vector}} \pnum -\indexlibrary{\idxcode{vector}}% +\indexlibraryglobal{vector}% To optimize space allocation, a specialization of vector for \tcode{bool} elements is provided: @@ -5901,7 +6086,7 @@ constexpr operator bool() const noexcept; constexpr reference& operator=(const bool x) noexcept; constexpr reference& operator=(const reference& x) noexcept; - constexpr void flip() noexcept; // flips the bit + constexpr void flip() noexcept; // flips the bit }; // construct/copy/destroy @@ -5976,7 +6161,7 @@ constexpr iterator erase(const_iterator first, const_iterator last); constexpr void swap(vector&); constexpr static void swap(reference x, reference y) noexcept; - constexpr void flip() noexcept; // flips all bits + constexpr void flip() noexcept; // flips all bits constexpr void clear() noexcept; }; } @@ -6010,7 +6195,8 @@ \begin{itemdescr} \pnum -\effects Replaces each element in the container with its complement. +\effects +Replaces each element in the container with its complement. \end{itemdescr} \indexlibrarymember{swap}{vector}% @@ -6020,7 +6206,8 @@ \begin{itemdescr} \pnum -\effects Exchanges the contents of \tcode{x} and \tcode{y} as if by: +\effects +Exchanges the contents of \tcode{x} and \tcode{y} as if by: \begin{codeblock} bool b = x; @@ -6044,8 +6231,8 @@ \rSec2[associative.general]{In general} \pnum -The header \tcode{} defines the class templates \tcode{map} and -\tcode{multimap}; the header \tcode{} defines the class templates +The header \libheader{map} defines the class templates \tcode{map} and +\tcode{multimap}; the header \libheader{set} defines the class templates \tcode{set} and \tcode{multiset}. \pnum @@ -6068,7 +6255,7 @@ \rSec2[associative.map.syn]{Header \tcode{} synopsis} -\indexhdr{map}% +\indexheader{map}% \begin{codeblock} #include @@ -6129,8 +6316,7 @@ \rSec2[associative.set.syn]{Header \tcode{} synopsis}% -\indexhdr{set}% - +\indexheader{set}% \begin{codeblock} #include @@ -6187,7 +6373,7 @@ \rSec3[map.overview]{Overview} -\indexlibrary{\idxcode{map}}% +\indexlibraryglobal{map}% \pnum A \tcode{map} is an associative container that supports unique keys (contains at most one of each key value) and @@ -6434,10 +6620,10 @@ \rSec3[map.cons]{Constructors, copy, and assignment}% -\indexlibrary{\idxcode{map}!\idxcode{operator==}}% -\indexlibrary{\idxcode{map}!\idxcode{operator<}} +\indexlibrarymember{map}{operator==}% +\indexlibrarymember{map}{operator<} -\indexlibrary{\idxcode{map}!constructor}% +\indexlibraryctor{map}% \begin{itemdecl} explicit map(const Compare& comp, const Allocator& = Allocator()); \end{itemdecl} @@ -6454,7 +6640,7 @@ Constant. \end{itemdescr} -\indexlibrary{\idxcode{map}!constructor}% +\indexlibraryctor{map}% \begin{itemdecl} template map(InputIterator first, InputIterator last, @@ -6503,7 +6689,7 @@ Equivalent to: \tcode{return try_emplace(move(x)).first->second;} \end{itemdescr} -\indexlibrary{\idxcode{at}!\idxcode{map}}% +\indexlibrarymember{at}{map}% \begin{itemdecl} mapped_type& at(const key_type& x); const mapped_type& at(const key_type& x) const; @@ -6520,7 +6706,8 @@ no such element is present. \pnum -\complexity Logarithmic. +\complexity +Logarithmic. \end{itemdescr} \rSec3[map.modifiers]{Modifiers} @@ -6703,7 +6890,7 @@ \rSec3[map.erasure]{Erasure} -\indexlibrary{\idxcode{erase_if}!\idxcode{map}}% +\indexlibrarymember{erase_if}{map}% \begin{itemdecl} template void erase_if(map& c, Predicate pred); @@ -6729,7 +6916,7 @@ \rSec3[multimap.overview]{Overview} \pnum -\indexlibrary{\idxcode{multimap}}% +\indexlibraryglobal{multimap}% A \tcode{multimap} is an associative container that supports equivalent keys (possibly containing multiple copies of @@ -6957,12 +7144,12 @@ noexcept(noexcept(x.swap(y))); } \end{codeblock}% -\indexlibrary{\idxcode{multimap}!\idxcode{operator==}}% -\indexlibrary{\idxcode{multimap}!\idxcode{operator<}} +\indexlibrarymember{multimap}{operator==}% +\indexlibrarymember{multimap}{operator<} \rSec3[multimap.cons]{Constructors} -\indexlibrary{\idxcode{multimap}!constructor}% +\indexlibraryctor{multimap}% \begin{itemdecl} explicit multimap(const Compare& comp, const Allocator& = Allocator()); \end{itemdecl} @@ -6979,7 +7166,7 @@ Constant. \end{itemdescr} -\indexlibrary{\idxcode{multimap}!constructor}% +\indexlibraryctor{multimap}% \begin{itemdecl} template multimap(InputIterator first, InputIterator last, @@ -7028,7 +7215,7 @@ \rSec3[multimap.erasure]{Erasure} -\indexlibrary{\idxcode{erase_if}!\idxcode{multimap}}% +\indexlibrarymember{erase_if}{multimap}% \begin{itemdecl} template void erase_if(multimap& c, Predicate pred); @@ -7054,7 +7241,7 @@ \rSec3[set.overview]{Overview} \pnum -\indexlibrary{\idxcode{set}}% +\indexlibraryglobal{set}% A \tcode{set} is an associative container that supports unique keys (contains at most one of each key value) and @@ -7259,12 +7446,12 @@ noexcept(noexcept(x.swap(y))); } \end{codeblock}% -\indexlibrary{\idxcode{set}!\idxcode{operator==}}% -\indexlibrary{\idxcode{set}!\idxcode{operator<}} +\indexlibrarymember{set}{operator==}% +\indexlibrarymember{set}{operator<} \rSec3[set.cons]{Constructors, copy, and assignment} -\indexlibrary{\idxcode{set}!constructor}% +\indexlibraryctor{set}% \begin{itemdecl} explicit set(const Compare& comp, const Allocator& = Allocator()); \end{itemdecl} @@ -7279,7 +7466,7 @@ Constant. \end{itemdescr} -\indexlibrary{\idxcode{set}!constructor}% +\indexlibraryctor{set}% \begin{itemdecl} template set(InputIterator first, InputIterator last, @@ -7307,7 +7494,7 @@ \rSec3[set.erasure]{Erasure} -\indexlibrary{\idxcode{erase_if}!\idxcode{set}}% +\indexlibrarymember{erase_if}{set}% \begin{itemdecl} template void erase_if(set& c, Predicate pred); @@ -7333,7 +7520,7 @@ \rSec3[multiset.overview]{Overview} \pnum -\indexlibrary{\idxcode{multiset}}% +\indexlibraryglobal{multiset}% A \tcode{multiset} is an associative container that supports equivalent keys (possibly contains multiple copies of @@ -7536,12 +7723,12 @@ noexcept(noexcept(x.swap(y))); } \end{codeblock}% -\indexlibrary{\idxcode{multiset}!\idxcode{operator==}}% -\indexlibrary{\idxcode{multiset}!\idxcode{operator<}} +\indexlibrarymember{multiset}{operator==}% +\indexlibrarymember{multiset}{operator<} \rSec3[multiset.cons]{Constructors} -\indexlibrary{\idxcode{multiset}!constructor}% +\indexlibraryctor{multiset}% \begin{itemdecl} explicit multiset(const Compare& comp, const Allocator& = Allocator()); \end{itemdecl} @@ -7556,7 +7743,7 @@ Constant. \end{itemdescr} -\indexlibrary{\idxcode{multiset}!constructor}% +\indexlibraryctor{multiset}% \begin{itemdecl} template multiset(InputIterator first, InputIterator last, @@ -7584,7 +7771,7 @@ \rSec3[multiset.erasure]{Erasure} -\indexlibrary{\idxcode{erase_if}!\idxcode{multiset}}% +\indexlibrarymember{erase_if}{multiset}% \begin{itemdecl} template void erase_if(multiset& c, Predicate pred); @@ -7610,9 +7797,9 @@ \rSec2[unord.general]{In general} \pnum -The header \tcode{} defines the class templates +The header \libheader{unordered_map} defines the class templates \tcode{unordered_map} and -\tcode{unordered_multimap}; the header \tcode{} defines the class templates +\tcode{unordered_multimap}; the header \libheader{unordered_set} defines the class templates \tcode{unordered_set} and \tcode{unordered_multiset}. \pnum @@ -7620,10 +7807,11 @@ \placeholder{iter-key-type}, \placeholder{iter-mapped-type}, and \placeholder{iter-to-alloc-type} defined in \ref{associative.general} may appear in deduction guides for unordered containers. -\rSec2[unord.map.syn]{Header \tcode{} synopsis}% -\indexhdr{unordered_map}% -\indexlibrary{\idxcode{unordered_map}}% -\indexlibrary{\idxcode{unordered_multimap}}% +\rSec2[unord.map.syn]{Header \tcode{} synopsis} + +\indexheader{unordered_map}% +\indexlibraryglobal{unordered_map}% +\indexlibraryglobal{unordered_multimap}% \begin{codeblock} #include @@ -7688,10 +7876,11 @@ } \end{codeblock} -\rSec2[unord.set.syn]{Header \tcode{} synopsis}% -\indexhdr{unordered_set}% -\indexlibrary{\idxcode{unordered_set}}% -\indexlibrary{\idxcode{unordered_multiset}}% +\rSec2[unord.set.syn]{Header \tcode{} synopsis} + +\indexheader{unordered_set}% +\indexlibraryglobal{unordered_set}% +\indexlibraryglobal{unordered_multiset}% \begin{codeblock} #include @@ -7751,7 +7940,7 @@ \end{codeblock} \rSec2[unord.map]{Class template \tcode{unordered_map}}% -\indexlibrary{\idxcode{unordered_map}} +\indexlibraryglobal{unordered_map} \rSec3[unord.map.overview]{Overview} @@ -7773,7 +7962,7 @@ are not described in one of the requirement tables, or for which there is additional semantic information. -\indexlibrary{\idxcode{unordered_map}}% +\indexlibraryglobal{unordered_map}% \begin{codeblock} namespace std { template unordered_map(InputIterator f, InputIterator l, @@ -8068,7 +8259,8 @@ \begin{itemdescr} \pnum -\effects Constructs an empty \tcode{unordered_map} using the +\effects +Constructs an empty \tcode{unordered_map} using the specified hash function, key equality predicate, and allocator, and using at least \tcode{n} buckets. If \tcode{n} is not provided, the number of buckets is \impldef{default number of buckets in @@ -8079,7 +8271,8 @@ \tcode{max_load_factor()} returns \tcode{1.0}. \pnum -\complexity Average case linear, worst case quadratic. +\complexity +Average case linear, worst case quadratic. \end{itemdescr} \rSec3[unord.map.elem]{Element access} @@ -8092,7 +8285,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return try_emplace(k).first->second;} +\effects +Equivalent to: \tcode{return try_emplace(k).first->second;} \end{itemdescr} \indexlibrarymember{unordered_map}{operator[]}% @@ -8103,7 +8297,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return try_emplace(move(k)).first->second;} +\effects +Equivalent to: \tcode{return try_emplace(move(k)).first->second;} \end{itemdescr} \indexlibrarymember{unordered_map}{at}% @@ -8115,10 +8310,12 @@ \begin{itemdescr} \pnum -\returns A reference to \tcode{x.second}, where \tcode{x} is the (unique) element whose key is equivalent to \tcode{k}. +\returns +A reference to \tcode{x.second}, where \tcode{x} is the (unique) element whose key is equivalent to \tcode{k}. \pnum -\throws An exception object of type \tcode{out_of_range} if no such element is present. +\throws +An exception object of type \tcode{out_of_range} if no such element is present. \end{itemdescr} \rSec3[unord.map.modifiers]{Modifiers} @@ -8136,7 +8333,8 @@ \tcode{is_constructible_v} is \tcode{true}. \pnum -\effects Equivalent to: \tcode{return emplace(std::forward

(obj));} +\effects +Equivalent to: \tcode{return emplace(std::forward

(obj));} \end{itemdescr} \indexlibrarymember{unordered_map}{insert}% @@ -8151,7 +8349,8 @@ \tcode{is_constructible_v} is \tcode{true}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return emplace_hint(hint, std::forward

(obj));} \end{itemdescr} @@ -8312,7 +8511,7 @@ \rSec3[unord.map.erasure]{Erasure} -\indexlibrary{\idxcode{erase_if}!\idxcode{unordered_map}}% +\indexlibrarymember{erase_if}{unordered_map}% \begin{itemdecl} template void erase_if(unordered_map& c, Predicate pred); @@ -8334,7 +8533,7 @@ \end{itemdescr} \rSec2[unord.multimap]{Class template \tcode{unordered_multimap}}% -\indexlibrary{\idxcode{unordered_multimap}} +\indexlibraryglobal{unordered_multimap} \rSec3[unord.multimap.overview]{Overview} @@ -8362,7 +8561,7 @@ that are not described in one of the requirement tables, or for which there is additional semantic information. -\indexlibrary{\idxcode{unordered_multimap}}% +\indexlibraryglobal{unordered_multimap}% \begin{codeblock} namespace std { template unordered_multimap(InputIterator f, InputIterator l, @@ -8634,7 +8835,8 @@ \begin{itemdescr} \pnum -\effects Constructs an empty \tcode{unordered_multimap} using the +\effects +Constructs an empty \tcode{unordered_multimap} using the specified hash function, key equality predicate, and allocator, and using at least \tcode{n} buckets. If \tcode{n} is not provided, the number of buckets is \impldef{default number of buckets in @@ -8645,7 +8847,8 @@ \tcode{max_load_factor()} returns \tcode{1.0}. \pnum -\complexity Average case linear, worst case quadratic. +\complexity +Average case linear, worst case quadratic. \end{itemdescr} \rSec3[unord.multimap.modifiers]{Modifiers} @@ -8662,7 +8865,8 @@ \tcode{is_constructible_v} is \tcode{true}. \pnum -\effects Equivalent to: \tcode{return emplace(std::forward

(obj));} +\effects +Equivalent to: \tcode{return emplace(std::forward

(obj));} \end{itemdescr} \indexlibrarymember{unordered_multimap}{insert}% @@ -8677,13 +8881,14 @@ \tcode{is_constructible_v} is \tcode{true}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return emplace_hint(hint, std::forward

(obj));} \end{itemdescr} \rSec3[unord.multimap.erasure]{Erasure} -\indexlibrary{\idxcode{erase_if}!\idxcode{unordered_multimap}}% +\indexlibrarymember{erase_if}{unordered_multimap}% \begin{itemdecl} template void erase_if(unordered_multimap& c, Predicate pred); @@ -8705,7 +8910,7 @@ \end{itemdescr} \rSec2[unord.set]{Class template \tcode{unordered_set}}% -\indexlibrary{\idxcode{unordered_set}} +\indexlibraryglobal{unordered_set} \rSec3[unord.set.overview]{Overview} @@ -8727,7 +8932,7 @@ are not described in one of the requirement tables, or for which there is additional semantic information. -\indexlibrary{\idxcode{unordered_set}}% +\indexlibraryglobal{unordered_set}% \begin{codeblock} namespace std { template unordered_set(InputIterator f, InputIterator l, @@ -8985,7 +9192,8 @@ \begin{itemdescr} \pnum -\effects Constructs an empty \tcode{unordered_set} using the +\effects +Constructs an empty \tcode{unordered_set} using the specified hash function, key equality predicate, and allocator, and using at least \tcode{n} buckets. If \tcode{n} is not provided, the number of buckets is \impldef{default number of buckets in @@ -8996,12 +9204,13 @@ \tcode{max_load_factor()} returns \tcode{1.0}. \pnum -\complexity Average case linear, worst case quadratic. +\complexity +Average case linear, worst case quadratic. \end{itemdescr} \rSec3[unord.set.erasure]{Erasure} -\indexlibrary{\idxcode{erase_if}!\idxcode{unordered_set}}% +\indexlibrarymember{erase_if}{unordered_set}% \begin{itemdecl} template void erase_if(unordered_set& c, Predicate pred); @@ -9023,7 +9232,7 @@ \end{itemdescr} \rSec2[unord.multiset]{Class template \tcode{unordered_multiset}}% -\indexlibrary{\idxcode{unordered_multiset}} +\indexlibraryglobal{unordered_multiset} \rSec3[unord.multiset.overview]{Overview} @@ -9052,7 +9261,7 @@ are not described in one of the requirement tables, or for which there is additional semantic information. -\indexlibrary{\idxcode{unordered_multiset}}% +\indexlibraryglobal{unordered_multiset}% \begin{codeblock} namespace std { template unordered_multiset(InputIterator f, InputIterator l, @@ -9308,7 +9519,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects Constructs an empty \tcode{unordered_multiset} using the specified hash function, key equality predicate, and allocator, and using at least \tcode{n} buckets. If \tcode{n} is not @@ -9319,12 +9531,14 @@ \range{il.begin()}{il.end()} for the second form. \tcode{max_load_factor()} returns \tcode{1.0}. -\pnum\complexity Average case linear, worst case quadratic. +\pnum +\complexity +Average case linear, worst case quadratic. \end{itemdescr} \rSec3[unord.multiset.erasure]{Erasure} -\indexlibrary{\idxcode{erase_if}!\idxcode{unordered_multiset}}% +\indexlibrarymember{erase_if}{unordered_multiset}% \begin{itemdecl} template void erase_if(unordered_multiset& c, Predicate pred); @@ -9350,7 +9564,7 @@ \rSec2[container.adaptors.general]{In general} \pnum -The headers \tcode{} and \tcode{} define the container adaptors +The headers \libheader{queue} and \libheader{stack} define the container adaptors \tcode{queue}, \tcode{priority_queue}, and \tcode{stack}. \pnum @@ -9377,9 +9591,9 @@ \item It has both \tcode{Container} and \tcode{Allocator} template parameters, and \tcode{uses_allocator_v} is \tcode{false}. \end{itemize} -\rSec2[queue.syn]{Header \tcode{} synopsis}% -\indexhdr{queue}% +\rSec2[queue.syn]{Header \tcode{} synopsis} +\indexheader{queue} \begin{codeblock} #include @@ -9419,9 +9633,9 @@ } \end{codeblock} -\rSec2[stack.syn]{Header \tcode{} synopsis}% -\indexhdr{stack}% +\rSec2[stack.syn]{Header \tcode{} synopsis} +\indexheader{stack}% \begin{codeblock} #include @@ -9456,7 +9670,7 @@ \rSec3[queue.defn]{Definition} \pnum -\indexlibrary{\idxcode{queue}}% +\indexlibraryglobal{queue}% Any sequence container supporting operations \tcode{front()}, \tcode{back()}, @@ -9534,7 +9748,8 @@ \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{cont}. +\effects +Initializes \tcode{c} with \tcode{cont}. \end{itemdescr} \begin{itemdecl} @@ -9543,7 +9758,8 @@ \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{std::move(cont)}. +\effects +Initializes \tcode{c} with \tcode{std::move(cont)}. \end{itemdescr} \rSec3[queue.cons.alloc]{Constructors with allocators} @@ -9558,7 +9774,8 @@ \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{a}. +\effects +Initializes \tcode{c} with \tcode{a}. \end{itemdescr} \begin{itemdecl} @@ -9567,7 +9784,8 @@ \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{cont} as the first argument and \tcode{a} +\effects +Initializes \tcode{c} with \tcode{cont} as the first argument and \tcode{a} as the second argument. \end{itemdescr} @@ -9577,7 +9795,8 @@ \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{std::move(cont)} as the first argument and \tcode{a} +\effects +Initializes \tcode{c} with \tcode{std::move(cont)} as the first argument and \tcode{a} as the second argument. \end{itemdescr} @@ -9587,7 +9806,8 @@ \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{q.c} as the first argument and \tcode{a} as the +\effects +Initializes \tcode{c} with \tcode{q.c} as the first argument and \tcode{a} as the second argument. \end{itemdescr} @@ -9597,13 +9817,14 @@ \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{std::move(q.c)} as the first argument and \tcode{a} +\effects +Initializes \tcode{c} with \tcode{std::move(q.c)} as the first argument and \tcode{a} as the second argument. \end{itemdescr} \rSec3[queue.ops]{Operators} -\indexlibrary{\idxcode{operator==}!\idxcode{queue}}% +\indexlibrarymember{operator==}{queue}% \begin{itemdecl} template bool operator==(const queue& x, const queue& y); @@ -9627,7 +9848,7 @@ \tcode{x.c != y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator<}!\idxcode{queue}}% +\indexlibrarymember{operator<}{queue}% \begin{itemdecl} template bool operator< (const queue& x, const queue& y); @@ -9639,7 +9860,7 @@ \tcode{x.c < y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator>}!\idxcode{queue}}% +\indexlibrarymember{operator>}{queue}% \begin{itemdecl} template bool operator> (const queue& x, const queue& y); @@ -9651,7 +9872,7 @@ \tcode{x.c > y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator<=}!\idxcode{queue}}% +\indexlibrarymember{operator<=}{queue}% \begin{itemdecl} template bool operator<=(const queue& x, const queue& y); @@ -9663,7 +9884,7 @@ \tcode{x.c <= y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator>=}!\idxcode{queue}}% +\indexlibrarymember{operator>=}{queue}% \begin{itemdecl} template bool operator>=(const queue& x, @@ -9676,7 +9897,7 @@ \tcode{x.c >= y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator<=>}!\idxcode{queue}}% +\indexlibrarymember{operator<=>}{queue}% \begin{itemdecl} template compare_three_way_result_t @@ -9703,7 +9924,8 @@ \tcode{is_swappable_v} is \tcode{true}. \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec2[priority.queue]{Class template \tcode{priority_queue}} @@ -9711,7 +9933,7 @@ \rSec3[priqueue.overview]{Overview} \pnum -\indexlibrary{\idxcode{priority_queue}}% +\indexlibraryglobal{priority_queue}% Any sequence container with random access iterator and supporting operations \tcode{front()}, \tcode{push_back()} @@ -9805,7 +10027,7 @@ \rSec3[priqueue.cons]{Constructors} -\indexlibrary{\idxcode{priority_queue}!constructor}% +\indexlibraryctor{priority_queue}% \begin{itemdecl} priority_queue(const Compare& x, const Container& y); priority_queue(const Compare& x, Container&& y); @@ -9827,7 +10049,7 @@ \tcode{make_heap(c.begin(), c.end(), comp)}. \end{itemdescr} -\indexlibrary{\idxcode{priority_queue}!constructor}% +\indexlibraryctor{priority_queue}% \begin{itemdecl} template priority_queue(InputIterator first, InputIterator last, const Compare& x, const Container& y); @@ -9860,27 +10082,29 @@ If \tcode{uses_allocator_v} is \tcode{false} the constructors in this subclause shall not participate in overload resolution. -\indexlibrary{\idxcode{priority_queue}!constructor}% +\indexlibraryctor{priority_queue}% \begin{itemdecl} template explicit priority_queue(const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{a} and value-initializes \tcode{comp}. +\effects +Initializes \tcode{c} with \tcode{a} and value-initializes \tcode{comp}. \end{itemdescr} -\indexlibrary{\idxcode{priority_queue}!constructor}% +\indexlibraryctor{priority_queue}% \begin{itemdecl} template priority_queue(const Compare& compare, const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{a} and initializes \tcode{comp} with \tcode{compare}. +\effects +Initializes \tcode{c} with \tcode{a} and initializes \tcode{comp} with \tcode{compare}. \end{itemdescr} -\indexlibrary{\idxcode{priority_queue}!constructor}% +\indexlibraryctor{priority_queue}% \begin{itemdecl} template priority_queue(const Compare& compare, const Container& cont, const Alloc& a); @@ -9888,12 +10112,13 @@ \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{cont} as the first argument and \tcode{a} as the second +\effects +Initializes \tcode{c} with \tcode{cont} as the first argument and \tcode{a} as the second argument, and initializes \tcode{comp} with \tcode{compare}; calls \tcode{make_heap(c.begin(), c.end(), comp)}. \end{itemdescr} -\indexlibrary{\idxcode{priority_queue}!constructor}% +\indexlibraryctor{priority_queue}% \begin{itemdecl} template priority_queue(const Compare& compare, Container&& cont, const Alloc& a); @@ -9901,36 +10126,39 @@ \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{std::move(cont)} as the first argument and \tcode{a} +\effects +Initializes \tcode{c} with \tcode{std::move(cont)} as the first argument and \tcode{a} as the second argument, and initializes \tcode{comp} with \tcode{compare}; calls \tcode{make_heap(c.begin(), c.end(), comp)}. \end{itemdescr} -\indexlibrary{\idxcode{priority_queue}!constructor}% +\indexlibraryctor{priority_queue}% \begin{itemdecl} template priority_queue(const priority_queue& q, const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{q.c} as the first argument and \tcode{a} as +\effects +Initializes \tcode{c} with \tcode{q.c} as the first argument and \tcode{a} as the second argument, and initializes \tcode{comp} with \tcode{q.comp}. \end{itemdescr} -\indexlibrary{\idxcode{priority_queue}!constructor}% +\indexlibraryctor{priority_queue}% \begin{itemdecl} template priority_queue(priority_queue&& q, const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{std::move(q.c)} as the first argument and \tcode{a} +\effects +Initializes \tcode{c} with \tcode{std::move(q.c)} as the first argument and \tcode{a} as the second argument, and initializes \tcode{comp} with \tcode{std::move(q.comp)}. \end{itemdescr} \rSec3[priqueue.members]{Members} -\indexlibrary{\idxcode{push}!\idxcode{priority_queue}}% +\indexlibrarymember{push}{priority_queue}% \begin{itemdecl} void push(const value_type& x); \end{itemdecl} @@ -9945,7 +10173,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{push}!\idxcode{priority_queue}}% +\indexlibrarymember{push}{priority_queue}% \begin{itemdecl} void push(value_type&& x); \end{itemdecl} @@ -9976,7 +10204,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{pop}!\idxcode{priority_queue}}% +\indexlibrarymember{pop}{priority_queue}% \begin{itemdecl} void pop(); \end{itemdecl} @@ -10007,13 +10235,14 @@ \tcode{is_swappable_v} is \tcode{true}. \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec2[stack]{Class template \tcode{stack}} \pnum -\indexlibrary{\idxcode{stack}}% +\indexlibraryglobal{stack}% Any sequence container supporting operations \tcode{back()}, \tcode{push_back()} @@ -10082,24 +10311,26 @@ \rSec3[stack.cons]{Constructors} -\indexlibrary{\idxcode{stack}!constructor}% +\indexlibraryctor{stack}% \begin{itemdecl} explicit stack(const Container& cont); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{c} with \tcode{cont}. +\effects +Initializes \tcode{c} with \tcode{cont}. \end{itemdescr} -\indexlibrary{\idxcode{stack}!constructor}% +\indexlibraryctor{stack}% \begin{itemdecl} explicit stack(Container&& cont); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{c} with \tcode{std::move(cont)}. +\effects +Initializes \tcode{c} with \tcode{std::move(cont)}. \end{itemdescr} \rSec3[stack.cons.alloc]{Constructors with allocators} @@ -10108,63 +10339,68 @@ If \tcode{uses_allocator_v} is \tcode{false} the constructors in this subclause shall not participate in overload resolution. -\indexlibrary{\idxcode{stack}!constructor}% +\indexlibraryctor{stack}% \begin{itemdecl} template explicit stack(const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{a}. +\effects +Initializes \tcode{c} with \tcode{a}. \end{itemdescr} -\indexlibrary{\idxcode{stack}!constructor}% +\indexlibraryctor{stack}% \begin{itemdecl} template stack(const container_type& cont, const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{cont} as the first argument and \tcode{a} as the +\effects +Initializes \tcode{c} with \tcode{cont} as the first argument and \tcode{a} as the second argument. \end{itemdescr} -\indexlibrary{\idxcode{stack}!constructor}% +\indexlibraryctor{stack}% \begin{itemdecl} template stack(container_type&& cont, const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{std::move(cont)} as the first argument and \tcode{a} +\effects +Initializes \tcode{c} with \tcode{std::move(cont)} as the first argument and \tcode{a} as the second argument. \end{itemdescr} -\indexlibrary{\idxcode{stack}!constructor}% +\indexlibraryctor{stack}% \begin{itemdecl} template stack(const stack& s, const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{s.c} as the first argument and \tcode{a} +\effects +Initializes \tcode{c} with \tcode{s.c} as the first argument and \tcode{a} as the second argument. \end{itemdescr} -\indexlibrary{\idxcode{stack}!constructor}% +\indexlibraryctor{stack}% \begin{itemdecl} template stack(stack&& s, const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Initializes \tcode{c} with \tcode{std::move(s.c)} as the first argument and \tcode{a} +\effects +Initializes \tcode{c} with \tcode{std::move(s.c)} as the first argument and \tcode{a} as the second argument. \end{itemdescr} \rSec3[stack.ops]{Operators} -\indexlibrary{\idxcode{operator==}!\idxcode{stack}}% +\indexlibrarymember{operator==}{stack}% \begin{itemdecl} template bool operator==(const stack& x, const stack& y); @@ -10188,7 +10424,7 @@ \tcode{x.c != y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator<}!\idxcode{stack}}% +\indexlibrarymember{operator<}{stack}% \begin{itemdecl} template bool operator< (const stack& x, const stack& y); @@ -10200,7 +10436,7 @@ \tcode{x.c < y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator>}!\idxcode{stack}}% +\indexlibrarymember{operator>}{stack}% \begin{itemdecl} template bool operator> (const stack& x, const stack& y); @@ -10212,7 +10448,7 @@ \tcode{x.c > y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator<=}!\idxcode{stack}}% +\indexlibrarymember{operator<=}{stack}% \begin{itemdecl} template bool operator<=(const stack& x, const stack& y); @@ -10224,7 +10460,7 @@ \tcode{x.c <= y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator>=}!\idxcode{stack}}% +\indexlibrarymember{operator>=}{stack}% \begin{itemdecl} template bool operator>=(const stack& x, const stack& y); @@ -10236,7 +10472,7 @@ \tcode{x.c >= y.c}. \end{itemdescr} -\indexlibrary{\idxcode{operator<=>}!\idxcode{stack}}% +\indexlibrarymember{operator<=>}{stack}% \begin{itemdecl} template compare_three_way_result_t @@ -10263,7 +10499,8 @@ \tcode{is_swappable_v} is \tcode{true}. \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec1[views]{Views} @@ -10271,11 +10508,11 @@ \rSec2[views.general]{General} \pnum -The header \tcode{} defines the view \tcode{span}. +The header \libheader{span} defines the view \tcode{span}. \rSec2[span.syn]{Header \tcode{} synopsis}% -\indexhdr{span}% +\indexheader{span}% \begin{codeblock} namespace std { // constants @@ -10295,12 +10532,12 @@ as_writable_bytes(span s) noexcept; // \ref{span.tuple}, tuple interface - template class tuple_size; - template class tuple_element; + template struct tuple_size; + template struct tuple_element; template struct tuple_size>; template - struct tuple_size>; // not defined + struct tuple_size>; // \notdef template struct tuple_element>; template @@ -10313,14 +10550,14 @@ \rSec3[span.overview]{Overview} \pnum -\indexlibrary{\idxcode{span}}% +\indexlibraryglobal{span}% A \tcode{span} is a view over a contiguous sequence of objects, the storage of which is owned by some other object. \pnum All member functions of \tcode{span} have constant time complexity. -\indexlibrary{\idxcode{span}}% +\indexlibraryglobal{span}% \begin{codeblock} namespace std { template @@ -10401,8 +10638,8 @@ friend constexpr iterator end(span s) noexcept { return s.end(); } private: - pointer data_; // \expos - index_type size_; // \expos + pointer data_; // \expos + index_type size_; // \expos }; template @@ -10424,7 +10661,7 @@ \rSec3[span.cons]{Constructors, copy, and assignment} -\indexlibrary{\idxcode{span}!constructor}% +\indexlibraryctor{span}% \begin{itemdecl} constexpr span() noexcept; \end{itemdecl} @@ -10439,14 +10676,15 @@ \tcode{size() == 0 \&\& data() == nullptr}. \end{itemdescr} -\indexlibrary{\idxcode{span}!constructor}% +\indexlibraryctor{span}% \begin{itemdecl} constexpr span(pointer ptr, index_type count); \end{itemdecl} \begin{itemdescr} \pnum -\expects \range{ptr}{ptr + count} is a valid range. +\expects +\range{ptr}{ptr + count} is a valid range. If \tcode{extent} is not equal to \tcode{dynamic_extent}, then \tcode{count} is equal to \tcode{extent}. @@ -10463,7 +10701,7 @@ Nothing. \end{itemdescr} -\indexlibrary{\idxcode{span}!constructor}% +\indexlibraryctor{span}% \begin{itemdecl} constexpr span(pointer first, pointer last); \end{itemdecl} @@ -10488,7 +10726,7 @@ Nothing. \end{itemdescr} -\indexlibrary{\idxcode{span}!constructor}% +\indexlibraryctor{span}% \begin{itemdecl} template constexpr span(element_type (&arr)[N]) noexcept; template constexpr span(array& arr) noexcept; @@ -10512,7 +10750,7 @@ \tcode{size() == N \&\& data() == data(arr)}. \end{itemdescr} -\indexlibrary{\idxcode{span}!constructor}% +\indexlibraryctor{span}% \begin{itemdecl} template constexpr span(Container& cont); template constexpr span(const Container& cont); @@ -10547,7 +10785,7 @@ What and when \tcode{data(cont)} and \tcode{size(cont)} throw. \end{itemdescr} -\indexlibrary{\idxcode{span}!constructor}% +\indexlibraryctor{span}% \begin{itemdecl} constexpr span(const span& other) noexcept = default; \end{itemdecl} @@ -10558,7 +10796,7 @@ \tcode{other.size() == size() \&\& other.data() == data()}. \end{itemdescr} -\indexlibrary{\idxcode{span}!constructor}% +\indexlibraryctor{span}% \begin{itemdecl} template constexpr span(const span& s) noexcept; @@ -10582,7 +10820,7 @@ \tcode{size() == s.size() \&\& data() == s.data()}. \end{itemdescr} -\indexlibrary{\idxcode{operator=}!\idxcode{span}}% +\indexlibrarymember{operator=}{span}% \begin{itemdecl} constexpr span& operator=(const span& other) noexcept = default; \end{itemdecl} @@ -10866,7 +11104,7 @@ \begin{itemdescr} \pnum -\returns +\effects Equivalent to: \tcode{return reverse_iterator(begin());} \end{itemdescr} @@ -10919,7 +11157,7 @@ \rSec3[span.objectrep]{Views of object representation} -\indexlibrary{\idxcode{as_bytes}}% +\indexlibraryglobal{as_bytes}% \begin{itemdecl} template span @@ -10932,7 +11170,7 @@ Equivalent to: \tcode{return \{reinterpret_cast(s.data()), s.size_bytes()\};} \end{itemdescr} -\indexlibrary{\idxcode{as_writable_bytes}}% +\indexlibraryglobal{as_writable_bytes}% \begin{itemdecl} template span @@ -10951,14 +11189,14 @@ \rSec3[span.tuple]{Tuple interface} -\indexlibrary{\idxcode{tuple_size}}% +\indexlibraryglobal{tuple_size}% \begin{itemdecl} template struct tuple_size> : integral_constant { }; \end{itemdecl} -\indexlibrary{\idxcode{tuple_element}}% +\indexlibraryglobal{tuple_element}% \begin{itemdecl} template struct tuple_element> { @@ -10972,7 +11210,7 @@ \tcode{Extent != dynamic_extent \&\& I < Extent} is \tcode{true}. \end{itemdescr} -\indexlibrary{\idxcode{get}}% +\indexlibraryglobal{get}% \begin{itemdecl} template constexpr ElementType& get(span s) noexcept; @@ -10985,6 +11223,5 @@ \pnum \returns -A reference to the $\tcode{I}^\text{th}$ element of \tcode{s}, -where indexing is zero-based. +\tcode{s[I]}. \end{itemdescr} diff --git a/source/declarations.tex b/source/declarations.tex index 56eae8421a..968c86ef52 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -6,10 +6,11 @@ \indextext{linkage specification|see{specification, linkage}} +\rSec1[dcl.pre]{Preamble} + \pnum Declarations generally specify how names are to be interpreted. Declarations have the form - \begin{bnf} \nontermdef{declaration-seq}\br declaration\br @@ -93,11 +94,9 @@ A \grammarterm{simple-declaration} or \grammarterm{nodeclspec-function-declaration} of the form - \begin{ncsimplebnf} \opt{attribute-specifier-seq} \opt{decl-specifier-seq} \opt{init-declarator-list} \terminal{;} \end{ncsimplebnf} - is divided into three parts. Attributes are described in~\ref{dcl.attr}. \grammarterm{decl-specifier}{s}, the principal components of @@ -108,10 +107,12 @@ appertains to each of the entities declared by the \grammarterm{declarator}{s} of the \grammarterm{init-declarator-list}. -\begin{note} In the declaration for an entity, attributes appertaining to that +\begin{note} +In the declaration for an entity, attributes appertaining to that entity may appear at the start of the declaration and after the \grammarterm{declarator-id} for that declaration. -\end{note} \begin{example} +\end{note} +\begin{example} \begin{codeblock} [[noreturn]] void f [[noreturn]] (); // OK \end{codeblock} @@ -174,10 +175,10 @@ source character set\iref{lex.charset} are not required to appear in the diagnostic message. \begin{example} - \begin{codeblock} static_assert(sizeof(int) == sizeof(void*), "wrong pointer size"); -\end{codeblock}\end{example} +\end{codeblock} +\end{example} \pnum An \grammarterm{empty-declaration} has no effect. @@ -247,7 +248,6 @@ \pnum \indextext{specifier!declaration}% The specifiers that can be used in a declaration are - \begin{bnf} \nontermdef{decl-specifier}\br storage-class-specifier\br @@ -334,7 +334,6 @@ \pnum The storage class specifiers are - \begin{bnf} \nontermdef{storage-class-specifier}\br \keyword{static}\br @@ -581,18 +580,14 @@ declaration\iref{class.name} or enum declaration\iref{dcl.enum} does. \begin{example} After - \begin{codeblock} typedef int MILES, *KLICKSP; \end{codeblock} - the constructions - \begin{codeblock} MILES distance; extern KLICKSP metricp; \end{codeblock} - are all correct declarations; the type of \tcode{distance} is \tcode{int} and that of \tcode{metricp} is ``pointer to \tcode{int}''. \end{example} @@ -607,14 +602,12 @@ semantics as if it were introduced by the \tcode{typedef} specifier. In particular, it does not define a new type. \begin{example} - \begin{codeblock} using handler_t = void (*)(int); extern handler_t ignore; extern void (*ignore)(int); // redeclare \tcode{ignore} using cell = pair; // ill-formed \end{codeblock} - \end{example} The \grammarterm{defining-type-specifier-seq} of the \grammarterm{defining-type-id} shall not define @@ -627,7 +620,6 @@ redeclare the name of any type declared in that scope to refer to the type to which it already refers. \begin{example} - \begin{codeblock} typedef struct s { @\commentellip@ } s; typedef int I; @@ -642,7 +634,6 @@ also a \grammarterm{typedef-name} to refer to the type to which it already refers. \begin{example} - \begin{codeblock} struct S { typedef struct A { } A; // OK @@ -657,7 +648,8 @@ entity that can be referenced using an \grammarterm{elaborated-type-specifier}, the entity can continue to be referenced by an \grammarterm{elaborated-type-specifier} or as an enumeration or class name -in an enumeration or class definition respectively. \begin{example} +in an enumeration or class definition respectively. +\begin{example} \begin{codeblock} struct S; typedef struct S S; @@ -787,7 +779,8 @@ with respect to the \tcode{constexpr} or \tcode{consteval} specifier. \end{note} \begin{note} -Function parameters cannot be declared \tcode{constexpr}.\end{note} +Function parameters cannot be declared \tcode{constexpr}. +\end{note} \begin{example} \begin{codeblock} constexpr void square(int &x); // OK: declaration @@ -825,11 +818,10 @@ shall not be declared with the \tcode{consteval} specifier. \pnum -\indextext{specifier!\idxcode{constexpr}!function} -\indextext{constexpr function} +\indextext{specifier!\idxcode{constexpr}!function}% +\indextext{constexpr function}% The definition of a constexpr function shall satisfy the following requirements: - \begin{itemize} \item its return type (if any) shall be a literal type; @@ -1127,7 +1119,6 @@ \pnum The type-specifiers are - \indextext{type!\idxcode{const}}% \indextext{type!\idxcode{volatile}}% % @@ -1177,7 +1168,6 @@ is allowed in a \grammarterm{type-specifier-seq}. The only exceptions to this rule are the following: - \begin{itemize} \item \tcode{const} can be combined with any type specifier except itself. @@ -1236,8 +1226,11 @@ \ref{basic.type.qualifier} and \ref{dcl.fct} describe how cv-qualifiers affect object and function types. \end{note} -Redundant cv-qualifications are ignored. \begin{note} For example, -these could be introduced by typedefs.\end{note} +Redundant cv-qualifications are ignored. +\begin{note} +For example, +these could be introduced by typedefs. +\end{note} \pnum \begin{note} @@ -1329,7 +1322,6 @@ \pnum The simple type specifiers are - \begin{bnf} \nontermdef{simple-type-specifier}\br \opt{nested-name-specifier} type-name\br @@ -1526,11 +1518,9 @@ \begin{note} This implies that, within a class template with a template \grammarterm{type-parameter} \tcode{T}, the declaration - \begin{codeblock} friend class T; \end{codeblock} - is ill-formed. However, the similar declaration \tcode{friend T;} is allowed\iref{class.friend}. \end{note} @@ -1550,8 +1540,8 @@ and either the \tcode{class} or \tcode{struct} \grammarterm{class-key} shall be used to refer to a class\iref{class} declared using the \tcode{class} or \tcode{struct} -\grammarterm{class-key}. \begin{example} - +\grammarterm{class-key}. +\begin{example} \begin{codeblock} enum class E { a, b }; enum E x = E::a; // OK @@ -1571,7 +1561,6 @@ \pnum \indextext{type specifier!\idxcode{decltype}}% For an expression \tcode{e}, the type denoted by \tcode{decltype(e)} is defined as follows: - \begin{itemize} \item if \tcode{e} is an unparenthesized \grammarterm{id-expression} naming a structured binding\iref{dcl.struct.bind}, @@ -1725,11 +1714,9 @@ be followed by a non-empty \grammarterm{initializer}. In an \grammarterm{initializer} of the form - \begin{codeblock} ( @\textrm{\grammarterm{expression-list}}@ ) \end{codeblock} - the \grammarterm{expression-list} shall be a single \grammarterm{assignment-expression}. \begin{example} @@ -1830,10 +1817,12 @@ that is a function or function template with a placeholder in its declared type occurs when the definition is instantiated even if the function body contains a \tcode{return} statement with a non-type-dependent operand. -\begin{note} Therefore, any use of a specialization of the function template will +\begin{note} +Therefore, any use of a specialization of the function template will cause an implicit instantiation. Any errors that arise from this instantiation are not in the immediate context of the function type and can result in the -program being ill-formed\iref{temp.deduct}. \end{note} +program being ill-formed\iref{temp.deduct}. +\end{note} \begin{example} \begin{codeblock} template auto f(T t) { return t; } // return type deduced at instantiation time @@ -1875,6 +1864,12 @@ friend T frf(T); }; auto frf(int i) { return i; } // not a friend of \tcode{A} +extern int v; +auto v = 17; // OK, redeclares \tcode{v} +struct S { + static int i; +}; +auto S::i = 23; // OK \end{codeblock} \end{example} @@ -1913,7 +1908,6 @@ A type \tcode{T} containing a placeholder type, and a corresponding initializer \tcode{e}, are determined as follows: - \begin{itemize} \item for a non-discarded \tcode{return} statement that occurs @@ -1998,7 +1992,8 @@ placeholder alone. The type deduced for \tcode{T} is determined as described in~\ref{dcl.type.simple}, as though \tcode{e} had -been the operand of the \tcode{decltype}. \begin{example} +been the operand of the \tcode{decltype}. +\begin{example} \begin{codeblock} int i; int&& f(); @@ -2018,10 +2013,11 @@ \end{example} \pnum -For a \grammarterm{placeholder-type-specifier} with -a \grammarterm{type-constraint}, -if the type deduced for the placeholder does not satisfy its -immediately-declared constraint\iref{temp}, the program is ill-formed. +For a \grammarterm{placeholder-type-specifier} +with a \grammarterm{type-constraint}, +the immediately-declared constraint\iref{temp} +of the \grammarterm{type-constraint} for the type deduced for the placeholder +shall be satisfied. \rSec3[dcl.type.class.deduct]{Deduced class template specialization types} \indextext{deduction!class template arguments}% @@ -2038,8 +2034,8 @@ template struct A { A(T...) {} }; -A x[29]{}; // error: no declarator operators allowed -const A& y{}; // error: no declarator operators allowed +A x[29]{}; // error: no declarator operators allowed +const A& y{}; // error: no declarator operators allowed \end{codeblock} \end{example} The placeholder is replaced by the return type @@ -2409,7 +2405,6 @@ in its syntactic context shall be considered a \grammarterm{type-id}. \begin{example} - \begin{codeblock} template struct X {}; template struct Y {}; @@ -2446,7 +2441,6 @@ rather than a \grammarterm{declarator-id}. \begin{example} - \begin{codeblock} class C { }; void f(int(C)) { } // \tcode{void f(int(*fp)(C c)) \{ \}} @@ -2461,7 +2455,6 @@ \end{codeblock} For another example, - \begin{codeblock} class C { }; void h(int *(C[10])); // \tcode{void h(int *(*_fp)(C _parm[10]));} @@ -2533,11 +2526,9 @@ \pnum Thus, a declaration of a particular identifier has the form - \begin{codeblock} T D \end{codeblock} - where \tcode{T} is of the form \opt{\grammarterm{attribute-specifier-seq}} @@ -2555,11 +2546,9 @@ \grammarterm{decl-specifier-seq} determines a type. In a declaration - \begin{codeblock} T D \end{codeblock} - the \grammarterm{decl-specifier-seq} \tcode{T} @@ -2567,11 +2556,9 @@ \tcode{T}. \begin{example} In the declaration - \begin{codeblock} int unsigned i; \end{codeblock} - the type specifiers \tcode{int} \tcode{unsigned} @@ -2596,11 +2583,9 @@ where \tcode{D} has the form - \begin{ncsimplebnf} \terminal{(} \terminal{D1} \terminal{)} \end{ncsimplebnf} - the type of the contained \grammarterm{declarator-id} is the same as that of the contained @@ -2624,11 +2609,9 @@ where \tcode{D} has the form - \begin{ncsimplebnf} \terminal{*} \opt{attribute-specifier-seq} \opt{cv-qualifier-seq} \terminal{D1} \end{ncsimplebnf} - and the type of the identifier in the declaration \tcode{T} \tcode{D1} @@ -2652,7 +2635,6 @@ const int ci = 10, *pc = &ci, *const cpc = pc, **ppc; int i, *p, *const cp = &i; \end{codeblock} - declare \tcode{ci}, a constant integer; @@ -2680,7 +2662,6 @@ \tcode{cp}. Examples of some correct operations are - \begin{codeblock} i = ci; *cp = ci; @@ -2691,7 +2672,6 @@ \end{codeblock} Examples of ill-formed operations are - \begin{codeblock} ci = 1; // error ci++; // error @@ -2705,7 +2685,6 @@ Each is unacceptable because it would either change the value of an object declared \tcode{const} or allow it to be changed through a cv-unqualified pointer later, for example: - \begin{codeblock} *ppc = &ci; // OK, but would make \tcode{p} point to \tcode{ci} because of previous error *p = 5; // clobber \tcode{ci} @@ -2735,12 +2714,10 @@ where \tcode{D} has either of the forms - \begin{ncsimplebnf} \terminal{\&} \opt{attribute-specifier-seq} \terminal{D1}\br \terminal{\&\&} \opt{attribute-specifier-seq} \terminal{D1} \end{ncsimplebnf} - and the type of the identifier in the declaration \tcode{T} \tcode{D1} @@ -2757,7 +2734,6 @@ \grammarterm{decltype-specifier}\iref{dcl.type.simple}, in which case the cv-qualifiers are ignored. \begin{example} - \begin{codeblock} typedef int& A; const A aref = 3; // ill-formed; lvalue reference to non-\tcode{const} initialized with rvalue @@ -2789,14 +2765,12 @@ \indextext{declaration!reference}% \indextext{parameter!reference}% \begin{example} - \begin{codeblock} void f(double& a) { a += 3.14; } // ... double d = 0; f(d); \end{codeblock} - declares \tcode{a} to be a reference parameter of @@ -2815,7 +2789,6 @@ // ... g(3) = 7; \end{codeblock} - declares the function \tcode{g()} to return a reference to an integer so @@ -2825,7 +2798,6 @@ to the fourth element of the array \tcode{v}. For another example, - \begin{codeblock} struct link { link* next; @@ -2844,7 +2816,6 @@ h(q); } \end{codeblock} - declares \tcode{p} to be a reference to a pointer to @@ -2891,9 +2862,10 @@ is a reference to a type \tcode{T}, an attempt to create the type ``lvalue reference to \cv{}~\tcode{TR}'' creates the type ``lvalue reference to \tcode{T}'', while an attempt to create the type ``rvalue reference to \cv{}~\tcode{TR}'' creates the type \tcode{TR}. -\begin{note} This rule is known as reference collapsing. \end{note} +\begin{note} +This rule is known as reference collapsing. +\end{note} \begin{example} - \begin{codeblock} int i; typedef int& LRI; @@ -2912,7 +2884,8 @@ \end{example} \pnum -\begin{note} Forming a reference to function type is ill-formed if the function +\begin{note} +Forming a reference to function type is ill-formed if the function type has \grammarterm{cv-qualifier}{s} or a \grammarterm{ref-qualifier}; see~\ref{dcl.fct}. \end{note} @@ -2928,11 +2901,9 @@ where \tcode{D} has the form - \begin{ncsimplebnf} nested-name-specifier \terminal{*} \opt{attribute-specifier-seq} \opt{cv-qualifier-seq} \terminal{D1} \end{ncsimplebnf} - and the \grammarterm{nested-name-specifier} denotes a class, @@ -2963,7 +2934,6 @@ double X::* pmd; char Y::* pmc; \end{codeblock} - declares \tcode{pmi}, \tcode{pmf}, @@ -3031,11 +3001,9 @@ \pnum In a declaration \tcode{T} \tcode{D} where \tcode{D} has the form - \begin{ncsimplebnf} \terminal{D1} \terminal{[} \opt{constant-expression} \terminal{]} \opt{attribute-specifier-seq} \end{ncsimplebnf} - and the type of the contained \grammarterm{declarator-id} in the declaration \tcode{T} \tcode{D1} is ``\placeholder{derived-declarator-type-list} \tcode{T}'', @@ -3050,11 +3018,9 @@ \pnum In a declaration \tcode{T} \tcode{D} where \tcode{D} has the form - \begin{ncsimplebnf} \terminal{D1 [ ]} \opt{attribute-specifier-seq} \end{ncsimplebnf} - and the type of the contained \grammarterm{declarator-id} in the declaration \tcode{T} \tcode{D1} is ``\placeholder{derived-declarator-type-list} \tcode{T}'', @@ -3278,12 +3244,10 @@ where \tcode{D} has the form - \begin{ncsimplebnf} \terminal{D1} \terminal{(} parameter-declaration-clause \terminal{)} \opt{cv-qualifier-seq}\br \bnfindent\opt{ref-qualifier} \opt{noexcept-specifier} \opt{attribute-specifier-seq} trailing-return-type \end{ncsimplebnf} - and the type of the contained \grammarterm{declarator-id} in the declaration @@ -3380,11 +3344,9 @@ ``\tcode{...}''. \begin{example} The declaration - \begin{codeblock} int printf(const char*, ...); \end{codeblock} - declares a function that can be called with varying numbers and types of arguments. \begin{codeblock} @@ -3398,9 +3360,7 @@ \tcode{char*}. \end{example} \begin{note} -The standard header -\tcode{} -\indexhdr{cstdarg}% +The standard header \libheaderref{cstdarg} contains a mechanism for accessing arguments passed using the ellipsis (see~\ref{expr.call} and~\ref{support.runtime}). \end{note} @@ -3428,9 +3388,11 @@ and the presence or absence of the ellipsis or a function parameter pack is the function's \defn{parameter-type-list}. -\begin{note} This transformation does not affect the types of the parameters. +\begin{note} +This transformation does not affect the types of the parameters. For example, \tcode{int(*)(const int p, decltype(p)*)} and -\tcode{int(*)(int, const int*)} are identical types. \end{note} +\tcode{int(*)(int, const int*)} are identical types. +\end{note} \pnum A function type with a \grammarterm{cv-qualifier-seq} or a @@ -3452,7 +3414,6 @@ \grammarterm{type-parameter}\iref{temp.arg.type}. \end{itemize} \begin{example} - \begin{codeblock} typedef int FIC(int) const; FIC f; // ill-formed: does not declare a member function @@ -3469,10 +3430,11 @@ in a function declarator is not the same as adding cv-qualification on top of the function type. In the latter case, the cv-qualifiers are ignored. -\begin{note} A function type that has a \grammarterm{cv-qualifier-seq} is not a -cv-qualified type; there are no cv-qualified function types. \end{note} +\begin{note} +A function type that has a \grammarterm{cv-qualifier-seq} is not a +cv-qualified type; there are no cv-qualified function types. +\end{note} \begin{example} - \begin{codeblock} typedef void F(); struct S { @@ -3496,11 +3458,9 @@ \pnum \begin{example} The declaration - \begin{codeblock} int fseek(FILE*, long, int); \end{codeblock} - declares a function taking three arguments of the specified types, and returning \tcode{int}\iref{dcl.type}. @@ -3533,7 +3493,6 @@ A typedef of function type may be used to declare a function but shall not be used to define a function\iref{dcl.fct.def}. \begin{example} - \begin{codeblock} typedef void F(); F fv; // OK: equivalent to \tcode{void fv();} @@ -3557,7 +3516,6 @@ \pnum \begin{example} The declaration - \begin{codeblock} int i, *pi, @@ -3566,7 +3524,6 @@ (*pif)(const char*, const char*), (*fpif(int))(int); \end{codeblock} - declares an integer \tcode{i}, a pointer @@ -3610,26 +3567,20 @@ the function \tcode{fpif} above could have been declared - \begin{codeblock} typedef int IFUNC(int); IFUNC* fpif(int); \end{codeblock} - or - \begin{codeblock} auto fpif(int)->int(*)(int); \end{codeblock} A \grammarterm{trailing-return-type} is most useful for a type that would be more complicated to specify before the \grammarterm{declarator-id}: - \begin{codeblock} template auto add(T t, U u) -> decltype(t + u); \end{codeblock} - rather than - \begin{codeblock} template decltype((*(T*)0) + (*(U*)0)) add(T t, U u); \end{codeblock} @@ -3637,7 +3588,10 @@ \pnum A \term{non-template function} is a function that is not a function template -specialization. \begin{note} A function template is not a function. \end{note} +specialization. +\begin{note} +A function template is not a function. +\end{note} \pnum \indextext{abbreviated!template function|see{template, function, abbreviated}}% @@ -3780,15 +3734,12 @@ \indextext{argument!example of default}% \begin{example} The declaration - \begin{codeblock} void point(int = 3, int = 4); \end{codeblock} - declares a function that can be called with zero, one, or two arguments of type \tcode{int}. It can be called in any of these ways: - \begin{codeblock} point(1,2); point(1); point(); \end{codeblock} @@ -3971,7 +3922,6 @@ may not appear in a default argument of a member function; see~\ref{expr.prim.this}. \begin{example} - \begin{codeblock} class A { void f(A* p = this) { } // error @@ -4059,7 +4009,6 @@ An overriding function in a derived class does not acquire default arguments from the function it overrides. \begin{example} - \begin{codeblock} struct A { virtual void f(int a = 7); @@ -4074,7 +4023,7 @@ pb->f(); // error: wrong number of arguments for \tcode{B::f()} } \end{codeblock} -\end{example}% +\end{example} \indextext{declaration!default argument|)}% \indextext{declarator!meaning of|)} @@ -4157,7 +4106,6 @@ variables and functions, regardless of the variable's storage duration. \begin{example} - \begin{codeblock} int f(int); int a = 2; @@ -4191,7 +4139,6 @@ an object or reference of type \tcode{T} means: - \begin{itemize} \item if @@ -4270,7 +4217,6 @@ default-initialization of \tcode{T} would invoke a user-provided constructor of \tcode{T} (not inherited from a base class) or if - \begin{itemize} \item each direct non-variant non-static data member \tcode{M} of \tcode{T} @@ -4298,7 +4244,6 @@ an object of type \tcode{T} means: - \begin{itemize} \item if @@ -4332,7 +4277,8 @@ of reference type is ill-formed. \pnum -\begin{note} For every object of static storage duration, +\begin{note} +For every object of static storage duration, static initialization\iref{basic.start.static} is performed at program startup before any other initialization takes place. In some cases, additional initialization is done later. @@ -4350,11 +4296,9 @@ \tcode{()} is not permitted by the syntax for \grammarterm{initializer}, - \begin{codeblock} X a(); \end{codeblock} - is not the declaration of an object of class \tcode{X}, but the declaration of a function taking no argument and returning an @@ -4740,9 +4684,11 @@ and a narrowing conversion\iref{dcl.init.list} is required to convert the expression, the program is ill-formed. -\begin{note} If an initializer is itself an initializer list, +\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. \end{note} +of the rules in this subclause if the element is an aggregate. +\end{note} \begin{example} \begin{codeblock} struct A { @@ -4812,12 +4758,10 @@ is copy-initialized from an empty initializer list. \end{itemize} \begin{example} - \begin{codeblock} struct S { int a; const char* b; int c; int d = b[a]; }; S ss = { 1, "asdf" }; \end{codeblock} - initializes \tcode{ss.a} with 1, @@ -4828,13 +4772,11 @@ \tcode{int\{\}} (that is, \tcode{0}), and \tcode{ss.d} with the value of \tcode{ss.b[ss.a]} (that is, \tcode{'s'}), and in - \begin{codeblock} struct X { int i, j, k = 42; }; X a[] = { 1, 2, 3, 4, 5, 6 }; X b[2] = { { 1, 2, 3 }, { 4, 5, 6 } }; \end{codeblock} - \tcode{a} and \tcode{b} have the same value \begin{codeblock} @@ -4886,11 +4828,9 @@ \tcode{n} elements\iref{dcl.array}. \begin{example} - \begin{codeblock} int x[] = { 1, 3, 5 }; \end{codeblock} - declares and initializes \tcode{x} as a one-dimensional array that has three elements @@ -4923,7 +4863,6 @@ unnamed bit-fields are not considered elements of the aggregate. \begin{example} - \begin{codeblock} struct A { int i; @@ -4949,11 +4888,9 @@ \grammarterm{initializer-clause}{s} exceeds the number of elements of the aggregate. \begin{example} - \begin{codeblock} char cv[4] = { 'a', 's', 'd', 'f', 0 }; // error \end{codeblock} - is ill-formed. \end{example} @@ -4964,17 +4901,17 @@ the program is ill-formed. \begin{example} \begin{codeblock} - struct A; - extern A a; - struct A { - const A& a1 { A{a,a} }; // OK - const A& a2 { A{} }; // error - }; - A a{a,a}; // OK +struct A; +extern A a; +struct A { + const A& a1 { A{a,a} }; // OK + const A& a2 { A{} }; // error +}; +A a{a,a}; // OK - struct B { - int n = B{}.n; // error - }; +struct B { + int n = B{}.n; // error +}; \end{codeblock} \end{example} @@ -5011,11 +4948,9 @@ initialize the elements with the last (rightmost) index of the array varying the fastest\iref{dcl.array}. \begin{example} - \begin{codeblock} int x[2][2] = { 3, 1, 4, 2 }; \end{codeblock} - initializes \tcode{x[0][0]} to @@ -5031,13 +4966,11 @@ to \tcode{2}. On the other hand, - \begin{codeblock} float y[4][3] = { { 1 }, { 2 }, { 3 }, { 4 } }; \end{codeblock} - initializes the first column of \tcode{y} (regarded as a two-dimensional array) @@ -5068,7 +5001,6 @@ are left to initialize the next element of the aggregate of which the current subaggregate is an element. \begin{example} - \begin{codeblock} float y[4][3] = { { 1, 3, 5 }, @@ -5076,7 +5008,6 @@ { 3, 5, 7 }, }; \end{codeblock} - is a completely-braced initialization: 1, 3, and 5 initialize the first row of the array \tcode{y[0]}, @@ -5104,7 +5035,6 @@ has the same effect as the completely-braced \grammarterm{initializer-list} of the above example, - \begin{codeblock} float y[4][3] = { 1, 3, 5, 2, 4, 6, 3, 5, 7 @@ -5133,13 +5063,14 @@ brace elision is assumed and the \grammarterm{assignment-expression} is considered for the initialization of the first element of the subaggregate. -\begin{note} As specified above, brace elision cannot apply to +\begin{note} +As specified above, brace elision cannot apply to subaggregates with no elements; an \grammarterm{initializer-clause} for the entire subobject is -required.\end{note} +required. +\end{note} \begin{example} - \begin{codeblock} struct A { int i; @@ -5233,11 +5164,9 @@ value of the string literal initialize the elements of the array. \begin{example} - \begin{codeblock} char msg[] = "Syntax error on line %s\n"; \end{codeblock} - shows a character array whose members are initialized with a \grammarterm{string-literal}. @@ -5255,11 +5184,9 @@ \pnum There shall not be more initializers than there are array elements. \begin{example} - \begin{codeblock} char cv[4] = "asdf"; // error \end{codeblock} - is ill-formed since there is no space for the implied trailing \tcode{'\textbackslash 0'}. \end{example} @@ -5276,7 +5203,6 @@ ``reference to type \tcode{T}''\iref{dcl.ref} shall be initialized. \begin{example} - \begin{codeblock} int g(int) noexcept; void f() { @@ -5313,7 +5239,6 @@ specifier is explicitly used. \indextext{declaration!extern@\tcode{extern} reference}% \begin{example} - \begin{codeblock} int& r1; // error: initializer missing extern int& r2; // OK @@ -5344,7 +5269,6 @@ \begin{itemize} \item If the reference is an lvalue reference and the initializer expression - \begin{itemize} \item is an lvalue (but is not a @@ -5374,7 +5298,6 @@ \end{note} \begin{example} - \begin{codeblock} double d = 2.0; double& rd = d; // \tcode{rd} refers to \tcode{d} @@ -5394,7 +5317,6 @@ type that is not const-qualified or is volatile-qualified, the program is ill-formed. \begin{example} - \begin{codeblock} double& rd2 = 2.0; // error: not an lvalue and reference not \tcode{const} int i = 2; @@ -5403,7 +5325,6 @@ \end{example} \item Otherwise, if the initializer expression - \begin{itemize} \item is an rvalue (but not a bit-field) or function lvalue and ``\cvqual{cv1} \tcode{T1}'' is @@ -5414,9 +5335,7 @@ an rvalue or function lvalue of type ``\cvqual{cv3} \tcode{T3}'', where ``\cvqual{cv1} \tcode{T1}'' is reference-compatible with ``\cvqual{cv3} \tcode{T3}'' (see~\ref{over.match.ref}), - \end{itemize} - then the value of the initializer expression in the first case and the result of the conversion in the second case @@ -5429,7 +5348,6 @@ (or to an appropriate base class subobject). \begin{example} - \begin{codeblock} struct A { }; struct B : A { } b; @@ -5542,9 +5460,9 @@ List-initialization can occur in direct-initialization or copy-initialization contexts; list-initialization in a direct-initialization context is called \defn{direct-list-initialization} and list-initialization in a -copy-initialization context is called \defn{copy-list-initialization}. \begin{note} +copy-initialization context is called \defn{copy-list-initialization}. +\begin{note} List-initialization can be used - \begin{itemize} \item as the initializer in a variable definition\iref{dcl.init} \item as the initializer in a \grammarterm{new-expression}\iref{expr.new} @@ -5569,18 +5487,21 @@ x = double{1}; // explicitly construct a \tcode{double} std::map anim = { {"bear",4}, {"cassowary",2}, {"tiger",7} }; \end{codeblock} -\end{example} \end{note} +\end{example} +\end{note} \pnum A constructor is an \defn{initializer-list constructor} if its first parameter is of type \tcode{std::initializer_list} or reference to possibly cv-qualified \tcode{std::initializer_list} for some type \tcode{E}, and either there are no other parameters or else all other parameters have default arguments\iref{dcl.fct.default}. -\begin{note} Initializer-list constructors are favored over other constructors in +\begin{note} +Initializer-list constructors are favored over other constructors in list-initialization\iref{over.match.list}. Passing an initializer list as the argument to the constructor template \tcode{template C(T)} of a class \tcode{C} does not create an initializer-list constructor, because an initializer list argument causes the -corresponding parameter to be a non-deduced context\iref{temp.deduct.call}. \end{note} +corresponding parameter to be a non-deduced context\iref{temp.deduct.call}. +\end{note} The template \tcode{std::initializer_list} is not predefined; if the header \tcode{} is not included prior to a use of @@ -5738,8 +5659,10 @@ in which case the type of the temporary is the type of \tcode{x} in the declaration \tcode{U x[] $H$}, where $H$ is the initializer list. -\begin{note} As usual, the binding will fail and the program is ill-formed if -the reference type is an lvalue reference to a non-const type. \end{note} +\begin{note} +As usual, the binding will fail and the program is ill-formed if +the reference type is an lvalue reference to a non-const type. +\end{note} \begin{example} \begin{codeblock} @@ -5803,11 +5726,13 @@ given \grammarterm{initializer-clause} is sequenced before every value computation and side effect associated with any \grammarterm{initializer-clause} that follows it in the comma-separated list of the \grammarterm{initializer-list}. -\begin{note} This evaluation ordering holds regardless of the semantics of the +\begin{note} +This evaluation ordering holds regardless of the semantics of the initialization; for example, it applies when the elements of the \grammarterm{initializer-list} are interpreted as arguments of a constructor call, even though ordinarily there are no sequencing constraints on the -arguments of a call. \end{note} +arguments of a call. +\end{note} \pnum An object of type \tcode{std::initializer_list} is constructed from @@ -5818,10 +5743,12 @@ initializer list. Each element of that array is copy-initialized with the corresponding element of the initializer list, and the \tcode{std::initializer_list} object is constructed to refer to that array. -\begin{note} A constructor or conversion function selected for the copy shall be +\begin{note} +A constructor or conversion function selected for the copy shall be accessible\iref{class.access} in the context of the initializer list. \end{note} -If a narrowing conversion is required to initialize any of the elements, the program is ill-formed. \begin{example} +If a narrowing conversion is required to initialize any of the elements, the program is ill-formed. +\begin{example} \begin{codeblock} struct X { X(std::initializer_list v); @@ -5830,13 +5757,12 @@ \end{codeblock} The initialization will be implemented in a way roughly equivalent to this: - \begin{codeblock} const double __a[3] = {double{1}, double{2}, double{3}}; X x(std::initializer_list(__a, __a+3)); \end{codeblock} - -assuming that the implementation can construct an \tcode{initializer_list} object with a pair of pointers. \end{example} +assuming that the implementation can construct an \tcode{initializer_list} object with a pair of pointers. +\end{example} \pnum The array has the same lifetime as any other temporary @@ -5844,7 +5770,6 @@ \tcode{initiali\-zer_list} object from the array extends the lifetime of the array exactly like binding a reference to a temporary. \begin{example} - \begin{codeblock} typedef std::complex cmplx; std::vector v1 = { 1, 2, 3 }; @@ -5871,14 +5796,14 @@ ill-formed\iref{class.base.init}. \end{example} \begin{note} -The implementation is free to allocate the array in read-only memory if an explicit array with the same initializer could be so allocated. \end{note} +The implementation is free to allocate the array in read-only memory if an explicit array with the same initializer could be so allocated. +\end{note} \pnum A \indextext{narrowing conversion}% \indextext{conversion!narrowing}% \term{narrowing conversion} is an implicit conversion - \begin{itemize} \item from a floating-point type to an integer type, or @@ -5898,9 +5823,11 @@ expression whose value after integral promotions will fit into the target type. \end{itemize} -\begin{note} As indicated above, such conversions are not allowed at the top level in -list-initializations.\end{note} \begin{example} - +\begin{note} +As indicated above, such conversions are not allowed at the top level in +list-initializations. +\end{note} +\begin{example} \begin{codeblock} int x = 999; // \tcode{x} is not a constant expression const int y = 999; @@ -5920,7 +5847,7 @@ int f(int); int a[] = { 2, f(2), f(2.0) }; // OK: the \tcode{double}-to-\tcode{int} conversion is not at the top level \end{codeblock} -\end{example}% +\end{example} \indextext{initialization!list-initialization|)}% \indextext{initialization|)}% \indextext{declarator|)} @@ -5933,7 +5860,6 @@ \pnum \indextext{body!function}% Function definitions have the form - \indextext{\idxgram{function-definition}}% % \begin{bnf} @@ -5973,7 +5899,6 @@ \pnum \begin{example} A simple example of a complete function definition is - \begin{codeblock} int max(int a, int b, int c) { int m = (a > b) ? a : b; @@ -6061,7 +5986,6 @@ \tcode{= default ;} is called an \defnx{explicitly-defaulted}{definition!function!explicitly-defaulted} definition. A function that is explicitly defaulted shall - \begin{itemize} \item be a special member function or a comparison operator (\ref{expr.spaceship}, \ref{expr.rel}, \ref{expr.eq}), and @@ -6156,11 +6080,11 @@ Declaring a function as defaulted after its first declaration can provide efficient execution and concise definition while enabling a stable binary interface to an evolving code -base.\end{note} +base. +\end{note} \pnum \begin{example} - \begin{codeblock} struct trivial { trivial() = default; @@ -6191,16 +6115,20 @@ \pnum A program that refers to a deleted function implicitly or explicitly, other -than to declare it, is ill-formed. \begin{note} This includes calling the function +than to declare it, is ill-formed. +\begin{note} +This includes calling the function implicitly or explicitly and forming a pointer or pointer-to-member to the function. It applies even for references in expressions that are not potentially-evaluated. If a function is overloaded, it is referenced only if the function is selected by overload resolution. The implicit odr-use\iref{basic.def.odr} of a virtual function does not, by itself, -constitute a reference. \end{note} +constitute a reference. +\end{note} \pnum -\begin{example} One can prevent default initialization and +\begin{example} +One can prevent default initialization and initialization by non-\tcode{double}s with \begin{codeblock} struct onlydouble { @@ -6245,8 +6173,11 @@ \end{example} \pnum -A deleted function is implicitly an inline function\iref{dcl.inline}. \begin{note} The -one-definition rule\iref{basic.def.odr} applies to deleted definitions. \end{note} +A deleted function is implicitly an inline function\iref{dcl.inline}. +\begin{note} +The +one-definition rule\iref{basic.def.odr} applies to deleted definitions. +\end{note} A deleted definition of a function shall be the first declaration of the function or, for an explicit specialization of a function template, the first declaration of that specialization. @@ -6259,7 +6190,7 @@ }; sometype::sometype() = delete; // ill-formed; not first declaration \end{codeblock} -\end{example}% +\end{example} \indextext{definition!function|)} \rSec2[dcl.fct.def.coroutine]{Coroutine definitions}% @@ -6542,21 +6473,17 @@ \grammarterm{assignment-expression} in the \grammarterm{initializer} has array type \tcode{A} and no \grammarterm{ref-qualifier} is present, \exposid{e} is defined by - \begin{ncbnf} \opt{attribute-specifier-seq} \placeholder{S} \cv{} \terminal{A} \exposid{e} \terminal{;} \end{ncbnf} - and each element is copy-initialized or direct-initialized from the corresponding element of the \grammarterm{assignment-expression} as specified by the form of the \grammarterm{initializer}. Otherwise, \exposid{e} is defined as-if by - \begin{ncbnf} \opt{attribute-specifier-seq} decl-specifier-seq \opt{ref-qualifier} \exposid{e} initializer \terminal{;} \end{ncbnf} - where the declaration is never interpreted as a function declaration and the parts of the declaration other than the \grammarterm{declarator-id} are taken @@ -6583,9 +6510,9 @@ \end{note} \begin{example} \begin{codeblock} - auto f() -> int(&)[2]; - auto [ x, y ] = f(); // \tcode{x} and \tcode{y} refer to elements in a copy of the array return value - auto& [ xr, yr ] = f(); // \tcode{xr} and \tcode{yr} refer to elements in the array referred to by \tcode{f}'s return value +auto f() -> int(&)[2]; +auto [ x, y ] = f(); // \tcode{x} and \tcode{y} refer to elements in a copy of the array return value +auto& [ xr, yr ] = f(); // \tcode{xr} and \tcode{yr} refer to elements in the array referred to by \tcode{f}'s return value \end{codeblock} \end{example} @@ -6733,15 +6660,16 @@ ``\tcode{enum} \opt{\grammarterm{nested-name-specifier}} \grammarterm{identifier}'' within the \grammarterm{decl-specifier-seq} of a \grammarterm{member-declaration} is parsed as part of an \grammarterm{enum-base}. -\begin{note} This resolves a potential ambiguity between the declaration of an enumeration +\begin{note} +This resolves a potential ambiguity between the declaration of an enumeration with an \grammarterm{enum-base} and the declaration of an unnamed bit-field of enumeration -type. \begin{example} - +type. +\begin{example} \begin{codeblock} - struct S { - enum E : int {}; - enum E : int {}; // error: redeclaration of enumeration - }; +struct S { + enum E : int {}; + enum E : int {}; // error: redeclaration of enumeration +}; \end{codeblock} \end{example} @@ -6777,12 +6705,10 @@ obtained by increasing the value of the previous \grammarterm{enumerator} by one. \begin{example} - \begin{codeblock} enum { a, b, c=0 }; enum { d, e, f=e+2 }; \end{codeblock} - defines \tcode{a}, \tcode{c}, and \tcode{d} to be zero, \tcode{b} and \tcode{e} to be \tcode{1}, and \tcode{f} to be \tcode{3}. \end{example} @@ -6792,10 +6718,13 @@ \pnum An \grammarterm{opaque-enum-declaration} is either a redeclaration of an enumeration in the current scope or a declaration of a new enumeration. -\begin{note} An enumeration declared by an +\begin{note} +An enumeration declared by an \grammarterm{opaque-enum-declaration} has a fixed underlying type and is a complete type. The list of enumerators can be provided in a later redeclaration -with an \grammarterm{enum-specifier}. \end{note} A scoped enumeration +with an \grammarterm{enum-specifier}. +\end{note} +A scoped enumeration shall not be later redeclared as unscoped or with a different underlying type. An unscoped enumeration shall not be later redeclared as scoped and each redeclaration shall include an \grammarterm{enum-base} specifying the same @@ -6905,10 +6834,10 @@ converted to an integer by integral promotion\iref{conv.prom}. \begin{example} \begin{codeblock} - enum color { red, yellow, green=20, blue }; - color col = red; - color* cp = &col; - if (*cp == blue) // ... +enum color { red, yellow, green=20, blue }; +color col = red; +color* cp = &col; +if (*cp == blue) // ... \end{codeblock} makes \tcode{color} a type describing various colors, and then declares \tcode{col} as an object of that type, and \tcode{cp} as a pointer to an @@ -6939,7 +6868,8 @@ Each scoped \grammarterm{enumerator} is declared in the scope of the enumeration. These names obey the scope rules defined for all names -in~\ref{basic.scope} and~\ref{basic.lookup}. \begin{example} +in~\ref{basic.scope} and~\ref{basic.lookup}. +\begin{example} \begin{codeblock} enum direction { left='l', right='r' }; @@ -6963,7 +6893,6 @@ member access operators (\tcode{::}, \tcode{.} (dot) and \tcode{->} (arrow)), see~\ref{expr.ref}. \begin{example} - \begin{codeblock} struct X { enum direction { left='l', right='r' }; @@ -7244,13 +7173,11 @@ \pnum An \grammarterm{unnamed-namespace-definition} behaves as if it were replaced by - \begin{ncsimplebnf} \opt{\keyword{inline}} \keyword{namespace} \exposid{unique} \terminal{\{} \terminal{/* empty body */} \terminal{\}}\br \keyword{using} \keyword{namespace} \exposid{unique} \terminal{;}\br \keyword{namespace} \exposid{unique} \terminal{\{} namespace-body \terminal{\}} \end{ncsimplebnf} - where \tcode{inline} appears if and only if it appears in the \grammarterm{unnamed-namespace-definition} @@ -7348,10 +7275,13 @@ the friend is a member of the innermost enclosing namespace. The friend declaration does not by itself make the name visible to unqualified lookup\iref{basic.lookup.unqual} or qualified -lookup\iref{basic.lookup.qual}. \begin{note} The name of the friend will be +lookup\iref{basic.lookup.qual}. +\begin{note} +The name of the friend will be visible in its namespace if a matching declaration is provided at namespace scope (either before or after the class definition granting friendship). -\end{note} If a friend +\end{note} +If a friend function or function template is called, its name may be found by the name lookup that considers functions from namespaces and classes associated with the types of the function @@ -7360,12 +7290,13 @@ \grammarterm{template-id} and the declaration is a function or an \grammarterm{elaborated-type-specifier}, the lookup to determine whether the entity has been previously declared shall not consider any scopes -outside the innermost enclosing namespace. \begin{note} The other forms of +outside the innermost enclosing namespace. +\begin{note} +The other forms of friend declarations cannot declare a new member of the innermost enclosing namespace and thus follow the usual lookup rules. \end{note} \begin{example} - \begin{codeblock} // Assume \tcode{f} and \tcode{g} have not yet been declared. void h(int); @@ -7484,7 +7415,6 @@ A \grammarterm{using-directive} does not add any members to the declarative region in which it appears. \begin{example} - \begin{codeblock} namespace A { int i; @@ -7521,9 +7451,10 @@ contains \grammarterm{using-directive}{s}, the effect is as if the \grammarterm{using-directive}{s} from the second namespace also appeared in the first. -\begin{note} For qualified lookup, see~\ref{namespace.qual}. \end{note} +\begin{note} +For qualified lookup, see~\ref{namespace.qual}. +\end{note} \begin{example} - \begin{codeblock} namespace M { int i; @@ -7541,7 +7472,6 @@ \end{codeblock} For another example, - \begin{codeblock} namespace A { int i; @@ -7626,7 +7556,6 @@ considering the set of names found as a result of following \grammarterm{using-directive}{s}.} \begin{example} - \begin{codeblock} namespace D { int d1; @@ -7657,7 +7586,7 @@ f('a'); // OK: \tcode{D::f(char)} } \end{codeblock} -\end{example}% +\end{example} \indextext{using-directive|)}% \indextext{namespaces|)} @@ -7696,7 +7625,8 @@ the \grammarterm{unqualified-id} is declared in the declarative region in which the \grammarterm{using-declaration} appears as a synonym for each declaration introduced by the \grammarterm{using-declarator}. -\begin{note} Only the specified name is so declared; +\begin{note} +Only the specified name is so declared; specifying an enumeration name in a \grammarterm{using-declaration} does not declare its enumerators in the \grammarterm{using-declaration}{'s} declarative region. @@ -7710,7 +7640,6 @@ Every \grammarterm{using-declaration} is a \grammarterm{declaration} and a \grammarterm{member-declaration} and can therefore be used in a class definition. \begin{example} - \begin{codeblock} struct B { void f(char); @@ -7793,7 +7722,6 @@ \pnum A \grammarterm{using-declaration} shall not name a \grammarterm{template-id}. \begin{example} - \begin{codeblock} struct A { template void f(T); @@ -7887,9 +7815,9 @@ overloads added after the \grammarterm{using-declaration} are ignored, but default function arguments\iref{dcl.fct.default}, default template arguments\iref{temp.param}, and template specializations~(\ref{temp.class.spec}, -\ref{temp.expl.spec}) are considered. \end{note} +\ref{temp.expl.spec}) are considered. +\end{note} \begin{example} - \begin{codeblock} namespace A { void f(int); @@ -7926,7 +7854,6 @@ on declarations of the same name in the same declarative region\iref{basic.scope} also apply to \grammarterm{using-declaration}{s}. \begin{example} - \begin{codeblock} namespace A { int x; @@ -7974,7 +7901,6 @@ introduced by such \grammarterm{using-declaration}{s}, the function call is ill-formed. \begin{example} - \begin{codeblock} namespace B { void f(int); @@ -8008,7 +7934,6 @@ Such hidden or overridden declarations are excluded from the set of declarations introduced by the \grammarterm{using-declarator}. \begin{example} - \begin{codeblock} struct B { virtual void f(int); @@ -8135,7 +8060,6 @@ when used to construct an object of the corresponding base class, and the accessibility of the \grammarterm{using-declaration} is ignored. \begin{example} - \begin{codeblock} class A { private: @@ -8168,7 +8092,6 @@ \pnum An \tcode{asm} declaration has the form - \begin{bnf} \nontermdef{asm-declaration}\br \opt{attribute-specifier-seq} \keyword{asm} \terminal{(} string-literal \terminal{)} \terminal{;} @@ -8357,9 +8280,9 @@ program (see~\ref{basic.def.odr}); this implies that such an entity must not be defined in more -than one namespace scope.\end{note} +than one namespace scope. +\end{note} \begin{example} - \begin{codeblock} int x; namespace A { @@ -8389,7 +8312,6 @@ declared name and whether it is a definition. Such a declaration shall not specify a storage class. \begin{example} - \begin{codeblock} extern "C" double f(); static double f(); // error @@ -8525,8 +8447,10 @@ \end{example} \pnum -\begin{note} For each individual attribute, the form of the -\grammarterm{balanced-token-seq} will be specified. \end{note} +\begin{note} +For each individual attribute, the form of the +\grammarterm{balanced-token-seq} will be specified. +\end{note} \pnum In an \grammarterm{attribute-list}, an ellipsis may appear only if that @@ -8576,9 +8500,12 @@ when introducing an \grammarterm{attribute-specifier} or within the \grammarterm{balanced-token-seq} of an \grammarterm{attribute-argument-clause}. -\begin{note} If two consecutive left square brackets appear +\begin{note} +If two consecutive left square brackets appear where an \grammarterm{attribute-specifier} is not allowed, the program is ill-formed even -if the brackets match an alternative grammar production. \end{note} \begin{example} +if the brackets match an alternative grammar production. +\end{note} +\begin{example} \begin{codeblock} int p[10]; void f() { @@ -8609,7 +8536,6 @@ \pnum When the \grammarterm{alignment-specifier} is of the form \tcode{alignas(} \grammarterm{constant-expression} \tcode{)}: - \begin{itemize} \item the \grammarterm{constant-expression} shall be an integral constant expression @@ -8668,7 +8594,8 @@ \end{example} \pnum -\begin{example} An aligned buffer with an alignment requirement +\begin{example} +An aligned buffer with an alignment requirement of \tcode{A} and holding \tcode{N} elements of type \tcode{T} can be declared as: \begin{codeblock} @@ -8719,8 +8646,10 @@ program is ill-formed, no diagnostic required. \pnum -\begin{note} The \tcode{carries_dependency} attribute does not change the meaning of the -program, but may result in generation of more efficient code. \end{note} +\begin{note} +The \tcode{carries_dependency} attribute does not change the meaning of the +program, but may result in generation of more efficient code. +\end{note} \pnum \begin{example} @@ -8765,7 +8694,7 @@ \tcode{g} carries a dependency into \tcode{g}, but its second call does not. The implementation might need to insert a fence prior to the second call to \tcode{g}. -\end{example}% +\end{example} \indextext{attribute|)}% \indextext{declaration|)} @@ -8774,15 +8703,19 @@ \pnum The \grammarterm{attribute-token} \tcode{deprecated} can be used to mark names and entities -whose use is still allowed, but is discouraged for some reason. \begin{note} In particular, +whose use is still allowed, but is discouraged for some reason. +\begin{note} +In particular, \tcode{deprecated} is appropriate for names and entities that are deemed obsolescent or -unsafe. \end{note} It shall appear at most once in each \grammarterm{attribute-list}. An +unsafe. +\end{note} +It shall appear at most once in each \grammarterm{attribute-list}. An \grammarterm{attribute-argument-clause} may be present and, if present, it shall have the form: - \begin{ncbnf} \terminal{(} string-literal \terminal{)} \end{ncbnf} -\begin{note} The \grammarterm{string-literal} in the \grammarterm{attribute-argument-clause} +\begin{note} +The \grammarterm{string-literal} in the \grammarterm{attribute-argument-clause} could be used to explain the rationale for deprecation and/or to suggest a replacing entity. \end{note} @@ -8800,19 +8733,24 @@ \pnum A name or entity declared without the \tcode{deprecated} attribute can later be redeclared -with the attribute and vice-versa. \begin{note} Thus, an entity initially declared without the +with the attribute and vice-versa. +\begin{note} +Thus, an entity initially declared without the attribute can be marked as deprecated by a subsequent redeclaration. However, after an entity -is marked as deprecated, later redeclarations do not un-deprecate the entity. \end{note} +is marked as deprecated, later redeclarations do not un-deprecate the entity. +\end{note} Redeclarations using different forms of the attribute (with or without the \grammarterm{attribute-argument-clause} or with different \grammarterm{attribute-argument-clause}{s}) are allowed. \pnum -\begin{note} Implementations may use the \tcode{deprecated} attribute to produce a diagnostic +\begin{note} +Implementations may use the \tcode{deprecated} attribute to produce a diagnostic message in case the program refers to a name or entity other than to declare it, after a declaration that specifies the attribute. The diagnostic message may include the text provided within the \grammarterm{attribute-argument-clause} of any \tcode{deprecated} attribute applied -to the name or entity. \end{note} +to the name or entity. +\end{note} \rSec2[dcl.attr.fallthrough]{Fallthrough attribute} \indextext{attribute!fallthrough} @@ -9025,7 +8963,7 @@ whose return type is a nodiscard type, or \item an explicit type - conversion~(\ref{expr.static.cast}, \ref{expr.cast}, \ref{expr.type.conv}) + conversion~(\ref{expr.type.conv}, \ref{expr.static.cast}, \ref{expr.cast}) that constructs an object through a constructor declared \tcode{nodiscard} in a reachable declaration, or that initializes an object of a nodiscard type. @@ -9088,9 +9026,15 @@ \pnum If a function \tcode{f} is called where \tcode{f} was previously declared with the \tcode{noreturn} -attribute and \tcode{f} eventually returns, the behavior is undefined. \begin{note} The function may -terminate by throwing an exception. \end{note} \begin{note} Implementations should issue a -warning if a function marked \tcode{[[noreturn]]} might return. \end{note} +attribute and \tcode{f} eventually returns, the behavior is undefined. +\begin{note} +The function may +terminate by throwing an exception. +\end{note} +\begin{note} +Implementations should issue a +warning if a function marked \tcode{[[noreturn]]} might return. +\end{note} \pnum \begin{example} diff --git a/source/diagnostics.tex b/source/diagnostics.tex index 8ef0376b6d..1e7e29ec85 100644 --- a/source/diagnostics.tex +++ b/source/diagnostics.tex @@ -41,24 +41,21 @@ \pnum By contrast, runtime errors are due to events beyond the scope of the program. They cannot be easily predicted in advance. -The header -\tcode{} -\indexhdr{stdexcept}% +The header \libheaderdef{stdexcept} defines several types of predefined exceptions for reporting errors in a \Cpp{} program. These exceptions are related by inheritance. \rSec2[stdexcept.syn]{Header \tcode{} synopsis} -\indexhdr{stdexcept}% -\indexlibrary{\idxcode{logic_error}}% -\indexlibrary{\idxcode{domain_error}}% -\indexlibrary{\idxcode{invalid_argument}}% -\indexlibrary{\idxcode{length_error}}% -\indexlibrary{\idxcode{out_of_range}}% -\indexlibrary{\idxcode{runtime_error}}% -\indexlibrary{\idxcode{range_error}}% -\indexlibrary{\idxcode{overflow_error}}% -\indexlibrary{\idxcode{underflow_error}}% +\indexlibraryglobal{logic_error}% +\indexlibraryglobal{domain_error}% +\indexlibraryglobal{invalid_argument}% +\indexlibraryglobal{length_error}% +\indexlibraryglobal{out_of_range}% +\indexlibraryglobal{runtime_error}% +\indexlibraryglobal{range_error}% +\indexlibraryglobal{overflow_error}% +\indexlibraryglobal{underflow_error}% \begin{codeblock} namespace std { class logic_error; @@ -75,7 +72,7 @@ \rSec2[logic.error]{Class \tcode{logic_error}} -\indexlibrary{\idxcode{logic_error}}% +\indexlibraryglobal{logic_error}% \begin{codeblock} namespace std { class logic_error : public exception { @@ -94,7 +91,7 @@ the program executes, such as violations of logical preconditions or class invariants. -\indexlibrary{\idxcode{logic_error}!constructor}% +\indexlibraryctor{logic_error}% \begin{itemdecl} logic_error(const string& what_arg); \end{itemdecl} @@ -105,7 +102,7 @@ \tcode{strcmp(what(), what_arg.c_str()) == 0}. \end{itemdescr} -\indexlibrary{\idxcode{logic_error}!constructor}% +\indexlibraryctor{logic_error}% \begin{itemdecl} logic_error(const char* what_arg); \end{itemdecl} @@ -118,7 +115,7 @@ \rSec2[domain.error]{Class \tcode{domain_error}} -\indexlibrary{\idxcode{domain_error}}% +\indexlibraryglobal{domain_error}% \begin{codeblock} namespace std { class domain_error : public logic_error { @@ -135,7 +132,7 @@ defines the type of objects thrown as exceptions by the implementation to report domain errors. -\indexlibrary{\idxcode{domain_error}!constructor}% +\indexlibraryctor{domain_error}% \begin{itemdecl} domain_error(const string& what_arg); \end{itemdecl} @@ -146,7 +143,7 @@ \tcode{strcmp(what(), what_arg.c_str()) == 0}. \end{itemdescr} -\indexlibrary{\idxcode{domain_error}!constructor}% +\indexlibraryctor{domain_error}% \begin{itemdecl} domain_error(const char* what_arg); \end{itemdecl} @@ -159,7 +156,7 @@ \rSec2[invalid.argument]{Class \tcode{invalid_argument}} -\indexlibrary{\idxcode{invalid_argument}}% +\indexlibraryglobal{invalid_argument}% \begin{codeblock} namespace std { class invalid_argument : public logic_error { @@ -175,7 +172,7 @@ \tcode{invalid_argument} defines the type of objects thrown as exceptions to report an invalid argument. -\indexlibrary{\idxcode{invalid_argument}!constructor}% +\indexlibraryctor{invalid_argument}% \begin{itemdecl} invalid_argument(const string& what_arg); \end{itemdecl} @@ -186,7 +183,7 @@ \tcode{strcmp(what(), what_arg.c_str()) == 0}. \end{itemdescr} -\indexlibrary{\idxcode{invalid_argument}!constructor}% +\indexlibraryctor{invalid_argument}% \begin{itemdecl} invalid_argument(const char* what_arg); \end{itemdecl} @@ -199,7 +196,7 @@ \rSec2[length.error]{Class \tcode{length_error}} -\indexlibrary{\idxcode{length_error}}% +\indexlibraryglobal{length_error}% \begin{codeblock} namespace std { class length_error : public logic_error { @@ -217,7 +214,7 @@ to report an attempt to produce an object whose length exceeds its maximum allowable size. -\indexlibrary{\idxcode{length_error}!constructor}% +\indexlibraryctor{length_error}% \begin{itemdecl} length_error(const string& what_arg); \end{itemdecl} @@ -228,7 +225,7 @@ \tcode{strcmp(what(), what_arg.c_str()) == 0}. \end{itemdescr} -\indexlibrary{\idxcode{length_error}!constructor}% +\indexlibraryctor{length_error}% \begin{itemdecl} length_error(const char* what_arg); \end{itemdecl} @@ -241,7 +238,7 @@ \rSec2[out.of.range]{Class \tcode{out_of_range}} -\indexlibrary{\idxcode{out_of_range}}% +\indexlibraryglobal{out_of_range}% \begin{codeblock} namespace std { class out_of_range : public logic_error { @@ -259,7 +256,7 @@ argument value not in its expected range. \indextext{argument} -\indexlibrary{\idxcode{out_of_range}!constructor}% +\indexlibraryctor{out_of_range}% \begin{itemdecl} out_of_range(const string& what_arg); \end{itemdecl} @@ -270,7 +267,7 @@ \tcode{strcmp(what(), what_arg.c_str()) == 0}. \end{itemdescr} -\indexlibrary{\idxcode{out_of_range}!constructor}% +\indexlibraryctor{out_of_range}% \begin{itemdecl} out_of_range(const char* what_arg); \end{itemdecl} @@ -283,7 +280,7 @@ \rSec2[runtime.error]{Class \tcode{runtime_error}} -\indexlibrary{\idxcode{runtime_error}}% +\indexlibraryglobal{runtime_error}% \begin{codeblock} namespace std { class runtime_error : public exception { @@ -300,7 +297,7 @@ defines the type of objects thrown as exceptions to report errors presumably detectable only when the program executes. -\indexlibrary{\idxcode{runtime_error}!constructor}% +\indexlibraryctor{runtime_error}% \begin{itemdecl} runtime_error(const string& what_arg); \end{itemdecl} @@ -311,7 +308,7 @@ \tcode{strcmp(what(), what_arg.c_str()) == 0}. \end{itemdescr} -\indexlibrary{\idxcode{runtime_error}!constructor}% +\indexlibraryctor{runtime_error}% \begin{itemdecl} runtime_error(const char* what_arg); \end{itemdecl} @@ -324,7 +321,7 @@ \rSec2[range.error]{Class \tcode{range_error}} -\indexlibrary{\idxcode{range_error}}% +\indexlibraryglobal{range_error}% \begin{codeblock} namespace std { class range_error : public runtime_error { @@ -341,7 +338,7 @@ defines the type of objects thrown as exceptions to report range errors in internal computations. -\indexlibrary{\idxcode{range_error}!constructor}% +\indexlibraryctor{range_error}% \begin{itemdecl} range_error(const string& what_arg); \end{itemdecl} @@ -352,7 +349,7 @@ \tcode{strcmp(what(), what_arg.c_str()) == 0}. \end{itemdescr} -\indexlibrary{\idxcode{range_error}!constructor}% +\indexlibraryctor{range_error}% \begin{itemdecl} range_error(const char* what_arg); \end{itemdecl} @@ -365,7 +362,7 @@ \rSec2[overflow.error]{Class \tcode{overflow_error}} -\indexlibrary{\idxcode{overflow_error}}% +\indexlibraryglobal{overflow_error}% \begin{codeblock} namespace std { class overflow_error : public runtime_error { @@ -381,7 +378,7 @@ \tcode{overflow_error} defines the type of objects thrown as exceptions to report an arithmetic overflow error. -\indexlibrary{\idxcode{overflow_error}!constructor}% +\indexlibraryctor{overflow_error}% \begin{itemdecl} overflow_error(const string& what_arg); \end{itemdecl} @@ -392,7 +389,7 @@ \tcode{strcmp(what(), what_arg.c_str()) == 0}. \end{itemdescr} -\indexlibrary{\idxcode{overflow_error}!constructor}% +\indexlibraryctor{overflow_error}% \begin{itemdecl} overflow_error(const char* what_arg); \end{itemdecl} @@ -405,7 +402,7 @@ \rSec2[underflow.error]{Class \tcode{underflow_error}} -\indexlibrary{\idxcode{underflow_error}}% +\indexlibraryglobal{underflow_error}% \begin{codeblock} namespace std { class underflow_error : public runtime_error { @@ -421,7 +418,7 @@ \tcode{underflow_error} defines the type of objects thrown as exceptions to report an arithmetic underflow error. -\indexlibrary{\idxcode{underflow_error}!constructor}% +\indexlibraryctor{underflow_error}% \begin{itemdecl} underflow_error(const string& what_arg); \end{itemdecl} @@ -432,7 +429,7 @@ \tcode{strcmp(what(), what_arg.c_str()) == 0}. \end{itemdescr} -\indexlibrary{\idxcode{underflow_error}!constructor}% +\indexlibraryctor{underflow_error}% \begin{itemdecl} underflow_error(const char* what_arg); \end{itemdecl} @@ -446,24 +443,21 @@ \rSec1[assertions]{Assertions} \pnum -The header -\tcode{} +The header \libheaderdef{cassert} provides a macro for documenting \Cpp{} program assertions and a mechanism for disabling the assertion checks. \rSec2[cassert.syn]{Header \tcode{} synopsis} -\indexhdr{cassert}% -\indexlibrary{\idxcode{assert}}% +\indexlibraryglobal{assert}% \begin{codeblock} #define assert(E) @\seebelow@ \end{codeblock} \pnum -\indexhdr{assert.h}% \indextext{static_assert@\tcode{static_assert}!not macro}% The contents are the same as the C standard library header -\tcode{}, +\libheader{assert.h}, except that a macro named \tcode{static_assert} is not defined. @@ -486,9 +480,8 @@ \rSec1[errno]{Error numbers} \pnum -\indexhdr{errno.h}% -The contents of the header \tcode{} are the same as the POSIX header -\tcode{}, except that \tcode{errno} shall be defined as a macro. +The contents of the header \libheaderdef{cerrno} are the same as the POSIX header +\libheader{errno.h}, except that \tcode{errno} shall be defined as a macro. \begin{note} The intent is to remain in close alignment with the POSIX standard. \end{note} @@ -496,86 +489,85 @@ \rSec2[cerrno.syn]{Header \tcode{} synopsis} -\indexhdr{cerrno}% -\indexlibrary{\idxcode{errno}}% -\indexlibrary{\idxcode{E2BIG}}% -\indexlibrary{\idxcode{EACCES}}% -\indexlibrary{\idxcode{EADDRINUSE}}% -\indexlibrary{\idxcode{EADDRNOTAVAIL}}% -\indexlibrary{\idxcode{EAFNOSUPPORT}}% -\indexlibrary{\idxcode{EAGAIN}}% -\indexlibrary{\idxcode{EALREADY}}% -\indexlibrary{\idxcode{EBADF}}% -\indexlibrary{\idxcode{EBADMSG}}% -\indexlibrary{\idxcode{EBUSY}}% -\indexlibrary{\idxcode{ECANCELED}}% -\indexlibrary{\idxcode{ECHILD}}% -\indexlibrary{\idxcode{ECONNABORTED}}% -\indexlibrary{\idxcode{ECONNREFUSED}}% -\indexlibrary{\idxcode{ECONNRESET}}% -\indexlibrary{\idxcode{EDEADLK}}% -\indexlibrary{\idxcode{EDESTADDRREQ}}% -\indexlibrary{\idxcode{EDOM}}% -\indexlibrary{\idxcode{EEXIST}}% -\indexlibrary{\idxcode{EFAULT}}% -\indexlibrary{\idxcode{EFBIG}}% -\indexlibrary{\idxcode{EHOSTUNREACH}}% -\indexlibrary{\idxcode{EIDRM}}% -\indexlibrary{\idxcode{EILSEQ}}% -\indexlibrary{\idxcode{EINPROGRESS}}% -\indexlibrary{\idxcode{EINTR}}% -\indexlibrary{\idxcode{EINVAL}}% -\indexlibrary{\idxcode{EIO}}% -\indexlibrary{\idxcode{EISCONN}}% -\indexlibrary{\idxcode{EISDIR}}% -\indexlibrary{\idxcode{ELOOP}}% -\indexlibrary{\idxcode{EMFILE}}% -\indexlibrary{\idxcode{EMLINK}}% -\indexlibrary{\idxcode{EMSGSIZE}}% -\indexlibrary{\idxcode{ENAMETOOLONG}}% -\indexlibrary{\idxcode{ENETDOWN}}% -\indexlibrary{\idxcode{ENETRESET}}% -\indexlibrary{\idxcode{ENETUNREACH}}% -\indexlibrary{\idxcode{ENFILE}}% -\indexlibrary{\idxcode{ENOBUFS}}% -\indexlibrary{\idxcode{ENODATA}}% -\indexlibrary{\idxcode{ENODEV}}% -\indexlibrary{\idxcode{ENOENT}}% -\indexlibrary{\idxcode{ENOEXEC}}% -\indexlibrary{\idxcode{ENOLCK}}% -\indexlibrary{\idxcode{ENOLINK}}% -\indexlibrary{\idxcode{ENOMEM}}% -\indexlibrary{\idxcode{ENOMSG}}% -\indexlibrary{\idxcode{ENOPROTOOPT}}% -\indexlibrary{\idxcode{ENOSPC}}% -\indexlibrary{\idxcode{ENOSR}}% -\indexlibrary{\idxcode{ENOSTR}}% -\indexlibrary{\idxcode{ENOSYS}}% -\indexlibrary{\idxcode{ENOTCONN}}% -\indexlibrary{\idxcode{ENOTDIR}}% -\indexlibrary{\idxcode{ENOTEMPTY}}% -\indexlibrary{\idxcode{ENOTRECOVERABLE}}% -\indexlibrary{\idxcode{ENOTSOCK}}% -\indexlibrary{\idxcode{ENOTSUP}}% -\indexlibrary{\idxcode{ENOTTY}}% -\indexlibrary{\idxcode{ENXIO}}% -\indexlibrary{\idxcode{EOPNOTSUPP}}% -\indexlibrary{\idxcode{EOVERFLOW}}% -\indexlibrary{\idxcode{EOWNERDEAD}}% -\indexlibrary{\idxcode{EPERM}}% -\indexlibrary{\idxcode{EPIPE}}% -\indexlibrary{\idxcode{EPROTO}}% -\indexlibrary{\idxcode{EPROTONOSUPPORT}}% -\indexlibrary{\idxcode{EPROTOTYPE}}% -\indexlibrary{\idxcode{ERANGE}}% -\indexlibrary{\idxcode{EROFS}}% -\indexlibrary{\idxcode{ESPIPE}}% -\indexlibrary{\idxcode{ESRCH}}% -\indexlibrary{\idxcode{ETIME}}% -\indexlibrary{\idxcode{ETIMEDOUT}}% -\indexlibrary{\idxcode{ETXTBSY}}% -\indexlibrary{\idxcode{EWOULDBLOCK}}% -\indexlibrary{\idxcode{EXDEV}}% +\indexlibraryglobal{errno}% +\indexlibraryglobal{E2BIG}% +\indexlibraryglobal{EACCES}% +\indexlibraryglobal{EADDRINUSE}% +\indexlibraryglobal{EADDRNOTAVAIL}% +\indexlibraryglobal{EAFNOSUPPORT}% +\indexlibraryglobal{EAGAIN}% +\indexlibraryglobal{EALREADY}% +\indexlibraryglobal{EBADF}% +\indexlibraryglobal{EBADMSG}% +\indexlibraryglobal{EBUSY}% +\indexlibraryglobal{ECANCELED}% +\indexlibraryglobal{ECHILD}% +\indexlibraryglobal{ECONNABORTED}% +\indexlibraryglobal{ECONNREFUSED}% +\indexlibraryglobal{ECONNRESET}% +\indexlibraryglobal{EDEADLK}% +\indexlibraryglobal{EDESTADDRREQ}% +\indexlibraryglobal{EDOM}% +\indexlibraryglobal{EEXIST}% +\indexlibraryglobal{EFAULT}% +\indexlibraryglobal{EFBIG}% +\indexlibraryglobal{EHOSTUNREACH}% +\indexlibraryglobal{EIDRM}% +\indexlibraryglobal{EILSEQ}% +\indexlibraryglobal{EINPROGRESS}% +\indexlibraryglobal{EINTR}% +\indexlibraryglobal{EINVAL}% +\indexlibraryglobal{EIO}% +\indexlibraryglobal{EISCONN}% +\indexlibraryglobal{EISDIR}% +\indexlibraryglobal{ELOOP}% +\indexlibraryglobal{EMFILE}% +\indexlibraryglobal{EMLINK}% +\indexlibraryglobal{EMSGSIZE}% +\indexlibraryglobal{ENAMETOOLONG}% +\indexlibraryglobal{ENETDOWN}% +\indexlibraryglobal{ENETRESET}% +\indexlibraryglobal{ENETUNREACH}% +\indexlibraryglobal{ENFILE}% +\indexlibraryglobal{ENOBUFS}% +\indexlibraryglobal{ENODATA}% +\indexlibraryglobal{ENODEV}% +\indexlibraryglobal{ENOENT}% +\indexlibraryglobal{ENOEXEC}% +\indexlibraryglobal{ENOLCK}% +\indexlibraryglobal{ENOLINK}% +\indexlibraryglobal{ENOMEM}% +\indexlibraryglobal{ENOMSG}% +\indexlibraryglobal{ENOPROTOOPT}% +\indexlibraryglobal{ENOSPC}% +\indexlibraryglobal{ENOSR}% +\indexlibraryglobal{ENOSTR}% +\indexlibraryglobal{ENOSYS}% +\indexlibraryglobal{ENOTCONN}% +\indexlibraryglobal{ENOTDIR}% +\indexlibraryglobal{ENOTEMPTY}% +\indexlibraryglobal{ENOTRECOVERABLE}% +\indexlibraryglobal{ENOTSOCK}% +\indexlibraryglobal{ENOTSUP}% +\indexlibraryglobal{ENOTTY}% +\indexlibraryglobal{ENXIO}% +\indexlibraryglobal{EOPNOTSUPP}% +\indexlibraryglobal{EOVERFLOW}% +\indexlibraryglobal{EOWNERDEAD}% +\indexlibraryglobal{EPERM}% +\indexlibraryglobal{EPIPE}% +\indexlibraryglobal{EPROTO}% +\indexlibraryglobal{EPROTONOSUPPORT}% +\indexlibraryglobal{EPROTOTYPE}% +\indexlibraryglobal{ERANGE}% +\indexlibraryglobal{EROFS}% +\indexlibraryglobal{ESPIPE}% +\indexlibraryglobal{ESRCH}% +\indexlibraryglobal{ETIME}% +\indexlibraryglobal{ETIMEDOUT}% +\indexlibraryglobal{ETXTBSY}% +\indexlibraryglobal{EWOULDBLOCK}% +\indexlibraryglobal{EXDEV}% \begin{codeblock} #define errno @\seebelow@ @@ -678,15 +670,15 @@ libraries unchanged. \rSec2[system.error.syn]{Header \tcode{} synopsis} -\indexhdr{system_error}% -\indexlibrary{\idxcode{error_category}}% -\indexlibrary{\idxcode{error_code}}% -\indexlibrary{\idxcode{error_condition}}% -\indexlibrary{\idxcode{system_error}}% -\indexlibrary{\idxcode{is_error_code_enum}}% -\indexlibrary{\idxcode{is_error_condition_enum}}% -\indexlibrary{\idxcode{errc}}% +\indexheader{system_error}% +\indexlibraryglobal{error_category}% +\indexlibraryglobal{error_code}% +\indexlibraryglobal{error_condition}% +\indexlibraryglobal{system_error}% +\indexlibraryglobal{is_error_code_enum}% +\indexlibraryglobal{is_error_condition_enum}% +\indexlibraryglobal{errc}% \begin{codeblock} namespace std { class error_category; @@ -816,10 +808,11 @@ } \end{codeblock} -\pnum The value of each \tcode{enum errc} constant shall be the same as -the value of the \tcode{} macro shown in the above synopsis. Whether -or not the \tcode{} implementation exposes the \tcode{} -macros is unspecified. +\pnum +The value of each \tcode{enum errc} constant shall be 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. \pnum The \tcode{is_error_code_enum} and \tcode{is_error_condition_enum} may be @@ -837,17 +830,20 @@ Classes may be derived from \tcode{error_category} to support categories of errors in addition to those defined in this document. Such classes shall behave as specified in this -subclause~\ref{syserr.errcat}. \begin{note} \tcode{error_category} objects are +subclause~\ref{syserr.errcat}. +\begin{note} +\tcode{error_category} objects are passed by reference, and two such objects are equal if they have the same address. This means that applications using custom \tcode{error_category} types should create a single object of each -such type. \end{note} +such type. +\end{note} -\indexlibrary{\idxcode{error_category}}% -\indexlibrary{\idxcode{error_category}!constructor}% -\indexlibrary{\idxcode{error_category}!destructor}% -\indexlibrary{\idxcode{generic_category}}% -\indexlibrary{\idxcode{system_category}}% +\indexlibraryglobal{error_category}% +\indexlibraryctor{error_category}% +\indexlibrarydtor{error_category}% +\indexlibraryglobal{generic_category}% +\indexlibraryglobal{system_category}% \begin{codeblock} namespace std { class error_category { @@ -880,7 +876,8 @@ \begin{itemdescr} \pnum -\returns A string naming the error category. +\returns +A string naming the error category. \end{itemdescr} \indexlibrarymember{default_error_condition}{error_category}% @@ -901,7 +898,8 @@ \begin{itemdescr} \pnum -\returns \tcode{default_error_condition(code) == condition}. +\returns +\tcode{default_error_condition(code) == condition}. \end{itemdescr} \indexlibrarymember{equivalent}{error_category}% @@ -911,7 +909,8 @@ \begin{itemdescr} \pnum -\returns \tcode{*this == code.category() \&\& code.value() == condition}. +\returns +\tcode{*this == code.category() \&\& code.value() == condition}. \end{itemdescr} \indexlibrarymember{message}{error_category}% @@ -921,7 +920,8 @@ \begin{itemdescr} \pnum -\returns A string that describes the error condition denoted by \tcode{ev}. +\returns +A string that describes the error condition denoted by \tcode{ev}. \end{itemdescr} \rSec3[syserr.errcat.nonvirtuals]{Non-virtual members} @@ -933,7 +933,8 @@ \begin{itemdescr} \pnum -\returns \tcode{this == \&rhs}. +\returns +\tcode{this == \&rhs}. \end{itemdescr} \indexlibrarymember{operator<=>}{error_category}% @@ -943,7 +944,8 @@ \begin{itemdescr} \pnum -\returns \tcode{compare_three_way()(this, \&rhs)}. +\returns +\tcode{compare_three_way()(this, \&rhs)}. \begin{note} \tcode{compare_three_way}\iref{cmp.object} provides a total ordering for pointers. @@ -959,7 +961,8 @@ \begin{itemdescr} \pnum -\returns A string naming the error category. +\returns +A string naming the error category. \end{itemdescr} \indexlibrarymember{default_error_condition}{error_category}% @@ -969,7 +972,8 @@ \begin{itemdescr} \pnum -\returns An object of type \tcode{error_condition} that corresponds to \tcode{ev}. +\returns +An object of type \tcode{error_condition} that corresponds to \tcode{ev}. \end{itemdescr} \indexlibrarymember{equivalent}{error_category}% @@ -979,7 +983,8 @@ \begin{itemdescr} \pnum -\returns \tcode{true} if, for the category of error represented by \tcode{*this}, \tcode{code} is considered equivalent to \tcode{condition}; otherwise, \tcode{false}. +\returns +\tcode{true} if, for the category of error represented by \tcode{*this}, \tcode{code} is considered equivalent to \tcode{condition}; otherwise, \tcode{false}. \end{itemdescr} \indexlibrarymember{equivalent}{error_category}% @@ -989,37 +994,42 @@ \begin{itemdescr} \pnum -\returns \tcode{true} if, for the category of error represented by \tcode{*this}, \tcode{code} is considered equivalent to \tcode{condition}; otherwise, \tcode{false}. +\returns +\tcode{true} if, for the category of error represented by \tcode{*this}, \tcode{code} is considered equivalent to \tcode{condition}; otherwise, \tcode{false}. \end{itemdescr} \rSec3[syserr.errcat.objects]{Error category objects} -\indexlibrary{\idxcode{generic_category}}% +\indexlibraryglobal{generic_category}% \begin{itemdecl} const error_category& generic_category() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns A reference to an object of a type derived from class \tcode{error_category}. +\returns +A reference to an object of a type derived from class \tcode{error_category}. All calls to this function shall return references to the same object. \pnum -\remarks 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 shall return a pointer to the string \tcode{"generic"}. +\remarks +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 shall return a pointer to the string \tcode{"generic"}. \end{itemdescr} -\indexlibrary{\idxcode{system_category}}% +\indexlibraryglobal{system_category}% \begin{itemdecl} const error_category& system_category() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns A reference to an object of a type derived from class \tcode{error_category}. +\returns +A reference to an object of a type derived from class \tcode{error_category}. All calls to this function shall return references to the same object. \pnum -\remarks The object's \tcode{equivalent} virtual functions shall behave as specified for +\remarks +The object's \tcode{equivalent} virtual functions shall behave as specified for class \tcode{error_category}. The object's \tcode{name} virtual function shall return a pointer to the string \tcode{"system"}. The object's \tcode{default_error_condition} virtual function shall behave as follows: @@ -1028,9 +1038,12 @@ function shall return \tcode{error_condition(posv, generic_category())}. Otherwise, the function shall return \tcode{error_condition(ev, system_category())}. What constitutes correspondence for any given operating -system is unspecified. \begin{note} The number of potential system error codes is large +system is unspecified. +\begin{note} +The number of potential system error codes is large and unbounded, and some may not correspond to any POSIX \tcode{errno} value. Thus -implementations are given latitude in determining correspondence. \end{note} +implementations are given latitude in determining correspondence. +\end{note} \end{itemdescr} \rSec2[syserr.errcode]{Class \tcode{error_code}} @@ -1040,10 +1053,13 @@ \pnum The class \tcode{error_code} describes an object used to hold error code values, such as those originating from the operating system or other low-level -application program interfaces. \begin{note} Class \tcode{error_code} is an -adjunct to error reporting by exception. \end{note} +application program interfaces. +\begin{note} +Class \tcode{error_code} is an +adjunct to error reporting by exception. +\end{note} -\indexlibrary{\idxcode{error_code}}% +\indexlibraryglobal{error_code}% \begin{codeblock} namespace std { class error_code { @@ -1083,27 +1099,29 @@ \rSec3[syserr.errcode.constructors]{Constructors} -\indexlibrary{\idxcode{error_code}!constructor}% +\indexlibraryctor{error_code}% \begin{itemdecl} error_code() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{val_ == 0} and \tcode{cat_ == \&system_category()}. +\ensures +\tcode{val_ == 0} and \tcode{cat_ == \&system_category()}. \end{itemdescr} -\indexlibrary{\idxcode{error_code}!constructor}% +\indexlibraryctor{error_code}% \begin{itemdecl} error_code(int val, const error_category& cat) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{val_ == val} and \tcode{cat_ == \&cat}. +\ensures +\tcode{val_ == val} and \tcode{cat_ == \&cat}. \end{itemdescr} -\indexlibrary{\idxcode{error_code}!constructor}% +\indexlibraryctor{error_code}% \begin{itemdecl} template error_code(ErrorCodeEnum e) noexcept; @@ -1114,7 +1132,8 @@ \constraints \tcode{is_error_code_enum_v} is \tcode{true}. \pnum -\ensures \tcode{*this == make_error_code(e)}. +\ensures +\tcode{*this == make_error_code(e)}. \end{itemdescr} \rSec3[syserr.errcode.modifiers]{Modifiers} @@ -1126,7 +1145,8 @@ \begin{itemdescr} \pnum -\ensures \tcode{val_ == val} and \tcode{cat_ == \&cat}. +\ensures +\tcode{val_ == val} and \tcode{cat_ == \&cat}. \end{itemdescr} \indexlibrarymember{operator=}{error_code}% @@ -1140,10 +1160,12 @@ \constraints \tcode{is_error_code_enum_v} is \tcode{true}. \pnum -\ensures \tcode{*this == make_error_code(e)}. +\ensures +\tcode{*this == make_error_code(e)}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{clear}{error_code}% @@ -1153,7 +1175,8 @@ \begin{itemdescr} \pnum -\ensures \tcode{value() == 0} and \tcode{category() == system_category()}. +\ensures +\tcode{value() == 0} and \tcode{category() == system_category()}. \end{itemdescr} @@ -1166,7 +1189,8 @@ \begin{itemdescr} \pnum -\returns \tcode{val_}. +\returns +\tcode{val_}. \end{itemdescr} \indexlibrarymember{category}{error_code}% @@ -1176,7 +1200,8 @@ \begin{itemdescr} \pnum -\returns \tcode{*cat_}. +\returns +\tcode{*cat_}. \end{itemdescr} \indexlibrarymember{default_error_condition}{error_code}% @@ -1186,7 +1211,8 @@ \begin{itemdescr} \pnum -\returns \tcode{category().default_error_condition(value())}. +\returns +\tcode{category().default_error_condition(value())}. \end{itemdescr} \indexlibrarymember{message}{error_code}% @@ -1196,7 +1222,8 @@ \begin{itemdescr} \pnum -\returns \tcode{category().message(value())}. +\returns +\tcode{category().message(value())}. \end{itemdescr} \indexlibrarymember{operator bool}{error_code}% @@ -1206,7 +1233,8 @@ \begin{itemdescr} \pnum -\returns \tcode{value() != 0}. +\returns +\tcode{value() != 0}. \end{itemdescr} \rSec3[syserr.errcode.nonmembers]{Non-member functions} @@ -1218,7 +1246,8 @@ \begin{itemdescr} \pnum -\returns \tcode{error_code(static_cast(e), generic_category())}. +\returns +\tcode{error_code(static_cast(e), generic_category())}. \end{itemdescr} \indexlibrarymember{operator<<}{error_code}% @@ -1240,10 +1269,13 @@ \pnum The class \tcode{error_condition} describes an object used to hold values identifying -error conditions. \begin{note} \tcode{error_condition} values are portable abstractions, -while \tcode{error_code} values\iref{syserr.errcode} are implementation specific. \end{note} +error conditions. +\begin{note} +\tcode{error_condition} values are portable abstractions, +while \tcode{error_code} values\iref{syserr.errcode} are implementation specific. +\end{note} -\indexlibrary{\idxcode{error_condition}}% +\indexlibraryglobal{error_condition}% \begin{codeblock} namespace std { class error_condition { @@ -1275,27 +1307,29 @@ \rSec3[syserr.errcondition.constructors]{Constructors} -\indexlibrary{\idxcode{error_condition}!constructor}% +\indexlibraryctor{error_condition}% \begin{itemdecl} error_condition() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{val_ == 0} and \tcode{cat_ == \&generic_category()}. +\ensures +\tcode{val_ == 0} and \tcode{cat_ == \&generic_category()}. \end{itemdescr} -\indexlibrary{\idxcode{error_condition}!constructor}% +\indexlibraryctor{error_condition}% \begin{itemdecl} error_condition(int val, const error_category& cat) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{val_ == val} and \tcode{cat_ == \&cat}. +\ensures +\tcode{val_ == val} and \tcode{cat_ == \&cat}. \end{itemdescr} -\indexlibrary{\idxcode{error_condition}!constructor}% +\indexlibraryctor{error_condition}% \begin{itemdecl} template error_condition(ErrorConditionEnum e) noexcept; @@ -1306,7 +1340,8 @@ \constraints \tcode{is_error_condition_enum_v} is \tcode{true}. \pnum -\ensures \tcode{*this == make_error_condition(e)}. +\ensures +\tcode{*this == make_error_condition(e)}. \end{itemdescr} @@ -1319,7 +1354,8 @@ \begin{itemdescr} \pnum -\ensures \tcode{val_ == val} and \tcode{cat_ == \&cat}. +\ensures +\tcode{val_ == val} and \tcode{cat_ == \&cat}. \end{itemdescr} \indexlibrarymember{operator=}{error_condition}% @@ -1333,10 +1369,12 @@ \constraints \tcode{is_error_condition_enum_v} is \tcode{true}. \pnum -\ensures \tcode{*this == make_error_condition(e)}. +\ensures +\tcode{*this == make_error_condition(e)}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{clear}{error_condition}% @@ -1346,7 +1384,8 @@ \begin{itemdescr} \pnum -\ensures \tcode{value() == 0} and \tcode{category() == generic_category()}. +\ensures +\tcode{value() == 0} and \tcode{category() == generic_category()}. \end{itemdescr} \rSec3[syserr.errcondition.observers]{Observers} @@ -1358,7 +1397,8 @@ \begin{itemdescr} \pnum -\returns \tcode{val_}. +\returns +\tcode{val_}. \end{itemdescr} \indexlibrarymember{category}{error_condition}% @@ -1368,7 +1408,8 @@ \begin{itemdescr} \pnum -\returns \tcode{*cat_}. +\returns +\tcode{*cat_}. \end{itemdescr} \indexlibrarymember{message}{error_condition}% @@ -1378,7 +1419,8 @@ \begin{itemdescr} \pnum -\returns \tcode{category().message(value())}. +\returns +\tcode{category().message(value())}. \end{itemdescr} \indexlibrarymember{operator bool}{error_condition}% @@ -1388,7 +1430,8 @@ \begin{itemdescr} \pnum -\returns \tcode{value() != 0}. +\returns +\tcode{value() != 0}. \end{itemdescr} \rSec3[syserr.errcondition.nonmembers]{Non-member functions} @@ -1400,7 +1443,8 @@ \begin{itemdescr} \pnum -\returns \tcode{error_condition(static_cast(e), generic_category())}. +\returns +\tcode{error_condition(static_cast(e), generic_category())}. \end{itemdescr} \rSec2[syserr.compare]{Comparison functions} @@ -1476,14 +1520,15 @@ \rSec2[syserr.hash]{System error hash support} -\indexlibrary{\idxcode{hash}!\idxcode{error_code}}% +\indexlibrarymember{hash}{error_code}% \begin{itemdecl} template<> struct hash; template<> struct hash; \end{itemdecl} \begin{itemdescr} -\pnum The specializations are enabled\iref{unord.hash}. +\pnum +The specializations are enabled\iref{unord.hash}. \end{itemdescr} \rSec2[syserr.syserr]{Class \tcode{system_error}} @@ -1502,7 +1547,7 @@ encouraged to throw an exception object of type \tcode{bad_alloc}\iref{bad.alloc} rather than \tcode{system_error}. \end{note} -\indexlibrary{\idxcode{system_error}}% +\indexlibraryglobal{system_error}% \begin{codeblock} namespace std { class system_error : public runtime_error { @@ -1521,68 +1566,74 @@ \rSec3[syserr.syserr.members]{Members} -\indexlibrary{\idxcode{system_error}!constructor}% +\indexlibraryctor{system_error}% \begin{itemdecl} system_error(error_code ec, const string& what_arg); \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{code() == ec} and\newline +\ensures +\tcode{code() == ec} and\newline \tcode{string_view(what()).find(what_arg.c_str()) != string_view::npos}. \end{itemdescr} -\indexlibrary{\idxcode{system_error}!constructor}% +\indexlibraryctor{system_error}% \begin{itemdecl} system_error(error_code ec, const char* what_arg); \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{code() == ec} and +\ensures +\tcode{code() == ec} and \tcode{string_view(what()).find(what_arg) != string_view::npos}. \end{itemdescr} -\indexlibrary{\idxcode{system_error}!constructor}% +\indexlibraryctor{system_error}% \begin{itemdecl} system_error(error_code ec); \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{code() == ec}. +\ensures +\tcode{code() == ec}. \end{itemdescr} -\indexlibrary{\idxcode{system_error}!constructor}% +\indexlibraryctor{system_error}% \begin{itemdecl} system_error(int ev, const error_category& ecat, const string& what_arg); \end{itemdecl} \begin{itemdescr} \pnum -\ensures \raggedright \tcode{code() == error_code(ev, ecat)} and\linebreak +\ensures +\raggedright \tcode{code() == error_code(ev, ecat)} and\linebreak \tcode{string_view(what()).find(what_arg.c_str()) != string_view::npos}. \end{itemdescr} -\indexlibrary{\idxcode{system_error}!constructor}% +\indexlibraryctor{system_error}% \begin{itemdecl} system_error(int ev, const error_category& ecat, const char* what_arg); \end{itemdecl} \begin{itemdescr} \pnum -\ensures \raggedright \tcode{code() == error_code(ev, ecat)} and\linebreak +\ensures +\raggedright \tcode{code() == error_code(ev, ecat)} and\linebreak \tcode{string_view(what()).find(what_arg) != string_view::npos}. \end{itemdescr} -\indexlibrary{\idxcode{system_error}!constructor}% +\indexlibraryctor{system_error}% \begin{itemdecl} system_error(int ev, const error_category& ecat); \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{code() == error_code(ev, ecat)}. +\ensures +\tcode{code() == error_code(ev, ecat)}. \end{itemdescr} \indexlibrarymember{code}{system_error}% @@ -1592,7 +1643,8 @@ \begin{itemdescr} \pnum -\returns \tcode{ec} or \tcode{error_code(ev, ecat)}, from the constructor, +\returns +\tcode{ec} or \tcode{error_code(ev, ecat)}, from the constructor, as appropriate. \end{itemdescr} @@ -1603,8 +1655,11 @@ \begin{itemdescr} \pnum -\returns An \ntbs{} incorporating the arguments supplied in the constructor. +\returns +An \ntbs{} incorporating the arguments supplied in the constructor. -\begin{note} The returned \ntbs{} might be the contents of \tcode{what_arg + ": " + -code.message()}.\end{note} +\begin{note} +The returned \ntbs{} might be the contents of \tcode{what_arg + ": " + +code.message()}. +\end{note} \end{itemdescr} diff --git a/source/exceptions.tex b/source/exceptions.tex index e219237b0b..ceeba0c96c 100644 --- a/source/exceptions.tex +++ b/source/exceptions.tex @@ -7,6 +7,8 @@ \indextext{exception object|see{exception handling, exception object}}% \indextext{object!exception|see{exception handling, exception object}} +\rSec1[except.pre]{Preamble} + \pnum Exception handling provides a way of transferring control and information from a point in the execution of a thread to an exception handler @@ -57,9 +59,11 @@ \indextext{try block|see{exception handling, try block}}% \indextext{handler|see{exception handling, handler}}% A \grammarterm{try-block} is a \grammarterm{statement}\iref{stmt.stmt}. -\begin{note} Within this Clause +\begin{note} +Within this Clause ``try block'' is taken to mean both \grammarterm{try-block} and -\grammarterm{function-try-block}. \end{note} +\grammarterm{function-try-block}. +\end{note} \pnum \indextext{exception handling!\idxcode{goto}}% @@ -108,7 +112,6 @@ will be destroyed in the context that directly contains its declaration. \begin{example} - \begin{codeblock} lab: try { T1 t1; @@ -275,7 +278,6 @@ If a handler exits by rethrowing, control is passed to another handler for the same exception object. The points of potential destruction for the exception object are: - \begin{itemize} \item when an active handler for the exception exits by @@ -300,9 +302,11 @@ The implementation may then deallocate the memory for the exception object; any such deallocation is done in an unspecified way. -\begin{note} A thrown exception does not +\begin{note} +A thrown exception does not propagate to other threads unless caught, stored, and rethrown using -appropriate library functions; see~\ref{propagation} and~\ref{futures}. \end{note} +appropriate library functions; see~\ref{propagation} and~\ref{futures}. +\end{note} \pnum \indextext{exception handling!exception object!constructor}% @@ -665,7 +669,6 @@ The variable declared by the \grammarterm{exception-declaration}, of type \cv{}~\tcode{T} or \cv{}~\tcode{T\&}, is initialized from the exception object, of type \tcode{E}, as follows: - \begin{itemize} \item if \tcode{T} is a base class of \tcode{E}, the variable is @@ -816,7 +819,6 @@ \pnum An expression \tcode{e} is \defnx{potentially-throwing}{potentially-throwing!expression} if - \begin{itemize} \item \tcode{e} is a function call\iref{expr.call} @@ -858,7 +860,6 @@ has a potentially-throwing exception specification if and only if any of the following constructs is potentially-throwing: - \begin{itemize} \item a constructor selected by overload resolution @@ -949,7 +950,6 @@ \pnum An exception specification is considered to be \defnx{needed}{needed!exception specification} when: - \begin{itemize} \item in an expression, the function is the unique lookup result or the selected member of a set of overloaded functions~(\ref{basic.lookup}, \ref{over.match}, \ref{over.over}); @@ -966,7 +966,8 @@ \item the exception specification is needed for a defaulted special member function that calls the function. -\begin{note} A defaulted declaration does not require the +\begin{note} +A defaulted declaration does not require the exception specification of a base member function to be evaluated until the implicit exception specification of the derived function is needed, but an explicit \grammarterm{noexcept-specifier} needs @@ -997,8 +998,9 @@ \pnum \indextext{\idxcode{terminate}}% In some situations exception handling must be abandoned -for less subtle error handling techniques. \begin{note} These situations are: - +for less subtle error handling techniques. +\begin{note} +These situations are: \indextext{\idxcode{terminate}!called}% \begin{itemize} \item% @@ -1096,7 +1098,7 @@ \tcode{std::terminate}. \rSec2[except.uncaught]{The \tcode{std::uncaught_exceptions()} function}% -\indexlibrary{\idxcode{uncaught_exceptions}} +\indexlibraryglobal{uncaught_exceptions} \pnum An exception is considered uncaught diff --git a/source/expressions.tex b/source/expressions.tex index add9621513..25c974605d 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -117,12 +117,13 @@ \end{note} \pnum -The values of the floating operands and the results of floating -expressions may be represented in greater precision and range than that +The values of the floating-point operands and +the results of floating-point expressions +may be represented in greater precision and range than that required by the type; the types are not changed\ thereby.\footnote{The cast and assignment operators must still perform their specific -conversions as described in~\ref{expr.cast}, \ref{expr.static.cast} -and~\ref{expr.ass}.} +conversions as described in~\ref{expr.type.conv}, \ref{expr.cast}, +\ref{expr.static.cast} and~\ref{expr.ass}.} \rSec1[expr.prop]{Properties of expressions} @@ -150,12 +151,15 @@ \pnum Every expression belongs to exactly one of the fundamental classifications in this taxonomy: lvalue, xvalue, or prvalue. This property of an expression is called -its \defn{value category}. \begin{note} The discussion of each built-in operator in +its \defn{value category}. +\begin{note} +The discussion of each built-in operator in \ref{expr.compound} indicates the category of the value it yields and the value categories of the operands it expects. For example, the built-in assignment operators expect that the left operand is an lvalue and that the right operand is a prvalue and yield an lvalue as the result. User-defined operators are functions, and the categories of -values they expect and yield are determined by their parameter and return types. \end{note} +values they expect and yield are determined by their parameter and return types. +\end{note} \pnum \begin{note} @@ -177,8 +181,8 @@ whose return type is an rvalue reference to object type\iref{expr.call}, \item a cast to an rvalue reference to object type -(\ref{expr.dynamic.cast}, \ref{expr.static.cast}, \ref{expr.reinterpret.cast}, -\ref{expr.const.cast}, \ref{expr.cast}), +(\ref{expr.type.conv}, \ref{expr.dynamic.cast}, \ref{expr.static.cast} +\ref{expr.reinterpret.cast}, \ref{expr.const.cast}, \ref{expr.cast}), \item a subscripting operation with an xvalue array operand\iref{expr.sub}, @@ -331,7 +335,6 @@ \tcode{p2} having types \tcode{T1} and \tcode{T2}, respectively, where at least one is a pointer or pointer-to-member type or \tcode{std::nullptr_t}, is: - \begin{itemize} \item if both \tcode{p1} and \tcode{p2} are null pointer constants, @@ -446,7 +449,8 @@ these expressions. \end{itemize} -\begin{note} Using an overloaded operator causes a function call; the +\begin{note} +Using an overloaded operator causes a function call; the above covers only operators with built-in meaning. \end{note} If the (possibly converted) expression is a prvalue, @@ -455,7 +459,8 @@ If the expression is an lvalue of class type, it must have a volatile copy constructor to initialize the temporary object that is the result object of the lvalue-to-rvalue -conversion. \end{note} +conversion. +\end{note} The glvalue expression is evaluated and its value is discarded. \rSec1[conv]{Standard conversions} @@ -489,7 +494,9 @@ \begin{note} A standard conversion sequence can be empty, i.e., it can consist of no -conversions. \end{note} A standard conversion sequence will be applied to +conversions. +\end{note} +A standard conversion sequence will be applied to an expression if necessary to convert it to a required destination type. \pnum @@ -644,7 +651,8 @@ \pnum \begin{note} -See also~\ref{basic.lval}.\end{note} +See also~\ref{basic.lval}. +\end{note} \rSec2[conv.array]{Array-to-pointer conversion} @@ -934,8 +942,12 @@ converted is in the range of values that can be represented but the value cannot be represented exactly, it is an \impldef{value of result of inexact integer to floating-point conversion} choice of either the next lower or higher representable -value. \begin{note} Loss of precision occurs if the integral value cannot be represented -exactly as a value of the floating-point type. \end{note} If the value being converted is +value. +\begin{note} +Loss of precision occurs if the integral value cannot be represented +exactly as a value of the floating-point type. +\end{note} +If the value being converted is outside the range of values that can be represented, the behavior is undefined. If the source type is \tcode{bool}, the value \tcode{false} is converted to zero and the value \tcode{true} is converted to one. @@ -962,7 +974,9 @@ pointer conversion followed by a qualification conversion\iref{conv.qual}. A null pointer constant of integral type can be converted to a prvalue of type \tcode{std::nullptr_t}. -\begin{note} The resulting prvalue is not a null pointer value. \end{note} +\begin{note} +The resulting prvalue is not a null pointer value. +\end{note} \pnum A prvalue of type ``pointer to \cv{} \tcode{T}'', where \tcode{T} @@ -1044,11 +1058,11 @@ \begin{example} \begin{codeblock} - void (*p)(); - void (**pp)() noexcept = &p; // error: cannot convert to pointer to \tcode{noexcept} function +void (*p)(); +void (**pp)() noexcept = &p; // error: cannot convert to pointer to \tcode{noexcept} function - struct S { typedef void (*p)(); operator p(); }; - void (*q)() noexcept = S(); // error: cannot convert to pointer to \tcode{noexcept} function +struct S { typedef void (*p)(); operator p(); }; +void (*q)() noexcept = S(); // error: cannot convert to pointer to \tcode{noexcept} function \end{codeblock} \end{example} @@ -1167,8 +1181,11 @@ before the optional \grammarterm{cv-qualifier-seq} and it shall not appear within the declaration of a static member function (although its type and value category are defined within a static member function as they are within a non-static -member function). \begin{note} This is because declaration matching does not -occur until the complete declarator is known. \end{note} +member function). +\begin{note} +This is because declaration matching does not +occur until the complete declarator is known. +\end{note} \begin{note} In a \grammarterm{trailing-return-type}, the class being defined is not required to be complete @@ -1243,7 +1260,6 @@ \pnum An \grammarterm{id-expression} that denotes a non-static data member or non-static member function of a class can only be used: - \begin{itemize} \item as part of a class member access\iref{expr.ref} in which the object expression @@ -1256,7 +1272,6 @@ \item if that \grammarterm{id-expression} denotes a non-static data member and it appears in an unevaluated operand. \begin{example} - \begin{codeblock} struct S { int m; @@ -1270,8 +1285,11 @@ \pnum An \grammarterm{id-expression} that denotes an immediate function\iref{dcl.constexpr} -shall appear as a subexpression of an immediate invocation or -in an immediate function context\iref{expr.const}. +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 An \grammarterm{id-expression} @@ -1514,7 +1532,7 @@ C().C::~C(); // undefined behavior: temporary of type \tcode{C} destroyed twice using T = int; 0 .T::~T(); // OK, no effect - 0.T::~T(); // error: \tcode{0.T} is a \grammarterm{user-defined-floating-literal}\iref{lex.ext} + 0.T::~T(); // error: \tcode{0.T} is a \grammarterm{user-defined-floating-point-literal}\iref{lex.ext} } \end{codeblock} \end{example} @@ -1557,7 +1575,8 @@ whose result object is called the \defn{closure object}. \begin{note} A closure object behaves like a function -object\iref{function.objects}.\end{note} +object\iref{function.objects}. +\end{note} \pnum In the \grammarterm{decl-specifier-seq} of the \grammarterm{lambda-declarator}, @@ -1609,14 +1628,17 @@ \pnum The closure type is declared in the smallest block scope, class scope, or namespace scope that contains the corresponding -\grammarterm{lambda-expression}. \begin{note} This determines the set of namespaces and +\grammarterm{lambda-expression}. +\begin{note} +This determines the set of namespaces and classes associated with the closure type\iref{basic.lookup.argdep}. The parameter types of a \grammarterm{lambda-declarator} do not affect these associated namespaces and -classes. \end{note} The closure type is not an aggregate type\iref{dcl.init.aggr}. +classes. +\end{note} +The closure type is not an aggregate type\iref{dcl.init.aggr}. An implementation may define the closure type differently from what is described below provided this does not alter the observable behavior of the program other than by changing: - \begin{itemize} \item the size and/or alignment of the closure type, @@ -1687,7 +1709,8 @@ It is an immediate function\iref{dcl.constexpr} if the corresponding \grammarterm{lambda-expression}{'s} \grammarterm{parameter-declaration-clause} is followed by \tcode{consteval}. -\begin{note} Names referenced in +\begin{note} +Names referenced in the \grammarterm{lambda-declarator} are looked up in the context in which the \grammarterm{lambda-expression} appears. \end{note} @@ -1908,8 +1931,10 @@ It has a deleted copy assignment operator if the \grammarterm{lambda-expression} has a \grammarterm{lambda-capture} and defaulted copy and move assignment operators otherwise\iref{class.copy.assign}. -\begin{note} These special member functions are implicitly defined as -usual, and might therefore be defined as deleted. \end{note} +\begin{note} +These special member functions are implicitly defined as +usual, and might therefore be defined as deleted. +\end{note} \pnum The closure type associated with a \grammarterm{lambda-expression} has an @@ -1980,7 +2005,8 @@ ``\tcode{\&} \grammarterm{identifier}'', ``\tcode{this}'', or ``\tcode{* this}''. -\begin{note} The form \tcode{[\&,this]} is redundant but accepted +\begin{note} +The form \tcode{[\&,this]} is redundant but accepted for compatibility with ISO \CppXIV{}. \end{note} Ignoring appearances in @@ -2256,11 +2282,13 @@ \grammarterm{lambda-expression} that is an odr-use\iref{basic.def.odr} of an entity captured by copy is transformed into an access to the corresponding unnamed data member of the closure type. -\begin{note} An \grammarterm{id-expression} that is not an odr-use refers to +\begin{note} +An \grammarterm{id-expression} that is not an odr-use refers to the original entity, never to a member of the closure type. However, such an \grammarterm{id-expression} can still cause the implicit capture of the -entity. \end{note} +entity. +\end{note} If \tcode{*this} is captured by copy, each expression that odr-uses \tcode{*this} is transformed to instead refer to the corresponding unnamed data member of the closure type. \begin{example} @@ -2298,9 +2326,11 @@ that is an odr-use of a reference captured by reference refers to the entity to which the captured reference is bound and not to the captured reference. -\begin{note} The validity of such captures is determined by +\begin{note} +The validity of such captures is determined by the lifetime of the object to which the reference refers, -not by the lifetime of the reference itself. \end{note} +not by the lifetime of the reference itself. +\end{note} \begin{example} \begin{codeblock} auto h(int &r) { @@ -2317,12 +2347,10 @@ captured by an immediately enclosing \grammarterm{lambda-expression} \tcode{m1}, then \tcode{m2}'s capture is transformed as follows: - \begin{itemize} \item if \tcode{m1} captures the entity by copy, \tcode{m2} captures the corresponding non-static data member of \tcode{m1}'s closure type; - \item if \tcode{m1} captures the entity by reference, \tcode{m2} captures the same entity captured by \tcode{m1}. @@ -2353,12 +2381,14 @@ \grammarterm{init-capture}{s} are initialized as indicated by the corresponding \grammarterm{initializer} (which may be copy- or direct-initialization). (For array members, the array elements are direct-initialized in increasing subscript order.) These initializations are performed -in the (unspecified) order in which the non-static data members are declared. \begin{note} +in the (unspecified) order in which the non-static data members are declared. +\begin{note} This ensures that the destructions will occur in the reverse order of the constructions. \end{note} \pnum -\begin{note} If a non-reference entity is implicitly or explicitly captured by reference, +\begin{note} +If a non-reference entity is implicitly or explicitly captured by reference, invoking the function call operator of the corresponding \grammarterm{lambda-expression} after the lifetime of the entity has ended is likely to result in undefined behavior. \end{note} @@ -2383,7 +2413,7 @@ lm2(); } \end{codeblock} -\end{example}% +\end{example} \indextext{expression!lambda|)} \rSec2[expr.prim.fold]{Fold expressions}% @@ -2677,9 +2707,8 @@ into the \grammarterm{return-type-requirement} is performed. \item -The contextually-determined type being constrained -by the \grammarterm{type-constraint} is \tcode{decltype((E))}. -The immediately-declared constraint\iref{temp} of \tcode{decltype((E))} +The immediately-declared constraint\iref{temp} +of the \grammarterm{type-constraint} for \tcode{decltype((E))} shall be satisfied. \begin{example} Given concepts \tcode{C} and \tcode{D}, @@ -2813,12 +2842,14 @@ \end{bnf} \pnum -\begin{note} The \tcode{>} token following the +\begin{note} +The \tcode{>} token following the \grammarterm{type-id} in a \tcode{dynamic_cast}, \tcode{static_cast}, \tcode{reinterpret_cast}, or \tcode{const_cast} may be the product of replacing a \tcode{>{>}} token by two consecutive \tcode{>} -tokens\iref{temp.names}.\end{note} +tokens\iref{temp.names}. +\end{note} \rSec3[expr.sub]{Subscripting} @@ -2946,8 +2977,8 @@ the program is ill-formed if one is not present. \begin{example} \begin{codeblock} - template int f(int n = 0, T ...t); - int x = f(); // error: no argument for second function parameter +template int f(int n = 0, T ...t); +int x = f(); // error: no argument for second function parameter \end{codeblock} \end{example} If the function is a non-static member @@ -3076,10 +3107,12 @@ When there is no parameter for a given argument, the argument is passed in such a way that the receiving function can obtain the value of the argument by invoking \tcode{va_arg}\iref{support.runtime}. -\begin{note} This paragraph does not apply to arguments passed to a function parameter pack. +\begin{note} +This paragraph does not apply to arguments passed to a function parameter pack. Function parameter packs are expanded during template instantiation\iref{temp.variadic}, thus each such argument has a corresponding parameter when a function template -specialization is actually called. \end{note} +specialization is actually called. +\end{note} The lvalue-to-rvalue\iref{conv.lval}, array-to-pointer\iref{conv.array}, and function-to-pointer\iref{conv.func} standard conversions are @@ -3277,8 +3310,11 @@ \tcode{E1.E2} is a prvalue. The expression designates a non-static member function. The expression can be used only as the left-hand operand of a member function call\iref{class.mfct}. -\begin{note} Any redundant set of parentheses surrounding the expression -is ignored\iref{expr.prim.paren}. \end{note} The type of \tcode{E1.E2} is +\begin{note} +Any redundant set of parentheses surrounding the expression +is ignored\iref{expr.prim.paren}. +\end{note} +The type of \tcode{E1.E2} is ``function of parameter-type-list \cv{} returning \tcode{T}''. \end{itemize} @@ -3310,7 +3346,7 @@ The value of a postfix \tcode{++} expression is the value of its operand. \begin{note} -The value obtained is a copy of the original value +The value obtained is a copy of the original value. \end{note} The operand shall be a modifiable lvalue. The type of the operand shall be an arithmetic type other than \cv{}~\tcode{bool}, @@ -3393,7 +3429,6 @@ reference cases, the program is ill-formed if \tcode{B} is an inaccessible or ambiguous base class of \tcode{D}. \begin{example} - \begin{codeblock} struct B { }; struct D : B { }; @@ -3444,9 +3479,8 @@ handler\iref{except.handle} of type \tcode{std::bad_cast}\iref{bad.cast}. \indextext{\idxcode{bad_cast}}% -\indexlibrary{\idxcode{bad_cast}}% +\indexlibraryglobal{bad_cast}% \begin{example} - \begin{codeblock} class A { virtual void f(); }; class B { virtual void g(); }; @@ -3485,7 +3519,7 @@ \indextext{\idxcode{typeid}}% The result of a \tcode{typeid} expression is an lvalue of static type \indextext{\idxcode{type_info}}% -\indexlibrary{\idxcode{type_info}}% +\indexlibraryglobal{type_info}% \tcode{const} \tcode{std::type_info}\iref{type.info} and dynamic type \tcode{const} \tcode{std::type_info} or \tcode{const} \term{name} where \term{name} is an \impldef{derived type for \tcode{typeid}} class publicly derived from @@ -3510,7 +3544,7 @@ \tcode{typeid} expression throws an exception\iref{except.throw} of a type that would match a handler of type \indextext{\idxcode{bad_typeid}}% -\indexlibrary{\idxcode{bad_typeid}}% +\indexlibraryglobal{bad_typeid}% \tcode{std::bad_typeid} exception\iref{bad.typeid}. @@ -3535,6 +3569,10 @@ representing the cv-unqualified referenced type. If the type of the \grammarterm{type-id} is a class type or a reference to a class type, the class shall be completely-defined. +\begin{note} +The \grammarterm{type-id} cannot denote a function type with +a \grammarterm{cv-qualifier-seq} or a \grammarterm{ref-qualifier}\iref{dcl.fct}. +\end{note} \pnum If the type of the expression or \grammarterm{type-id} is a @@ -3542,7 +3580,6 @@ to a \tcode{std::type_info} object representing the cv-unqualified type. \begin{example} - \begin{codeblock} class D { @\commentellip@ }; D d1; @@ -3556,7 +3593,7 @@ \end{example} \pnum -If the header \tcode{}\iref{type.info} is not included prior +If the header \libheaderrefx{typeinfo}{type.info} is not included prior to a use of \tcode{typeid}, the program is ill-formed. \pnum @@ -3600,7 +3637,6 @@ of type \tcode{D}, the result refers to the enclosing object of type \tcode{D}. Otherwise, the behavior is undefined. \begin{example} - \begin{codeblock} struct B { }; struct D : public B { }; @@ -3635,7 +3671,7 @@ If \tcode{T} is a reference type, the effect is the same as performing the declaration and initialization \begin{codeblock} - T t(e); +T t(e); \end{codeblock} for some invented temporary variable \tcode{t}\iref{dcl.init} and then using the temporary variable as the result of the conversion. @@ -3788,7 +3824,6 @@ the result is a pointer to \placeholder{b}. Otherwise, the pointer value is unchanged by the conversion. \begin{example} - \begin{codeblock} T* p1 = new T; const T* p2 = static_cast(static_cast(p1)); @@ -3836,11 +3871,15 @@ \begin{note} It is intended to be unsurprising to those who know the addressing structure of the underlying machine. -\end{note} A value of type \tcode{std::nullptr_t} can be converted to an integral +\end{note} +A value of type \tcode{std::nullptr_t} can be converted to an integral type; the conversion has the same meaning and validity as a conversion of -\tcode{(void*)0} to the integral type. \begin{note} A \tcode{reinterpret_cast} +\tcode{(void*)0} to the integral type. +\begin{note} +A \tcode{reinterpret_cast} cannot be used to convert a value of any type to the type -\tcode{std::nullptr_t}. \end{note} +\tcode{std::nullptr_t}. +\end{note} \pnum \indextext{cast!reinterpret!integer to pointer}% @@ -3852,8 +3891,10 @@ \indextext{conversion!implementation-defined pointer integer}% mappings between pointers and integers are otherwise \impldef{conversions between pointers and integers}. -\begin{note} Except as described in \ref{basic.stc.dynamic.safety}, the result of -such a conversion will not be a safely-derived pointer value. \end{note} +\begin{note} +Except as described in \ref{basic.stc.dynamic.safety}, the result of +such a conversion will not be a safely-derived pointer value. +\end{note} \pnum \indextext{cast!reinterpret!pointer-to-function}% @@ -3999,7 +4040,6 @@ For two object types \tcode{T1} and \tcode{T2}, if a pointer to \tcode{T1} can be explicitly converted to the type ``pointer to \tcode{T2}'' using a \tcode{const_cast}, then the following conversions can also be made: - \begin{itemize} \item an lvalue of type \tcode{T1} can be explicitly converted to an lvalue of type \tcode{T2} using the cast \tcode{const_cast}; @@ -4040,13 +4080,10 @@ there is a cv-decomposition\iref{conv.qual} of \tcode{T1} yielding \placeholder{n} such that \tcode{T2} has a cv-decomposition of the form - \begin{indented} $\cv{}_0^2$ $P_0^2$ $\cv{}_1^2$ $P_1^2$ $\cdots$ $\cv{}_{n-1}^2$ $P_{n-1}^2$ $\cv{}_n^2$ $\mathtt{U}_2$, \end{indented} - and there is no qualification conversion that converts \tcode{T1} to - \begin{indented} $\cv{}_0^2$ $P_0^1$ $\cv{}_1^2$ $P_1^1$ $\cdots$ $\cv{}_{n-1}^2$ $P_{n-1}^1$ $\cv{}_n^2$ $\mathtt{U}_1$. \end{indented} @@ -4068,7 +4105,7 @@ conversions between pointers to member functions, and in particular, the conversion from a pointer to a const member function to a pointer to a non-const member function, are not covered. -\end{note}% +\end{note} \indextext{expression!postfix|)} \rSec2[expr.unary]{Unary expressions} @@ -4475,7 +4512,6 @@ auto f(int x = co_await h()); // error: \grammarterm{await-expression} outside of function suspension context int a[] = { co_await h() }; // error: \grammarterm{await-expression} outside of function suspension context - \end{codeblock} \end{example} @@ -4547,7 +4583,6 @@ in the pack\iref{temp.variadic}. A \tcode{sizeof...} expression is a pack expansion\iref{temp.variadic}. \begin{example} - \begin{codeblock} template struct count { @@ -4558,15 +4593,14 @@ \pnum \indextext{\idxcode{size_t}}% -\indexlibrary{\idxcode{size_t}}% +\indexlibraryglobal{size_t}% The result of \tcode{sizeof} and \tcode{sizeof...} is a prvalue of type \tcode{std::size_t}. \begin{note} A \tcode{sizeof} expression is an integral constant expression\iref{expr.const}. The type \tcode{std::size_t} is defined in the standard header -\indexhdr{cstddef}% -\tcode{}~(\ref{cstddef.syn}, \ref{support.types.layout}). +\libheader{cstddef}~(\ref{cstddef.syn}, \ref{support.types.layout}). \end{note} \rSec3[expr.alignof]{Alignof} @@ -4585,8 +4619,7 @@ An \tcode{alignof} expression is an integral constant expression\iref{expr.const}. The type \tcode{std::size_t} is defined in the standard header -\indexhdr{cstddef}% -\tcode{}~(\ref{cstddef.syn}, \ref{support.types.layout}). +\libheader{cstddef}~(\ref{cstddef.syn}, \ref{support.types.layout}). \end{note} \pnum @@ -4716,7 +4749,6 @@ \tcode{*}, and \tcode{[]} and their expression counterparts. \end{note} \begin{example} - \begin{codeblock} new int * i; // syntax error: parsed as \tcode{(new int*) i}, not as \tcode{(new int)*i} \end{codeblock} @@ -4730,13 +4762,10 @@ Parentheses in a \grammarterm{new-type-id} of a \grammarterm{new-expression} can have surprising effects. \begin{example} - \begin{codeblock} new int(*[10])(); // error \end{codeblock} - is ill-formed because the binding is - \begin{codeblock} (new int) (*[10])(); // error \end{codeblock} @@ -4748,7 +4777,6 @@ \begin{codeblock} new (int (*[10])()); \end{codeblock} - allocates an array of \tcode{10} pointers to functions (taking no argument and returning \tcode{int}). \end{example} @@ -4808,7 +4836,6 @@ is present, it is implicitly converted to \tcode{std::size_t}. \indextext{function!allocation}% The \grammarterm{expression} is erroneous if: - \begin{itemize} \item the expression is of non-class type and its value before converting to @@ -4914,7 +4941,6 @@ extend the allocation of a \grammarterm{new-expression} \tcode{e1} to provide storage for a \grammarterm{new-expression} \tcode{e2} if the following would be true were the allocation not extended: - \begin{itemize} \item the evaluation of \tcode{e1} is sequenced before the evaluation of \tcode{e2}, and @@ -4938,25 +4964,25 @@ \begin{example} \begin{codeblock} - void can_merge(int x) { - // These allocations are safe for merging: - std::unique_ptr a{new (std::nothrow) char[8]}; - std::unique_ptr b{new (std::nothrow) char[8]}; - std::unique_ptr c{new (std::nothrow) char[x]}; +void can_merge(int x) { + // These allocations are safe for merging: + std::unique_ptr a{new (std::nothrow) char[8]}; + std::unique_ptr b{new (std::nothrow) char[8]}; + std::unique_ptr c{new (std::nothrow) char[x]}; - g(a.get(), b.get(), c.get()); - } + g(a.get(), b.get(), c.get()); +} - void cannot_merge(int x) { - std::unique_ptr a{new char[8]}; - try { - // Merging this allocation would change its catch handler. - std::unique_ptr b{new char[x]}; - } catch (const std::bad_alloc& e) { - std::cerr << "Allocation failed: " << e.what() << std::endl; - throw; - } +void cannot_merge(int x) { + std::unique_ptr a{new char[8]}; + try { + // Merging this allocation would change its catch handler. + std::unique_ptr b{new char[x]}; + } catch (const std::bad_alloc& e) { + std::cerr << "Allocation failed: " << e.what() << std::endl; + throw; } +} \end{codeblock} \end{example} @@ -5018,7 +5044,6 @@ \pnum \begin{example} - \begin{itemize} \item \tcode{new T} results in one of the following calls: \begin{codeblock} @@ -5057,7 +5082,7 @@ exception specification\iref{except.spec}, it indicates failure to allocate storage by throwing a \indextext{\idxcode{bad_alloc}}% -\indexlibrary{\idxcode{bad_alloc}}% +\indexlibraryglobal{bad_alloc}% \tcode{std::bad_alloc} exception~(\ref{basic.stc.dynamic.allocation}, \ref{except}, \ref{bad.alloc}); it returns a non-null pointer otherwise. If the allocation function @@ -5092,8 +5117,11 @@ \begin{itemize} \item If the \grammarterm{new-initializer} is omitted, the object is -default-initialized\iref{dcl.init}. \begin{note} If no initialization -is performed, the object has an indeterminate value. \end{note} +default-initialized\iref{dcl.init}. +\begin{note} +If no initialization +is performed, the object has an indeterminate value. +\end{note} \item Otherwise, the \grammarterm{new-initializer} is interpreted according to the initialization rules of~\ref{dcl.init} for direct-initialization. @@ -5161,7 +5189,6 @@ function lookup is used to find the matching deallocation function\iref{expr.delete} \begin{example} - \begin{codeblock} struct S { // Placement allocation function: @@ -5463,7 +5490,6 @@ \pnum The conversions performed by - \begin{itemize} \indextext{cast!const}% \indextext{cast!static}% @@ -5474,12 +5500,10 @@ \item a \tcode{reinterpret_cast}\iref{expr.reinterpret.cast}, or \item a \tcode{reinterpret_cast} followed by a \tcode{const_cast}, \end{itemize} - can be performed using the cast notation of explicit type conversion. The same semantic restrictions and behaviors apply, with the exception that in performing a \tcode{static_cast} in the following situations the conversion is valid even if the base class is inaccessible: - \begin{itemize} \item a pointer to an object of derived class type or an lvalue or rvalue of derived class type may be explicitly converted to a pointer or @@ -5503,7 +5527,6 @@ \tcode{static_cast} followed by a \tcode{const_cast}, the conversion is ill-formed. \begin{example} - \begin{codeblock} struct A { }; struct I1 : A { }; @@ -5529,7 +5552,7 @@ a multi-pass compiler would be permitted to interpret a cast between pointers to the classes as if the class types were complete at the point of the cast. -\end{note}% +\end{note} \indextext{expression!cast|)} \rSec2[expr.mptr.oper]{Pointer-to-member operators} @@ -5587,7 +5610,6 @@ It is not possible to use a pointer to member that refers to a \tcode{mutable} member to modify a const class object. For example, - \begin{codeblock} struct S { S() : i(0) { } @@ -5608,11 +5630,9 @@ result can be used only as the operand for the function call operator \tcode{()}. \begin{example} - \begin{codeblock} (ptr_to_obj->*ptr_to_mfct)(10); \end{codeblock} - calls the member function denoted by \tcode{ptr_to_mfct} for the object pointed to by \tcode{ptr_to_obj}. \end{example} @@ -5708,7 +5728,6 @@ \pnum For subtraction, one of the following shall hold: - \begin{itemize} \item both operands have arithmetic or unscoped enumeration type; or @@ -5754,13 +5773,12 @@ \indextext{\idxcode{ptrdiff_t}!implementation-defined type of}% \indextext{subtraction!implementation-defined pointer}% \indextext{\idxcode{ptrdiff_t}}% -\indexhdr{cstddef}% \indextext{comparison!undefined pointer}% When two pointer expressions \tcode{P} and \tcode{Q} are subtracted, the type of the result is an \impldef{type of \tcode{ptrdiff_t}} signed integral type; this type shall be the same type that is defined as -\tcode{std::ptrdiff_t} in the \tcode{} -header\iref{support.types}. +\tcode{std::ptrdiff_t} in the \libheader{cstddef} +header\iref{support.types.layout}. \begin{itemize} \item If \tcode{P} and \tcode{Q} both evaluate to null pointer values, the result is 0. @@ -5781,7 +5799,8 @@ 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 +\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} @@ -5871,7 +5890,7 @@ \begin{itemize} \item If a narrowing conversion\iref{dcl.init.list} is required, -other than from an integral type to a floating point type, +other than from an integral type to a floating-point type, the program is ill-formed. \item @@ -5975,8 +5994,7 @@ \tcode{std::weak_equality}, and \tcode{std::partial_ordering}) are not predefined; -if the header -\indexhdr{compare}\tcode{} +if the header \libheaderref{compare} is not included prior to a use of such a class type -- even an implicit use in which the type is not named (e.g., via the \tcode{auto} specifier\iref{dcl.spec.auto} @@ -5993,7 +6011,6 @@ \tcode{a struct X { }; constexpr A a = alignof(int); alignas(a) int n; // error: ambiguous conversion struct B { int n : a; }; // error: ambiguous conversion @@ -7170,7 +7196,6 @@ expression, implicitly converted to type \tcode{T}, where the converted expression is a constant expression and the implicit conversion sequence contains only - \begin{itemize} \item user-defined conversions, \item lvalue-to-rvalue conversions\iref{conv.lval}, @@ -7183,7 +7208,6 @@ \item null member pointer conversions\iref{conv.mem} from \tcode{std::nullptr_t}, and \item function pointer conversions\iref{conv.fctptr}, \end{itemize} - and where the reference binding (if any) binds directly. \begin{note} Such expressions may be used in \tcode{new} @@ -7206,13 +7230,11 @@ an entity that is a permitted result of a constant expression (as defined below), or a prvalue core constant expression whose value satisfies the following constraints: - \begin{itemize} \item if the value is an object of class type, each non-static data member of reference type refers to an entity that is a permitted result of a constant expression, - \item if the value is of pointer type, it contains the address of an object with static storage duration, @@ -7246,14 +7268,15 @@ \end{example} \pnum -\begin{note} Since this document +\begin{note} +Since this document imposes no restrictions on the accuracy of floating-point operations, it is unspecified whether the evaluation of a floating-point expression during translation yields the same result as the evaluation of the same expression (or the same operations on the same values) during program execution.\footnote{Nonetheless, implementations should provide consistent results, irrespective of whether the evaluation was performed during translation and/or during program -execution.} \begin{example} - +execution.} +\begin{example} \begin{codeblock} bool f() { char array[1 + int(1 + 0.2 - 0.1 - 0.1)]; // Must be evaluated during translation @@ -7262,7 +7285,8 @@ } \end{codeblock} It is unspecified whether the value of \tcode{f()} will be \tcode{true} or \tcode{false}. -\end{example} \end{note}% +\end{example} +\end{note} \pnum An expression or conversion is in an \defn{immediate function context} @@ -7318,7 +7342,6 @@ \indextext{expression!potentially constant evaluated}% An expression or conversion is \defn{potentially constant evaluated} if it is: - \begin{itemize} \item a manifestly constant-evaluated expression, @@ -7346,7 +7369,6 @@ A function or variable is \defn{needed for constant evaluation} if it is: - \begin{itemize} \item a constexpr function that is named by an expression\iref{basic.def.odr} diff --git a/source/future.tex b/source/future.tex index f726e1cd03..6126cc4e3c 100644 --- a/source/future.tex +++ b/source/future.tex @@ -121,10 +121,10 @@ \begin{example} \begin{codeblock} struct A { - static constexpr int n = 5; // definition (declaration in \CppXIV{}) + static constexpr int n = 5; // definition (declaration in \CppXIV{}) }; -constexpr int A::n; // redundant declaration (definition in \CppXIV{}) +constexpr int A::n; // redundant declaration (definition in \CppXIV{}) \end{codeblock} \end{example} @@ -152,61 +152,61 @@ \begin{multicolfloattable}{C headers}{depr.c.headers} {lllll} -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ +\libheaderdef{assert.h} \\ +\libheader{complex.h} \\ +\libheaderdef{ctype.h} \\ +\libheaderdef{errno.h} \\ +\libheaderdef{fenv.h} \\ +\libheaderdef{float.h} \\ \columnbreak -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ +\libheaderdef{inttypes.h} \\ +\libheader{iso646.h} \\ +\libheaderdef{limits.h} \\ +\libheaderdef{locale.h} \\ +\libheaderdef{math.h} \\ +\libheaderdef{setjmp.h} \\ \columnbreak -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ +\libheaderdef{signal.h} \\ +\libheader{stdalign.h} \\ +\libheaderdef{stdarg.h} \\ +\libheader{stdbool.h} \\ +\libheaderdef{stddef.h} \\ +\libheaderdef{stdint.h} \\ \columnbreak -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ -\tcode{} \\ +\libheaderdef{stdio.h} \\ +\libheaderdef{stdlib.h} \\ +\libheaderdef{string.h} \\ +\libheader{tgmath.h} \\ +\libheaderdef{time.h} \\ +\libheaderdef{uchar.h} \\ \columnbreak -\tcode{} \\ -\tcode{} \\ +\libheaderdef{wchar.h} \\ +\libheaderdef{wctype.h} \\ \end{multicolfloattable} \rSec2[depr.complex.h.syn]{Header \tcode{} synopsis} -\indexhdr{complex.h}% +\indexheader{complex.h}% \begin{codeblock} #include \end{codeblock} \pnum -The header \tcode{} +The header \libheader{complex.h} behaves as if it simply includes the header -\tcode{}\iref{complex.syn}. +\libheaderref{complex}. \pnum \begin{note} -Names introduced by \tcode{} in namespace \tcode{std} -are not placed into the global namespace scope by \tcode{}. +Names introduced by \libheader{complex} in namespace \tcode{std} +are not placed into the global namespace scope by \libheader{complex.h}. \end{note} \rSec2[depr.iso646.h.syn]{Header \tcode{} synopsis} -\indexhdr{iso646.h}% +\indexheader{iso646.h}% \pnum -The \Cpp{} header \tcode{} is empty. +The \Cpp{} header \libheader{iso646.h} is empty. \begin{note} \tcode{and}, \tcode{and_eq}, @@ -224,62 +224,63 @@ \rSec2[depr.stdalign.h.syn]{Header \tcode{} synopsis} -\indexlibrary{\idxcode{__alignas_is_defined}}% -\indexhdr{stdalign.h}% +\indexheader{stdalign.h}% +\indexlibraryglobal{__alignas_is_defined}% \begin{codeblock} #define @\xname{alignas_is_defined}@ 1 \end{codeblock} \pnum -\indexhdr{stdalign.h}% -The contents of the \Cpp{} header \tcode{} are the same as the C -standard library header \tcode{}, with the following changes: -The header \tcode{} does not +The contents of the \Cpp{} header \libheader{stdalign.h} are the same as the C +standard library header \libheader{stdalign.h}, with the following changes: +The header \libheader{stdalign.h} does not define a macro named \tcode{alignas}. \xrefc{7.15} \rSec2[depr.stdbool.h.syn]{Header \tcode{} synopsis} +\indexheader{stdbool.h}% \indexhdr{stdbool.h}% -\indexlibrary{\idxcode{__bool_true_false_are_defined}}% +\indexlibraryglobal{__bool_true_false_are_defined}% \begin{codeblock} #define @\xname{bool_true_false_are_defined}@ 1 \end{codeblock} \pnum -\indexhdr{stdbool.h}% -The contents of the \Cpp{} header \tcode{} are the same as the C -standard library header \tcode{}, with the following changes: -The header \tcode{} does not +The contents of the \Cpp{} header \libheader{stdbool.h} are the same as the C +standard library header \libheader{stdbool.h}, with the following changes: +The header \libheader{stdbool.h} does not define macros named \tcode{bool}, \tcode{true}, or \tcode{false}. \xrefc{7.18} \rSec2[depr.tgmath.h.syn]{Header \tcode{} synopsis} -\indexhdr{tgmath.h}% +\indexheader{tgmath.h}% \begin{codeblock} #include #include \end{codeblock} \pnum -The header \tcode{} +The header \libheader{tgmath.h} behaves as if it simply includes the headers -\tcode{}\iref{cmath.syn} and -\tcode{}\iref{complex.syn}. +\libheaderref{cmath} and +\libheaderref{complex}. \pnum -\begin{note} The overloads provided in C by type-generic macros are already -provided in \tcode{} and \tcode{} by ``sufficient'' additional -overloads.\end{note} +\begin{note} +The overloads provided in C by type-generic macros +are already provided in \libheader{complex} and \libheader{cmath} +by ``sufficient'' additional overloads. +\end{note} \pnum \begin{note} -Names introduced by \tcode{} or \tcode{} +Names introduced by \libheader{cmath} or \libheader{complex} in namespace \tcode{std} -are not placed into the global namespace scope by \tcode{}. +are not placed into the global namespace scope by \libheader{tgmath.h}. \end{note} \rSec2[depr.c.headers.other]{Other C headers} @@ -287,11 +288,11 @@ \pnum Every C header other than -\tcode{}, -\tcode{}, -\tcode{}, -\tcode{}, and -\tcode{}, +\libdeprheaderref{complex.h}, +\libdeprheaderref{iso646.h}, +\libdeprheaderref{stdalign.h}, +\libdeprheaderref{stdbool.h}, and +\libdeprheaderref{tgmath.h}, each of which has a name of the form \indextext{header!C}% @@ -311,26 +312,21 @@ \pnum \begin{example} -The header -\indexhdr{cstdlib}% -\indexhdr{stdlib.h}% -\tcode{} assuredly +The header \libheader{cstdlib} assuredly provides its declarations and definitions within the namespace \tcode{std}. It may also provide these names within the global namespace. -The header -\tcode{} +The header \libheader{stdlib.h} assuredly provides the same declarations and definitions within the global namespace, much as in the C Standard. It may also provide these names within the namespace \tcode{std}. \end{example} + \rSec1[depr.relops]{Relational operators} \pnum -The header \tcode{} -\indexhdr{utility}% -has the following additions: +The header \libheaderref{utility} has the following additions: \begin{codeblock} namespace std::rel_ops { @@ -361,7 +357,7 @@ \tcode{!(x == y)}. \end{itemdescr} -\indexlibrary{\idxcode{operator>}}% +\indexlibraryglobal{operator>}% \begin{itemdecl} template bool operator>(const T& x, const T& y); \end{itemdecl} @@ -411,9 +407,7 @@ \rSec2[depr.strstream.syn]{Header \tcode{} synopsis} \pnum -The header -\indexhdr{strstream}% -\tcode{} +The header \libheaderdef{strstream} defines types that associate stream buffers with character array objects and assist reading and writing such objects. @@ -428,7 +422,7 @@ \rSec2[depr.strstreambuf]{Class \tcode{strstreambuf}} -\indexlibrary{\idxcode{strstreambuf}}% +\indexlibraryglobal{strstreambuf}% \begin{codeblock} namespace std { class strstreambuf : public basic_streambuf { @@ -465,15 +459,15 @@ streambuf* setbuf(char* s, streamsize n) override; private: - using strstate = T1; // \expos - static const strstate allocated; // \expos - static const strstate constant; // \expos - static const strstate dynamic; // \expos - static const strstate frozen; // \expos - strstate strmode; // \expos - streamsize alsize; // \expos - void* (*palloc)(size_t); // \expos - void (*pfree)(void*); // \expos + using strstate = T1; // \expos + static const strstate allocated; // \expos + static const strstate constant; // \expos + static const strstate dynamic; // \expos + static const strstate frozen; // \expos + strstate strmode; // \expos + streamsize alsize; // \expos + void* (*palloc)(size_t); // \expos + void (*pfree)(void*); // \expos }; } \end{codeblock} @@ -541,7 +535,7 @@ \rSec3[depr.strstreambuf.cons]{\tcode{strstreambuf} constructors} -\indexlibrary{\idxcode{strstreambuf}!constructor}% +\indexlibraryctor{strstreambuf}% \begin{itemdecl} explicit strstreambuf(streamsize alsize_arg); \end{itemdecl} @@ -565,7 +559,7 @@ \tcode{pfree} & a null pointer \\ \end{libtab2} -\indexlibrary{\idxcode{strstreambuf}!constructor}% +\indexlibraryctor{strstreambuf}% \begin{itemdecl} strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*)); \end{itemdecl} @@ -591,7 +585,7 @@ \end{itemdescr} \indextext{unspecified}% -\indexlibrary{\idxcode{strstreambuf}!constructor}% +\indexlibraryctor{strstreambuf}% \begin{itemdecl} strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr); strstreambuf(signed char* gnext_arg, streamsize n, @@ -632,22 +626,16 @@ \tcode{n == 0}, \tcode{N} is \tcode{std::strlen(gnext_arg)}. -\indexlibrary{\idxcode{strlen}}% +\indexlibraryglobal{strlen}% \item If \tcode{n < 0}, \tcode{N} is \tcode{INT_MAX}.\footnote{The function signature -\indexlibrary{\idxcode{strlen}}% +\indexlibraryglobal{strlen}% \tcode{strlen(const char*)} -is declared in -\indexhdr{cstring}% -\tcode{}\iref{cstring.syn}. -The macro -\tcode{INT_MAX} -is defined in -\indexhdr{climits}% -\tcode{}\iref{climits.syn}.} +is declared in \libheaderref{cstring}. +The macro \tcode{INT_MAX} is defined in \libheaderref{climits}.} \end{itemize} \pnum @@ -667,7 +655,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{strstreambuf}!constructor}% +\indexlibraryctor{strstreambuf}% \begin{itemdecl} strstreambuf(const char* gnext_arg, streamsize n); strstreambuf(const signed char* gnext_arg, streamsize n); @@ -682,7 +670,7 @@ except that the constructor also sets \tcode{constant} in \tcode{strmode}. \end{itemdescr} -\indexlibrary{\idxcode{strstreambuf}!destructor}% +\indexlibrarydtor{strstreambuf}% \begin{itemdecl} virtual ~strstreambuf(); \end{itemdecl} @@ -1063,7 +1051,7 @@ \rSec2[depr.istrstream]{Class \tcode{istrstream}} -\indexlibrary{\idxcode{istrstream}}% +\indexlibraryglobal{istrstream}% \begin{codeblock} namespace std { class istrstream : public basic_istream { @@ -1077,7 +1065,7 @@ strstreambuf* rdbuf() const; char* str(); private: - strstreambuf sb; // \expos + strstreambuf sb; // \expos }; } \end{codeblock} @@ -1099,7 +1087,7 @@ \rSec3[depr.istrstream.cons]{\tcode{istrstream} constructors} -\indexlibrary{\idxcode{istrstream}!constructor}% +\indexlibraryctor{istrstream}% \begin{itemdecl} explicit istrstream(const char* s); explicit istrstream(char* s); @@ -1118,7 +1106,7 @@ \indextext{NTBS} \end{itemdescr} -\indexlibrary{\idxcode{istrstream}!constructor}% +\indexlibraryctor{istrstream}% \begin{itemdecl} istrstream(const char* s, streamsize n); istrstream(char* s, streamsize n); @@ -1163,7 +1151,7 @@ \rSec2[depr.ostrstream]{Class \tcode{ostrstream}} -\indexlibrary{\idxcode{ostrstream}}% +\indexlibraryglobal{ostrstream}% \begin{codeblock} namespace std { class ostrstream : public basic_ostream { @@ -1177,7 +1165,7 @@ char* str(); int pcount() const; private: - strstreambuf sb; // \expos + strstreambuf sb; // \expos }; } \end{codeblock} @@ -1199,7 +1187,7 @@ \rSec3[depr.ostrstream.cons]{\tcode{ostrstream} constructors} -\indexlibrary{\idxcode{ostrstream}!constructor}% +\indexlibraryctor{ostrstream}% \begin{itemdecl} ostrstream(); \end{itemdecl} @@ -1215,7 +1203,7 @@ \tcode{strstreambuf()}. \end{itemdescr} -\indexlibrary{\idxcode{ostrstream}!constructor}% +\indexlibraryctor{ostrstream}% \begin{itemdecl} ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out); \end{itemdecl} @@ -1245,11 +1233,9 @@ \indextext{NTBS}% The constructor is \tcode{strstreambuf(s, n, s + std::strlen(s))}.\footnote{The function signature -\indexlibrary{\idxcode{strlen}}% +\indexlibraryglobal{strlen}% \tcode{strlen(const char*)} -is declared in -\indexhdr{cstring}% -\tcode{}\iref{cstring.syn}.} +is declared in \libheaderref{cstring}.} \end{itemize} \end{itemdescr} @@ -1302,7 +1288,7 @@ \rSec2[depr.strstream]{Class \tcode{strstream}} -\indexlibrary{\idxcode{strstream}}% +\indexlibraryglobal{strstream}% \begin{codeblock} namespace std { class strstream @@ -1327,7 +1313,7 @@ char* str(); private: - strstreambuf sb; // \expos + strstreambuf sb; // \expos }; } \end{codeblock} @@ -1349,7 +1335,7 @@ \rSec3[depr.strstream.cons]{\tcode{strstream} constructors} -\indexlibrary{\idxcode{strstream}!constructor}% +\indexlibraryctor{strstream}% \begin{itemdecl} strstream(); \end{itemdecl} @@ -1363,7 +1349,7 @@ \tcode{iostream(\&sb)}. \end{itemdescr} -\indexlibrary{\idxcode{strstream}!constructor}% +\indexlibraryctor{strstream}% \begin{itemdecl} strstream(char* s, int n, ios_base::openmode mode = ios_base::in|ios_base::out); @@ -1392,13 +1378,13 @@ an \ntbs{} whose first element is designated by \tcode{s}. The constructor is \tcode{strstreambuf(s,n,s + std::strlen(s))}. -\indexlibrary{\idxcode{strstream}!destructor}% +\indexlibrarydtor{strstream}% \end{itemize} \end{itemdescr} \rSec3[depr.strstream.dest]{\tcode{strstream} destructor} -\indexlibrary{\idxcode{strstream}!destructor}% +\indexlibrarydtor{strstream}% \begin{itemdecl} virtual ~strstream(); \end{itemdecl} @@ -1460,11 +1446,10 @@ \rSec1[depr.meta.types]{Deprecated type traits} \pnum -The header -\indexhdr{type_traits}% -\tcode{} has the following addition: +The header \libheaderrefx{type_traits}{meta.type.synop} +has the following addition: -\indexlibrary{\idxcode{is_literal_type}}% +\indexlibraryglobal{is_literal_type}% \begin{codeblock} namespace std { template struct is_pod; @@ -1508,11 +1493,9 @@ \rSec2[depr.iterator.basic]{Basic iterator} \pnum -The header -\indexhdr{iterator}% -\tcode{} has the following addition: +The header \libheaderrefx{iterator}{iterator.synopsis} has the following addition: -\indexlibrary{\idxcode{iterator}}% +\indexlibraryglobal{iterator}% \begin{codeblock} namespace std { template} has the following additions: +The header \libheaderref{memory} has the following additions: -\indexlibrary{\idxcode{shared_ptr}}% +\indexlibraryglobal{shared_ptr}% \begin{codeblock} namespace std { template @@ -1637,10 +1623,12 @@ \requires \tcode{p} shall not be null. \pnum -\returns \tcode{true} if atomic access to \tcode{*p} is lock-free, \tcode{false} otherwise. +\returns +\tcode{true} if atomic access to \tcode{*p} is lock-free, \tcode{false} otherwise. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{atomic_load}{shared_ptr}% @@ -1653,10 +1641,12 @@ \requires \tcode{p} shall not be null. \pnum -\returns \tcode{atomic_load_explicit(p, memory_order_seq_cst)}. +\returns +\tcode{atomic_load_explicit(p, memory_order_seq_cst)}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{atomic_load_explicit}{shared_ptr}% @@ -1672,10 +1662,12 @@ \requires \tcode{mo} shall not be \tcode{memory_order_release} or \tcode{memory_order_acq_rel}. \pnum -\returns \tcode{*p}. +\returns +\tcode{*p}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{atomic_store}{shared_ptr}% @@ -1688,10 +1680,12 @@ \requires \tcode{p} shall not be null. \pnum -\effects As if by \tcode{atomic_store_explicit(p, r, memory_order_seq_cst)}. +\effects +As if by \tcode{atomic_store_explicit(p, r, memory_order_seq_cst)}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{atomic_store_explicit}{shared_ptr}% @@ -1707,10 +1701,12 @@ \requires \tcode{mo} shall not be \tcode{memory_order_acquire} or \tcode{memory_order_acq_rel}. \pnum -\effects As if by \tcode{p->swap(r)}. +\effects +As if by \tcode{p->swap(r)}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{atomic_exchange}{shared_ptr}% @@ -1723,10 +1719,12 @@ \requires \tcode{p} shall not be null. \pnum -\returns \tcode{atomic_exchange_explicit(p, r, memory_order_seq_cst)}. +\returns +\tcode{atomic_exchange_explicit(p, r, memory_order_seq_cst)}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{atomic_exchange_explicit}{shared_ptr}% @@ -1740,13 +1738,16 @@ \requires \tcode{p} shall not be null. \pnum -\effects As if by \tcode{p->swap(r)}. +\effects +As if by \tcode{p->swap(r)}. \pnum -\returns The previous value of \tcode{*p}. +\returns +The previous value of \tcode{*p}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{atomic_compare_exchange_weak}{shared_ptr}% @@ -1766,7 +1767,8 @@ \end{codeblock} \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{atomic_compare_exchange_strong}{shared_ptr}% @@ -1803,19 +1805,23 @@ \tcode{memory_order_acq_rel}. \pnum -\effects If \tcode{*p} is equivalent to \tcode{*v}, assigns \tcode{w} to +\effects +If \tcode{*p} is equivalent to \tcode{*v}, assigns \tcode{w} to \tcode{*p} and has synchronization semantics corresponding to the value of \tcode{success}, otherwise assigns \tcode{*p} to \tcode{*v} and has synchronization semantics corresponding to the value of \tcode{failure}. \pnum -\returns \tcode{true} if \tcode{*p} was equivalent to \tcode{*v}, \tcode{false} otherwise. +\returns +\tcode{true} if \tcode{*p} was equivalent to \tcode{*v}, \tcode{false} otherwise. \pnum -\throws Nothing. +\throws +Nothing. \pnum -\remarks Two \tcode{shared_ptr} objects are equivalent if they store the same +\remarks +Two \tcode{shared_ptr} objects are equivalent if they store the same pointer value and share ownership. The weak form may fail spuriously. See~\ref{atomics.types.operations}. \end{itemdescr} @@ -1826,7 +1832,7 @@ The following member is declared in addition to those members specified in \ref{string.capacity}: -\indexlibrary{\idxcode{basic_string}}% +\indexlibraryglobal{basic_string}% \begin{codeblock} namespace std { template, @@ -1844,24 +1850,27 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects After this call, \tcode{capacity()} has an unspecified value greater than or equal to \tcode{size()}. -\begin{note} This is a non-binding shrink to fit request. \end{note} +\begin{note} +This is a non-binding shrink to fit request. +\end{note} \end{itemdescr} \rSec1[depr.locale.stdcvt]{Deprecated standard code conversion facets} \pnum -\indexhdr{codecvt}% -The header \tcode{} provides code conversion facets for various character encodings. +The header \libheaderdef{codecvt} provides +code conversion facets for various character encodings. \rSec2[depr.codecvt.syn]{Header \tcode{} synopsis} -\indexlibrary{\idxcode{codecvt_mode}}% -\indexlibrary{\idxcode{codecvt_utf8}}% -\indexlibrary{\idxcode{codecvt_utf16}}% -\indexlibrary{\idxcode{codecvt_utf8_utf16}}% +\indexlibraryglobal{codecvt_mode}% +\indexlibraryglobal{codecvt_utf8}% +\indexlibraryglobal{codecvt_utf16}% +\indexlibraryglobal{codecvt_utf8_utf16}% \begin{codeblock} namespace std { enum codecvt_mode { @@ -1920,7 +1929,7 @@ \end{itemize} \pnum -For the facet \tcode{codecvt_utf8}\indexlibrary{\idxcode{codecvt_utf8}}: +For the facet \tcode{codecvt_utf8}\indexlibraryglobal{codecvt_utf8}: \begin{itemize} \item The facet shall convert between UTF-8 multibyte sequences @@ -1933,7 +1942,7 @@ \end{itemize} \pnum -For the facet \tcode{codecvt_utf16}\indexlibrary{\idxcode{codecvt_utf16}}: +For the facet \tcode{codecvt_utf16}\indexlibraryglobal{codecvt_utf16}: \begin{itemize} \item The facet shall convert between UTF-16 multibyte sequences @@ -1948,7 +1957,7 @@ \end{itemize} \pnum -For the facet \tcode{codecvt_utf8_utf16}\indexlibrary{\idxcode{codecvt_utf8_utf16}}: +For the facet \tcode{codecvt_utf8_utf16}\indexlibraryglobal{codecvt_utf8_utf16}: \begin{itemize} \item The facet shall convert between UTF-8 multibyte sequences @@ -1966,7 +1975,7 @@ \rSec1[depr.conversions]{Deprecated convenience conversion interfaces} \pnum -The header \tcode{} has the following additions: +The header \libheaderref{locale} has the following additions: \begin{codeblock} namespace std { @@ -1987,7 +1996,9 @@ Class template \tcode{wstring_convert} performs conversions between a wide string and a byte string. It lets you specify a code conversion facet (like class template \tcode{codecvt}) to perform the conversions, without -affecting any streams or locales. \begin{example} If you want to use the code +affecting any streams or locales. +\begin{example} +If you want to use the code conversion facet \tcode{codecvt_utf8} to output to \tcode{cout} a UTF-8 multibyte sequence corresponding to a wide string, but you don't want to alter the locale for \tcode{cout}, you can write something like: @@ -1998,7 +2009,7 @@ \end{codeblock} \end{example} -\indexlibrary{\idxcode{wstring_convert}}% +\indexlibraryglobal{wstring_convert}% \begin{codeblock} namespace std { template, Wide_alloc>}. \end{itemdescr} -\indexlibrary{\idxcode{wstring_convert}!constructor}% +\indexlibraryctor{wstring_convert}% \begin{itemdecl} explicit wstring_convert(Codecvt* pcvt); wstring_convert(Codecvt* pcvt, state_type state); @@ -2233,14 +2245,15 @@ \tcode{wide_err_string}. \end{itemdescr} -\indexlibrary{\idxcode{wstring_convert}!destructor}% +\indexlibrarydtor{wstring_convert}% \begin{itemdecl} ~wstring_convert(); \end{itemdecl} \begin{itemdescr} \pnum -\effects The destructor shall delete \tcode{cvtptr}. +\effects +The destructor shall delete \tcode{cvtptr}. \end{itemdescr} \rSec2[depr.conversions.buffer]{Class template \tcode{wbuffer_convert}} @@ -2252,7 +2265,7 @@ lets you specify a code conversion facet to perform the conversions, without affecting any streams or locales. -\indexlibrary{\idxcode{wbuffer_convert}}% +\indexlibraryglobal{wbuffer_convert}% \begin{codeblock} namespace std { template> @@ -2309,7 +2322,8 @@ \begin{itemdescr} \pnum -\returns \tcode{cvtstate}. +\returns +\tcode{cvtstate}. \end{itemdescr} \indexlibrarymember{rdbuf}{wbuffer_convert}% @@ -2319,7 +2333,8 @@ \begin{itemdescr} \pnum -\returns \tcode{bufptr}. +\returns +\tcode{bufptr}. \end{itemdescr} \indexlibrarymember{rdbuf}{wbuffer_convert}% @@ -2329,10 +2344,12 @@ \begin{itemdescr} \pnum -\effects Stores \tcode{bytebuf} in \tcode{bufptr}. +\effects +Stores \tcode{bytebuf} in \tcode{bufptr}. \pnum -\returns The previous value of \tcode{bufptr}. +\returns +The previous value of \tcode{bufptr}. \end{itemdescr} \indexlibrarymember{state_type}{wbuffer_convert}% @@ -2345,7 +2362,7 @@ The type shall be a synonym for \tcode{Codecvt::state_type}. \end{itemdescr} -\indexlibrary{\idxcode{wbuffer_convert}!constructor}% +\indexlibraryctor{wbuffer_convert}% \begin{itemdecl} explicit wbuffer_convert( streambuf* bytebuf, @@ -2359,19 +2376,21 @@ \tcode{pcvt != nullptr}. \pnum -\effects The constructor constructs a stream buffer object, initializes +\effects +The constructor constructs a stream buffer object, initializes \tcode{bufptr} to \tcode{bytebuf}, initializes \tcode{cvtptr} to \tcode{pcvt}, and initializes \tcode{cvtstate} to \tcode{state}. \end{itemdescr} -\indexlibrary{\idxcode{wbuffer_convert}!destructor}% +\indexlibrarydtor{wbuffer_convert}% \begin{itemdecl} ~wbuffer_convert(); \end{itemdecl} \begin{itemdescr} \pnum -\effects The destructor shall delete \tcode{cvtptr}. +\effects +The destructor shall delete \tcode{cvtptr}. \end{itemdescr} \rSec1[depr.locale.category]{Deprecated locale category facets} @@ -2406,7 +2425,7 @@ \rSec1[depr.fs.path.factory]{Deprecated filesystem path factory functions} -\indexlibrary{\idxcode{u8path}}% +\indexlibraryglobal{u8path}% \begin{itemdecl} template path u8path(const Source& source); @@ -2441,7 +2460,8 @@ \end{itemize} \pnum -\remarks Argument format conversion\iref{fs.path.fmt.cvt} applies to the +\remarks +Argument format conversion\iref{fs.path.fmt.cvt} applies to the arguments for these functions. How Unicode encoding conversions are performed is unspecified. diff --git a/source/generalindex.ist b/source/generalindex.ist new file mode 100644 index 0000000000..20892a73ae --- /dev/null +++ b/source/generalindex.ist @@ -0,0 +1,3 @@ +headings_flag 1 +heading_prefix "\\rSecindex{general}{" +heading_suffix "}\n" diff --git a/source/intro.tex b/source/intro.tex index d815287230..362e27d834 100644 --- a/source/intro.tex +++ b/source/intro.tex @@ -234,7 +234,7 @@ \definition{signature}{defns.signature} \defncontext{function} name, -parameter type list\iref{dcl.fct}, +parameter-type-list\iref{dcl.fct}, enclosing namespace (if any), and trailing \grammarterm{requires-clause}\iref{dcl.decl} (if any) @@ -248,7 +248,7 @@ \definition{signature}{defns.signature.templ} \defncontext{function template} name, -parameter type list\iref{dcl.fct}, +parameter-type-list\iref{dcl.fct}, enclosing namespace (if any), return type, \grammarterm{template-head}, @@ -264,7 +264,7 @@ \definition{signature}{defns.signature.member} \defncontext{class member function} name, -parameter type list\iref{dcl.fct}, +parameter-type-list\iref{dcl.fct}, class of which the function is a member, \cv-qualifiers (if any), \grammarterm{ref-qualifier} (if any), @@ -275,7 +275,7 @@ \definition{signature}{defns.signature.member.templ} \defncontext{class member function template} name, -parameter type list\iref{dcl.fct}, +parameter-type-list\iref{dcl.fct}, class of which the function is a member, \cv-qualifiers (if any), \grammarterm{ref-qualifier} (if any), @@ -363,7 +363,6 @@ \indextext{observable behavior|see{behavior, observable}}% \indextext{precedence of operator|see{operator, precedence of}}% \indextext{order of evaluation in expression|see{expression, order of evaluation of}}% -\indextext{atomic operations|see{operation, atomic}}% \indextext{multiple threads|see{threads, multiple}}% \rSec1[intro.compliance]{Implementation compliance} @@ -457,7 +456,7 @@ Each implementation shall include documentation that identifies all conditionally-supported constructs\indextext{behavior!conditionally-supported} that it does not support and defines all locale-specific characteristics.\footnote{This documentation also defines implementation-defined behavior; -see~\ref{intro.execution}.}% +see~\ref{intro.abstract}.}% \indextext{conformance requirements!general|)}% \indextext{conformance requirements|)}% @@ -513,8 +512,10 @@ Certain other operations are described in this document as undefined (for example, the effect of attempting to modify a const object). -\begin{note} This document imposes no requirements on the -behavior of programs that contain undefined behavior. \end{note} +\begin{note} +This document imposes no requirements on the +behavior of programs that contain undefined behavior. +\end{note} \pnum \indextext{program!well-formed}% @@ -548,8 +549,10 @@ These collectively are referred to as the \defnx{observable behavior}{behavior!observable} of the program. -\begin{note} More stringent correspondences between abstract and actual -semantics may be defined by each implementation. \end{note} +\begin{note} +More stringent correspondences between abstract and actual +semantics may be defined by each implementation. +\end{note} \rSec1[intro.structure]{Structure of this document} @@ -596,11 +599,9 @@ alternatives is marked by the phrase ``one of''. If the text of an alternative is too long to fit on a line, the text is continued on subsequent lines indented from the first one. An optional terminal or non-terminal symbol is indicated by the subscript ``\opt{\relax}'', so - \begin{ncbnf} \terminal{\{} \opt{expression} \terminal{\}} \end{ncbnf} - indicates an optional expression enclosed in braces.% \pnum diff --git a/source/iostreams.tex b/source/iostreams.tex index 52b9db824e..2d6a8e8c48 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -106,7 +106,9 @@ Concurrent access to a stream object~(\ref{string.streams}, \ref{file.streams}), stream buffer object\iref{stream.buffers}, or C Library stream\iref{c.files} by multiple threads may result in a data race\iref{intro.multithread} unless otherwise specified\iref{iostream.objects}. -\begin{note} Data races result in undefined behavior\iref{intro.multithread}. \end{note} +\begin{note} +Data races result in undefined behavior\iref{intro.multithread}. +\end{note} \pnum If one thread makes a library call \textit{a} that writes a value to a stream @@ -118,56 +120,56 @@ \rSec1[iostream.forward]{Forward declarations} \rSec2[iosfwd.syn]{Header \tcode{} synopsis} -\indexhdr{iosfwd}% - -\indexlibrary{\idxcode{basic_ios}}% -\indexlibrary{\idxcode{basic_streambuf}}% -\indexlibrary{\idxcode{basic_istream}}% -\indexlibrary{\idxcode{basic_ostream}}% -\indexlibrary{\idxcode{basic_stringbuf}}% -\indexlibrary{\idxcode{basic_istringstream}}% -\indexlibrary{\idxcode{basic_ostringstream}}% -\indexlibrary{\idxcode{basic_stringstream}}% -\indexlibrary{\idxcode{basic_filebuf}}% -\indexlibrary{\idxcode{basic_ifstream}}% -\indexlibrary{\idxcode{basic_ofstream}}% -\indexlibrary{\idxcode{basic_fstream}}% -\indexlibrary{\idxcode{basic_istreambuf_iterator}}% -\indexlibrary{\idxcode{basic_ostreambuf_iterator}}% -\indexlibrary{\idxcode{basic_syncbuf}}% -\indexlibrary{\idxcode{basic_osyncstream}}% -\indexlibrary{\idxcode{ios}}% -\indexlibrary{\idxcode{streambuf}}% -\indexlibrary{\idxcode{istream}}% -\indexlibrary{\idxcode{ostream}}% -\indexlibrary{\idxcode{stringbuf}}% -\indexlibrary{\idxcode{istringstream}}% -\indexlibrary{\idxcode{ostringstream}}% -\indexlibrary{\idxcode{stringstream}}% -\indexlibrary{\idxcode{filebuf}}% -\indexlibrary{\idxcode{ifstream}}% -\indexlibrary{\idxcode{ofstream}}% -\indexlibrary{\idxcode{fstream}}% -\indexlibrary{\idxcode{wstreambuf}}% -\indexlibrary{\idxcode{wistream}}% -\indexlibrary{\idxcode{wostream}}% -\indexlibrary{\idxcode{wstringbuf}}% -\indexlibrary{\idxcode{wistringstream}}% -\indexlibrary{\idxcode{wostringstream}}% -\indexlibrary{\idxcode{wstringstream}}% -\indexlibrary{\idxcode{wfilebuf}}% -\indexlibrary{\idxcode{wifstream}}% -\indexlibrary{\idxcode{wofstream}}% -\indexlibrary{\idxcode{wfstream}}% -\indexlibrary{\idxcode{syncbuf}}% -\indexlibrary{\idxcode{wsyncbuf}}% -\indexlibrary{\idxcode{osyncstream}}% -\indexlibrary{\idxcode{wosyncstream}}% -\indexlibrary{\idxcode{fpos}}% -\indexlibrary{\idxcode{streampos}}% -\indexlibrary{\idxcode{wstreampos}}% -\indexlibrary{\idxcode{u16streampos}}% -\indexlibrary{\idxcode{u32streampos}}% + +\indexheader{iosfwd}% +\indexlibraryglobal{basic_ios}% +\indexlibraryglobal{basic_streambuf}% +\indexlibraryglobal{basic_istream}% +\indexlibraryglobal{basic_ostream}% +\indexlibraryglobal{basic_stringbuf}% +\indexlibraryglobal{basic_istringstream}% +\indexlibraryglobal{basic_ostringstream}% +\indexlibraryglobal{basic_stringstream}% +\indexlibraryglobal{basic_filebuf}% +\indexlibraryglobal{basic_ifstream}% +\indexlibraryglobal{basic_ofstream}% +\indexlibraryglobal{basic_fstream}% +\indexlibraryglobal{basic_istreambuf_iterator}% +\indexlibraryglobal{basic_ostreambuf_iterator}% +\indexlibraryglobal{basic_syncbuf}% +\indexlibraryglobal{basic_osyncstream}% +\indexlibraryglobal{ios}% +\indexlibraryglobal{streambuf}% +\indexlibraryglobal{istream}% +\indexlibraryglobal{ostream}% +\indexlibraryglobal{stringbuf}% +\indexlibraryglobal{istringstream}% +\indexlibraryglobal{ostringstream}% +\indexlibraryglobal{stringstream}% +\indexlibraryglobal{filebuf}% +\indexlibraryglobal{ifstream}% +\indexlibraryglobal{ofstream}% +\indexlibraryglobal{fstream}% +\indexlibraryglobal{wstreambuf}% +\indexlibraryglobal{wistream}% +\indexlibraryglobal{wostream}% +\indexlibraryglobal{wstringbuf}% +\indexlibraryglobal{wistringstream}% +\indexlibraryglobal{wostringstream}% +\indexlibraryglobal{wstringstream}% +\indexlibraryglobal{wfilebuf}% +\indexlibraryglobal{wifstream}% +\indexlibraryglobal{wofstream}% +\indexlibraryglobal{wfstream}% +\indexlibraryglobal{syncbuf}% +\indexlibraryglobal{wsyncbuf}% +\indexlibraryglobal{osyncstream}% +\indexlibraryglobal{wosyncstream}% +\indexlibraryglobal{fpos}% +\indexlibraryglobal{streampos}% +\indexlibraryglobal{wstreampos}% +\indexlibraryglobal{u16streampos}% +\indexlibraryglobal{u32streampos}% \begin{codeblock} namespace std { template struct char_traits; @@ -274,14 +276,13 @@ \pnum Default template arguments are described as appearing both in -\tcode{} +\libheader{iosfwd} and in the synopsis of other headers but it is well-formed to include both -\tcode{} +\libheader{iosfwd} and one or more of the other headers.\footnote{It is the implementation's responsibility to implement headers so -that including -\tcode{} +that including \libheader{iosfwd} and other headers does not violate the rules about multiple occurrences of default arguments.} @@ -392,8 +393,8 @@ \rSec1[iostream.objects]{Standard iostream objects} \rSec2[iostream.syn]{Header \tcode{} synopsis} -\indexhdr{iostream}% +\indexheader{iostream}% \begin{codeblock} #include // see \ref{ios.syn} #include // see \ref{streambuf.syn} @@ -417,20 +418,13 @@ \pnum In this Clause, the type name \tcode{FILE} refers to -the type -\tcode{FILE} -declared in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}. +the type \tcode{FILE} declared in \libheaderref{cstdio}. \pnum -The header -\tcode{} +The header \libheader{iostream} declares objects that associate objects with the standard C streams provided for by the functions declared in -\tcode{}\iref{c.files}, and includes all the headers necessary to use -these objects. -\indexhdr{cstdio}% +\libheader{cstdio}, and includes all the headers necessary to use these objects. \pnum The objects are constructed and the associations are established at some @@ -446,8 +440,8 @@ or \tcode{stderr}. } -The results of including \tcode{} in a translation unit shall be as if -\tcode{} defined an instance of \tcode{ios_base::Init} with static +The results of including \libheader{iostream} in a translation unit shall be as if +\libheader{iostream} defined an instance of \tcode{ios_base::Init} with static storage duration. \pnum @@ -457,27 +451,25 @@ as specified in the C standard library. \pnum -Concurrent access to a synchronized\iref{ios.members.static} standard iostream object's formatted and unformatted input\iref{istream} and output\iref{ostream} functions or a standard C stream by multiple threads shall not result in a data race\iref{intro.multithread}. \begin{note} Users must still synchronize concurrent use of these objects and streams by multiple threads if they wish to avoid interleaved characters. \end{note} +Concurrent access to a synchronized\iref{ios.members.static} standard iostream object's formatted and unformatted input\iref{istream} and output\iref{ostream} functions or a standard C stream by multiple threads shall not result in a data race\iref{intro.multithread}. +\begin{note} +Users must still synchronize concurrent use of these objects and streams by multiple threads if they wish to avoid interleaved characters. +\end{note} \xrefc{7.21.2} \rSec2[narrow.stream.objects]{Narrow stream objects} -\indexlibrary{\idxcode{cin}}% +\indexlibraryglobal{cin}% \begin{itemdecl} istream cin; \end{itemdecl} \begin{itemdescr} \pnum -The object -\tcode{cin} -controls input from a stream buffer -associated with the object -\tcode{stdin}, -declared in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}. +The object \tcode{cin} +controls input from a stream buffer associated with the object \tcode{stdin}, +declared in \libheaderref{cstdio}. \pnum After the object @@ -490,38 +482,28 @@ \tcode{basic_ios::init}\iref{basic.ios.cons}. \end{itemdescr} -\indexlibrary{\idxcode{cout}}% +\indexlibraryglobal{cout}% \begin{itemdecl} ostream cout; \end{itemdecl} \begin{itemdescr} \pnum -The object -\tcode{cout} -controls output to a stream buffer -associated with the object -\tcode{stdout}, -declared in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}. +The object \tcode{cout} +controls output to a stream buffer associated with the object \tcode{stdout}, +declared in \libheaderref{cstdio}. \end{itemdescr} -\indexlibrary{\idxcode{cerr}}% +\indexlibraryglobal{cerr}% \begin{itemdecl} ostream cerr; \end{itemdecl} \begin{itemdescr} \pnum -The object -\tcode{cerr} -controls output to a stream buffer -associated with the object -\tcode{stderr}, -declared in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}. +The object \tcode{cerr} +controls output to a stream buffer associated with the object \tcode{stderr}, +declared in \libheaderref{cstdio}. \pnum After the object @@ -533,40 +515,31 @@ \tcode{basic_ios::init}\iref{basic.ios.cons}. \end{itemdescr} -\indexlibrary{\idxcode{clog}}% +\indexlibraryglobal{clog}% \begin{itemdecl} ostream clog; \end{itemdecl} \begin{itemdescr} \pnum -The object -\tcode{clog} +The object \tcode{clog} controls output to a stream buffer -associated with the object -\tcode{stderr}, -declared in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}. +associated with the object \tcode{stderr}, +declared in \libheaderref{cstdio}. \end{itemdescr} \rSec2[wide.stream.objects]{Wide stream objects} -\indexlibrary{\idxcode{wcin}}% +\indexlibraryglobal{wcin}% \begin{itemdecl} wistream wcin; \end{itemdecl} \begin{itemdescr} \pnum -The object -\tcode{wcin} -controls input from a stream buffer -associated with the object -\tcode{stdin}, -declared in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}. +The object \tcode{wcin} +controls input from a stream buffer associated with the object \tcode{stdin}, +declared in \libheaderref{cstdio}. \pnum After the object @@ -579,38 +552,28 @@ \tcode{basic_ios::init}\iref{basic.ios.cons}. \end{itemdescr} -\indexlibrary{\idxcode{wcout}}% +\indexlibraryglobal{wcout}% \begin{itemdecl} wostream wcout; \end{itemdecl} \begin{itemdescr} \pnum -The object -\tcode{wcout} -controls output to a stream buffer -associated with the object -\tcode{stdout}, -declared in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}. +The object \tcode{wcout} +controls output to a stream buffer associated with the object \tcode{stdout}, +declared in \libheaderref{cstdio}. \end{itemdescr} -\indexlibrary{\idxcode{wcerr}}% +\indexlibraryglobal{wcerr}% \begin{itemdecl} wostream wcerr; \end{itemdecl} \begin{itemdescr} \pnum -The object -\tcode{wcerr} -controls output to a stream buffer -associated with the object -\tcode{stderr}, -declared in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}. +The object \tcode{wcerr} +controls output to a stream buffer associated with the object \tcode{stderr}, +declared in \libheaderref{cstdio}. \pnum After the object @@ -622,29 +585,24 @@ \tcode{basic_ios::init}\iref{basic.ios.cons}. \end{itemdescr} -\indexlibrary{\idxcode{wclog}}% +\indexlibraryglobal{wclog}% \begin{itemdecl} wostream wclog; \end{itemdecl} \begin{itemdescr} \pnum -The object -\tcode{wclog} -controls output to a stream buffer -associated with the object -\tcode{stderr}, -declared in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}. +The object \tcode{wclog} +controls output to a stream buffer associated with the object \tcode{stderr}, +declared in \libheaderref{cstdio}. \end{itemdescr} \rSec1[iostreams.base]{Iostreams base classes} \rSec2[ios.syn]{Header \tcode{} synopsis} -\indexhdr{ios}% -\indexlibrary{\idxcode{io_errc}}% +\indexheader{ios}% +\indexlibraryglobal{io_errc}% \begin{codeblock} #include // see \ref{iosfwd.syn} @@ -706,15 +664,15 @@ const error_category& iostream_category() noexcept; } \end{codeblock} -\indexlibrary{\idxcode{ios}}% -\indexlibrary{\idxcode{basic_ios}}% -\indexlibrary{\idxcode{wios}}% -\indexlibrary{\idxcode{basic_ios}}% -\indexlibrary{\idxcode{fpos}}% +\indexlibraryglobal{ios}% +\indexlibraryglobal{basic_ios}% +\indexlibraryglobal{wios}% +\indexlibraryglobal{basic_ios}% +\indexlibraryglobal{fpos}% \rSec2[stream.types]{Types} -\indexlibrary{\idxcode{streamoff}}% +\indexlibraryglobal{streamoff}% \begin{itemdecl} using streamoff = @\impdef@; \end{itemdecl} @@ -725,7 +683,7 @@ sufficient size to represent the maximum possible file size for the operating system.\footnote{Typically \tcode{long long}.} \end{itemdescr} -\indexlibrary{\idxcode{streamsize}}% +\indexlibraryglobal{streamsize}% \begin{itemdecl} using streamsize = @\impdef@; \end{itemdecl} @@ -742,12 +700,12 @@ \end{itemdescr} \rSec2[ios.base]{Class \tcode{ios_base}} -\indexlibrary{\idxcode{ios_base}}% +\indexlibraryglobal{ios_base}% \begin{codeblock} namespace std { class ios_base { public: - class failure; // see below + class failure; // see below // \ref{ios.fmtflags}, \tcode{fmtflags} using fmtflags = @\textit{T1}@; @@ -832,9 +790,9 @@ ios_base(); private: - static int index; // \expos - long* iarray; // \expos - void** parray; // \expos + static int index; // \expos + long* iarray; // \expos + void** parray; // \expos }; } \end{codeblock} @@ -892,8 +850,8 @@ \rSec4[ios.failure]{Class \tcode{ios_base::failure}} -\indexlibrary{\idxcode{ios_base::failure}}% -\indexlibrary{\idxcode{ios_base}!\idxcode{failure}}% +\indexlibraryglobal{ios_base::failure}% +\indexlibrarymember{ios_base}{failure}% \begin{codeblock} namespace std { class ios_base::failure : public system_error { @@ -922,14 +880,16 @@ \pnum When throwing \tcode{ios_base::failure} exceptions, implementations should provide -values of \tcode{ec} that identify the specific reason for the failure. \begin{note} +values of \tcode{ec} that identify the specific reason for the failure. +\begin{note} Errors arising from the operating system would typically be reported as \tcode{system_category()} errors with an error value of the error number reported by the operating system. Errors arising from within the stream library would typically be reported as \tcode{error_code(io_errc::stream, -iostream_category())}. \end{note} +iostream_category())}. +\end{note} -\indexlibrary{\idxcode{ios_base::failure}!constructor}% +\indexlibraryctor{ios_base::failure}% \begin{itemdecl} explicit failure(const string& msg, const error_code& ec = io_errc::stream); \end{itemdecl} @@ -941,7 +901,7 @@ \tcode{failure} by constructing the base class with \tcode{msg} and \tcode{ec}. \end{itemdescr} -\indexlibrary{\idxcode{ios_base::failure}!constructor}% +\indexlibraryctor{ios_base::failure}% \begin{itemdecl} explicit failure(const char* msg, const error_code& ec = io_errc::stream); \end{itemdecl} @@ -1108,8 +1068,8 @@ \rSec4[ios.init]{Class \tcode{ios_base::Init}} -\indexlibrary{\idxcode{ios_base::Init}}% -\indexlibrary{\idxcode{ios_base}!\idxcode{Init}}% +\indexlibraryglobal{ios_base::Init}% +\indexlibrarymember{ios_base}{Init}% \begin{codeblock} namespace std { class ios_base::Init { @@ -1119,20 +1079,19 @@ ~Init(); Init& operator=(const Init&) = default; private: - static int init_cnt; // \expos + static int init_cnt; // \expos }; } \end{codeblock} \pnum -The class -\tcode{Init} +The class \tcode{Init} describes an object whose construction ensures the construction of the eight objects declared in -\tcode{}\iref{iostream.objects} that associate file +\libheader{iostream}\iref{iostream.objects} that associate file stream buffers with the standard C streams provided for by the functions declared in -\tcode{}\iref{cstdio.syn}. +\libheaderref{cstdio}. \pnum For the sake of exposition, the maintained data is presented here as: @@ -1145,7 +1104,7 @@ initialized to zero. \end{itemize} -\indexlibrary{\idxcode{ios_base::Init}!constructor}% +\indexlibraryctor{ios_base::Init}% \begin{itemdecl} Init(); \end{itemdecl} @@ -1160,7 +1119,7 @@ they have not already been constructed and initialized. \end{itemdescr} -\indexlibrary{\idxcode{ios_base::Init}!destructor}% +\indexlibrarydtor{ios_base::Init}% \begin{itemdecl} ~Init(); \end{itemdecl} @@ -1172,7 +1131,7 @@ \tcode{Init}. If there are no other instances of the class still in existence, calls -\indexlibrary{\idxcode{flush}}% +\indexlibraryglobal{flush}% \tcode{cout.flush()}, \tcode{cerr.flush()}, \tcode{clog.flush()}, @@ -1585,7 +1544,7 @@ \rSec3[ios.base.cons]{Constructors and destructor} -\indexlibrary{\idxcode{ios_base}!constructor}% +\indexlibraryctor{ios_base}% \begin{itemdecl} ios_base(); \end{itemdecl} @@ -1602,7 +1561,7 @@ the behavior is undefined. \end{itemdescr} -\indexlibrary{\idxcode{ios_base}!destructor}% +\indexlibrarydtor{ios_base}% \begin{itemdecl} ~ios_base(); \end{itemdecl} @@ -1624,7 +1583,7 @@ \rSec2[fpos]{Class template \tcode{fpos}} -\indexlibrary{\idxcode{fpos}}% +\indexlibraryglobal{fpos}% \begin{codeblock} namespace std { template class fpos { @@ -1633,7 +1592,7 @@ stateT state() const; void state(stateT); private; - stateT st; // \expos + stateT st; // \expos }; } \end{codeblock} @@ -1665,8 +1624,8 @@ \rSec3[fpos.operations]{Requirements} \pnum -\indexlibrary{\idxcode{fpos}}% -\indexlibrary{\idxcode{streamoff}}% +\indexlibraryglobal{fpos}% +\indexlibraryglobal{streamoff}% An \tcode{fpos} type specifies file position information. It holds a state object whose type is equal to the template parameter \tcode{stateT}. @@ -1785,7 +1744,7 @@ \rSec3[ios.overview]{Overview} -\indexlibrary{\idxcode{basic_ios}}% +\indexlibraryglobal{basic_ios}% \begin{codeblock} namespace std { template> @@ -1849,7 +1808,7 @@ \rSec3[basic.ios.cons]{Constructors} -\indexlibrary{\idxcode{basic_ios}!constructor}% +\indexlibraryctor{basic_ios}% \begin{itemdecl} explicit basic_ios(basic_streambuf* sb); \end{itemdecl} @@ -1863,7 +1822,7 @@ \tcode{init(sb)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ios}!constructor}% +\indexlibraryctor{basic_ios}% \begin{itemdecl} basic_ios(); \end{itemdecl} @@ -1880,7 +1839,7 @@ behavior is undefined. \end{itemdescr} -\indexlibrary{\idxcode{basic_ios}!destructor}% +\indexlibrarydtor{basic_ios}% \begin{itemdecl} ~basic_ios(); \end{itemdecl} @@ -2160,7 +2119,8 @@ \begin{itemdescr} \pnum -\ensures \tcode{*this} shall have the state that +\ensures +\tcode{*this} shall have the state that \tcode{rhs} had before the function call, except that \tcode{rdbuf()} shall return 0. \tcode{rhs} shall be in a valid but unspecified state, except that \tcode{rhs.rdbuf()} shall return the @@ -2175,7 +2135,8 @@ \begin{itemdescr} \pnum -\effects The states of \tcode{*this} and \tcode{rhs} +\effects +The states of \tcode{*this} and \tcode{rhs} shall be exchanged, except that \tcode{rdbuf()} shall return the same value as it returned before the function call, and \tcode{rhs.rdbuf()} shall return the same value as it returned before the function call. @@ -2191,15 +2152,18 @@ \requires \tcode{sb != nullptr}. \pnum -\effects Associates the \tcode{basic_streambuf} object +\effects +Associates the \tcode{basic_streambuf} object pointed to by \tcode{sb} with this stream without calling \tcode{clear()}. \pnum -\ensures \tcode{rdbuf() == sb}. +\ensures +\tcode{rdbuf() == sb}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \rSec3[iostate.flags]{Flags functions} @@ -2211,7 +2175,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!fail()}. +\returns +\tcode{!fail()}. \end{itemdescr} \indexlibrarymember{operator"!}{basic_ios}% @@ -2375,7 +2340,7 @@ Each function specified in this subclause is a designated addressable function\iref{namespace.std}. -\indexlibrary{\idxcode{boolalpha}}% +\indexlibraryglobal{boolalpha}% \begin{itemdecl} ios_base& boolalpha(ios_base& str); \end{itemdecl} @@ -2391,7 +2356,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{noboolalpha}}% +\indexlibraryglobal{noboolalpha}% \begin{itemdecl} ios_base& noboolalpha(ios_base& str); \end{itemdecl} @@ -2407,7 +2372,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{showbase}}% +\indexlibraryglobal{showbase}% \begin{itemdecl} ios_base& showbase(ios_base& str); \end{itemdecl} @@ -2423,7 +2388,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{noshowbase}}% +\indexlibraryglobal{noshowbase}% \begin{itemdecl} ios_base& noshowbase(ios_base& str); \end{itemdecl} @@ -2439,7 +2404,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{showpoint}}% +\indexlibraryglobal{showpoint}% \begin{itemdecl} ios_base& showpoint(ios_base& str); \end{itemdecl} @@ -2455,7 +2420,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{noshowpoint}}% +\indexlibraryglobal{noshowpoint}% \begin{itemdecl} ios_base& noshowpoint(ios_base& str); \end{itemdecl} @@ -2471,7 +2436,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{showpos}}% +\indexlibraryglobal{showpos}% \begin{itemdecl} ios_base& showpos(ios_base& str); \end{itemdecl} @@ -2487,7 +2452,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{noshowpos}}% +\indexlibraryglobal{noshowpos}% \begin{itemdecl} ios_base& noshowpos(ios_base& str); \end{itemdecl} @@ -2503,7 +2468,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{skipws}}% +\indexlibraryglobal{skipws}% \begin{itemdecl} ios_base& skipws(ios_base& str); \end{itemdecl} @@ -2519,7 +2484,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{noskipws}}% +\indexlibraryglobal{noskipws}% \begin{itemdecl} ios_base& noskipws(ios_base& str); \end{itemdecl} @@ -2535,7 +2500,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{uppercase}}% +\indexlibraryglobal{uppercase}% \begin{itemdecl} ios_base& uppercase(ios_base& str); \end{itemdecl} @@ -2551,7 +2516,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{nouppercase}}% +\indexlibraryglobal{nouppercase}% \begin{itemdecl} ios_base& nouppercase(ios_base& str); \end{itemdecl} @@ -2567,7 +2532,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{unitbuf}}% +\indexlibraryglobal{unitbuf}% \begin{itemdecl} ios_base& unitbuf(ios_base& str); \end{itemdecl} @@ -2583,7 +2548,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{nounitbuf}}% +\indexlibraryglobal{nounitbuf}% \begin{itemdecl} ios_base& nounitbuf(ios_base& str); \end{itemdecl} @@ -2605,7 +2570,7 @@ Each function specified in this subclause is a designated addressable function\iref{namespace.std}. -\indexlibrary{\idxcode{internal}}% +\indexlibraryglobal{internal}% \begin{itemdecl} ios_base& internal(ios_base& str); \end{itemdecl} @@ -2621,7 +2586,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{left}}% +\indexlibraryglobal{left}% \begin{itemdecl} ios_base& left(ios_base& str); \end{itemdecl} @@ -2637,7 +2602,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{right}}% +\indexlibraryglobal{right}% \begin{itemdecl} ios_base& right(ios_base& str); \end{itemdecl} @@ -2659,7 +2624,7 @@ Each function specified in this subclause is a designated addressable function\iref{namespace.std}. -\indexlibrary{\idxcode{dec}}% +\indexlibraryglobal{dec}% \begin{itemdecl} ios_base& dec(ios_base& str); \end{itemdecl} @@ -2683,7 +2648,7 @@ \tcode{cout}.}. \end{itemdescr} -\indexlibrary{\idxcode{hex}}% +\indexlibraryglobal{hex}% \begin{itemdecl} ios_base& hex(ios_base& str); \end{itemdecl} @@ -2699,7 +2664,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{oct}}% +\indexlibraryglobal{oct}% \begin{itemdecl} ios_base& oct(ios_base& str); \end{itemdecl} @@ -2721,7 +2686,7 @@ Each function specified in this subclause is a designated addressable function\iref{namespace.std}. -\indexlibrary{\idxcode{fixed}}% +\indexlibraryglobal{fixed}% \begin{itemdecl} ios_base& fixed(ios_base& str); \end{itemdecl} @@ -2737,7 +2702,7 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{scientific}}% +\indexlibraryglobal{scientific}% \begin{itemdecl} ios_base& scientific(ios_base& str); \end{itemdecl} @@ -2753,26 +2718,32 @@ \tcode{str}. \end{itemdescr} -\indexlibrary{\idxcode{hexfloat}}% +\indexlibraryglobal{hexfloat}% \begin{itemdecl} ios_base& hexfloat(ios_base& str); \end{itemdecl} \begin{itemdescr} -\pnum\effects Calls \tcode{str.setf(ios_base::fixed | ios_base::scientific, +\pnum +\effects +Calls \tcode{str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield)}. -\pnum\returns \tcode{str}. +\pnum +\returns +\tcode{str}. \end{itemdescr} \pnum -\begin{note} The more obvious use of +\begin{note} +The more obvious use of \tcode{ios_base::hex} to specify hexadecimal floating-point format would change the meaning of existing well-defined programs. \CppIII{} gives no meaning to the combination of \tcode{fixed} and -\tcode{scientific}.\end{note} +\tcode{scientific}. +\end{note} -\indexlibrary{\idxcode{defaultfloat}}% +\indexlibraryglobal{defaultfloat}% \begin{itemdecl} ios_base& defaultfloat(ios_base& str); \end{itemdecl} @@ -2783,7 +2754,8 @@ Calls \tcode{str.unsetf(ios_base::floatfield)}. \pnum -\returns \tcode{str}. +\returns +\tcode{str}. \end{itemdescr} \rSec2[error.reporting]{Error reporting} @@ -2795,7 +2767,8 @@ \begin{itemdescr} \pnum -\returns \tcode{error_code(static_cast(e), iostream_category())}. +\returns +\tcode{error_code(static_cast(e), iostream_category())}. \end{itemdescr} \indexlibrarymember{make_error_condition}{io_errc}% @@ -2805,17 +2778,19 @@ \begin{itemdescr} \pnum -\returns \tcode{error_condition(static_cast(e), iostream_category())}. +\returns +\tcode{error_condition(static_cast(e), iostream_category())}. \end{itemdescr} -\indexlibrary{\idxcode{iostream_category}}% +\indexlibraryglobal{iostream_category}% \begin{itemdecl} const error_category& iostream_category() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns A reference to an object of a type derived from class +\returns +A reference to an object of a type derived from class \tcode{error_category}. \pnum @@ -2826,12 +2801,12 @@ \rSec1[stream.buffers]{Stream buffers} \rSec2[streambuf.syn]{Header \tcode{} synopsis} -\indexhdr{streambuf}% -\indexlibrary{\idxcode{streambuf}}% -\indexlibrary{\idxcode{basic_streambuf}}% -\indexlibrary{\idxcode{wstreambuf}}% -\indexlibrary{\idxcode{basic_streambuf}}% +\indexheader{streambuf}% +\indexlibraryglobal{streambuf}% +\indexlibraryglobal{basic_streambuf}% +\indexlibraryglobal{wstreambuf}% +\indexlibraryglobal{basic_streambuf}% \begin{codeblock} namespace std { template> @@ -2842,11 +2817,9 @@ \end{codeblock} \pnum -The header -\tcode{} +The header \libheader{streambuf} defines types that control input from and output to -\textit{character} -sequences. +\textit{character} sequences. \rSec2[streambuf.reqts]{Stream buffer requirements} @@ -2950,7 +2923,7 @@ \rSec2[streambuf]{Class template \tcode{basic_streambuf}} -\indexlibrary{\idxcode{basic_streambuf}}% +\indexlibraryglobal{basic_streambuf}% \begin{codeblock} namespace std { template> @@ -3063,7 +3036,7 @@ \rSec3[streambuf.cons]{Constructors} -\indexlibrary{\idxcode{basic_streambuf}!constructor}% +\indexlibraryctor{basic_streambuf}% \begin{itemdecl} basic_streambuf(); \end{itemdecl} @@ -3099,14 +3072,15 @@ is called. \end{itemdescr} -\indexlibrary{\idxcode{basic_streambuf}!constructor}% +\indexlibraryctor{basic_streambuf}% \begin{itemdecl} basic_streambuf(const basic_streambuf& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs a copy of \tcode{rhs}. +\effects +Constructs a copy of \tcode{rhs}. \pnum \ensures @@ -3122,7 +3096,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{basic_streambuf}!destructor}% +\indexlibrarydtor{basic_streambuf}% \begin{itemdecl} ~basic_streambuf(); \end{itemdecl} @@ -3387,7 +3361,8 @@ \begin{itemdescr} \pnum -\effects Assigns the data members of \tcode{rhs} +\effects +Assigns the data members of \tcode{rhs} to \tcode{*this}. \pnum @@ -3404,7 +3379,8 @@ \end{itemize} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_streambuf}% @@ -3414,7 +3390,8 @@ \begin{itemdescr} \pnum -\effects Swaps the data members of \tcode{rhs} +\effects +Swaps the data members of \tcode{rhs} and \tcode{*this}. \end{itemdescr} @@ -3754,7 +3731,7 @@ call this virtual function only if \tcode{gptr()} is null or -\tcode{gptr() >= egptr()} +\tcode{gptr() >= egptr()}. \pnum \returns @@ -4081,8 +4058,8 @@ \rSec1[iostream.format]{Formatting and manipulators} \rSec2[istream.syn]{Header \tcode{} synopsis} -\indexhdr{istream}% +\indexheader{istream}% \begin{codeblock} namespace std { template> @@ -4105,14 +4082,14 @@ } \end{codeblock} -\indexlibrary{\idxcode{istream}}% -\indexlibrary{\idxcode{basic_istream}}% -\indexlibrary{\idxcode{wistream}}% -\indexlibrary{\idxcode{basic_istream}}% +\indexlibraryglobal{istream}% +\indexlibraryglobal{basic_istream}% +\indexlibraryglobal{wistream}% +\indexlibraryglobal{basic_istream}% \rSec2[ostream.syn]{Header \tcode{} synopsis} -\indexhdr{ostream}% +\indexheader{ostream}% \begin{codeblock} namespace std { template> @@ -4140,14 +4117,14 @@ } \end{codeblock} -\indexlibrary{\idxcode{ostream}}% -\indexlibrary{\idxcode{basic_ostream}}% -\indexlibrary{\idxcode{wostream}}% -\indexlibrary{\idxcode{basic_ostream}}% +\indexlibraryglobal{ostream}% +\indexlibraryglobal{basic_ostream}% +\indexlibraryglobal{wostream}% +\indexlibraryglobal{basic_ostream}% \rSec2[iomanip.syn]{Header \tcode{} synopsis} -\indexhdr{iomanip}% +\indexheader{iomanip}% \begin{codeblock} namespace std { // types \tcode{T1}, \tcode{T2}, ... are unspecified implementation types @@ -4182,14 +4159,12 @@ \rSec2[input.streams]{Input streams} \pnum -The header -\tcode{} -defines two types +The header \libheader{istream} defines two types and a function signature that control input from a stream buffer along with a function template that extracts from stream rvalues. \rSec3[istream]{Class template \tcode{basic_istream}} -\indexlibrary{\idxcode{basic_istream}}% +\indexlibraryglobal{basic_istream}% \begin{codeblock} namespace std { template> @@ -4260,11 +4235,11 @@ protected: // \ref{istream.cons}, copy/move constructor - basic_istream(const basic_istream& rhs) = delete; + basic_istream(const basic_istream&) = delete; basic_istream(basic_istream&& rhs); // \ref{istream.assign}, assign and swap - basic_istream& operator=(const basic_istream& rhs) = delete; + basic_istream& operator=(const basic_istream&) = delete; basic_istream& operator=(basic_istream&& rhs); void swap(basic_istream& rhs); }; @@ -4340,7 +4315,7 @@ \rSec4[istream.cons]{Constructors} -\indexlibrary{\idxcode{basic_istream}!constructor}% +\indexlibraryctor{basic_istream}% \begin{itemdecl} explicit basic_istream(basic_streambuf* sb); \end{itemdecl} @@ -4359,21 +4334,22 @@ \end{itemdescr} -\indexlibrary{\idxcode{basic_istream}!constructor}% +\indexlibraryctor{basic_istream}% \begin{itemdecl} basic_istream(basic_istream&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs}. +\effects +Move constructs from the rvalue \tcode{rhs}. This is accomplished by default constructing the base class, copying the \tcode{gcount()} from \tcode{rhs}, calling \tcode{basic_ios::move(rhs)} to initialize the base class, and setting the \tcode{gcount()} for \tcode{rhs} to 0. \end{itemdescr} -\indexlibrary{\idxcode{basic_istream}!destructor}% +\indexlibrarydtor{basic_istream}% \begin{itemdecl} virtual ~basic_istream(); \end{itemdecl} @@ -4399,10 +4375,12 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{swap(rhs)}. +\effects +As if by \tcode{swap(rhs)}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_istream}% @@ -4412,20 +4390,21 @@ \begin{itemdescr} \pnum -\effects Calls \tcode{basic_ios::swap(rhs)}. +\effects +Calls \tcode{basic_ios::swap(rhs)}. Exchanges the values returned by \tcode{gcount()} and \tcode{rhs.gcount()}. \end{itemdescr} \rSec4[istream.sentry]{Class \tcode{basic_istream::sentry}} -\indexlibrary{\idxcode{basic_istream::sentry}}% -\indexlibrary{\idxcode{sentry}!\idxcode{basic_istream}}% +\indexlibraryglobal{basic_istream::sentry}% +\indexlibrarymember{sentry}{basic_istream}% \begin{codeblock} namespace std { template> class basic_istream::sentry { - bool ok_; // \expos + bool ok_; // \expos public: explicit sentry(basic_istream& is, bool noskipws = false); ~sentry(); @@ -4444,8 +4423,8 @@ operations. \end{itemdescr} -\indexlibrary{\idxcode{sentry}!constructor}% -\indexlibrary{\idxcode{basic_istream::sentry}!constructor}% +\indexlibraryctor{sentry}% +\indexlibraryctor{basic_istream::sentry}% \begin{itemdecl} explicit sentry(basic_istream& is, bool noskipws = false); \end{itemdecl} @@ -4464,7 +4443,7 @@ \tcode{is.tie()} is not a null pointer, the function calls -\indexlibrary{\idxcode{flush}}% +\indexlibraryglobal{flush}% \tcode{is.tie()->flush()} to synchronize the output sequence with any associated external C stream. @@ -4529,7 +4508,7 @@ During preparation, the constructor may call \tcode{setstate(failbit)} (which may throw -\tcode{ios_base::\brk{}failure}\iref{iostate.flags})\footnote{The +\tcode{ios_base::\brk{}failure}\iref{iostate.flags}).\footnote{The \tcode{sentry} constructor and destructor can also perform additional @@ -4537,8 +4516,8 @@ implementation-dependent operations.} \end{itemdescr} -\indexlibrary{\idxcode{sentry}!destructor}% -\indexlibrary{\idxcode{basic_istream::sentry}!destructor}% +\indexlibrarydtor{sentry}% +\indexlibrarydtor{basic_istream::sentry}% \begin{itemdecl} ~sentry(); \end{itemdecl} @@ -4719,7 +4698,7 @@ \returns \tcode{pf(*this)}.\footnote{See, for example, the function signature \tcode{ws(basic_istream\&)}\iref{istream.manip}.% -\indexlibrary{\idxcode{ws}}}% +\indexlibraryglobal{ws}}% \end{itemdescr} \indexlibrarymember{operator>>}{basic_istream}% @@ -4974,7 +4953,7 @@ Otherwise, the function calls \tcode{setstate(failbit)}, which may throw -\tcode{ios_base::failure}\iref{iostate.flags}, +\tcode{ios_base::failure}\iref{iostate.flags}. \pnum \returns @@ -5206,12 +5185,12 @@ while (cin.getline(buffer, line_buffer_size, '@\textbackslash@n') || cin.gcount()) { int count = cin.gcount(); if (cin.eof()) - cout << "Partial final line"; // \tcode{cin.fail()} is \tcode{false} + cout << "Partial final line"; // \tcode{cin.fail()} is \tcode{false} else if (cin.fail()) { cout << "Partial long line"; cin.clear(cin.rdstate() & ~ios_base::failbit); } else { - count--; // Don't include newline in \tcode{count} + count--; // Don't include newline in \tcode{count} cout << "Line " << ++line_number; } cout << " (" << count << " chars): " << buffer << endl; @@ -5572,7 +5551,7 @@ specified in this subclause is a designated addressable function\iref{namespace.std}. -\indexlibrary{\idxcode{ws}}% +\indexlibraryglobal{ws}% \begin{itemdecl} template basic_istream& ws(basic_istream& is); @@ -5609,20 +5588,22 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} is >> std::forward(x); return is; \end{codeblock} \pnum -\remarks This function shall not participate in overload resolution +\remarks +This function shall not participate in overload resolution unless the expression \tcode{is >> std::forward(x)} is well-formed. \end{itemdescr} \rSec3[iostreamclass]{Class template \tcode{basic_iostream}} -\indexlibrary{\idxcode{basic_iostream}}% +\indexlibraryglobal{basic_iostream}% \begin{codeblock} namespace std { template> @@ -5644,11 +5625,11 @@ protected: // \ref{iostream.cons}, constructor - basic_iostream(const basic_iostream& rhs) = delete; + basic_iostream(const basic_iostream&) = delete; basic_iostream(basic_iostream&& rhs); // \ref{iostream.assign}, assign and swap - basic_iostream& operator=(const basic_iostream& rhs) = delete; + basic_iostream& operator=(const basic_iostream&) = delete; basic_iostream& operator=(basic_iostream&& rhs); void swap(basic_iostream& rhs); }; @@ -5663,7 +5644,7 @@ \rSec4[iostream.cons]{Constructors} -\indexlibrary{\idxcode{basic_iostream}!constructor}% +\indexlibraryctor{basic_iostream}% \begin{itemdecl} explicit basic_iostream(basic_streambuf* sb); \end{itemdecl} @@ -5684,21 +5665,22 @@ \tcode{gcount() == 0}. \end{itemdescr} -\indexlibrary{\idxcode{basic_iostream}!constructor}% +\indexlibraryctor{basic_iostream}% \begin{itemdecl} basic_iostream(basic_iostream&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs} by +\effects +Move constructs from the rvalue \tcode{rhs} by constructing the \tcode{basic_istream} base class with \tcode{move(rhs)}. \end{itemdescr} \rSec4[iostream.dest]{Destructor} -\indexlibrary{\idxcode{basic_iostream}!destructor}% +\indexlibrarydtor{basic_iostream}% \begin{itemdecl} virtual ~basic_iostream(); \end{itemdecl} @@ -5724,7 +5706,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{swap(rhs)}. +\effects +As if by \tcode{swap(rhs)}. \end{itemdescr} \indexlibrarymember{swap}{basic_iostream}% @@ -5734,22 +5717,21 @@ \begin{itemdescr} \pnum -\effects Calls \tcode{basic_istream::swap(rhs)}. +\effects +Calls \tcode{basic_istream::swap(rhs)}. \end{itemdescr} \rSec2[output.streams]{Output streams} \pnum -The header -\tcode{} -defines a type +The header \libheader{ostream} defines a type and several function signatures that control output to a stream buffer along with a function template that inserts into stream rvalues. \rSec3[ostream]{Class template \tcode{basic_ostream}} -\indexlibrary{\idxcode{basic_ostream}}% +\indexlibraryglobal{basic_ostream}% \begin{codeblock} namespace std { template> @@ -5807,11 +5789,11 @@ protected: // \ref{ostream.cons}, copy/move constructor - basic_ostream(const basic_ostream& rhs) = delete; + basic_ostream(const basic_ostream&) = delete; basic_ostream(basic_ostream&& rhs); // \ref{ostream.assign}, assign and swap - basic_ostream& operator=(const basic_ostream& rhs) = delete; + basic_ostream& operator=(const basic_ostream&) = delete; basic_ostream& operator=(basic_ostream&& rhs); void swap(basic_ostream& rhs); }; @@ -5870,7 +5852,7 @@ operator<<(basic_ostream&, const char16_t*) = delete; template basic_ostream& - operator<<(basic_ostream&, const char32_t*) = delete; + operator<<(basic_ostream&, const char32_t*) = delete; template basic_ostream& operator<<(basic_ostream&, const char8_t*) = delete; @@ -5935,7 +5917,7 @@ \rSec4[ostream.cons]{Constructors} -\indexlibrary{\idxcode{basic_ostream}!constructor}% +\indexlibraryctor{basic_ostream}% \begin{itemdecl} explicit basic_ostream(basic_streambuf* sb); \end{itemdecl} @@ -5953,20 +5935,21 @@ \tcode{rdbuf() == sb}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ostream}!constructor}% +\indexlibraryctor{basic_ostream}% \begin{itemdecl} basic_ostream(basic_ostream&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs}. +\effects +Move constructs from the rvalue \tcode{rhs}. This is accomplished by default constructing the base class and calling \tcode{basic_ios::move(rhs)} to initialize the base class. \end{itemdescr} -\indexlibrary{\idxcode{basic_ostream}!destructor}% +\indexlibrarydtor{basic_ostream}% \begin{itemdecl} virtual ~basic_ostream(); \end{itemdecl} @@ -5992,10 +5975,12 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{swap(rhs)}. +\effects +As if by \tcode{swap(rhs)}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_ostream}% @@ -6005,18 +5990,19 @@ \begin{itemdescr} \pnum -\effects Calls \tcode{basic_ios::swap(rhs)}. +\effects +Calls \tcode{basic_ios::swap(rhs)}. \end{itemdescr} \rSec4[ostream.sentry]{Class \tcode{basic_ostream::sentry}} -\indexlibrary{\idxcode{basic_ostream::sentry}}% -\indexlibrary{\idxcode{sentry}!\idxcode{basic_ostream}}% +\indexlibraryglobal{basic_ostream::sentry}% +\indexlibrarymember{sentry}{basic_ostream}% \begin{codeblock} namespace std { template> class basic_ostream::sentry { - bool ok_; // \expos + bool ok_; // \expos public: explicit sentry(basic_ostream& os); ~sentry(); @@ -6034,7 +6020,7 @@ defines a class that is responsible for doing exception safe prefix and suffix operations. -\indexlibrary{\idxcode{basic_ostream::sentry}!constructor}% +\indexlibraryctor{basic_ostream::sentry}% \begin{itemdecl} explicit sentry(basic_ostream& os); \end{itemdecl} @@ -6047,7 +6033,7 @@ If \tcode{os.tie()} is not a null pointer, calls -\indexlibrary{\idxcode{flush}}% +\indexlibraryglobal{flush}% \tcode{os.tie()->flush()}.\footnote{The call \tcode{os.tie()->flush()} does not necessarily occur if the function can determine that no @@ -6064,7 +6050,7 @@ During preparation, the constructor may call \tcode{setstate(failbit)} (which may throw -\tcode{ios_base::\brk{}failure}\iref{iostate.flags})\footnote{The +\tcode{ios_base::\brk{}failure}\iref{iostate.flags}).\footnote{The \tcode{sentry} constructor and destructor can also perform additional @@ -6072,7 +6058,7 @@ implementation-dependent operations.} \end{itemdescr} -\indexlibrary{\idxcode{basic_ostream::sentry}!destructor}% +\indexlibrarydtor{basic_ostream::sentry}% \begin{itemdecl} ~sentry(); \end{itemdecl} @@ -6366,7 +6352,7 @@ \pnum \returns \tcode{pf(*this)}.\footnote{See, for example, the function signature -\indexlibrary{\idxcode{endl}}% +\indexlibraryglobal{endl}% \tcode{endl(basic_ostream\&)}\iref{ostream.manip}.} \end{itemdescr} @@ -6387,7 +6373,7 @@ \pnum \returns \tcode{*this}.\footnote{See, for example, the function signature -\indexlibrary{\idxcode{dec}}% +\indexlibraryglobal{dec}% \tcode{dec(ios_base\&)}\iref{basefield.manip}.} \end{itemdescr} @@ -6669,7 +6655,8 @@ \begin{itemdescr} \pnum -\effects Behaves as an unformatted output function (as described above). +\effects +Behaves as an unformatted output function (as described above). If \tcode{rdbuf()} is not a null pointer, @@ -6695,7 +6682,7 @@ specified in this subclause is a designated addressable function\iref{namespace.std}. -\indexlibrary{\idxcode{endl}}% +\indexlibraryglobal{endl}% \begin{itemdecl} template basic_ostream& endl(basic_ostream& os); @@ -6714,7 +6701,7 @@ \tcode{os}. \end{itemdescr} -\indexlibrary{\idxcode{ends}}% +\indexlibraryglobal{ends}% \begin{itemdecl} template basic_ostream& ends(basic_ostream& os); @@ -6732,7 +6719,7 @@ \tcode{os}. \end{itemdescr} -\indexlibrary{\idxcode{flush}}% +\indexlibraryglobal{flush}% \begin{itemdecl} template basic_ostream& flush(basic_ostream& os); @@ -6749,7 +6736,7 @@ \tcode{os}. \end{itemdescr} -\indexlibrary{\idxcode{emit_on_flush}}% +\indexlibraryglobal{emit_on_flush}% \begin{itemdecl} template basic_ostream& emit_on_flush(basic_ostream& os); @@ -6775,7 +6762,7 @@ \tcode{os}. \end{itemdescr} -\indexlibrary{\idxcode{noemit_on_flush}}% +\indexlibraryglobal{noemit_on_flush}% \begin{itemdecl} template basic_ostream& noemit_on_flush(basic_ostream& os); @@ -6795,7 +6782,7 @@ \tcode{os}. \end{itemdescr} -\indexlibrary{\idxcode{flush_emit}}% +\indexlibraryglobal{flush_emit}% \begin{itemdecl} template basic_ostream& flush_emit(basic_ostream& os); @@ -6825,31 +6812,36 @@ \begin{itemdescr} \pnum -\effects As if by: \tcode{os << x;} +\effects +As if by: \tcode{os << x;} \pnum -\returns \tcode{os}. +\returns +\tcode{os}. \pnum -\remarks This function shall not participate in overload resolution +\remarks +This function shall not participate in overload resolution unless the expression \tcode{os << x} is well-formed. \end{itemdescr} \rSec2[std.manip]{Standard manipulators} -\pnum The header \tcode{} defines several functions that support +\pnum +The header \libheader{iomanip} defines several functions that support extractors and inserters that alter information maintained by class \tcode{ios_base} and its derived classes. -\indexlibrary{\idxcode{resetiosflags}}% +\indexlibraryglobal{resetiosflags}% \begin{itemdecl} @\unspec@ resetiosflags(ios_base::fmtflags mask); \end{itemdecl} \begin{itemdescr} \pnum -\returns An object of +\returns +An object of unspecified type such that if \tcode{out} is an object of type \tcode{basic_ostream} then the expression \tcode{out << resetiosflags(mask)} behaves as if it called @@ -6877,7 +6869,7 @@ expression \tcode{in >> resetiosflags(mask)} shall have type \tcode{basic_istream\&} and value \tcode{in}. \end{itemdescr} -\indexlibrary{\idxcode{setiosflags}}% +\indexlibraryglobal{setiosflags}% \begin{itemdecl} @\unspec@ setiosflags(ios_base::fmtflags mask); \end{itemdecl} @@ -6901,7 +6893,7 @@ \tcode{in >> setiosflags(mask)} behaves as if it called \tcode{f(in, mask)}, where the function \tcode{f} is defined as: -\indexlibrary{\idxcode{fmtflags}!\idxcode{ios_base}}% +\indexlibrarymember{fmtflags}{ios_base}% \begin{codeblock} void f(ios_base& str, ios_base::fmtflags mask) { @@ -6924,7 +6916,7 @@ \tcode{in}. \end{itemdescr} -\indexlibrary{\idxcode{setbase}}% +\indexlibraryglobal{setbase}% \begin{itemdecl} @\unspec@ setbase(int base); \end{itemdecl} @@ -6973,7 +6965,7 @@ \tcode{in}. \end{itemdescr} -\indexlibrary{\idxcode{setfill}}% +\indexlibraryglobal{setfill}% \begin{itemdecl} @\unspec@ setfill(char_type c); \end{itemdecl} @@ -7008,7 +7000,7 @@ \tcode{out}. \end{itemdescr} -\indexlibrary{\idxcode{setprecision}}% +\indexlibraryglobal{setprecision}% \begin{itemdecl} @\unspec@ setprecision(int n); \end{itemdecl} @@ -7054,7 +7046,7 @@ \tcode{in}. \end{itemdescr} -\indexlibrary{\idxcode{setw}}% +\indexlibraryglobal{setw}% \begin{itemdecl} @\unspec@ setw(int n); \end{itemdecl} @@ -7103,10 +7095,10 @@ \rSec2[ext.manip]{Extended manipulators} \pnum -The header \tcode{} defines several functions that support extractors and inserters that allow for the +The header \libheader{iomanip} defines several functions that support extractors and inserters that allow for the parsing and formatting of sequences and values for money and time. -\indexlibrary{\idxcode{get_money}}% +\indexlibraryglobal{get_money}% \begin{itemdecl} template @\unspec@ get_money(moneyT& mon, bool intl = false); \end{itemdecl} @@ -7117,11 +7109,13 @@ specialization of the \tcode{basic_string} template\iref{strings}. \pnum -\effects The expression \tcode{in >> get_money(mon, intl)} described below +\effects +The expression \tcode{in >> get_money(mon, intl)} described below behaves as a formatted input function\iref{istream.formatted.reqmts}. \pnum -\returns An object of unspecified type such that if +\returns +An object of unspecified type such that if \tcode{in} is an object of type \tcode{basic_istream} then the expression \tcode{in >> get_money(mon, intl)} behaves as if it called \tcode{f(in, mon, intl)}, where the function \tcode{f} is defined as: @@ -7146,7 +7140,7 @@ \tcode{basic_istream\&} and value \tcode{in}. \end{itemdescr} -\indexlibrary{\idxcode{put_money}}% +\indexlibraryglobal{put_money}% \begin{itemdecl} template @\unspec@ put_money(const moneyT& mon, bool intl = false); \end{itemdecl} @@ -7157,7 +7151,8 @@ specialization of the \tcode{basic_string} template\iref{strings}. \pnum -\returns An object of unspecified type such that if +\returns +An object of unspecified type such that if \tcode{out} is an object of type \tcode{basic_ostream} then the expression \tcode{out << put_money(mon, intl)} behaves as a formatted output function\iref{ostream.formatted.reqmts} that calls @@ -7182,7 +7177,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{get_time}}% +\indexlibraryglobal{get_time}% \begin{itemdecl} template @\unspec@ get_time(struct tm* tmb, const charT* fmt); \end{itemdecl} @@ -7193,7 +7188,8 @@ The argument \tcode{fmt} shall be a valid pointer to an array of objects of type \tcode{charT} with \tcode{char_traits::length(fmt)} elements. \pnum -\returns An object of unspecified type such that if \tcode{in} is an object of type +\returns +An object of unspecified type such that if \tcode{in} is an object of type \tcode{basic_istream} then the expression \tcode{in >> get_time(tmb, fmt)} behaves as if it called \tcode{f(in, tmb, fmt)}, where the function \tcode{f} is defined as: @@ -7219,7 +7215,7 @@ \tcode{basic_istream\&} and value \tcode{in}. \end{itemdescr} -\indexlibrary{\idxcode{put_time}}% +\indexlibraryglobal{put_time}% \begin{itemdecl} template @\unspec@ put_time(const struct tm* tmb, const charT* fmt); \end{itemdecl} @@ -7232,7 +7228,8 @@ \tcode{char_traits::length(\brk{}fmt)} elements. \pnum -\returns An object of unspecified type such that if \tcode{out} is an object of +\returns +An object of unspecified type such that if \tcode{out} is an object of type \tcode{basic_ostream} then the expression \tcode{out << put_time(tmb, fmt)} behaves as if it called \tcode{f(out, tmb, fmt)}, where the function \tcode{f} is defined as: @@ -7259,9 +7256,11 @@ \rSec2[quoted.manip]{Quoted manipulators} \pnum -\begin{note} Quoted manipulators provide string insertion and extraction of quoted strings (for example, XML and CSV formats). Quoted manipulators are useful in ensuring that the content of a string with embedded spaces remains unchanged if inserted and then extracted via stream I/O. \end{note} +\begin{note} +Quoted manipulators provide string insertion and extraction of quoted strings (for example, XML and CSV formats). Quoted manipulators are useful in ensuring that the content of a string with embedded spaces remains unchanged if inserted and then extracted via stream I/O. +\end{note} -\indexlibrary{\idxcode{quoted}}% +\indexlibraryglobal{quoted}% \begin{itemdecl} template @\unspec@ quoted(const charT* s, charT delim = charT('"'), charT escape = charT('\\')); @@ -7275,7 +7274,8 @@ \begin{itemdescr} \pnum -\returns An object of unspecified type such that if \tcode{out} is an instance +\returns +An object of unspecified type such that if \tcode{out} is an instance of \tcode{basic_ostream} with member type \tcode{char_type} the same as \tcode{charT} and with member type \tcode{traits_type}, which in the second and third forms is the same as \tcode{traits}, then the expression @@ -7299,7 +7299,7 @@ \tcode{basic_ostream\&} and value \tcode{out}. \end{itemdescr} -\indexlibrary{\idxcode{quoted}}% +\indexlibraryglobal{quoted}% \begin{itemdecl} template @\unspec@ quoted(basic_string& s, @@ -7308,7 +7308,8 @@ \begin{itemdescr} \pnum -\returns An object of unspecified type such that: +\returns +An object of unspecified type such that: \begin{itemize} \item If \tcode{in} is an instance of \tcode{basic_istream} with member types \tcode{char_type} and \tcode{traits_type} the same as \tcode{charT} @@ -7348,24 +7349,24 @@ \rSec1[string.streams]{String-based streams} \rSec2[sstream.syn]{Header \tcode{} synopsis} -\indexhdr{sstream}% - -\indexlibrary{\idxcode{stringbuf}}% -\indexlibrary{\idxcode{basic_stringbuf}}% -\indexlibrary{\idxcode{wstringbuf}}% -\indexlibrary{\idxcode{basic_stringbuf}}% -\indexlibrary{\idxcode{istringstream}}% -\indexlibrary{\idxcode{basic_istringstream}}% -\indexlibrary{\idxcode{wistringstream}}% -\indexlibrary{\idxcode{basic_istringstream}}% -\indexlibrary{\idxcode{ostringstream}}% -\indexlibrary{\idxcode{basic_ostringstream}}% -\indexlibrary{\idxcode{wostringstream}}% -\indexlibrary{\idxcode{basic_ostringstream}}% -\indexlibrary{\idxcode{stringstream}}% -\indexlibrary{\idxcode{basic_stringstream}}% -\indexlibrary{\idxcode{wstringstream}}% -\indexlibrary{\idxcode{basic_stringstream}}% + +\indexheader{sstream}% +\indexlibraryglobal{stringbuf}% +\indexlibraryglobal{basic_stringbuf}% +\indexlibraryglobal{wstringbuf}% +\indexlibraryglobal{basic_stringbuf}% +\indexlibraryglobal{istringstream}% +\indexlibraryglobal{basic_istringstream}% +\indexlibraryglobal{wistringstream}% +\indexlibraryglobal{basic_istringstream}% +\indexlibraryglobal{ostringstream}% +\indexlibraryglobal{basic_ostringstream}% +\indexlibraryglobal{wostringstream}% +\indexlibraryglobal{basic_ostringstream}% +\indexlibraryglobal{stringstream}% +\indexlibraryglobal{basic_stringstream}% +\indexlibraryglobal{wstringstream}% +\indexlibraryglobal{basic_stringstream}% \begin{codeblock} namespace std { template, @@ -7397,17 +7398,14 @@ \end{codeblock} \pnum -The header -\tcode{} -defines four -class templates +The header \libheader{sstream} defines four class templates and eight types that associate stream buffers with objects of class \tcode{basic_string}, -\indexlibrary{\idxcode{basic_string}}% +\indexlibraryglobal{basic_string}% as described in~\ref{string.classes}. \rSec2[stringbuf]{Class template \tcode{basic_stringbuf}} -\indexlibrary{\idxcode{basic_stringbuf}}% +\indexlibraryglobal{basic_stringbuf}% \begin{codeblock} namespace std { template, @@ -7445,12 +7443,12 @@ explicit basic_stringbuf( const basic_string& s, ios_base::openmode which = ios_base::in | ios_base::out); - basic_stringbuf(const basic_stringbuf& rhs) = delete; + basic_stringbuf(const basic_stringbuf&) = delete; basic_stringbuf(basic_stringbuf&& rhs); basic_stringbuf(basic_stringbuf&& rhs, const Allocator& a); // \ref{stringbuf.assign}, assign and swap - basic_stringbuf& operator=(const basic_stringbuf& rhs) = delete; + basic_stringbuf& operator=(const basic_stringbuf&) = delete; basic_stringbuf& operator=(basic_stringbuf&& rhs); void swap(basic_stringbuf& rhs) noexcept(@\seebelow@); @@ -7483,9 +7481,9 @@ = ios_base::in | ios_base::out) override; private: - ios_base::openmode mode; // \expos - basic_string buf; // \expos - void init_buf_ptrs(); // \expos + ios_base::openmode mode; // \expos + basic_string buf; // \expos + void init_buf_ptrs(); // \expos }; template @@ -7525,7 +7523,7 @@ \rSec3[stringbuf.cons]{Constructors} -\indexlibrary{\idxcode{basic_stringbuf}!constructor}% +\indexlibraryctor{basic_stringbuf}% \begin{itemdecl} explicit basic_stringbuf(ios_base::openmode which); \end{itemdecl} @@ -7549,7 +7547,7 @@ \tcode{str().empty()} is \tcode{true}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringbuf}!constructor}% +\indexlibraryctor{basic_stringbuf}% \begin{itemdecl} explicit basic_stringbuf( const basic_string& s, @@ -7566,7 +7564,7 @@ then calls \tcode{init_buf_ptrs()}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringbuf}!constructor}% +\indexlibraryctor{basic_stringbuf}% \begin{itemdecl} basic_stringbuf(ios_base::openmode which, const Allocator &a); \end{itemdecl} @@ -7585,7 +7583,7 @@ \tcode{str().empty()} is \tcode{true}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringbuf}!constructor}% +\indexlibraryctor{basic_stringbuf}% \begin{itemdecl} explicit basic_stringbuf( basic_string&& s, @@ -7601,7 +7599,7 @@ then calls \tcode{init_buf_ptrs()}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringbuf}!constructor}% +\indexlibraryctor{basic_stringbuf}% \begin{itemdecl} template basic_stringbuf( @@ -7618,7 +7616,7 @@ then calls \tcode{init_buf_ptrs()}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringbuf}!constructor}% +\indexlibraryctor{basic_stringbuf}% \begin{itemdecl} template explicit basic_stringbuf( @@ -7639,7 +7637,7 @@ then calls \tcode{init_buf_ptrs()}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringbuf}!constructor}% +\indexlibraryctor{basic_stringbuf}% \begin{itemdecl} basic_stringbuf(basic_stringbuf&& rhs); basic_stringbuf(basic_stringbuf&& rhs, const Allocator& a); @@ -7662,7 +7660,8 @@ the values which \tcode{rhs} had. \pnum -\ensures Let \tcode{rhs_p} refer to the state of +\ensures +Let \tcode{rhs_p} refer to the state of \tcode{rhs} just prior to this construction and let \tcode{rhs_a} refer to the state of \tcode{rhs} just after this construction. @@ -7693,11 +7692,13 @@ \begin{itemdescr} \pnum -\effects After the move assignment \tcode{*this} has the observable state it would +\effects +After the move assignment \tcode{*this} has the observable state it would have had if it had been move constructed from \tcode{rhs} (see~\ref{stringbuf.cons}). \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_stringbuf}% @@ -7707,16 +7708,19 @@ \begin{itemdescr} \pnum -\expects \tcode{allocator_traits::propagate_on_container_swap::value} +\expects +\tcode{allocator_traits::propagate_on_container_swap::value} is \tcode{true} or \tcode{get_allocator() == s.get_allocator()} is \tcode{true}. \pnum -\effects Exchanges the state of \tcode{*this} +\effects +Exchanges the state of \tcode{*this} and \tcode{rhs}. \pnum -\remarks The expression inside \tcode{noexcept} is equivalent to:\\ +\remarks +The expression inside \tcode{noexcept} is equivalent to:\\ \tcode{allocator_traits::propagate_on_container_swap::value ||}\\ \tcode{allocator_traits::is_always_equal::value}. \end{itemdescr} @@ -7730,7 +7734,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec3[stringbuf.members]{Member functions} @@ -7795,7 +7800,8 @@ \begin{itemdescr} \pnum -\returns \tcode{buf.get_allocator()}. +\returns +\tcode{buf.get_allocator()}. \end{itemdescr} \indexlibrarymember{str}{basic_stringbuf}% @@ -7805,7 +7811,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return basic_string(view(), get_allocator()); \end{codeblock} @@ -7823,7 +7830,8 @@ qualifies as an allocator\iref{container.requirements.general}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return basic_string(view(), sa); \end{codeblock} @@ -7906,7 +7914,8 @@ \constraints \tcode{is_same_v} is \tcode{false}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} buf = s; init_buf_ptrs(); @@ -7920,7 +7929,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} buf = std::move(s); init_buf_ptrs(); @@ -8198,7 +8208,7 @@ \rSec2[istringstream]{Class template \tcode{basic_istringstream}} -\indexlibrary{\idxcode{basic_istringstream}}% +\indexlibraryglobal{basic_istringstream}% \begin{codeblock} namespace std { template, @@ -8234,11 +8244,11 @@ explicit basic_istringstream( const basic_string& s, ios_base::openmode which = ios_base::in); - basic_istringstream(const basic_istringstream& rhs) = delete; + basic_istringstream(const basic_istringstream&) = delete; basic_istringstream(basic_istringstream&& rhs); // \ref{istringstream.assign}, assign and swap - basic_istringstream& operator=(const basic_istringstream& rhs) = delete; + basic_istringstream& operator=(const basic_istringstream&) = delete; basic_istringstream& operator=(basic_istringstream&& rhs); void swap(basic_istringstream& rhs); @@ -8256,7 +8266,7 @@ void str(basic_string&& s); private: - basic_stringbuf sb; // \expos + basic_stringbuf sb; // \expos }; template @@ -8281,7 +8291,7 @@ \rSec3[istringstream.cons]{Constructors} -\indexlibrary{\idxcode{basic_istringstream}!constructor}% +\indexlibraryctor{basic_istringstream}% \begin{itemdecl} explicit basic_istringstream(ios_base::openmode which); \end{itemdecl} @@ -8295,7 +8305,7 @@ \tcode{basic_stringbuf(which | ios_base::in)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_istringstream}!constructor}% +\indexlibraryctor{basic_istringstream}% \begin{itemdecl} explicit basic_istringstream( const basic_string& s, @@ -8311,7 +8321,7 @@ \tcode{basic_stringbuf(s, which | ios_base::in)}\linebreak(\ref{stringbuf.cons}). % avoid Overfull \end{itemdescr} -\indexlibrary{\idxcode{basic_istringstream}!constructor}% +\indexlibraryctor{basic_istringstream}% \begin{itemdecl} basic_istringstream(ios_base::openmode which, const Allocator& a); \end{itemdecl} @@ -8325,7 +8335,7 @@ \tcode{basic_stringbuf(which | ios_base::in, a)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_istringstream}!constructor}% +\indexlibraryctor{basic_istringstream}% \begin{itemdecl} explicit basic_istringstream( basic_string&& s, @@ -8341,7 +8351,7 @@ \tcode{basic_stringbuf(std::move(s), which | ios_base::\brk{}in)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_istringstream}!constructor}% +\indexlibraryctor{basic_istringstream}% \begin{itemdecl} template basic_istringstream( @@ -8358,7 +8368,7 @@ \tcode{basic_stringbuf(s, which | ios_base::in, a)}\linebreak(\ref{stringbuf.cons}). % avoid Overfull \end{itemdescr} -\indexlibrary{\idxcode{basic_istringstream}!constructor}% +\indexlibraryctor{basic_istringstream}% \begin{itemdecl} template explicit basic_istringstream( @@ -8375,14 +8385,15 @@ \tcode{basic_stringbuf(s, which | ios_base::in)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_istringstream}!constructor}% +\indexlibraryctor{basic_istringstream}% \begin{itemdecl} basic_istringstream(basic_istringstream&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs}. This +\effects +Move constructs from the rvalue \tcode{rhs}. This is accomplished by move constructing the base class, and the contained \tcode{basic_stringbuf}. Next \tcode{basic_istream::set_rdbuf(addressof(sb))} @@ -8399,11 +8410,13 @@ \begin{itemdescr} \pnum -\effects Move assigns the base and members of \tcode{*this} from the base and corresponding +\effects +Move assigns the base and members of \tcode{*this} from the base and corresponding members of \tcode{rhs}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_istringstream}% @@ -8413,7 +8426,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} basic_istream::swap(rhs); sb.swap(rhs.sb); @@ -8430,7 +8444,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec3[istringstream.members]{Member functions} @@ -8453,7 +8468,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return rdbuf()->str();} +\effects +Equivalent to: \tcode{return rdbuf()->str();} \end{itemdescr} \indexlibrarymember{str}{basic_istringstream}% @@ -8464,7 +8480,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return rdbuf()->str(sa);} +\effects +Equivalent to: \tcode{return rdbuf()->str(sa);} \end{itemdescr} \indexlibrarymember{str}{basic_istringstream}% @@ -8474,7 +8491,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return std::move(*rdbuf()).str();} +\effects +Equivalent to: \tcode{return std::move(*rdbuf()).str();} \end{itemdescr} \indexlibrarymember{view}{basic_istringstream}% @@ -8484,7 +8502,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return rdbuf()->view();} +\effects +Equivalent to: \tcode{return rdbuf()->view();} \end{itemdescr} \indexlibrarymember{str}{basic_istringstream}% @@ -8522,7 +8541,7 @@ \rSec2[ostringstream]{Class template \tcode{basic_ostringstream}} -\indexlibrary{\idxcode{basic_ostringstream}}% +\indexlibraryglobal{basic_ostringstream}% \begin{codeblock} namespace std { template, @@ -8558,11 +8577,11 @@ explicit basic_ostringstream( const basic_string& s, ios_base::openmode which = ios_base::out); - basic_ostringstream(const basic_ostringstream& rhs) = delete; + basic_ostringstream(const basic_ostringstream&) = delete; basic_ostringstream(basic_ostringstream&& rhs); // \ref{ostringstream.assign}, assign and swap - basic_ostringstream& operator=(const basic_ostringstream& rhs) = delete; + basic_ostringstream& operator=(const basic_ostringstream&) = delete; basic_ostringstream& operator=(basic_ostringstream&& rhs); void swap(basic_ostringstream& rhs); @@ -8581,7 +8600,7 @@ void str(basic_string&& s); private: - basic_stringbuf sb; // \expos + basic_stringbuf sb; // \expos }; template @@ -8606,7 +8625,7 @@ \rSec3[ostringstream.cons]{Constructors} -\indexlibrary{\idxcode{basic_ostringstream}!constructor}% +\indexlibraryctor{basic_ostringstream}% \begin{itemdecl} explicit basic_ostringstream(ios_base::openmode which); \end{itemdecl} @@ -8620,7 +8639,7 @@ \tcode{basic_stringbuf(which | ios_base::out)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ostringstream}!constructor}% +\indexlibraryctor{basic_ostringstream}% \begin{itemdecl} explicit basic_ostringstream( const basic_string& s, @@ -8636,7 +8655,7 @@ \tcode{basic_stringbuf(s, which | ios_base::out)}\linebreak(\ref{stringbuf.cons}). % avoid Overfull \end{itemdescr} -\indexlibrary{\idxcode{basic_ostringstream}!constructor}% +\indexlibraryctor{basic_ostringstream}% \begin{itemdecl} basic_ostringstream(ios_base::openmode which, const Allocator& a); \end{itemdecl} @@ -8650,7 +8669,7 @@ \tcode{basic_stringbuf(which | ios_base::out, a)}\linebreak(\ref{stringbuf.cons}). % avoid Overfull \end{itemdescr} -\indexlibrary{\idxcode{basic_ostringstream}!constructor}% +\indexlibraryctor{basic_ostringstream}% \begin{itemdecl} explicit basic_ostringstream( basic_string&& s, @@ -8666,7 +8685,7 @@ \tcode{basic_stringbuf(std::move(s), which | ios_base::\brk{}out)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ostringstream}!constructor}% +\indexlibraryctor{basic_ostringstream}% \begin{itemdecl} template basic_ostringstream( @@ -8683,7 +8702,7 @@ \tcode{basic_stringbuf(s, which | ios_base::out, a)}\linebreak(\ref{stringbuf.cons}). % avoid Overfull \end{itemdescr} -\indexlibrary{\idxcode{basic_ostringstream}!constructor}% +\indexlibraryctor{basic_ostringstream}% \begin{itemdecl} template explicit basic_ostringstream( @@ -8703,14 +8722,15 @@ \tcode{basic_stringbuf(s, which | ios_base::out)}\linebreak(\ref{stringbuf.cons}). % avoid Overfull \end{itemdescr} -\indexlibrary{\idxcode{basic_ostringstream}!constructor}% +\indexlibraryctor{basic_ostringstream}% \begin{itemdecl} basic_ostringstream(basic_ostringstream&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs}. This +\effects +Move constructs from the rvalue \tcode{rhs}. This is accomplished by move constructing the base class, and the contained \tcode{basic_stringbuf}. Next \tcode{basic_ostream::set_rdbuf(addressof(sb))} @@ -8727,11 +8747,13 @@ \begin{itemdescr} \pnum -\effects Move assigns the base and members of \tcode{*this} from the base and corresponding +\effects +Move assigns the base and members of \tcode{*this} from the base and corresponding members of \tcode{rhs}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_ostringstream}% @@ -8741,7 +8763,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} basic_ostream::swap(rhs); sb.swap(rhs.sb); @@ -8757,7 +8780,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec3[ostringstream.members]{Member functions} @@ -8854,7 +8878,7 @@ \rSec2[stringstream]{Class template \tcode{basic_stringstream}} -\indexlibrary{\idxcode{basic_stringstream}}% +\indexlibraryglobal{basic_stringstream}% \begin{codeblock} namespace std { template, @@ -8890,11 +8914,11 @@ explicit basic_stringstream( const basic_string& s, ios_base::openmode which = ios_base::out | ios_base::in); - basic_stringstream(const basic_stringstream& rhs) = delete; + basic_stringstream(const basic_stringstream&) = delete; basic_stringstream(basic_stringstream&& rhs); // \ref{stringstream.assign}, assign and swap - basic_stringstream& operator=(const basic_stringstream& rhs) = delete; + basic_stringstream& operator=(const basic_stringstream&) = delete; basic_stringstream& operator=(basic_stringstream&& rhs); void swap(basic_stringstream& rhs); @@ -8939,7 +8963,7 @@ \rSec3[stringstream.cons]{Constructors} -\indexlibrary{\idxcode{basic_stringstream}!constructor}% +\indexlibraryctor{basic_stringstream}% \begin{itemdecl} explicit basic_stringstream(ios_base::openmode which); \end{itemdecl} @@ -8955,7 +8979,7 @@ \tcode{basic_string\-buf(which)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringstream}!constructor}% +\indexlibraryctor{basic_stringstream}% \begin{itemdecl} explicit basic_stringstream( const basic_string& s, @@ -8973,7 +8997,7 @@ \tcode{basic_string\-buf(s, which)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringstream}!constructor}% +\indexlibraryctor{basic_stringstream}% \begin{itemdecl} basic_stringstream(ios_base::openmode which, const Allocator& a); \end{itemdecl} @@ -8987,7 +9011,7 @@ \tcode{basic_stringbuf(which, a)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringstream}!constructor}% +\indexlibraryctor{basic_stringstream}% \begin{itemdecl} explicit basic_stringstream( basic_string&& s, @@ -9003,7 +9027,7 @@ \tcode{basic_stringbuf(std::move(s), which)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringstream}!constructor}% +\indexlibraryctor{basic_stringstream}% \begin{itemdecl} template basic_stringstream( @@ -9020,7 +9044,7 @@ \tcode{basic_stringbuf(s, which, a)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringstream}!constructor}% +\indexlibraryctor{basic_stringstream}% \begin{itemdecl} template explicit basic_stringstream( @@ -9040,14 +9064,15 @@ \tcode{basic_stringbuf(s, which)}\iref{stringbuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_stringstream}!constructor}% +\indexlibraryctor{basic_stringstream}% \begin{itemdecl} basic_stringstream(basic_stringstream&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs}. This +\effects +Move constructs from the rvalue \tcode{rhs}. This is accomplished by move constructing the base class, and the contained \tcode{basic_stringbuf}. Next \tcode{basic_istream::set_rdbuf(addressof(sb))} is called to @@ -9063,11 +9088,13 @@ \begin{itemdescr} \pnum -\effects Move assigns the base and members of \tcode{*this} from the base and corresponding +\effects +Move assigns the base and members of \tcode{*this} from the base and corresponding members of \tcode{rhs}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_stringstream}% @@ -9094,7 +9121,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec3[stringstream.members]{Member functions} @@ -9192,23 +9220,24 @@ \rSec1[file.streams]{File-based streams} \rSec2[fstream.syn]{Header \tcode{} synopsis} -\indexhdr{fstream}% -\indexlibrary{\idxcode{filebuf}}% -\indexlibrary{\idxcode{basic_filebuf}}% -\indexlibrary{\idxcode{wfilebuf}}% -\indexlibrary{\idxcode{basic_filebuf}}% -\indexlibrary{\idxcode{ifstream}}% -\indexlibrary{\idxcode{basic_ifstream}}% -\indexlibrary{\idxcode{wifstream}}% -\indexlibrary{\idxcode{basic_ifstream}}% -\indexlibrary{\idxcode{ofstream}}% -\indexlibrary{\idxcode{basic_ofstream}}% -\indexlibrary{\idxcode{wofstream}}% -\indexlibrary{\idxcode{basic_ofstream}}% -\indexlibrary{\idxcode{fstream}}% -\indexlibrary{\idxcode{basic_fstream}}% -\indexlibrary{\idxcode{wfstream}}% -\indexlibrary{\idxcode{basic_fstream}}% + +\indexheader{fstream}% +\indexlibraryglobal{filebuf}% +\indexlibraryglobal{basic_filebuf}% +\indexlibraryglobal{wfilebuf}% +\indexlibraryglobal{basic_filebuf}% +\indexlibraryglobal{ifstream}% +\indexlibraryglobal{basic_ifstream}% +\indexlibraryglobal{wifstream}% +\indexlibraryglobal{basic_ifstream}% +\indexlibraryglobal{ofstream}% +\indexlibraryglobal{basic_ofstream}% +\indexlibraryglobal{wofstream}% +\indexlibraryglobal{basic_ofstream}% +\indexlibraryglobal{fstream}% +\indexlibraryglobal{basic_fstream}% +\indexlibraryglobal{wfstream}% +\indexlibraryglobal{basic_fstream}% \begin{codeblock} namespace std { template> @@ -9234,14 +9263,14 @@ \end{codeblock} \pnum -The header -\tcode{} +The header \libheader{fstream} defines four class templates and eight types that associate stream buffers with files and assist reading and writing files. \pnum -\begin{note} The class template \tcode{basic_filebuf} treats a file as a source or +\begin{note} +The class template \tcode{basic_filebuf} treats a file as a source or sink of bytes. In an environment that uses a large character set, the file typically holds multibyte character sequences and the \tcode{basic_filebuf} object converts those multibyte sequences into wide character sequences. @@ -9256,7 +9285,7 @@ \rSec2[filebuf]{Class template \tcode{basic_filebuf}} -\indexlibrary{\idxcode{basic_filebuf}}% +\indexlibraryglobal{basic_filebuf}% \begin{codeblock} namespace std { template> @@ -9270,12 +9299,12 @@ // \ref{filebuf.cons}, constructors/destructor basic_filebuf(); - basic_filebuf(const basic_filebuf& rhs) = delete; + basic_filebuf(const basic_filebuf&) = delete; basic_filebuf(basic_filebuf&& rhs); virtual ~basic_filebuf(); // \ref{filebuf.assign}, assign and swap - basic_filebuf& operator=(const basic_filebuf& rhs) = delete; + basic_filebuf& operator=(const basic_filebuf&) = delete; basic_filebuf& operator=(basic_filebuf&& rhs); void swap(basic_filebuf& rhs); @@ -9283,7 +9312,7 @@ bool is_open() const; basic_filebuf* open(const char* s, ios_base::openmode mode); basic_filebuf* open(const filesystem::path::value_type* s, - ios_base::openmode mode); // wide systems only; see \ref{fstream.syn} + ios_base::openmode mode); // wide systems only; see \ref{fstream.syn} basic_filebuf* open(const string& s, ios_base::openmode mode); basic_filebuf* open(const filesystem::path& s, @@ -9356,7 +9385,6 @@ In order to support file I/O and multibyte/wide character conversion, conversions are performed using members of a facet, referred to as \tcode{a_codecvt} in following subclauses, obtained as if by - \begin{codeblock} const codecvt& a_codecvt = use_facet>(getloc()); @@ -9364,7 +9392,7 @@ \rSec3[filebuf.cons]{Constructors} -\indexlibrary{\idxcode{basic_filebuf}!constructor}% +\indexlibraryctor{basic_filebuf}% \begin{itemdecl} basic_filebuf(); \end{itemdecl} @@ -9382,14 +9410,15 @@ \tcode{is_open() == false}. \end{itemdescr} -\indexlibrary{\idxcode{basic_filebuf}!constructor}% +\indexlibraryctor{basic_filebuf}% \begin{itemdecl} basic_filebuf(basic_filebuf&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs}. It +\effects +Move constructs from the rvalue \tcode{rhs}. It is \impldef{whether sequence pointers are copied by \tcode{basic_filebuf} move constructor} whether the sequence pointers in \tcode{*this} (\tcode{eback()}, \tcode{gptr()}, \tcode{egptr()}, @@ -9403,7 +9432,8 @@ copied. \pnum -\ensures Let \tcode{rhs_p} refer to the state of +\ensures +Let \tcode{rhs_p} refer to the state of \tcode{rhs} just prior to this construction and let \tcode{rhs_a} refer to the state of \tcode{rhs} just after this construction. @@ -9423,7 +9453,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{basic_filebuf}!destructor}% +\indexlibrarydtor{basic_filebuf}% \begin{itemdecl} virtual ~basic_filebuf(); \end{itemdecl} @@ -9447,12 +9477,14 @@ \begin{itemdescr} \pnum -\effects Calls \tcode{close()} then move assigns from \tcode{rhs}. After the +\effects +Calls \tcode{close()} then move assigns from \tcode{rhs}. After the move assignment \tcode{*this} has the observable state it would have had if it had been move constructed from \tcode{rhs} (see~\ref{filebuf.cons}). \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_filebuf}% @@ -9462,7 +9494,8 @@ \begin{itemdescr} \pnum -\effects Exchanges the state of \tcode{*this} +\effects +Exchanges the state of \tcode{*this} and \tcode{rhs}. \end{itemdescr} @@ -9475,7 +9508,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec3[filebuf.members]{Member functions} @@ -9519,7 +9553,7 @@ It then opens the file to which \tcode{s} resolves, if possible, as if by a call to \tcode{fopen} -\indexlibrary{\idxcode{fopen}}% +\indexlibraryglobal{fopen}% with the second argument determined from \tcode{mode \& \~{}ios_base::ate} as indicated in \tref{filebuf.open.modes}. @@ -9559,14 +9593,12 @@ \tcode{file} is the pointer returned by calling \tcode{fopen}).% \footnote{The macro \tcode{SEEK_END} is defined, and the function signatures -\indexlibrary{\idxcode{fopen}}% +\indexlibraryglobal{fopen}% \tcode{fopen(const char*, const char*)} and \tcode{fseek(FILE*, long, int)} -\indexlibrary{\idxcode{fseek}}% -are declared, in -\indexhdr{cstdio}% -\tcode{}\iref{cstdio.syn}.} +\indexlibraryglobal{fseek}% +are declared, in \libheaderref{cstdio}.} \pnum If the repositioning operation fails, calls @@ -9624,7 +9656,7 @@ Finally, regardless of whether any of the preceding calls fails or throws an exception, the function closes the file (as if by calling -\indexlibrary{\idxcode{fclose}}% +\indexlibraryglobal{fclose}% \tcode{fclose(file)}). If any of the calls made by the function, including \tcode{fclose}, fails, \tcode{close} fails by returning a null pointer. If one of these calls throws an @@ -9652,7 +9684,7 @@ \effects Behaves the same as \tcode{basic_streambuf::showmanyc()}\iref{streambuf.virtuals}. -\indexlibrary{\idxcode{showmanyc}!\idxcode{basic_streambuf}}% +\indexlibrarymember{showmanyc}{basic_streambuf}% \pnum \remarks @@ -9808,7 +9840,6 @@ \tcode{basic_streambuf::overflow(c)}, except that the behavior of ``consuming characters'' is performed by first converting as if by: - \begin{codeblock} charT* b = pbase(); charT* p = pptr(); @@ -9818,7 +9849,6 @@ codecvt_base::result r = a_codecvt.out(state, b, p, end, xbuf, xbuf+XSIZE, xbuf_end); \end{codeblock} - and then \begin{itemize} \item If \tcode{r == codecvt_base::error} then fail. @@ -10027,7 +10057,7 @@ \rSec2[ifstream]{Class template \tcode{basic_ifstream}} -\indexlibrary{\idxcode{basic_ifstream}}% +\indexlibraryglobal{basic_ifstream}% \begin{codeblock} namespace std { template> @@ -10044,16 +10074,16 @@ explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in); explicit basic_ifstream(const filesystem::path::value_type* s, - ios_base::openmode mode = ios_base::in); // wide systems only; see \ref{fstream.syn} + ios_base::openmode mode = ios_base::in);// wide systems only; see \ref{fstream.syn} explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in); explicit basic_ifstream(const filesystem::path& s, ios_base::openmode mode = ios_base::in); - basic_ifstream(const basic_ifstream& rhs) = delete; + basic_ifstream(const basic_ifstream&) = delete; basic_ifstream(basic_ifstream&& rhs); // \ref{ifstream.assign}, assign and swap - basic_ifstream& operator=(const basic_ifstream& rhs) = delete; + basic_ifstream& operator=(const basic_ifstream&) = delete; basic_ifstream& operator=(basic_ifstream&& rhs); void swap(basic_ifstream& rhs); @@ -10068,7 +10098,7 @@ void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in); void close(); private: - basic_filebuf sb; // \expos + basic_filebuf sb; // \expos }; template @@ -10086,7 +10116,6 @@ object to control the associated sequence. For the sake of exposition, the maintained data is presented here as: - \begin{itemize} \item \tcode{sb}, the \tcode{filebuf} object. @@ -10094,7 +10123,7 @@ \rSec3[ifstream.cons]{Constructors} -\indexlibrary{\idxcode{basic_ifstream}!constructor}% +\indexlibraryctor{basic_ifstream}% \begin{itemdecl} basic_ifstream(); \end{itemdecl} @@ -10110,7 +10139,7 @@ \tcode{basic_filebuf()}\iref{filebuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ifstream}!constructor}% +\indexlibraryctor{basic_ifstream}% \begin{itemdecl} explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in); @@ -10133,7 +10162,7 @@ \tcode{setstate(failbit)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ifstream}!constructor}% +\indexlibraryctor{basic_ifstream}% \begin{itemdecl} explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in); @@ -10143,17 +10172,19 @@ \begin{itemdescr} \pnum -\effects The same as \tcode{basic_ifstream(s.c_str(), mode)}. +\effects +The same as \tcode{basic_ifstream(s.c_str(), mode)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ifstream}!constructor}% +\indexlibraryctor{basic_ifstream}% \begin{itemdecl} basic_ifstream(basic_ifstream&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs}. This +\effects +Move constructs from the rvalue \tcode{rhs}. This is accomplished by move constructing the base class, and the contained \tcode{basic_filebuf}. Next \tcode{basic_istream::set_rdbuf(\brk{}addressof(sb))} @@ -10170,11 +10201,13 @@ \begin{itemdescr} \pnum -\effects Move assigns the base and members of \tcode{*this} from the base and corresponding +\effects +Move assigns the base and members of \tcode{*this} from the base and corresponding members of \tcode{rhs}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_ifstream}% @@ -10184,7 +10217,8 @@ \begin{itemdescr} \pnum -\effects Exchanges the state of \tcode{*this} +\effects +Exchanges the state of \tcode{*this} and \tcode{rhs} by calling \tcode{basic_istream::swap(rhs)} and \tcode{sb.swap(rhs.sb)}. @@ -10199,7 +10233,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec3[ifstream.members]{Member functions} @@ -10254,7 +10289,8 @@ \begin{itemdescr} \pnum -\effects Calls \tcode{open(s.c_str(), mode)}. +\effects +Calls \tcode{open(s.c_str(), mode)}. \end{itemdescr} \indexlibrarymember{close}{basic_ifstream}% @@ -10277,7 +10313,7 @@ \rSec2[ofstream]{Class template \tcode{basic_ofstream}} -\indexlibrary{\idxcode{basic_ofstream}}% +\indexlibraryglobal{basic_ofstream}% \begin{codeblock} namespace std { template> @@ -10293,17 +10329,17 @@ basic_ofstream(); explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out); - explicit basic_ofstream(const filesystem::path::value_type* s, - ios_base::openmode mode = ios_base::out); // wide systems only; see \ref{fstream.syn} + explicit basic_ofstream(const filesystem::path::value_type* s, // wide systems only; see \ref{fstream.syn} + ios_base::openmode mode = ios_base::out); explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out); explicit basic_ofstream(const filesystem::path& s, ios_base::openmode mode = ios_base::out); - basic_ofstream(const basic_ofstream& rhs) = delete; + basic_ofstream(const basic_ofstream&) = delete; basic_ofstream(basic_ofstream&& rhs); // \ref{ofstream.assign}, assign and swap - basic_ofstream& operator=(const basic_ofstream& rhs) = delete; + basic_ofstream& operator=(const basic_ofstream&) = delete; basic_ofstream& operator=(basic_ofstream&& rhs); void swap(basic_ofstream& rhs); @@ -10313,12 +10349,12 @@ bool is_open() const; void open(const char* s, ios_base::openmode mode = ios_base::out); void open(const filesystem::path::value_type* s, - ios_base::openmode mode = ios_base::out); // wide systems only; see \ref{fstream.syn} + ios_base::openmode mode = ios_base::out); // wide systems only; see \ref{fstream.syn} 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 + basic_filebuf sb; // \expos }; template @@ -10343,7 +10379,7 @@ \rSec3[ofstream.cons]{Constructors} -\indexlibrary{\idxcode{basic_ofstream}!constructor}% +\indexlibraryctor{basic_ofstream}% \begin{itemdecl} basic_ofstream(); \end{itemdecl} @@ -10359,7 +10395,7 @@ \tcode{basic_filebuf()}\iref{filebuf.cons}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ofstream}!constructor}% +\indexlibraryctor{basic_ofstream}% \begin{itemdecl} explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out); @@ -10382,7 +10418,7 @@ \tcode{setstate(\brk{}fail\-bit)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ofstream}!constructor}% +\indexlibraryctor{basic_ofstream}% \begin{itemdecl} explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out); @@ -10392,17 +10428,19 @@ \begin{itemdescr} \pnum -\effects The same as \tcode{basic_ofstream(s.c_str(), mode)}. +\effects +The same as \tcode{basic_ofstream(s.c_str(), mode)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_ofstream}!constructor}% +\indexlibraryctor{basic_ofstream}% \begin{itemdecl} basic_ofstream(basic_ofstream&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs}. This +\effects +Move constructs from the rvalue \tcode{rhs}. This is accomplished by move constructing the base class, and the contained \tcode{basic_filebuf}. Next \tcode{basic_ostream::set_rdbuf(\brk{}addressof(sb))} @@ -10419,11 +10457,13 @@ \begin{itemdescr} \pnum -\effects Move assigns the base and members of \tcode{*this} from the base and corresponding +\effects +Move assigns the base and members of \tcode{*this} from the base and corresponding members of \tcode{rhs}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_ofstream}% @@ -10433,7 +10473,8 @@ \begin{itemdescr} \pnum -\effects Exchanges the state of \tcode{*this} +\effects +Exchanges the state of \tcode{*this} and \tcode{rhs} by calling \tcode{basic_ostream::swap(rhs)} and \tcode{sb.swap(rhs.sb)}. @@ -10448,7 +10489,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec3[ofstream.members]{Member functions} @@ -10479,7 +10521,7 @@ \begin{itemdecl} void open(const char* s, ios_base::openmode mode = ios_base::out); void open(const filesystem::path::value_type* s, - ios_base::openmode mode = ios_base::out); // wide systems only; see \ref{fstream.syn} + ios_base::openmode mode = ios_base::out); // wide systems only; see \ref{fstream.syn} \end{itemdecl} \begin{itemdescr} @@ -10519,12 +10561,13 @@ \begin{itemdescr} \pnum -\effects Calls \tcode{open(s.c_str(), mode)}. +\effects +Calls \tcode{open(s.c_str(), mode)}. \end{itemdescr} \rSec2[fstream]{Class template \tcode{basic_fstream}} -\indexlibrary{\idxcode{basic_fstream}}% +\indexlibraryglobal{basic_fstream}% \begin{codeblock} namespace std { template> @@ -10543,18 +10586,18 @@ ios_base::openmode mode = ios_base::in | ios_base::out); explicit basic_fstream( const filesystem::path::value_type* s, - ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see \ref{fstream.syn} + ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see \ref{fstream.syn} explicit basic_fstream( const string& s, ios_base::openmode mode = ios_base::in | ios_base::out); explicit basic_fstream( const filesystem::path& s, ios_base::openmode mode = ios_base::in | ios_base::out); - basic_fstream(const basic_fstream& rhs) = delete; + basic_fstream(const basic_fstream&) = delete; basic_fstream(basic_fstream&& rhs); // \ref{fstream.assign}, assign and swap - basic_fstream& operator=(const basic_fstream& rhs) = delete; + basic_fstream& operator=(const basic_fstream&) = delete; basic_fstream& operator=(basic_fstream&& rhs); void swap(basic_fstream& rhs); @@ -10566,7 +10609,7 @@ ios_base::openmode mode = ios_base::in | ios_base::out); void open( const filesystem::path::value_type* s, - ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see \ref{fstream.syn} + ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see \ref{fstream.syn} void open( const string& s, ios_base::openmode mode = ios_base::in | ios_base::out); @@ -10576,7 +10619,7 @@ void close(); private: - basic_filebuf sb; // \expos + basic_filebuf sb; // \expos }; template @@ -10601,7 +10644,7 @@ \rSec3[fstream.cons]{Constructors} -\indexlibrary{\idxcode{basic_fstream}!constructor}% +\indexlibraryctor{basic_fstream}% \begin{itemdecl} basic_fstream(); \end{itemdecl} @@ -10619,7 +10662,7 @@ \tcode{basic_filebuf()}. \end{itemdescr} -\indexlibrary{\idxcode{basic_fstream}!constructor}% +\indexlibraryctor{basic_fstream}% \begin{itemdecl} explicit basic_fstream( const char* s, @@ -10646,7 +10689,7 @@ \tcode{setstate(failbit)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_fstream}!constructor}% +\indexlibraryctor{basic_fstream}% \begin{itemdecl} explicit basic_fstream( const string& s, @@ -10658,17 +10701,19 @@ \begin{itemdescr} \pnum -\effects The same as \tcode{basic_fstream(s.c_str(), mode)}. +\effects +The same as \tcode{basic_fstream(s.c_str(), mode)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_fstream}!constructor}% +\indexlibraryctor{basic_fstream}% \begin{itemdecl} basic_fstream(basic_fstream&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs from the rvalue \tcode{rhs}. This +\effects +Move constructs from the rvalue \tcode{rhs}. This is accomplished by move constructing the base class, and the contained \tcode{basic_filebuf}. Next \tcode{basic_istream::set_rdbuf(\brk{}addressof(sb))} @@ -10685,11 +10730,13 @@ \begin{itemdescr} \pnum -\effects Move assigns the base and members of \tcode{*this} from the base and corresponding +\effects +Move assigns the base and members of \tcode{*this} from the base and corresponding members of \tcode{rhs}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{basic_fstream}% @@ -10699,7 +10746,8 @@ \begin{itemdescr} \pnum -\effects Exchanges the state of \tcode{*this} +\effects +Exchanges the state of \tcode{*this} and \tcode{rhs} by calling \tcode{basic_iostream::swap(rhs)} and \tcode{sb.swap(rhs.sb)}. @@ -10714,7 +10762,8 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{x.swap(y)}. +\effects +As if by \tcode{x.swap(y)}. \end{itemdescr} \rSec3[fstream.members]{Member functions} @@ -10775,7 +10824,8 @@ \begin{itemdescr} \pnum -\effects Calls \tcode{open(s.c_str(), mode)}. +\effects +Calls \tcode{open(s.c_str(), mode)}. \end{itemdescr} \indexlibrarymember{close}{basic_fstream}% @@ -10799,12 +10849,12 @@ \rSec1[syncstream]{Synchronized output streams} \rSec2[syncstream.syn]{Header \tcode{} synopsis} -\indexhdr{syncstream}% -\indexlibrary{\idxcode{syncbuf}}% -\indexlibrary{\idxcode{wsyncbuf}}% -\indexlibrary{\idxcode{osyncstream}}% -\indexlibrary{\idxcode{wosyncstream}}% +\indexheader{syncstream}% +\indexlibraryglobal{syncbuf}% +\indexlibraryglobal{wsyncbuf}% +\indexlibraryglobal{osyncstream}% +\indexlibraryglobal{wosyncstream}% \begin{codeblock} #include // see \ref{ostream.syn} @@ -10824,14 +10874,14 @@ \end{codeblock} \pnum -The header \tcode{} provides a mechanism +The header \libheader{syncstream} provides a mechanism to synchronize execution agents writing to the same stream. \rSec2[syncstream.syncbuf]{Class template \tcode{basic_syncbuf}} \rSec3[syncstream.syncbuf.overview]{Overview} -\indexlibrary{\idxcode{basic_syncbuf}}% +\indexlibraryglobal{basic_syncbuf}% \begin{codeblock} namespace std { template @@ -10893,7 +10943,7 @@ \rSec3[syncstream.syncbuf.cons]{Construction and destruction} -\indexlibrary{\idxcode{basic_syncbuf}!constructor}% +\indexlibraryctor{basic_syncbuf}% \begin{itemdecl} basic_syncbuf(streambuf_type* obuf, const Allocator& allocator); \end{itemdecl} @@ -10922,7 +10972,7 @@ \tcode{get_allocator() == allocator} are \tcode{true}. \end{itemdescr} -\indexlibrary{\idxcode{basic_syncbuf}!constructor}% +\indexlibraryctor{basic_syncbuf}% \begin{itemdecl} basic_syncbuf(basic_syncbuf&& other); \end{itemdecl} @@ -10952,7 +11002,7 @@ ensuring destruction of \tcode{other} produces no output. \end{itemdescr} -\indexlibrary{\idxcode{basic_syncbuf}!destructor}% +\indexlibrarydtor{basic_syncbuf}% \begin{itemdecl} ~basic_syncbuf(); \end{itemdecl} @@ -11152,7 +11202,7 @@ \rSec3[syncstream.osyncstream.overview]{Overview} -\indexlibrary{\idxcode{basic_osyncstream}}% +\indexlibraryglobal{basic_osyncstream}% \begin{codeblock} namespace std { template @@ -11222,7 +11272,7 @@ \rSec3[syncstream.osyncstream.cons]{Construction and destruction} -\indexlibrary{\idxcode{basic_osyncstream}!constructor}% +\indexlibraryctor{basic_osyncstream}% \begin{itemdecl} basic_osyncstream(streambuf_type* buf, const Allocator& allocator); \end{itemdecl} @@ -11245,7 +11295,7 @@ \tcode{get_wrapped() == buf} is \tcode{true}. \end{itemdescr} -\indexlibrary{\idxcode{basic_osyncstream}!constructor}% +\indexlibraryctor{basic_osyncstream}% \begin{itemdecl} basic_osyncstream(basic_osyncstream&& other) noexcept; \end{itemdecl} @@ -11265,7 +11315,7 @@ \tcode{nullptr == other.get_wrapped()} is \tcode{true}. \end{itemdescr} -\indexlibrary{\idxcode{basic_osyncstream}!destructor}% +\indexlibrarydtor{basic_osyncstream}% \begin{itemdecl} ~basic_osyncstream(); \end{itemdecl} @@ -11424,15 +11474,19 @@ a link to an existing file. Some file systems support multiple hard links to a file. If the last hard link to a file is removed, the file itself is removed. -\begin{note} A hard link can be thought of as a shared-ownership smart -pointer to a file.\end{note} +\begin{note} +A hard link can be thought of as a shared-ownership smart +pointer to a file. +\end{note} A \defn{symbolic link} is a type of file with the property that when the file is encountered during pathname resolution\iref{fs.class.path}, a string stored by the file is used to modify the pathname resolution. -\begin{note} Symbolic links are often called symlinks. A symbolic link can be thought of as a raw pointer to a file. +\begin{note} +Symbolic links are often called symlinks. A symbolic link can be thought of as a raw pointer to a file. If the file pointed to does not exist, the symbolic link is said to be a -``dangling'' symbolic link.\end{note} +``dangling'' symbolic link. +\end{note} \rSec2[fs.conformance]{Conformance} @@ -11443,9 +11497,11 @@ \rSec3[fs.conform.9945]{POSIX conformance} \pnum Some behavior is specified by reference to POSIX\iref{fs.norm.ref}. How such behavior is actually implemented is unspecified. -\begin{note} This constitutes an ``as if'' rule allowing implementations +\begin{note} +This constitutes an ``as if'' rule allowing implementations to call native -operating system or other APIs. \end{note} +operating system or other APIs. +\end{note} \pnum Implementations should provide such behavior as it is defined by @@ -11454,14 +11510,17 @@ behavior should provide behavior as close to POSIX behavior as is reasonable given the limitations of actual operating systems and file systems. If an implementation cannot provide any reasonable behavior, the implementation shall report an error as specified in~\ref{fs.err.report}. -\begin{note} This allows users to rely on an exception being thrown or +\begin{note} +This allows users to rely on an exception being thrown or an error code being set when an implementation cannot provide any reasonable -behavior.\end{note} +behavior. +\end{note} \pnum Implementations are not required to provide behavior that is not supported by a particular file system. -\begin{example} The FAT file system used by some memory cards, camera memory, and +\begin{example} +The FAT file system used by some memory cards, camera memory, and floppy disks does not support hard links, symlinks, and many other features of more capable file systems, so implementations are not required to support those features on the FAT file system @@ -11496,7 +11555,8 @@ If the possibility of a file system race would make it unreliable for a program to test for a precondition before calling a function described herein, \requires is not specified for the function. -\begin{note} As a design practice, preconditions are not specified when it +\begin{note} +As a design practice, preconditions are not specified when it is unreasonable for a program to detect them prior to calling the function. \end{note} @@ -11530,11 +11590,13 @@ have a value type that is one of the encoded character types. \pnum -\begin{note} Use of an encoded character type implies an associated +\begin{note} +Use of an encoded character type implies an associated character set and encoding. Since \tcode{signed char} and \tcode{unsigned char} have no implied character set and encoding, -they are not included as permitted types. \end{note} +they are not included as permitted types. +\end{note} \pnum Template parameters named \tcode{Allocator} shall meet the @@ -11547,8 +11609,8 @@ subclause are assumed to be qualified with \tcode{::std::filesystem::}. \rSec2[fs.filesystem.syn]{Header \tcode{} synopsis} -\indexhdr{filesystem}% +\indexheader{filesystem}% \begin{codeblock} namespace std::filesystem { // \ref{fs.class.path}, paths @@ -11758,7 +11820,8 @@ \pnum Filesystem library functions often provide two overloads, one that throws an exception to report file system errors, and another that sets an \tcode{error_code}. -\begin{note} This supports two common use cases: +\begin{note} +This supports two common use cases: \begin{itemize} \item Uses where file system errors are truly exceptional @@ -11809,7 +11872,7 @@ \rSec2[fs.class.path]{Class \tcode{path}} -\indexlibrary{\idxcode{path}}% +\indexlibraryglobal{path}% \pnum An object of class \tcode{path} represents a path and contains a pathname. @@ -11861,7 +11924,8 @@ is the operating system dependent mechanism for resolving a pathname to a particular file in a file hierarchy. There may be multiple pathnames that resolve to the same file. -\begin{example} POSIX specifies the mechanism in section 4.11, Pathname resolution. +\begin{example} +POSIX specifies the mechanism in section 4.11, Pathname resolution. \end{example} \begin{codeblock} @@ -12094,8 +12158,11 @@ have special meaning. The following characteristics of filenames are operating system dependent: \begin{itemize} -\item The permitted characters. \begin{example} Some operating systems prohibit - the ASCII control characters (0x00 -- 0x1F) in filenames. \end{example} +\item The permitted characters. +\begin{example} +Some operating systems prohibit + the ASCII control characters (0x00 -- 0x1F) in filenames. +\end{example} \begin{note} For wide portability, users may wish to limit \grammarterm{filename} characters to the POSIX Portable Filename Character Set: \\ @@ -12128,7 +12195,8 @@ starting location for pathname resolution\iref{fs.class.path}. If there are no operating system dependent \grammarterm{root-name}{s}, at least one \impldefrootname{} \grammarterm{root-name} is required. -\begin{note} Many operating systems define a name +\begin{note} +Many operating systems define a name beginning with two \grammarterm{directory-separator} characters as a \grammarterm{root-name} that identifies network or other resource locations. @@ -12213,7 +12281,9 @@ and generic-to-native formats respectively. If \placeholder{g=G(n)} for some \placeholder{n}, then \placeholder{G(N(g))=g}; if \placeholder{n=N(g)} for some \placeholder{g}, then \placeholder{N(G(n))=n}. -\begin{note} Neither \placeholder{G} nor \placeholder{N} need be invertible. \end{note} +\begin{note} +Neither \placeholder{G} nor \placeholder{N} need be invertible. +\end{note} \pnum If the native format requires paths for regular files to be formatted @@ -12359,20 +12429,22 @@ \rSec4[fs.path.construct]{Constructors} -\indexlibrary{\idxcode{path}!constructor}% +\indexlibraryctor{path}% \begin{itemdecl} path() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an object of class \tcode{path}. +\effects +Constructs an object of class \tcode{path}. \pnum -\ensures \tcode{empty() == true}. +\ensures +\tcode{empty() == true}. \end{itemdescr} -\indexlibrary{\idxcode{path}!constructor}% +\indexlibraryctor{path}% \begin{itemdecl} path(const path& p); path(path&& p) noexcept; @@ -12387,7 +12459,7 @@ In the second form, \tcode{p} is left in a valid but unspecified state. \end{itemdescr} -\indexlibrary{\idxcode{path}!constructor}% +\indexlibraryctor{path}% \begin{itemdecl} path(string_type&& source, format fmt = auto_format); \end{itemdecl} @@ -12402,7 +12474,7 @@ \tcode{source} is left in a valid but unspecified state. \end{itemdescr} -\indexlibrary{\idxcode{path}!constructor}% +\indexlibraryctor{path}% \begin{itemdecl} template path(const Source& source, format fmt = auto_format); @@ -12412,14 +12484,15 @@ \begin{itemdescr} \pnum -\effects Let \tcode{s} be the effective range of \tcode{source}\iref{fs.path.req} +\effects +Let \tcode{s} be the effective range of \tcode{source}\iref{fs.path.req} or the range \range{first}{last}, with the encoding converted if required\iref{fs.path.cvt}. Finds the detected-format of \tcode{s}\iref{fs.path.fmt.cvt} and constructs an object of class \tcode{path} for which the pathname in that format is \tcode{s}. \end{itemdescr} -\indexlibrary{\idxcode{path}!constructor}% +\indexlibraryctor{path}% \begin{itemdecl} template path(const Source& source, const locale& loc, format fmt = auto_format); @@ -12434,7 +12507,8 @@ \tcode{char}. \pnum -\effects Let \tcode{s} be the effective range of \tcode{source} +\effects +Let \tcode{s} be the effective range of \tcode{source} or the range \range{first}{last}, after converting the encoding as follows: @@ -12492,14 +12566,16 @@ \begin{itemdescr} \pnum -\effects If \tcode{*this} and \tcode{p} are the same +\effects +If \tcode{*this} and \tcode{p} are the same object, has no effect. Otherwise, sets both respective pathnames of \tcode{*this} to the respective pathnames of \tcode{p}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator=}{path}% @@ -12509,15 +12585,19 @@ \begin{itemdescr} \pnum -\effects If \tcode{*this} and \tcode{p} are the same +\effects +If \tcode{*this} and \tcode{p} are the same object, has no effect. Otherwise, sets both respective pathnames of \tcode{*this} to the respective pathnames of \tcode{p}. \tcode{p} is left in a valid but unspecified state. -\begin{note} A valid implementation is \tcode{swap(p)}. \end{note} +\begin{note} +A valid implementation is \tcode{swap(p)}. +\end{note} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator=}{path}% @@ -12529,12 +12609,14 @@ \begin{itemdescr} \pnum -\effects Sets the pathname in the detected-format of \tcode{source} +\effects +Sets the pathname in the detected-format of \tcode{source} to the original value of \tcode{source}. \tcode{source} is left in a valid but unspecified state. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator=}{path}% @@ -12557,7 +12639,8 @@ and sets the pathname in that format to \tcode{s}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \rSec4[fs.path.append]{Appends} @@ -12573,7 +12656,8 @@ \begin{itemdescr} \pnum -\effects If \tcode{p.is_absolute() || (p.has_root_name() \&\& p.root_name() != root_name())}, +\effects +If \tcode{p.is_absolute() || (p.has_root_name() \&\& p.root_name() != root_name())}, then \tcode{operator=(p)}. \pnum @@ -12616,7 +12700,8 @@ \end{example} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator/=}{path}% @@ -12630,7 +12715,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return operator/=(path(source));} +\effects +Equivalent to: \tcode{return operator/=(path(source));} \end{itemdescr} \indexlibrarymember{operator/=}{path}% @@ -12642,7 +12728,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return operator/=(path(first, last));} +\effects +Equivalent to: \tcode{return operator/=(path(first, last));} \end{itemdescr} \rSec4[fs.path.concat]{Concatenation} @@ -12662,14 +12749,16 @@ \begin{itemdescr} \pnum -\effects Appends \tcode{path(x).native()} to the pathname in the native format. +\effects +Appends \tcode{path(x).native()} to the pathname in the native format. \begin{note} This directly manipulates the value of \tcode{native()} and may not be portable between operating systems. \end{note} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator+=}{path}% @@ -12682,7 +12771,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return *this += basic_string_view(\&x, 1);} +\effects +Equivalent to: \tcode{return *this += basic_string_view(\&x, 1);} \end{itemdescr} \indexlibrarymember{concat}{path}% @@ -12693,7 +12783,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return *this += path(first, last);} +\effects +Equivalent to: \tcode{return *this += path(first, last);} \end{itemdescr} \rSec4[fs.path.modifiers]{Modifiers} @@ -12705,7 +12796,8 @@ \begin{itemdescr} \pnum -\ensures \tcode{empty() == true}. +\ensures +\tcode{empty() == true}. \end{itemdescr} \indexlibrarymember{make_preferred}{path}% @@ -12715,12 +12807,14 @@ \begin{itemdescr} \pnum -\effects Each \grammarterm{directory-separator} +\effects +Each \grammarterm{directory-separator} of the pathname in the generic format is converted to \grammarterm{preferred-separator}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \pnum \begin{example} @@ -12752,21 +12846,24 @@ \begin{itemdescr} \pnum -\ensures \tcode{!has_filename()}. +\ensures +\tcode{!has_filename()}. \pnum -\effects Remove the generic format pathname of \tcode{filename()} from the generic format pathname. +\effects +Remove the generic format pathname of \tcode{filename()} from the generic format pathname. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \pnum \begin{example} \begin{codeblock} -path("foo/bar").remove_filename(); // yields \tcode{"foo/"} -path("foo/").remove_filename(); // yields \tcode{"foo/"} -path("/foo").remove_filename(); // yields \tcode{"/"} -path("/").remove_filename(); // yields \tcode{"/"} +path("foo/bar").remove_filename(); // yields \tcode{"foo/"} +path("foo/").remove_filename(); // yields \tcode{"foo/"} +path("/foo").remove_filename(); // yields \tcode{"/"} +path("/").remove_filename(); // yields \tcode{"/"} \end{codeblock} \end{example} \end{itemdescr} @@ -12786,13 +12883,14 @@ \end{codeblock} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \pnum \begin{example} \begin{codeblock} -path("/foo").replace_filename("bar"); // yields \tcode{"/bar"} on POSIX -path("/").replace_filename("bar"); // yields \tcode{"/bar"} on POSIX +path("/foo").replace_filename("bar"); // yields \tcode{"/bar"} on POSIX +path("/").replace_filename("bar"); // yields \tcode{"/bar"} on POSIX \end{codeblock} \end{example} \end{itemdescr} @@ -12816,7 +12914,8 @@ \end{itemize} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{swap}{path}% @@ -12826,10 +12925,12 @@ \begin{itemdescr} \pnum -\effects Swaps the contents (in all formats) of the two paths. +\effects +Swaps the contents (in all formats) of the two paths. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} \rSec4[fs.path.native.obs]{Native format observers} @@ -12844,7 +12945,8 @@ \begin{itemdescr} \pnum -\returns The pathname in the native format. +\returns +The pathname in the native format. \end{itemdescr} \indexlibrarymember{c_str}{path}% @@ -12854,7 +12956,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return native().c_str();} +\effects +Equivalent to: \tcode{return native().c_str();} \end{itemdescr} \indexlibrarymember{operator string_type}{path}% @@ -12864,12 +12967,15 @@ \begin{itemdescr} \pnum -\returns \tcode{native()}. +\returns +\tcode{native()}. \pnum -\begin{note} Conversion to \tcode{string_type} is provided so that an +\begin{note} +Conversion to \tcode{string_type} is provided so that an object of class \tcode{path} can be given as an argument to existing - standard library file stream constructors and open functions. \end{note} + standard library file stream constructors and open functions. +\end{note} \end{itemdescr} \indexlibrarymember{string}{path}% @@ -12882,10 +12988,12 @@ \begin{itemdescr} \pnum -\returns \tcode{native()}. +\returns +\tcode{native()}. \pnum -\remarks All memory allocation, including for the return value, shall +\remarks +All memory allocation, including for the return value, shall be performed by \tcode{a}. Conversion, if any, is specified by \ref{fs.path.cvt}. \end{itemdescr} @@ -12905,10 +13013,12 @@ \begin{itemdescr} \pnum -\returns \tcode{native()}. +\returns +\tcode{native()}. \pnum -\remarks Conversion, if any, is performed as specified +\remarks +Conversion, if any, is performed as specified by \ref{fs.path.cvt}. \end{itemdescr} @@ -12922,12 +13032,14 @@ the \grammarterm{directory-separator}. \pnum -\begin{example} On an operating system that uses backslash as +\begin{example} +On an operating system that uses backslash as its \grammarterm{preferred-separator}, \begin{codeblock} path("foo\\bar").generic_string() \end{codeblock} -returns \tcode{"foo/bar"}. \end{example} +returns \tcode{"foo/bar"}. +\end{example} \indexlibrarymember{generic_string}{path}% \begin{itemdecl} @@ -12939,10 +13051,12 @@ \begin{itemdescr} \pnum -\returns The pathname in the generic format. +\returns +The pathname in the generic format. \pnum -\remarks All memory allocation, including for the return value, shall +\remarks +All memory allocation, including for the return value, shall be performed by \tcode{a}. Conversion, if any, is specified by \ref{fs.path.cvt}. \end{itemdescr} @@ -12962,10 +13076,12 @@ \begin{itemdescr} \pnum -\returns The pathname in the generic format. +\returns +The pathname in the generic format. \pnum -\remarks Conversion, if any, is specified by~\ref{fs.path.cvt}. +\remarks +Conversion, if any, is specified by~\ref{fs.path.cvt}. \end{itemdescr} \rSec4[fs.path.compare]{Compare} @@ -13018,7 +13134,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return compare(path(s));} +\effects +Equivalent to: \tcode{return compare(path(s));} \end{itemdescr} \rSec4[fs.path.decompose]{Decomposition} @@ -13030,7 +13147,8 @@ \begin{itemdescr} \pnum -\returns \grammarterm{root-name}, if the pathname in the generic format +\returns +\grammarterm{root-name}, if the pathname in the generic format includes \grammarterm{root-name}, otherwise \tcode{path()}. \end{itemdescr} @@ -13041,7 +13159,8 @@ \begin{itemdescr} \pnum -\returns \grammarterm{root-directory}, if the pathname in the generic format +\returns +\grammarterm{root-directory}, if the pathname in the generic format includes \grammarterm{root-directory}, otherwise \tcode{path()}. \end{itemdescr} @@ -13052,7 +13171,8 @@ \begin{itemdescr} \pnum -\returns \tcode{root_name() / root_directory()}. +\returns +\tcode{root_name() / root_directory()}. \end{itemdescr} \indexlibrarymember{relative_path}{path}% @@ -13062,7 +13182,8 @@ \begin{itemdescr} \pnum -\returns A \tcode{path} composed from the pathname in the generic format, +\returns +A \tcode{path} composed from the pathname in the generic format, if \tcode{empty()} is \tcode{false}, beginning with the first \grammarterm{filename} after \tcode{root_path()}. Otherwise, \tcode{path()}. \end{itemdescr} @@ -13074,7 +13195,8 @@ \begin{itemdescr} \pnum -\returns \tcode{*this} if \tcode{has_relative_path()} is \tcode{false}, +\returns +\tcode{*this} if \tcode{has_relative_path()} is \tcode{false}, otherwise a path whose generic format pathname is the longest prefix of the generic format pathname of \tcode{*this} that produces one fewer element in its iteration. @@ -13087,18 +13209,19 @@ \begin{itemdescr} \pnum -\returns \tcode{relative_path().empty() ? path() : *--end()}. +\returns +\tcode{relative_path().empty() ? path() : *--end()}. \pnum \begin{example} \begin{codeblock} -path("/foo/bar.txt").filename(); // yields \tcode{"bar.txt"} -path("/foo/bar").filename(); // yields \tcode{"bar"} -path("/foo/bar/").filename(); // yields \tcode{""} -path("/").filename(); // yields \tcode{""} -path("//host").filename(); // yields \tcode{""} -path(".").filename(); // yields \tcode{"."} -path("..").filename(); // yields \tcode{".."} +path("/foo/bar.txt").filename(); // yields \tcode{"bar.txt"} +path("/foo/bar").filename(); // yields \tcode{"bar"} +path("/foo/bar/").filename(); // yields \tcode{""} +path("/").filename(); // yields \tcode{""} +path("//host").filename(); // yields \tcode{""} +path(".").filename(); // yields \tcode{"."} +path("..").filename(); // yields \tcode{".."} \end{codeblock} \end{example} \end{itemdescr} @@ -13110,7 +13233,8 @@ \begin{itemdescr} \pnum -\returns Let \tcode{f} be the generic format pathname of \tcode{filename()}. +\returns +Let \tcode{f} be the generic format pathname of \tcode{filename()}. Returns a path whose pathname in the generic format is \begin{itemize} \item \tcode{f}, if it contains no periods other than a leading period @@ -13121,7 +13245,7 @@ \pnum \begin{example} \begin{codeblock} -std::cout << path("/foo/bar.txt").stem(); // outputs \tcode{"bar"} +std::cout << path("/foo/bar.txt").stem(); // outputs \tcode{"bar"} path p = "foo.bar.baz.tar"; for (; !p.extension().empty(); p = p.stem()) std::cout << p.extension() << '\n'; @@ -13139,22 +13263,24 @@ \begin{itemdescr} \pnum -\returns A path whose pathname in the generic format is +\returns +A path whose pathname in the generic format is the suffix of \tcode{filename()} not included in \tcode{stem()}. \pnum \begin{example} \begin{codeblock} -path("/foo/bar.txt").extension(); // yields \tcode{".txt"} and \tcode{stem()} is \tcode{"bar"} -path("/foo/bar").extension(); // yields \tcode{""} and \tcode{stem()} is \tcode{"bar"} -path("/foo/.profile").extension(); // yields \tcode{""} and \tcode{stem()} is \tcode{".profile"} -path(".bar").extension(); // yields \tcode{""} and \tcode{stem()} is \tcode{".bar"} -path("..bar").extension(); // yields \tcode{".bar"} and \tcode{stem()} is \tcode{"."} +path("/foo/bar.txt").extension(); // yields \tcode{".txt"} and \tcode{stem()} is \tcode{"bar"} +path("/foo/bar").extension(); // yields \tcode{""} and \tcode{stem()} is \tcode{"bar"} +path("/foo/.profile").extension(); // yields \tcode{""} and \tcode{stem()} is \tcode{".profile"} +path(".bar").extension(); // yields \tcode{""} and \tcode{stem()} is \tcode{".bar"} +path("..bar").extension(); // yields \tcode{".bar"} and \tcode{stem()} is \tcode{"."} \end{codeblock} \end{example} \pnum -\begin{note} The period is included in the return value so that it is +\begin{note} +The period is included in the return value so that it is possible to distinguish between no extension and an empty extension. \end{note} @@ -13175,7 +13301,8 @@ \begin{itemdescr} \pnum -\returns \tcode{true} if the pathname in the generic format is empty, otherwise \tcode{false}. +\returns +\tcode{true} if the pathname in the generic format is empty, otherwise \tcode{false}. \end{itemdescr} \indexlibrarymember{has_root_path}{path}% @@ -13185,7 +13312,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!root_path().empty()}. +\returns +\tcode{!root_path().empty()}. \end{itemdescr} \indexlibrarymember{has_root_name}{path}% @@ -13195,7 +13323,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!root_name().empty()}. +\returns +\tcode{!root_name().empty()}. \end{itemdescr} \indexlibrarymember{has_root_directory}{path}% @@ -13205,7 +13334,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!root_directory().empty()}. +\returns +\tcode{!root_directory().empty()}. \end{itemdescr} \indexlibrarymember{has_relative_path}{path}% @@ -13215,7 +13345,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!relative_path().empty()}. +\returns +\tcode{!relative_path().empty()}. \end{itemdescr} \indexlibrarymember{has_parent_path}{path}% @@ -13225,7 +13356,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!parent_path().empty()}. +\returns +\tcode{!parent_path().empty()}. \end{itemdescr} \indexlibrarymember{has_filename}{path}% @@ -13235,7 +13367,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!filename().empty()}. +\returns +\tcode{!filename().empty()}. \end{itemdescr} \indexlibrarymember{has_stem}{path}% @@ -13245,7 +13378,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!stem().empty()}. +\returns +\tcode{!stem().empty()}. \end{itemdescr} \indexlibrarymember{has_extension}{path}% @@ -13255,7 +13389,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!extension().empty()}. +\returns +\tcode{!extension().empty()}. \end{itemdescr} \indexlibrarymember{is_absolute}{path}% @@ -13265,13 +13400,16 @@ \begin{itemdescr} \pnum -\returns \tcode{true} if the pathname in the native format +\returns +\tcode{true} if the pathname in the native format contains an absolute path\iref{fs.class.path}, otherwise \tcode{false}. \pnum -\begin{example} \tcode{path("/").is_absolute()} is +\begin{example} +\tcode{path("/").is_absolute()} is \tcode{true} for POSIX-based operating systems, and \tcode{false} for Windows-based -operating systems. \end{example} +operating systems. +\end{example} \end{itemdescr} \indexlibrarymember{is_relative}{path}% @@ -13281,7 +13419,8 @@ \begin{itemdescr} \pnum -\returns \tcode{!is_absolute()}. +\returns +\tcode{!is_absolute()}. \end{itemdescr} \rSec4[fs.path.gen]{Generation} @@ -13293,7 +13432,8 @@ \begin{itemdescr} \pnum -\returns A path whose pathname in the generic format is +\returns +A path whose pathname in the generic format is the normal form\iref{fs.path.generic} of the pathname in the generic format of \tcode{*this}. @@ -13317,7 +13457,8 @@ \begin{itemdescr} \pnum -\returns \tcode{*this} made relative to \tcode{base}. +\returns +\tcode{*this} made relative to \tcode{base}. Does not resolve\iref{fs.class.path} symlinks. Does not first normalize\iref{fs.path.generic} \tcode{*this} or \tcode{base}. @@ -13368,14 +13509,18 @@ \end{example} \pnum -\begin{note} If symlink following semantics are desired, - use the operational function \tcode{relative()}. \end{note} +\begin{note} +If symlink following semantics are desired, + use the operational function \tcode{relative()}. +\end{note} \pnum -\begin{note} If normalization\iref{fs.path.generic} is needed +\begin{note} +If normalization\iref{fs.path.generic} is needed to ensure consistent matching of elements, apply \tcode{lexically_normal()} to - \tcode{*this}, \tcode{base}, or both. \end{note} + \tcode{*this}, \tcode{base}, or both. +\end{note} \end{itemdescr} \indexlibrarymember{lexically_proximate}{path}% @@ -13385,23 +13530,28 @@ \begin{itemdescr} \pnum -\returns If the value of \tcode{lexically_relative(base)} is not an empty path, +\returns +If the value of \tcode{lexically_relative(base)} is not an empty path, return it. Otherwise return \tcode{*this}. \pnum -\begin{note} If symlink following semantics are desired, - use the operational function \tcode{proximate()}. \end{note} +\begin{note} +If symlink following semantics are desired, + use the operational function \tcode{proximate()}. +\end{note} \pnum -\begin{note} If normalization\iref{fs.path.generic} is needed +\begin{note} +If normalization\iref{fs.path.generic} is needed to ensure consistent matching of elements, apply \tcode{lexically_normal()} to - \tcode{*this}, \tcode{base}, or both. \end{note} + \tcode{*this}, \tcode{base}, or both. +\end{note} \end{itemdescr} \rSec3[fs.path.itr]{Iterators} -\indexlibrary{\idxcode{path}!\idxcode{iterator}}% +\indexlibrarymember{path}{iterator}% \pnum Path iterators iterate over the elements of the pathname in the generic format\iref{fs.path.generic}. @@ -13429,7 +13579,8 @@ \item The \grammarterm{root-directory} element, if present. \begin{note} The generic format is required to ensure lexicographical -comparison works correctly. \end{note} +comparison works correctly. +\end{note} \item Each successive \grammarterm{filename} element, if present. \item An empty element, if a trailing non-root \grammarterm{directory-separator} is present. @@ -13445,7 +13596,8 @@ \begin{itemdescr} \pnum -\returns An iterator for the first present element in the traversal +\returns +An iterator for the first present element in the traversal list above. If no elements are present, the end iterator. \end{itemdescr} @@ -13456,7 +13608,8 @@ \begin{itemdescr} \pnum -\returns The end iterator. +\returns +The end iterator. \end{itemdescr} \rSec3[fs.path.io]{Inserter and extractor} @@ -13470,11 +13623,15 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{os << quoted(p.string())}. -\begin{note} The \tcode{quoted} function is described in~\ref{quoted.manip}. \end{note} +\effects +Equivalent to \tcode{os << quoted(p.string())}. +\begin{note} +The \tcode{quoted} function is described in~\ref{quoted.manip}. +\end{note} \pnum -\returns \tcode{os}. +\returns +\tcode{os}. \end{itemdescr} \indexlibrarymember{operator>>}{path}% @@ -13495,29 +13652,32 @@ \end{codeblock} \pnum -\returns \tcode{is}. +\returns +\tcode{is}. \end{itemdescr} \rSec3[fs.path.nonmember]{Non-member functions} -\indexlibrary{\idxcode{swap}!\idxcode{path}}% +\indexlibrarymember{swap}{path}% \begin{itemdecl} void swap(path& lhs, path& rhs) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to \tcode{lhs.swap(rhs)}. +\effects +Equivalent to \tcode{lhs.swap(rhs)}. \end{itemdescr} -\indexlibrary{\idxcode{hash_value}!\idxcode{path}}% +\indexlibrarymember{hash_value}{path}% \begin{itemdecl} size_t hash_value (const path& p) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns A hash value for the path \tcode{p}. If +\returns +A hash value for the path \tcode{p}. If for two paths, \tcode{p1 == p2} then \tcode{hash_value(p1) == hash_value(p2)}. \end{itemdescr} @@ -13528,15 +13688,19 @@ \begin{itemdescr} \pnum -\returns \tcode{lhs.compare(rhs) == 0}. +\returns +\tcode{lhs.compare(rhs) == 0}. \indextext{path equality} \pnum -\begin{note} Path equality and path equivalence have different semantics. +\begin{note} +Path equality and path equivalence have different semantics. \begin{itemize} \item Equality is determined by the \tcode{path} non-member \tcode{operator==}, which considers the two paths' lexical representations only. -\begin{example} \tcode{path("foo") == "bar"} is never \tcode{true}. \end{example} +\begin{example} +\tcode{path("foo") == "bar"} is never \tcode{true}. +\end{example} \item Equivalence is determined by the \tcode{equivalent()} non-member function, which determines if two paths resolve\iref{fs.class.path} to the same file system entity. \begin{example} @@ -13545,7 +13709,8 @@ \end{itemize} Programmers wishing to determine if two paths are ``the same'' must decide if ``the same'' means ``the same representation'' or ``resolve to the same actual - file'', and choose the appropriate function accordingly. \end{note} + file'', and choose the appropriate function accordingly. +\end{note} \end{itemdescr} \indexlibrarymember{operator<=>}{path}% @@ -13555,7 +13720,8 @@ \begin{itemdescr} \pnum -\returns \tcode{lhs.compare(rhs) <=> 0}. +\returns +\tcode{lhs.compare(rhs) <=> 0}. \end{itemdescr} \indexlibrarymember{operator/}{path}% @@ -13565,12 +13731,13 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return path(lhs) /= rhs;} +\effects +Equivalent to: \tcode{return path(lhs) /= rhs;} \end{itemdescr} \rSec2[fs.class.filesystem.error]{Class \tcode{filesystem_error}} -\indexlibrary{\idxcode{filesystem_error}}% +\indexlibraryglobal{filesystem_error}% \begin{codeblock} namespace std::filesystem { class filesystem_error : public system_error { @@ -13598,7 +13765,7 @@ Constructors are provided that store zero, one, or two paths associated with an error. -\indexlibrary{\idxcode{filesystem_error}!constructor}% +\indexlibraryctor{filesystem_error}% \begin{itemdecl} filesystem_error(const string& what_arg, error_code ec); \end{itemdecl} @@ -13614,7 +13781,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{filesystem_error}!constructor}% +\indexlibraryctor{filesystem_error}% \begin{itemdecl} filesystem_error(const string& what_arg, const path& p1, error_code ec); \end{itemdecl} @@ -13630,7 +13797,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{filesystem_error}!constructor}% +\indexlibraryctor{filesystem_error}% \begin{itemdecl} filesystem_error(const string& what_arg, const path& p1, const path& p2, error_code ec); \end{itemdecl} @@ -13653,7 +13820,8 @@ \begin{itemdescr} \pnum -\returns A reference to the copy of \tcode{p1} stored by the +\returns +A reference to the copy of \tcode{p1} stored by the constructor, or, if none, an empty path. \end{itemdescr} @@ -13664,7 +13832,8 @@ \begin{itemdescr} \pnum -\returns A reference to the copy of \tcode{p2} stored by the +\returns +A reference to the copy of \tcode{p2} stored by the constructor, or, if none, an empty path. \end{itemdescr} @@ -13675,7 +13844,8 @@ \begin{itemdescr} \pnum -\returns An \ntbs{} that incorporates +\returns +An \ntbs{} that incorporates the \tcode{what_arg} argument supplied to the constructor. The exact format is unspecified. Implementations should include @@ -13706,12 +13876,13 @@ \begin{note} For POSIX-based systems, native and generic formats are equivalent and the character sequence should always be interpreted in the same way. - \end{note} \\\rowsep + \end{note} +\\\rowsep \end{floattable} \rSec3[fs.enum.file.type]{Enum class \tcode{file_type}} -\indexlibrary{\idxcode{file_type}}% +\indexlibraryglobal{file_type}% \pnum This enum class specifies constants used to identify file types, with the meanings listed in \tref{fs.enum.file.type}. @@ -13728,9 +13899,13 @@ The type of the file has not been determined or an error occurred while trying to determine the type. \\ \rowsep \tcode{not_found} & -Pseudo-type indicating the file was not found. \begin{note} The file +Pseudo-type indicating the file was not found. +\begin{note} +The file not being found is not considered an error while determining the -type of a file. \end{note} \\ \rowsep +type of a file. +\end{note} +\\ \rowsep \tcode{regular} & Regular file \\ \rowsep \tcode{directory} & Directory file \\ \rowsep \tcode{symlink} & Symbolic link file \\ \rowsep @@ -13753,7 +13928,7 @@ \rSec3[fs.enum.copy.opts]{Enum class \tcode{copy_options}} -\indexlibrary{\idxcode{copy_options}}% +\indexlibraryglobal{copy_options}% \pnum The \tcode{enum class} type \tcode{copy_options} is a bitmask type\iref{bitmask.types} that specifies bitmask constants used to control the semantics of @@ -13810,7 +13985,7 @@ \rSec3[fs.enum.perms]{Enum class \tcode{perms}} -\indexlibrary{\idxcode{perms}}% +\indexlibraryglobal{perms}% \pnum The \tcode{enum class} type \tcode{perms} is a bitmask type\iref{bitmask.types} that specifies bitmask constants used to identify file @@ -13869,7 +14044,7 @@ \rSec3[fs.enum.perm.opts]{Enum class \tcode{perm_options}} -\indexlibrary{\idxcode{perm_options}}% +\indexlibraryglobal{perm_options}% \pnum The \tcode{enum class} type \tcode{perm_options} is a bitmask type\iref{bitmask.types} that specifies bitmask constants used to @@ -13900,7 +14075,7 @@ \rSec3[fs.enum.dir.opts]{Enum class \tcode{directory_options}} -\indexlibrary{\idxcode{directory_options}}% +\indexlibraryglobal{directory_options}% \pnum The \tcode{enum class} type \tcode{directory_options} is a bitmask type\iref{bitmask.types} that specifies bitmask constants used to identify @@ -13925,7 +14100,7 @@ \rSec2[fs.class.file.status]{Class \tcode{file_status}} -\indexlibrary{\idxcode{file_status}}% +\indexlibraryglobal{file_status}% \begin{codeblock} namespace std::filesystem { class file_status { @@ -13961,14 +14136,15 @@ and permissions of a file. \rSec3[fs.file.status.cons]{Constructors} -\indexlibrary{\idxcode{file_status}!constructor}% +\indexlibraryctor{file_status}% \begin{itemdecl} explicit file_status(file_type ft, perms prms = perms::unknown) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{type() == ft} and \tcode{permissions() == prms}. +\ensures +\tcode{type() == ft} and \tcode{permissions() == prms}. \end{itemdescr} \rSec3[fs.file.status.obs]{Observers} @@ -13980,7 +14156,8 @@ \begin{itemdescr} \pnum -\returns The value of \tcode{type()} specified by the postconditions of the most recent call to a constructor, +\returns +The value of \tcode{type()} specified by the postconditions of the most recent call to a constructor, \tcode{operator=}, or \tcode{type(file_type)} function. \end{itemdescr} @@ -13991,7 +14168,8 @@ \begin{itemdescr} \pnum -\returns The value of \tcode{permissions()} specified by the postconditions of the most recent call to a constructor, +\returns +The value of \tcode{permissions()} specified by the postconditions of the most recent call to a constructor, \tcode{operator=}, or \tcode{permissions(perms)} function. \end{itemdescr} @@ -14004,7 +14182,8 @@ \begin{itemdescr} \pnum -\ensures \tcode{type() == ft}. +\ensures +\tcode{type() == ft}. \end{itemdescr} \indexlibrarymember{permissions}{file_status}% @@ -14014,12 +14193,13 @@ \begin{itemdescr} \pnum -\ensures \tcode{permissions() == prms}. +\ensures +\tcode{permissions() == prms}. \end{itemdescr} \rSec2[fs.class.directory.entry]{Class \tcode{directory_entry}} -\indexlibrary{\idxcode{directory_entry}}% +\indexlibraryglobal{directory_entry}% \begin{codeblock} namespace std::filesystem { class directory_entry { @@ -14080,8 +14260,8 @@ strong_ordering operator<=>(const directory_entry& rhs) const noexcept; private: - filesystem::path pathobject; // \expos - friend class directory_iterator; // \expos + filesystem::path pathobject; // \expos + friend class directory_iterator; // \expos }; } \end{codeblock} @@ -14123,7 +14303,7 @@ // call \tcode{refresh()} to refresh a stale cache for (auto&& x : directory_iterator(".")) { - lengthy_function(x.path()); // cache becomes stale + lengthy_function(x.path()); // cache becomes stale x.refresh(); std::cout << x.path() << " " << x.last_write_time() << std::endl; } @@ -14143,7 +14323,7 @@ \rSec3[fs.dir.entry.cons]{Constructors} -\indexlibrary{\idxcode{directory_entry}!constructor}% +\indexlibraryctor{directory_entry}% \begin{itemdecl} explicit directory_entry(const filesystem::path& p); directory_entry(const filesystem::path& p, error_code& ec); @@ -14151,15 +14331,18 @@ \begin{itemdescr} \pnum -\effects Constructs an object of type \tcode{directory_entry}, +\effects +Constructs an object of type \tcode{directory_entry}, then \tcode{refresh()} or \tcode{refresh(ec)}, respectively. \pnum -\ensures \tcode{path() == p} if no error occurs, +\ensures +\tcode{path() == p} if no error occurs, otherwise \tcode{path() == filesystem::path()}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.dir.entry.mods]{Modifiers} @@ -14172,12 +14355,14 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{pathobject = p}, +\effects +Equivalent to \tcode{pathobject = p}, then \tcode{refresh()} or \tcode{refresh(ec)}, respectively. If an error occurs, the values of any cached attributes are unspecified. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{replace_filename}{directory_entry}% @@ -14188,11 +14373,13 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{pathobject.replace_filename(p)}, +\effects +Equivalent to \tcode{pathobject.replace_filename(p)}, then \tcode{refresh()} or \tcode{refresh(ec)}, respectively. If an error occurs, the values of any cached attributes are unspecified. -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{refresh}{directory_entry}% @@ -14203,12 +14390,14 @@ \begin{itemdescr} \pnum -\effects Stores the current values of any cached attributes of the file \tcode{p} resolves to. +\effects +Stores the current values of any cached attributes of the file \tcode{p} resolves to. If an error occurs, an error is reported\iref{fs.err.report} and the values of any cached attributes are unspecified. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum \begin{note} @@ -14235,7 +14424,8 @@ \begin{itemdescr} \pnum -\returns \tcode{pathobject}. +\returns +\tcode{pathobject}. \end{itemdescr} \indexlibrarymember{exists}{directory_entry}% @@ -14246,10 +14436,12 @@ \begin{itemdescr} \pnum -\returns \tcode{exists(this->status())} or \tcode{exists(this->status(ec))}, respectively. +\returns +\tcode{exists(this->status())} or \tcode{exists(this->status(ec))}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{is_block_file}{directory_entry}% @@ -14260,10 +14452,12 @@ \begin{itemdescr} \pnum -\returns \tcode{is_block_file(this->status())} or \tcode{is_block_file(this->status(ec))}, respectively. +\returns +\tcode{is_block_file(this->status())} or \tcode{is_block_file(this->status(ec))}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{is_character_file}{directory_entry}% @@ -14274,10 +14468,12 @@ \begin{itemdescr} \pnum -\returns \tcode{is_character_file(this->status())} or \tcode{is_character_file(this->status(ec))}, respectively. +\returns +\tcode{is_character_file(this->status())} or \tcode{is_character_file(this->status(ec))}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{is_directory}{directory_entry}% @@ -14288,10 +14484,12 @@ \begin{itemdescr} \pnum -\returns \tcode{is_directory(this->status())} or \tcode{is_directory(this->status(ec))}, respectively. +\returns +\tcode{is_directory(this->status())} or \tcode{is_directory(this->status(ec))}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{is_fifo}{directory_entry}% @@ -14302,10 +14500,12 @@ \begin{itemdescr} \pnum -\returns \tcode{is_fifo(this->status())} or \tcode{is_fifo(this->status(ec))}, respectively. +\returns +\tcode{is_fifo(this->status())} or \tcode{is_fifo(this->status(ec))}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{is_other}{directory_entry}% @@ -14316,10 +14516,12 @@ \begin{itemdescr} \pnum -\returns \tcode{is_other(this->status())} or \tcode{is_other(this->status(ec))}, respectively. +\returns +\tcode{is_other(this->status())} or \tcode{is_other(this->status(ec))}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{is_regular_file}{directory_entry}% @@ -14330,10 +14532,12 @@ \begin{itemdescr} \pnum -\returns \tcode{is_regular_file(this->status())} or \tcode{is_regular_file(this->status(ec))}, respective\-ly. +\returns +\tcode{is_regular_file(this->status())} or \tcode{is_regular_file(this->status(ec))}, respective\-ly. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{is_socket}{directory_entry}% @@ -14344,10 +14548,12 @@ \begin{itemdescr} \pnum -\returns \tcode{is_socket(this->status())} or \tcode{is_socket(this->status(ec))}, respectively. +\returns +\tcode{is_socket(this->status())} or \tcode{is_socket(this->status(ec))}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{is_symlink}{directory_entry}% @@ -14358,10 +14564,12 @@ \begin{itemdescr} \pnum -\returns \tcode{is_symlink(this->symlink_status())} or \tcode{is_symlink(this->symlink_status(ec))}, respectively. +\returns +\tcode{is_symlink(this->symlink_status())} or \tcode{is_symlink(this->symlink_status(ec))}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{file_size}{directory_entry}% @@ -14372,11 +14580,13 @@ \begin{itemdescr} \pnum -\returns If cached, the file size attribute value. +\returns +If cached, the file size attribute value. Otherwise, \tcode{file_size(path())} or \tcode{file_size(path(), ec)}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{hard_link_count}{directory_entry}% @@ -14387,11 +14597,13 @@ \begin{itemdescr} \pnum -\returns If cached, the hard link count attribute value. +\returns +If cached, the hard link count attribute value. Otherwise, \tcode{hard_link_count(path())} or \tcode{hard_link_count(path(), ec)}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{last_write_time}{directory_entry}% @@ -14402,11 +14614,13 @@ \begin{itemdescr} \pnum -\returns If cached, the last write time attribute value. +\returns +If cached, the last write time attribute value. Otherwise, \tcode{last_write_time(path())} or \tcode{last_write_time(path(), ec)}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{status}{directory_entry}% @@ -14417,11 +14631,13 @@ \begin{itemdescr} \pnum -\returns If cached, the status attribute value. +\returns +If cached, the status attribute value. Otherwise, \tcode{status(path())} or \tcode{status(path(), ec)}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{symlink_status}{directory_entry}% @@ -14432,11 +14648,13 @@ \begin{itemdescr} \pnum -\returns If cached, the symlink status attribute value. +\returns +If cached, the symlink status attribute value. Otherwise, \tcode{symlink_status(path())} or \tcode{symlink_status(path(), ec)}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{operator==}{directory_entry}% @@ -14446,7 +14664,8 @@ \begin{itemdescr} \pnum -\returns \tcode{pathobject == rhs.pathobject}. +\returns +\tcode{pathobject == rhs.pathobject}. \end{itemdescr} \indexlibrarymember{operator<=>}{directory_entry}% @@ -14456,19 +14675,21 @@ \begin{itemdescr} \pnum -\returns \tcode{pathobject <=> rhs.pathobject}. +\returns +\tcode{pathobject <=> rhs.pathobject}. \end{itemdescr} \rSec2[fs.class.directory.iterator]{Class \tcode{directory_iterator}} -\indexlibrary{\idxcode{directory_iterator}}% +\indexlibraryglobal{directory_iterator}% \pnum An object of type \tcode{directory_iterator} provides an iterator for a sequence of \tcode{directory_entry} elements representing the path and any cached attribute values\iref{fs.class.directory.entry} for each file in a directory or in an \impldef{type of a directory-like file} directory-like file type. -\begin{note} For iteration into sub-directories, see class \tcode{recursive_directory_iterator}\iref{fs.class.rec.dir.itr}. +\begin{note} +For iteration into sub-directories, see class \tcode{recursive_directory_iterator}\iref{fs.class.rec.dir.itr}. \end{note} \begin{codeblock} @@ -14568,17 +14789,18 @@ \rSec3[fs.dir.itr.members]{Members} -\indexlibrary{\idxcode{directory_iterator}!constructor}% +\indexlibraryctor{directory_iterator}% \begin{itemdecl} directory_iterator() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs the end iterator. +\effects +Constructs the end iterator. \end{itemdescr} -\indexlibrary{\idxcode{directory_iterator}!constructor}% +\indexlibraryctor{directory_iterator}% \begin{itemdecl} explicit directory_iterator(const path& p); directory_iterator(const path& p, directory_options options); @@ -14588,7 +14810,8 @@ \begin{itemdescr} \pnum -\effects For the directory that \tcode{p} resolves to, constructs an +\effects +For the directory that \tcode{p} resolves to, constructs an iterator for the first element in a sequence of \tcode{directory_entry} elements representing the files in the directory, if any; otherwise the end iterator. However, if @@ -14600,13 +14823,16 @@ and does not report an error. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\begin{note} To iterate over the current directory, use \tcode{directory_iterator(".")} rather than \tcode{directory_iterator("")}. \end{note} +\begin{note} +To iterate over the current directory, use \tcode{directory_iterator(".")} rather than \tcode{directory_iterator("")}. +\end{note} \end{itemdescr} -\indexlibrary{\idxcode{directory_iterator}!constructor}% +\indexlibraryctor{directory_iterator}% \begin{itemdecl} directory_iterator(const directory_iterator& rhs); directory_iterator(directory_iterator&& rhs) noexcept; @@ -14614,10 +14840,12 @@ \begin{itemdescr} \pnum -\effects Constructs an object of class \tcode{directory_iterator}. +\effects +Constructs an object of class \tcode{directory_iterator}. \pnum -\ensures \tcode{*this} has the original value of \tcode{rhs}. +\ensures +\tcode{*this} has the original value of \tcode{rhs}. \end{itemdescr} \indexlibrarymember{operator=}{directory_iterator}% @@ -14628,14 +14856,17 @@ \begin{itemdescr} \pnum -\effects If \tcode{*this} and \tcode{rhs} are the same +\effects +If \tcode{*this} and \tcode{rhs} are the same object, the member has no effect. \pnum -\ensures \tcode{*this} has the original value of \tcode{rhs}. +\ensures +\tcode{*this} has the original value of \tcode{rhs}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{increment}{directory_iterator}% @@ -14648,14 +14879,17 @@ \begin{itemdescr} \pnum -\effects As specified for the prefix increment operation of +\effects +As specified for the prefix increment operation of Input iterators\iref{input.iterators}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} @@ -14664,29 +14898,31 @@ \pnum These functions enable range access for \tcode{directory_iterator}. -\indexlibrary{\idxcode{begin}!\idxcode{directory_iterator}}% +\indexlibrarymember{begin}{directory_iterator}% \begin{itemdecl} directory_iterator begin(directory_iterator iter) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{iter}. +\returns +\tcode{iter}. \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{directory_iterator}}% +\indexlibrarymember{end}{directory_iterator}% \begin{itemdecl} directory_iterator end(const directory_iterator&) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{directory_iterator()}. +\returns +\tcode{directory_iterator()}. \end{itemdescr} \rSec2[fs.class.rec.dir.itr]{Class \tcode{recursive_directory_iterator}} -\indexlibrary{\idxcode{recursive_directory_iterator}}% +\indexlibraryglobal{recursive_directory_iterator}% \pnum An object of type \tcode{recursive_directory_iterator} provides an iterator for a sequence of \tcode{directory_entry} elements representing the files in a @@ -14750,12 +14986,14 @@ as a \tcode{directory_iterator} unless otherwise specified. \pnum -\begin{note} If the directory structure being iterated over contains cycles -then the end iterator may be unreachable. \end{note} +\begin{note} +If the directory structure being iterated over contains cycles +then the end iterator may be unreachable. +\end{note} \rSec3[fs.rec.dir.itr.members]{Members} -\indexlibrary{\idxcode{recursive_directory_iterator}!constructor}% +\indexlibraryctor{recursive_directory_iterator}% \begin{itemdecl} recursive_directory_iterator() noexcept; \end{itemdecl} @@ -14763,12 +15001,13 @@ \begin{itemdescr} \pnum -\effects Constructs the end iterator. +\effects +Constructs the end iterator. \end{itemdescr} -\indexlibrary{\idxcode{recursive_directory_iterator}!constructor}% +\indexlibraryctor{recursive_directory_iterator}% \begin{itemdecl} explicit recursive_directory_iterator(const path& p); recursive_directory_iterator(const path& p, directory_options options); @@ -14779,7 +15018,8 @@ \begin{itemdescr} \pnum -\effects Constructs an iterator representing the first +\effects +Constructs an iterator representing the first entry in the directory to which \tcode{p} resolves, if any; otherwise, the end iterator. However, if \begin{codeblock} @@ -14790,30 +15030,37 @@ and does not report an error. \pnum -\ensures \tcode{options() == options} for the signatures with a +\ensures +\tcode{options() == options} for the signatures with a \tcode{directory_options} argument, otherwise \tcode{options() == directory_options::none}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\begin{note} To iterate over the current directory, use \tcode{recursive_directory_iterator(".")} - rather than \tcode{recursive_directory_iterator("")}. \end{note} +\begin{note} +To iterate over the current directory, use \tcode{recursive_directory_iterator(".")} + rather than \tcode{recursive_directory_iterator("")}. +\end{note} \pnum -\begin{note} By default, \tcode{recursive_directory_iterator} does not +\begin{note} +By default, \tcode{recursive_directory_iterator} does not follow directory symlinks. To follow directory symlinks, specify \tcode{options} as -\tcode{directory_options::follow_directory_symlink} \end{note} +\tcode{directory_options::follow_directory_symlink}. +\end{note} \end{itemdescr} -\indexlibrary{\idxcode{recursive_directory_iterator}!constructor}% +\indexlibraryctor{recursive_directory_iterator}% \begin{itemdecl} recursive_directory_iterator(const recursive_directory_iterator& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an object of class \tcode{recursive_directory_iterator}. +\effects +Constructs an object of class \tcode{recursive_directory_iterator}. \pnum \ensures @@ -14824,17 +15071,19 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{recursive_directory_iterator}!constructor}% +\indexlibraryctor{recursive_directory_iterator}% \begin{itemdecl} recursive_directory_iterator(recursive_directory_iterator&& rhs) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an object of class \tcode{recursive_directory_iterator}. +\effects +Constructs an object of class \tcode{recursive_directory_iterator}. \pnum -\ensures \tcode{options()}, \tcode{depth()}, +\ensures +\tcode{options()}, \tcode{depth()}, and \tcode{recursion_pending()} have the values that \tcode{rhs.options()}, \tcode{rhs.depth()}, and \tcode{rhs.recursion_pending()}, respectively, had before the function call. @@ -14847,7 +15096,8 @@ \begin{itemdescr} \pnum -\effects If \tcode{*this} and \tcode{rhs} are the same +\effects +If \tcode{*this} and \tcode{rhs} are the same object, the member has no effect. \pnum @@ -14859,7 +15109,8 @@ \end{itemize} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator=}{recursive_directory_iterator}% @@ -14869,16 +15120,19 @@ \begin{itemdescr} \pnum -\effects If \tcode{*this} and \tcode{rhs} are the same +\effects +If \tcode{*this} and \tcode{rhs} are the same object, the member has no effect. \pnum -\ensures \tcode{options()}, \tcode{depth()}, +\ensures +\tcode{options()}, \tcode{depth()}, and \tcode{recursion_pending()} have the values that \tcode{rhs.options()}, \tcode{rhs.depth()}, and \tcode{rhs.recursion_pending()}, respectively, had before the function call. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{options}{recursive_directory_iterator}% @@ -14888,12 +15142,14 @@ \begin{itemdescr} \pnum -\returns The value of the argument passed to the constructor for the +\returns +The value of the argument passed to the constructor for the \tcode{options} parameter, if present, otherwise \tcode{directory_options::none}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{depth}{recursive_directory_iterator}% @@ -14903,12 +15159,16 @@ \begin{itemdescr} \pnum -\returns The current depth of the directory tree being traversed. \begin{note} +\returns +The current depth of the directory tree being traversed. +\begin{note} The initial directory is depth \tcode{0}, its immediate subdirectories are depth \tcode{1}, - and so forth. \end{note} + and so forth. +\end{note} \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{recursion_pending}{recursive_directory_iterator}% @@ -14918,12 +15178,14 @@ \begin{itemdescr} \pnum -\returns \tcode{true} if \tcode{disable_recursion_pending()} +\returns +\tcode{true} if \tcode{disable_recursion_pending()} has not been called subsequent to the prior construction or increment operation, otherwise \tcode{false}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{increment}{recursive_directory_iterator}% @@ -14935,7 +15197,8 @@ \begin{itemdescr} \pnum -\effects As specified for the prefix increment operation of +\effects +As specified for the prefix increment operation of Input iterators\iref{input.iterators}, except that: @@ -14960,10 +15223,12 @@ \end{itemize} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \indexlibrarymember{pop}{recursive_directory_iterator}% @@ -14974,16 +15239,19 @@ \begin{itemdescr} \pnum -\effects If \tcode{depth() == 0}, set \tcode{*this} to \tcode{recursive_directory_iterator()}. +\effects +If \tcode{depth() == 0}, set \tcode{*this} to \tcode{recursive_directory_iterator()}. Otherwise, cease iteration of the directory currently being iterated over, and continue iteration over the parent directory. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \pnum -\remarks Any copies of the previous value of \tcode{*this} +\remarks +Any copies of the previous value of \tcode{*this} are no longer required to be dereferenceable nor to be in the domain of \tcode{==}. @@ -14994,11 +15262,14 @@ \begin{itemdescr} \pnum -\ensures \tcode{recursion_pending() == false}. +\ensures +\tcode{recursion_pending() == false}. \pnum -\begin{note} \tcode{disable_recursion_pending}\tcode{()} is used to prevent - unwanted recursion into a directory. \end{note} +\begin{note} +\tcode{disable_recursion_pending}\tcode{()} is used to prevent + unwanted recursion into a directory. +\end{note} \end{itemdescr} \rSec3[fs.rec.dir.itr.nonmembers]{Non-member functions} @@ -15007,24 +15278,26 @@ These functions enable use of \tcode{recursive_directory_iterator} with range-based for statements. -\indexlibrary{\idxcode{begin}!\idxcode{recursive_directory_iterator}}% +\indexlibrarymember{begin}{recursive_directory_iterator}% \begin{itemdecl} recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{iter}. +\returns +\tcode{iter}. \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{recursive_directory_iterator}}% +\indexlibrarymember{end}{recursive_directory_iterator}% \begin{itemdecl} recursive_directory_iterator end(const recursive_directory_iterator&) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{recursive_directory_iterator()}. +\returns +\tcode{recursive_directory_iterator()}. \end{itemdescr} \rSec2[fs.op.funcs]{Filesystem operation functions} @@ -15034,14 +15307,16 @@ in external storage. \pnum -\begin{note} Because hardware failures, network failures, file system races\iref{fs.race.behavior}, +\begin{note} +Because hardware failures, network failures, file system races\iref{fs.race.behavior}, and many other kinds of errors occur frequently in file system operations, users should be aware that any filesystem operation function, no matter how apparently innocuous, may encounter -an error; see~\ref{fs.err.report}. \end{note} +an error; see~\ref{fs.err.report}. +\end{note} \rSec3[fs.op.absolute]{Absolute} -\indexlibrary{\idxcode{absolute}}% +\indexlibraryglobal{absolute}% \begin{itemdecl} path absolute(const path& p); path absolute(const path& p, error_code& ec); @@ -15049,11 +15324,13 @@ \begin{itemdescr} \pnum -\effects Composes an absolute path referencing the same file system location +\effects +Composes an absolute path referencing the same file system location as \tcode{p} according to the operating system\iref{fs.conform.os}. \pnum -\returns The composed path. +\returns +The composed path. The signature with argument \tcode{ec} returns \tcode{path()} if an error occurs. \pnum @@ -15063,7 +15340,8 @@ \end{note} \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum \begin{note} @@ -15089,7 +15367,7 @@ \rSec3[fs.op.canonical]{Canonical} -\indexlibrary{\idxcode{canonical}}% +\indexlibraryglobal{canonical}% \begin{itemdecl} path canonical(const path& p); path canonical(const path& p, error_code& ec); @@ -15097,47 +15375,53 @@ \begin{itemdescr} \pnum -\effects Converts \tcode{p} to an absolute +\effects +Converts \tcode{p} to an absolute path that has no symbolic link, dot, or dot-dot elements in its pathname in the generic format. \pnum -\returns A path that refers to +\returns +A path that refers to the same file system object as \tcode{absolute(p)}. The signature with argument \tcode{ec} returns \tcode{path()} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\remarks \tcode{!exists(p)} is an error. +\remarks +\tcode{!exists(p)} is an error. \end{itemdescr} \rSec3[fs.op.copy]{Copy} -\indexlibrary{\idxcode{copy}!\idxcode{path}}% +\indexlibrarymember{copy}{path}% \begin{itemdecl} void copy(const path& from, const path& to); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to +\effects +Equivalent to \tcode{copy(from, to, copy_options::none)}. \end{itemdescr} -\indexlibrary{\idxcode{copy}!\idxcode{path}}% +\indexlibrarymember{copy}{path}% \begin{itemdecl} void copy(const path& from, const path& to, error_code& ec); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to +\effects +Equivalent to \tcode{copy(from, to, copy_options::none, ec)}. \end{itemdescr} -\indexlibrary{\idxcode{copy}!\idxcode{path}}% +\indexlibrarymember{copy}{path}% \begin{itemdecl} void copy(const path& from, const path& to, copy_options options); void copy(const path& from, const path& to, copy_options options, @@ -15247,14 +15531,17 @@ \end{itemize} \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\remarks For the signature with argument \tcode{ec}, any +\remarks +For the signature with argument \tcode{ec}, any library functions called by the implementation shall have an \tcode{error_code} argument if applicable. \pnum -\begin{example} Given this directory structure: +\begin{example} +Given this directory structure: \begin{codeblock} /dir1 file1 @@ -15295,7 +15582,7 @@ \rSec3[fs.op.copy.file]{Copy file} -\indexlibrary{\idxcode{copy_file}}% +\indexlibraryglobal{copy_file}% \begin{itemdecl} bool copy_file(const path& from, const path& to); bool copy_file(const path& from, const path& to, error_code& ec); @@ -15303,15 +15590,17 @@ \begin{itemdescr} \pnum -\returns \tcode{copy_file(from, to, copy_options::none)} or\\ +\returns +\tcode{copy_file(from, to, copy_options::none)} or\\ \tcode{copy_file(from, to, copy_options::none, ec)}, respectively. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} -\indexlibrary{\idxcode{copy_file}}% +\indexlibraryglobal{copy_file}% \begin{itemdecl} bool copy_file(const path& from, const path& to, copy_options options); bool copy_file(const path& from, const path& to, copy_options options, @@ -15357,20 +15646,23 @@ \end{itemize} \pnum -\returns \tcode{true} if the \tcode{from} file +\returns +\tcode{true} if the \tcode{from} file was copied, otherwise \tcode{false}. The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\complexity At most one direct or indirect invocation of \tcode{status(to)}. +\complexity +At most one direct or indirect invocation of \tcode{status(to)}. \end{itemdescr} \rSec3[fs.op.copy.symlink]{Copy symlink} -\indexlibrary{\idxcode{copy_symlink}}% +\indexlibraryglobal{copy_symlink}% \begin{itemdecl} void copy_symlink(const path& existing_symlink, const path& new_symlink); void copy_symlink(const path& existing_symlink, const path& new_symlink, @@ -15379,20 +15671,22 @@ \begin{itemdescr} \pnum -\effects Equivalent to +\effects +Equivalent to \tcode{\textit{function}(read_symlink(existing_symlink), new_symlink)} or\\ \tcode{\textit{function}(read_symlink(existing_symlink, ec), new_symlink, ec)}, respectively, where in each case \tcode{\textit{function}} is \tcode{create_symlink} or \tcode{create_directory_symlink} as appropriate. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.create.directories]{Create directories} -\indexlibrary{\idxcode{create_directories}}% +\indexlibraryglobal{create_directories}% \begin{itemdecl} bool create_directories(const path& p); bool create_directories(const path& p, error_code& ec); @@ -15400,26 +15694,30 @@ \begin{itemdescr} \pnum -\effects Calls \tcode{create_directory()} for each element of \tcode{p} +\effects +Calls \tcode{create_directory()} for each element of \tcode{p} that does not exist. \pnum -\returns \tcode{true} if a new directory was created +\returns +\tcode{true} if a new directory was created for the directory \tcode{p} resolves to, otherwise \tcode{false}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\complexity \bigoh{n} where \textit{n} is the number of elements +\complexity +\bigoh{n} where \textit{n} is the number of elements of \tcode{p}. \end{itemdescr} \rSec3[fs.op.create.directory]{Create directory} -\indexlibrary{\idxcode{create_directory}}% +\indexlibraryglobal{create_directory}% \begin{itemdecl} bool create_directory(const path& p); bool create_directory(const path& p, error_code& ec) noexcept; @@ -15427,20 +15725,23 @@ \begin{itemdescr} \pnum -\effects Creates the directory \tcode{p} resolves to, +\effects +Creates the directory \tcode{p} resolves to, as if by POSIX \tcode{mkdir} with a second argument of \tcode{static_cast(perms::all)}. If \tcode{mkdir} fails because \tcode{p} resolves to an existing directory, no error is reported. Otherwise on failure an error is reported. \pnum -\returns \tcode{true} if a new directory was created, otherwise \tcode{false}. +\returns +\tcode{true} if a new directory was created, otherwise \tcode{false}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} -\indexlibrary{\idxcode{create_directory}}% +\indexlibraryglobal{create_directory}% \begin{itemdecl} bool create_directory(const path& p, const path& existing_p); bool create_directory(const path& p, const path& existing_p, error_code& ec) noexcept; @@ -15448,13 +15749,15 @@ \begin{itemdescr} \pnum -\effects Creates the +\effects +Creates the directory \tcode{p} resolves to, with attributes copied from directory \tcode{existing_p}. The set of attributes copied is operating system dependent. If \tcode{mkdir} fails because \tcode{p} resolves to an existing directory, no error is reported. Otherwise on failure an error is reported. -\begin{note} For POSIX-based operating systems, the +\begin{note} +For POSIX-based operating systems, the attributes are those copied by native API \tcode{stat(existing_p.c_str(), \&attributes_stat)} followed by \tcode{mkdir(p.c_str(), attributes_stat.st_mode)}. For Windows-based operating systems, the attributes are those copied by native @@ -15462,18 +15765,20 @@ \end{note} \pnum -\returns \tcode{true} if a new directory was created +\returns +\tcode{true} if a new directory was created with attributes copied from directory \tcode{existing_p}, otherwise \tcode{false}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.create.dir.symlk]{Create directory symlink} -\indexlibrary{\idxcode{create_directory_symlink}}% +\indexlibraryglobal{create_directory_symlink}% \begin{itemdecl} void create_directory_symlink(const path& to, const path& new_symlink); void create_directory_symlink(const path& to, const path& new_symlink, @@ -15482,30 +15787,37 @@ \begin{itemdescr} \pnum -\effects Establishes the postcondition, as if by POSIX \tcode{symlink()}. +\effects +Establishes the postcondition, as if by POSIX \tcode{symlink()}. \pnum -\ensures \tcode{new_symlink} resolves to a symbolic link file that +\ensures +\tcode{new_symlink} resolves to a symbolic link file that contains an unspecified representation of \tcode{to}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\begin{note} Some operating systems require symlink creation to - identify that the link is to a directory. Portable code should use \tcode{create_directory_symlink()} to create directory symlinks rather than \tcode{create_symlink()} \end{note} +\begin{note} +Some operating systems require symlink creation to + identify that the link is to a directory. Portable code should use \tcode{create_directory_symlink()} to create directory symlinks rather than \tcode{create_symlink()} +\end{note} \pnum -\begin{note} Some operating systems do not support symbolic links at all or support +\begin{note} +Some operating systems do not support symbolic links at all or support them only for regular files. Some file systems (such as the FAT file system) do not support - symbolic links regardless of the operating system. \end{note} + symbolic links regardless of the operating system. +\end{note} \end{itemdescr} \rSec3[fs.op.create.hard.lk]{Create hard link} -\indexlibrary{\idxcode{create_hard_link}}% +\indexlibraryglobal{create_hard_link}% \begin{itemdecl} void create_hard_link(const path& to, const path& new_hard_link); void create_hard_link(const path& to, const path& new_hard_link, @@ -15514,7 +15826,8 @@ \begin{itemdescr} \pnum -\effects Establishes the postcondition, as if by POSIX \tcode{link()}. +\effects +Establishes the postcondition, as if by POSIX \tcode{link()}. \pnum \ensures @@ -15525,18 +15838,21 @@ \end{itemize} \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\begin{note} Some operating systems do not support hard links at all or support +\begin{note} +Some operating systems do not support hard links at all or support them only for regular files. Some file systems (such as the FAT file system) do not support hard links regardless of the operating system. - Some file systems limit the number of links per file. \end{note} + Some file systems limit the number of links per file. +\end{note} \end{itemdescr} \rSec3[fs.op.create.symlink]{Create symlink} -\indexlibrary{\idxcode{create_symlink}}% +\indexlibraryglobal{create_symlink}% \begin{itemdecl} void create_symlink(const path& to, const path& new_symlink); void create_symlink(const path& to, const path& new_symlink, @@ -15545,25 +15861,30 @@ \begin{itemdescr} \pnum -\effects Establishes the postcondition, as if by POSIX \tcode{symlink()}. +\effects +Establishes the postcondition, as if by POSIX \tcode{symlink()}. \pnum -\ensures \tcode{new_symlink} resolves to a symbolic link file that +\ensures +\tcode{new_symlink} resolves to a symbolic link file that contains an unspecified representation of \tcode{to}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\begin{note} Some operating systems do not support symbolic links at all or support +\begin{note} +Some operating systems do not support symbolic links at all or support them only for regular files. Some file systems (such as the FAT file system) do not - support symbolic links regardless of the operating system. \end{note} + support symbolic links regardless of the operating system. +\end{note} \end{itemdescr} \rSec3[fs.op.current.path]{Current path} -\indexlibrary{\idxcode{current_path}}% +\indexlibraryglobal{current_path}% \begin{itemdecl} path current_path(); path current_path(error_code& ec); @@ -15571,31 +15892,38 @@ \begin{itemdescr} \pnum -\returns The absolute path of the current working directory, +\returns +The absolute path of the current working directory, whose pathname in the native format is obtained as if by POSIX \tcode{getcwd()}. The signature with argument \tcode{ec} returns \tcode{path()} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\remarks The current working directory is the directory, associated +\remarks +The current working directory is the directory, associated with the process, that is used as the starting location in pathname resolution for relative paths. \pnum -\begin{note} The \tcode{current_path()} name was chosen to emphasize that the returned value is a - path, not just a single directory name. \end{note} +\begin{note} +The \tcode{current_path()} name was chosen to emphasize that the returned value is a + path, not just a single directory name. +\end{note} \pnum -\begin{note} The current path as returned by many operating systems is a dangerous +\begin{note} +The current path as returned by many operating systems is a dangerous global variable. It may be changed unexpectedly by third-party or system - library functions, or by another thread. \end{note} + library functions, or by another thread. +\end{note} \end{itemdescr} -\indexlibrary{\idxcode{current_path}}% +\indexlibraryglobal{current_path}% \begin{itemdecl} void current_path(const path& p); void current_path(const path& p, error_code& ec) noexcept; @@ -15603,23 +15931,28 @@ \begin{itemdescr} \pnum -\effects Establishes the postcondition, as if by POSIX \tcode{chdir()}. +\effects +Establishes the postcondition, as if by POSIX \tcode{chdir()}. \pnum -\ensures \tcode{equivalent(p, current_path())}. +\ensures +\tcode{equivalent(p, current_path())}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\begin{note} The current path for many operating systems is a dangerous +\begin{note} +The current path for many operating systems is a dangerous global state. It may be changed unexpectedly by a third-party or system - library functions, or by another thread. \end{note} + library functions, or by another thread. +\end{note} \end{itemdescr} \rSec3[fs.op.equivalent]{Equivalent} -\indexlibrary{\idxcode{equivalent}}% +\indexlibraryglobal{equivalent}% \begin{itemdecl} bool equivalent(const path& p1, const path& p2); bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept; @@ -15627,7 +15960,8 @@ \begin{itemdescr} \pnum -\returns \tcode{true}, if \tcode{p1} and \tcode{p2} resolve to the same file +\returns +\tcode{true}, if \tcode{p1} and \tcode{p2} resolve to the same file system entity, otherwise \tcode{false}. The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. @@ -15642,26 +15976,29 @@ \end{note} \pnum -\remarks \tcode{!exists(p1) || !exists(p2)} is an error. +\remarks +\tcode{!exists(p1) || !exists(p2)} is an error. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.exists]{Exists} -\indexlibrary{\idxcode{exists}}% +\indexlibraryglobal{exists}% \begin{itemdecl} bool exists(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{status_known(s) \&\& s.type() != file_type::not_found}. +\returns +\tcode{status_known(s) \&\& s.type() != file_type::not_found}. \end{itemdescr} -\indexlibrary{\idxcode{exists}}% +\indexlibraryglobal{exists}% \begin{itemdecl} bool exists(const path& p); bool exists(const path& p, error_code& ec) noexcept; @@ -15673,20 +16010,23 @@ determined as if by \tcode{status(p)} or \tcode{status(p, ec)}, respectively. \pnum -\effects The signature with argument \tcode{ec} calls \tcode{ec.clear()} +\effects +The signature with argument \tcode{ec} calls \tcode{ec.clear()} if \tcode{status_known(s)}. \pnum -\returns \tcode{exists(s)}. +\returns +\tcode{exists(s)}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.file.size]{File size} -\indexlibrary{\idxcode{file_size}}% +\indexlibraryglobal{file_size}% \begin{itemdecl} uintmax_t file_size(const path& p); uintmax_t file_size(const path& p, error_code& ec) noexcept; @@ -15711,13 +16051,14 @@ if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.hard.lk.ct]{Hard link count} -\indexlibrary{\idxcode{hard_link_count}}% +\indexlibraryglobal{hard_link_count}% \begin{itemdecl} uintmax_t hard_link_count(const path& p); uintmax_t hard_link_count(const path& p, error_code& ec) noexcept; @@ -15725,28 +16066,31 @@ \begin{itemdescr} \pnum -\returns The number of hard links for \tcode{p}. The signature +\returns +The number of hard links for \tcode{p}. The signature with argument \tcode{ec} returns \tcode{static_cast(-1)} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.is.block.file]{Is block file} -\indexlibrary{\idxcode{is_block_file}}% +\indexlibraryglobal{is_block_file}% \begin{itemdecl} bool is_block_file(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{s.type() == file_type::block}. +\returns +\tcode{s.type() == file_type::block}. \end{itemdescr} -\indexlibrary{\idxcode{is_block_file}}% +\indexlibraryglobal{is_block_file}% \begin{itemdecl} bool is_block_file(const path& p); bool is_block_file(const path& p, error_code& ec) noexcept; @@ -15754,27 +16098,30 @@ \begin{itemdescr} \pnum -\returns \tcode{is_block_file(status(p))} or \tcode{is_block_file(status(p, ec))}, respectively. +\returns +\tcode{is_block_file(status(p))} or \tcode{is_block_file(status(p, ec))}, respectively. The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.is.char.file]{Is character file} -\indexlibrary{\idxcode{is_character_file}}% +\indexlibraryglobal{is_character_file}% \begin{itemdecl} bool is_character_file(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{s.type() == file_type::character}. +\returns +\tcode{s.type() == file_type::character}. \end{itemdescr} -\indexlibrary{\idxcode{is_character_file}}% +\indexlibraryglobal{is_character_file}% \begin{itemdecl} bool is_character_file(const path& p); bool is_character_file(const path& p, error_code& ec) noexcept; @@ -15782,29 +16129,32 @@ \begin{itemdescr} \pnum -\returns \tcode{is_character_file(status(p))} +\returns +\tcode{is_character_file(status(p))} or \tcode{is_character_file(status(p, ec))}, respectively.\\The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.is.directory]{Is directory} -\indexlibrary{\idxcode{is_directory}}% +\indexlibraryglobal{is_directory}% \begin{itemdecl} bool is_directory(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{s.type() == file_type::directory}. +\returns +\tcode{s.type() == file_type::directory}. \end{itemdescr} -\indexlibrary{\idxcode{is_directory}}% +\indexlibraryglobal{is_directory}% \begin{itemdecl} bool is_directory(const path& p); bool is_directory(const path& p, error_code& ec) noexcept; @@ -15812,12 +16162,14 @@ \begin{itemdescr} \pnum -\returns \tcode{is_directory(status(p))} or \tcode{is_directory(status(p, ec))}, +\returns +\tcode{is_directory(status(p))} or \tcode{is_directory(status(p, ec))}, respectively. The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} @@ -15858,24 +16210,26 @@ \end{itemize} \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.is.fifo]{Is fifo} -\indexlibrary{\idxcode{is_fifo}}% +\indexlibraryglobal{is_fifo}% \begin{itemdecl} bool is_fifo(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{s.type() == file_type::fifo}. +\returns +\tcode{s.type() == file_type::fifo}. \end{itemdescr} -\indexlibrary{\idxcode{is_fifo}}% +\indexlibraryglobal{is_fifo}% \begin{itemdecl} bool is_fifo(const path& p); bool is_fifo(const path& p, error_code& ec) noexcept; @@ -15883,27 +16237,30 @@ \begin{itemdescr} \pnum -\returns \tcode{is_fifo(status(p))} or \tcode{is_fifo(status(p, ec))}, respectively. +\returns +\tcode{is_fifo(status(p))} or \tcode{is_fifo(status(p, ec))}, respectively. The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.is.other]{Is other} -\indexlibrary{\idxcode{is_other}}% +\indexlibraryglobal{is_other}% \begin{itemdecl} bool is_other(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{exists(s) \&\& !is_regular_file(s) \&\& !is_directory(s) \&\& !is_symlink(s)}. +\returns +\tcode{exists(s) \&\& !is_regular_file(s) \&\& !is_directory(s) \&\& !is_symlink(s)}. \end{itemdescr} -\indexlibrary{\idxcode{is_other}}% +\indexlibraryglobal{is_other}% \begin{itemdecl} bool is_other(const path& p); bool is_other(const path& p, error_code& ec) noexcept; @@ -15911,70 +16268,80 @@ \begin{itemdescr} \pnum -\returns \tcode{is_other(status(p))} or \tcode{is_other(status(p, ec))}, +\returns +\tcode{is_other(status(p))} or \tcode{is_other(status(p, ec))}, respectively. The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.is.regular.file]{Is regular file} -\indexlibrary{\idxcode{is_regular_file}}% +\indexlibraryglobal{is_regular_file}% \begin{itemdecl} bool is_regular_file(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{s.type() == file_type::regular}. +\returns +\tcode{s.type() == file_type::regular}. \end{itemdescr} -\indexlibrary{\idxcode{is_regular_file}}% +\indexlibraryglobal{is_regular_file}% \begin{itemdecl} bool is_regular_file(const path& p); \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{is_regular_file(status(p))}. +\returns +\tcode{is_regular_file(status(p))}. \pnum -\throws \tcode{filesystem_error} if \tcode{status(p)} would throw \tcode{filesystem_error.} +\throws +\tcode{filesystem_error} if \tcode{status(p)} would throw \tcode{filesystem_error}. \end{itemdescr} -\indexlibrary{\idxcode{is_regular_file}}% +\indexlibraryglobal{is_regular_file}% \begin{itemdecl} bool is_regular_file(const path& p, error_code& ec) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Sets \tcode{ec} as if by \tcode{status(p, ec)}. \begin{note} +\effects +Sets \tcode{ec} as if by \tcode{status(p, ec)}. +\begin{note} \tcode{file_type::none}, \tcode{file_type::not_found} and - \tcode{file_type::unknown} cases set \tcode{ec} to error values. To distinguish between cases, call the \tcode{status} function directly. \end{note} + \tcode{file_type::unknown} cases set \tcode{ec} to error values. To distinguish between cases, call the \tcode{status} function directly. +\end{note} \pnum -\returns \tcode{is_regular_file(status(p, ec))}. +\returns +\tcode{is_regular_file(status(p, ec))}. Returns \tcode{false} if an error occurs. \end{itemdescr} \rSec3[fs.op.is.socket]{Is socket} -\indexlibrary{\idxcode{is_socket}}% +\indexlibraryglobal{is_socket}% \begin{itemdecl} bool is_socket(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{s.type() == file_type::socket}. +\returns +\tcode{s.type() == file_type::socket}. \end{itemdescr} -\indexlibrary{\idxcode{is_socket}}% +\indexlibraryglobal{is_socket}% \begin{itemdecl} bool is_socket(const path& p); bool is_socket(const path& p, error_code& ec) noexcept; @@ -15982,28 +16349,31 @@ \begin{itemdescr} \pnum -\returns \tcode{is_socket(status(p))} or +\returns +\tcode{is_socket(status(p))} or \tcode{is_socket(status(p, ec))}, respectively. The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.is.symlink]{Is symlink} -\indexlibrary{\idxcode{is_symlink}}% +\indexlibraryglobal{is_symlink}% \begin{itemdecl} bool is_symlink(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{s.type() == file_type::symlink}. +\returns +\tcode{s.type() == file_type::symlink}. \end{itemdescr} -\indexlibrary{\idxcode{is_symlink}}% +\indexlibraryglobal{is_symlink}% \begin{itemdecl} bool is_symlink(const path& p); bool is_symlink(const path& p, error_code& ec) noexcept; @@ -16011,18 +16381,20 @@ \begin{itemdescr} \pnum -\returns \tcode{is_symlink(symlink_status(p))} or \tcode{is_symlink(symlink_status(p, ec))}, +\returns +\tcode{is_symlink(symlink_status(p))} or \tcode{is_symlink(symlink_status(p, ec))}, respectively. The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.last.write.time]{Last write time} -\indexlibrary{\idxcode{last_write_time}}% +\indexlibraryglobal{last_write_time}% \begin{itemdecl} file_time_type last_write_time(const path& p); file_time_type last_write_time(const path& p, error_code& ec) noexcept; @@ -16030,17 +16402,19 @@ \begin{itemdescr} \pnum -\returns The time of last data modification of \tcode{p}, +\returns +The time of last data modification of \tcode{p}, determined as if by the value of the POSIX \tcode{stat} class member \tcode{st_mtime} obtained as if by POSIX \tcode{stat()}. The signature with argument \tcode{ec} returns \tcode{file_time_type::min()} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} -\indexlibrary{\idxcode{last_write_time}}% +\indexlibraryglobal{last_write_time}% \begin{itemdecl} void last_write_time(const path& p, file_time_type new_time); void last_write_time(const path& p, file_time_type new_time, @@ -16049,20 +16423,24 @@ \begin{itemdescr} \pnum -\effects Sets the time of last data modification of the file +\effects +Sets the time of last data modification of the file resolved to by \tcode{p} to \tcode{new_time}, as if by POSIX \tcode{futimens()}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\begin{note} A postcondition of \tcode{last_write_time(p) == new_time} is not specified since it might not hold for file systems - with coarse time granularity. \end{note} +\begin{note} +A postcondition of \tcode{last_write_time(p) == new_time} is not specified since it might not hold for file systems + with coarse time granularity. +\end{note} \end{itemdescr} \rSec3[fs.op.permissions]{Permissions} -\indexlibrary{\idxcode{permissions}}% +\indexlibraryglobal{permissions}% \begin{itemdecl} void permissions(const path& p, perms prms, perm_options opts=perm_options::replace); void permissions(const path& p, perms prms, error_code& ec) noexcept; @@ -16086,29 +16464,34 @@ The action is applied as if by POSIX \tcode{fchmodat()}. \pnum -\begin{note} Conceptually permissions are viewed as bits, but the actual - implementation may use some other mechanism. \end{note} +\begin{note} +Conceptually permissions are viewed as bits, but the actual + implementation may use some other mechanism. +\end{note} \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.proximate]{Proximate} -\indexlibrary{\idxcode{proximate}}% +\indexlibraryglobal{proximate}% \begin{itemdecl} path proximate(const path& p, error_code& ec); \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{proximate(p, current_path(), ec)}. +\returns +\tcode{proximate(p, current_path(), ec)}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} -\indexlibrary{\idxcode{proximate}}% +\indexlibraryglobal{proximate}% \begin{itemdecl} path proximate(const path& p, const path& base = current_path()); path proximate(const path& p, const path& base, error_code& ec); @@ -16116,7 +16499,8 @@ \begin{itemdescr} \pnum -\returns For the first form: +\returns +For the first form: \begin{codeblock} weakly_canonical(p).lexically_proximate(weakly_canonical(base)); \end{codeblock} @@ -16127,12 +16511,13 @@ or \tcode{path()} at the first error occurrence, if any. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.read.symlink]{Read symlink} -\indexlibrary{\idxcode{read_symlink}}% +\indexlibraryglobal{read_symlink}% \begin{itemdecl} path read_symlink(const path& p); path read_symlink(const path& p, error_code& ec); @@ -16140,32 +16525,39 @@ \begin{itemdescr} \pnum -\returns If \tcode{p} resolves to a symbolic +\returns +If \tcode{p} resolves to a symbolic link, a \tcode{path} object containing the contents of that symbolic link. The signature with argument \tcode{ec} returns \tcode{path()} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. \begin{note} It is an error if \tcode{p} does not - resolve to a symbolic link. \end{note} +\throws +As specified in~\ref{fs.err.report}. +\begin{note} +It is an error if \tcode{p} does not + resolve to a symbolic link. +\end{note} \end{itemdescr} \rSec3[fs.op.relative]{Relative} -\indexlibrary{\idxcode{relative}}% +\indexlibraryglobal{relative}% \begin{itemdecl} path relative(const path& p, error_code& ec); \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{relative(p, current_path(), ec)}. +\returns +\tcode{relative(p, current_path(), ec)}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} -\indexlibrary{\idxcode{relative}}% +\indexlibraryglobal{relative}% \begin{itemdecl} path relative(const path& p, const path& base = current_path()); path relative(const path& p, const path& base, error_code& ec); @@ -16173,7 +16565,8 @@ \begin{itemdescr} \pnum -\returns For the first form: +\returns +For the first form: \begin{codeblock} weakly_canonical(p).lexically_relative(weakly_canonical(base)); \end{codeblock} @@ -16184,12 +16577,13 @@ or \tcode{path()} at the first error occurrence, if any. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.remove]{Remove} -\indexlibrary{\idxcode{remove}!\idxcode{path}}% +\indexlibrarymember{remove}{path}% \begin{itemdecl} bool remove(const path& p); bool remove(const path& p, error_code& ec) noexcept; @@ -16197,27 +16591,33 @@ \begin{itemdescr} \pnum -\effects If \tcode{exists(symlink_status(p, ec))}, the file \tcode{p} is +\effects +If \tcode{exists(symlink_status(p, ec))}, the file \tcode{p} is removed as if by POSIX \tcode{remove()}. -\begin{note} A symbolic link is itself removed, rather than the file it - resolves to. \end{note} +\begin{note} +A symbolic link is itself removed, rather than the file it + resolves to. +\end{note} \pnum -\ensures \tcode{exists(symlink_status(p))} is \tcode{false}. +\ensures +\tcode{exists(symlink_status(p))} is \tcode{false}. \pnum -\returns \tcode{false} if \tcode{p} did not exist, +\returns +\tcode{false} if \tcode{p} did not exist, otherwise \tcode{true}. The signature with argument \tcode{ec} returns \tcode{false} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.remove.all]{Remove all} -\indexlibrary{\idxcode{remove_all}}% +\indexlibraryglobal{remove_all}% \begin{itemdecl} uintmax_t remove_all(const path& p); uintmax_t remove_all(const path& p, error_code& ec); @@ -16225,27 +16625,33 @@ \begin{itemdescr} \pnum -\effects Recursively deletes the contents of \tcode{p} if it exists, +\effects +Recursively deletes the contents of \tcode{p} if it exists, then deletes file \tcode{p} itself, as if by POSIX \tcode{remove()}. -\begin{note} A symbolic link is itself removed, rather than the file it - resolves to. \end{note} +\begin{note} +A symbolic link is itself removed, rather than the file it + resolves to. +\end{note} \pnum -\ensures \tcode{exists(symlink_status(p))} is \tcode{false}. +\ensures +\tcode{exists(symlink_status(p))} is \tcode{false}. \pnum -\returns The number of files removed. The signature with argument +\returns +The number of files removed. The signature with argument \tcode{ec} returns \tcode{static_cast< uintmax_t>(-1)} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.rename]{Rename} -\indexlibrary{\idxcode{rename}}% +\indexlibraryglobal{rename}% \begin{itemdecl} void rename(const path& old_p, const path& new_p); void rename(const path& old_p, const path& new_p, error_code& ec) noexcept; @@ -16253,7 +16659,8 @@ \begin{itemdescr} \pnum -\effects Renames \tcode{old_p} to \tcode{new_p}, as if by +\effects +Renames \tcode{old_p} to \tcode{new_p}, as if by POSIX \tcode{rename()}. \begin{note} @@ -16273,13 +16680,14 @@ \end{note} \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.resize.file]{Resize file} -\indexlibrary{\idxcode{resize_file}}% +\indexlibraryglobal{resize_file}% \begin{itemdecl} void resize_file(const path& p, uintmax_t new_size); void resize_file(const path& p, uintmax_t new_size, error_code& ec) noexcept; @@ -16287,17 +16695,19 @@ \begin{itemdescr} \pnum -\effects Causes the size that would be returned by \tcode{file_size(p)} to be +\effects +Causes the size that would be returned by \tcode{file_size(p)} to be equal to \tcode{new_size}, as if by POSIX \tcode{truncate()}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.space]{Space} -\indexlibrary{\idxcode{space}}% +\indexlibraryglobal{space}% \begin{itemdecl} space_info space(const path& p); space_info space(const path& p, error_code& ec) noexcept; @@ -16305,7 +16715,8 @@ \begin{itemdescr} \pnum -\returns An object of type \tcode{space_info}. The value of the \tcode{space_info} +\returns +An object of type \tcode{space_info}. The value of the \tcode{space_info} object is determined as if by using POSIX \tcode{statvfs} to obtain a POSIX \tcode{struct statvfs}, and then multiplying its \tcode{f_blocks}, \tcode{f_bfree}, @@ -16317,25 +16728,31 @@ \tcode{static_cast(-1)} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\remarks The value of member \tcode{space_info::available} - is operating system dependent. \begin{note} \tcode{available} may be - less than \tcode{free}. \end{note} +\remarks +The value of member \tcode{space_info::available} + is operating system dependent. +\begin{note} +\tcode{available} may be + less than \tcode{free}. +\end{note} \end{itemdescr} \rSec3[fs.op.status]{Status} -\indexlibrary{\idxcode{status}}% +\indexlibraryglobal{status}% \begin{itemdecl} file_status status(const path& p); \end{itemdecl} \begin{itemdescr} \pnum -\effects As if: +\effects +As if: \begin{codeblock} error_code ec; file_status result = status(p, ec); @@ -16345,16 +16762,20 @@ \end{codeblock} \pnum -\returns See above. +\returns +See above. \pnum -\throws \tcode{filesystem_error}. -\begin{note} \tcode{result} values of \tcode{file_status(file_type::not_found)} +\throws +\tcode{filesystem_error}. +\begin{note} +\tcode{result} values of \tcode{file_status(file_type::not_found)} and \tcode{file_status(file_type::unknown)} are not considered failures and do not - cause an exception to be thrown.\end{note} + cause an exception to be thrown. +\end{note} \end{itemdescr} -\indexlibrary{\idxcode{status}}% +\indexlibraryglobal{status}% \begin{itemdecl} file_status status(const path& p, error_code& ec) noexcept; \end{itemdecl} @@ -16368,9 +16789,11 @@ If, during attribute determination, the underlying file system API reports an error, sets \tcode{ec} to indicate the specific error reported. Otherwise, \tcode{ec.clear()}. -\begin{note} This allows users to inspect the specifics of underlying +\begin{note} +This allows users to inspect the specifics of underlying API errors even when the value returned by \tcode{status()} is not - \tcode{file_status(file_type::none)}. \end{note} + \tcode{file_status(file_type::none)}. +\end{note} \pnum Let \tcode{prms} denote the result of \tcode{(m \& perms::mask)}, @@ -16391,22 +16814,28 @@ \tcode{file_status(file_type::unknown)}. \item Otherwise, returns \tcode{file_status(file_type::none)}. \end{itemize} -\begin{note} These semantics distinguish between \tcode{p} being known not to exist, \tcode{p} existing but not being able to determine its attributes, +\begin{note} +These semantics distinguish between \tcode{p} being known not to exist, \tcode{p} existing but not being able to determine its attributes, and there being an error that prevents even knowing if \tcode{p} exists. These - distinctions are important to some use cases. \end{note} + distinctions are important to some use cases. +\end{note} \item Otherwise, \begin{itemize} \item If the attributes indicate a regular file, as if by POSIX \tcode{S_ISREG}, - returns \tcode{file_status(file_type::regular, prms)}. \begin{note} - \tcode{file_type::regular} implies appropriate \tcode{} operations + returns \tcode{file_status(file_type::regular, prms)}. +\begin{note} + \tcode{file_type::regular} implies appropriate \libheader{fstream} operations would succeed, assuming no hardware, permission, access, or file system race errors. Lack of \tcode{file_type::regular} does not necessarily imply - \tcode{} operations would fail on a directory. \end{note} + \libheader{fstream} operations would fail on a directory. +\end{note} \item Otherwise, if the attributes indicate a directory, as if by POSIX \tcode{S_ISDIR}, returns \tcode{file_status(file_type::directory, prms)}. - \begin{note} \tcode{file_type::directory} implies that calling - \tcode{directory_iterator(p)} would succeed. \end{note} + \begin{note} +\tcode{file_type::directory} implies that calling + \tcode{directory_iterator(p)} would succeed. +\end{note} \item Otherwise, if the attributes indicate a block special file, as if by POSIX \tcode{S_ISBLK}, returns \tcode{file_status(file_type::block, prms)}. \item Otherwise, if the attributes indicate a character special file, as if @@ -16425,27 +16854,29 @@ \end{itemize} \pnum -\remarks If a symbolic link is encountered during pathname resolution, +\remarks +If a symbolic link is encountered during pathname resolution, pathname resolution continues using the contents of the symbolic link. \end{itemdescr} \rSec3[fs.op.status.known]{Status known} -\indexlibrary{\idxcode{status_known}}% +\indexlibraryglobal{status_known}% \begin{itemdecl} bool status_known(file_status s) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{s.type() != file_type::none}. +\returns +\tcode{s.type() != file_type::none}. \end{itemdescr} \rSec3[fs.op.symlink.status]{Symlink status} -\indexlibrary{\idxcode{symlink_status}}% +\indexlibraryglobal{symlink_status}% \begin{itemdecl} file_status symlink_status(const path& p); file_status symlink_status(const path& p, error_code& ec) noexcept; @@ -16453,7 +16884,8 @@ \begin{itemdescr} \pnum -\effects Same as \tcode{status()}, above, +\effects +Same as \tcode{status()}, above, except that the attributes of \tcode{p} are determined as if by using POSIX \tcode{lstat()} to obtain a POSIX \tcode{struct stat}. @@ -16464,23 +16896,26 @@ of the obtained \tcode{struct stat} to the type \tcode{perms}. \pnum -\returns Same as \tcode{status()}, above, except +\returns +Same as \tcode{status()}, above, except that if the attributes indicate a symbolic link, as if by POSIX \tcode{S_ISLNK}, returns \tcode{file_status(file_type::symlink, prms)}. The signature with argument \tcode{ec} returns \tcode{file_status(file_type::none)} if an error occurs. \pnum -\remarks Pathname resolution terminates if \tcode{p} names a symbolic link. +\remarks +Pathname resolution terminates if \tcode{p} names a symbolic link. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec3[fs.op.temp.dir.path]{Temporary directory path} -\indexlibrary{\idxcode{temp_directory_path}}% +\indexlibraryglobal{temp_directory_path}% \begin{itemdecl} path temp_directory_path(); path temp_directory_path(error_code& ec); @@ -16491,19 +16926,23 @@ Let \tcode{p} be an unspecified directory path suitable for temporary files. \pnum -\effects If \tcode{exists(p)} is \tcode{false} or \tcode{is_directory(p)} is +\effects +If \tcode{exists(p)} is \tcode{false} or \tcode{is_directory(p)} is \tcode{false}, an error is reported\iref{fs.err.report}. \pnum -\returns The path \tcode{p}. +\returns +The path \tcode{p}. The signature with argument \tcode{ec} returns \tcode{path()} if an error occurs. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \pnum -\begin{example} For POSIX-based operating systems, an implementation might +\begin{example} +For POSIX-based operating systems, an implementation might return the path supplied by the first environment variable found in the list TMPDIR, TMP, TEMP, TEMPDIR, or if none of these are found, \tcode{"/tmp"}. @@ -16515,7 +16954,7 @@ \rSec3[fs.op.weakly.canonical]{Weakly canonical} -\indexlibrary{\idxcode{weakly_canonical}}% +\indexlibraryglobal{weakly_canonical}% \begin{itemdecl} path weakly_canonical(const path& p); path weakly_canonical(const path& p, error_code& ec); @@ -16523,11 +16962,13 @@ \begin{itemdescr} \pnum -\returns \tcode{p} with symlinks resolved and +\returns +\tcode{p} with symlinks resolved and the result normalized\iref{fs.path.generic}. \pnum -\effects Using \tcode{status(p)} or \tcode{status(p, ec)}, respectively, +\effects +Using \tcode{status(p)} or \tcode{status(p, ec)}, respectively, to determine existence, return a path composed by \tcode{operator/=} from the result of calling \tcode{canonical()} @@ -16542,86 +16983,89 @@ \tcode{path()} is returned at the first error occurrence, if any. \pnum -\ensures The returned path is in normal form\iref{fs.path.generic}. +\ensures +The returned path is in normal form\iref{fs.path.generic}. \pnum -\remarks Implementations should +\remarks +Implementations should avoid unnecessary normalization such as when \tcode{canonical} has already been called on the entirety of \tcode{p}. \pnum -\throws As specified in~\ref{fs.err.report}. +\throws +As specified in~\ref{fs.err.report}. \end{itemdescr} \rSec1[c.files]{C library files} \rSec2[cstdio.syn]{Header \tcode{} synopsis} -\indexhdr{cstdio}% -\indexlibrary{\idxcode{size_t}}% -\indexlibrary{\idxcode{FILE}}% -\indexlibrary{\idxcode{fpos_t}}% -\indexlibrary{\idxcode{NULL}}% -\indexlibrary{\idxcode{_IOFBF}}% -\indexlibrary{\idxcode{_IOLBF}}% -\indexlibrary{\idxcode{_IONBF}}% -\indexlibrary{\idxcode{BUFSIZ}}% -\indexlibrary{\idxcode{EOF}}% -\indexlibrary{\idxcode{FOPEN_MAX}}% -\indexlibrary{\idxcode{FILENAME_MAX}}% -\indexlibrary{\idxcode{L_tmpnam}}% -\indexlibrary{\idxcode{SEEK_CUR}}% -\indexlibrary{\idxcode{SEEK_END}}% -\indexlibrary{\idxcode{SEEK_SET}}% -\indexlibrary{\idxcode{TMP_MAX}}% -\indexlibrary{\idxcode{stderr}}% -\indexlibrary{\idxcode{stdin}}% -\indexlibrary{\idxcode{stdout}}% -\indexlibrary{\idxcode{remove}}% -\indexlibrary{\idxcode{rename}}% -\indexlibrary{\idxcode{tmpfile}}% -\indexlibrary{\idxcode{tmpnam}}% -\indexlibrary{\idxcode{fclose}}% -\indexlibrary{\idxcode{fflush}}% -\indexlibrary{\idxcode{fopen}}% -\indexlibrary{\idxcode{freopen}}% -\indexlibrary{\idxcode{setbuf}}% -\indexlibrary{\idxcode{setvbuf}}% -\indexlibrary{\idxcode{fprintf}}% -\indexlibrary{\idxcode{fscanf}}% -\indexlibrary{\idxcode{printf}}% -\indexlibrary{\idxcode{scanf}}% -\indexlibrary{\idxcode{snprintf}}% -\indexlibrary{\idxcode{sprintf}}% -\indexlibrary{\idxcode{sscanf}}% -\indexlibrary{\idxcode{vfprintf}}% -\indexlibrary{\idxcode{vfscanf}}% -\indexlibrary{\idxcode{vprintf}}% -\indexlibrary{\idxcode{vscanf}}% -\indexlibrary{\idxcode{vsnprintf}}% -\indexlibrary{\idxcode{vsprintf}}% -\indexlibrary{\idxcode{vsscanf}}% -\indexlibrary{\idxcode{fgetc}}% -\indexlibrary{\idxcode{fgets}}% -\indexlibrary{\idxcode{fputc}}% -\indexlibrary{\idxcode{fputs}}% -\indexlibrary{\idxcode{getc}}% -\indexlibrary{\idxcode{getchar}}% -\indexlibrary{\idxcode{putc}}% -\indexlibrary{\idxcode{putchar}}% -\indexlibrary{\idxcode{puts}}% -\indexlibrary{\idxcode{ungetc}}% -\indexlibrary{\idxcode{fread}}% -\indexlibrary{\idxcode{fwrite}}% -\indexlibrary{\idxcode{fgetpos}}% -\indexlibrary{\idxcode{fseek}}% -\indexlibrary{\idxcode{fsetpos}}% -\indexlibrary{\idxcode{ftell}}% -\indexlibrary{\idxcode{rewind}}% -\indexlibrary{\idxcode{clearerr}}% -\indexlibrary{\idxcode{feof}}% -\indexlibrary{\idxcode{ferror}}% -\indexlibrary{\idxcode{perror}}% +\indexheader{cstdio}% +\indexlibraryglobal{size_t}% +\indexlibraryglobal{FILE}% +\indexlibraryglobal{fpos_t}% +\indexlibraryglobal{NULL}% +\indexlibraryglobal{_IOFBF}% +\indexlibraryglobal{_IOLBF}% +\indexlibraryglobal{_IONBF}% +\indexlibraryglobal{BUFSIZ}% +\indexlibraryglobal{EOF}% +\indexlibraryglobal{FOPEN_MAX}% +\indexlibraryglobal{FILENAME_MAX}% +\indexlibraryglobal{L_tmpnam}% +\indexlibraryglobal{SEEK_CUR}% +\indexlibraryglobal{SEEK_END}% +\indexlibraryglobal{SEEK_SET}% +\indexlibraryglobal{TMP_MAX}% +\indexlibraryglobal{stderr}% +\indexlibraryglobal{stdin}% +\indexlibraryglobal{stdout}% +\indexlibraryglobal{remove}% +\indexlibraryglobal{rename}% +\indexlibraryglobal{tmpfile}% +\indexlibraryglobal{tmpnam}% +\indexlibraryglobal{fclose}% +\indexlibraryglobal{fflush}% +\indexlibraryglobal{fopen}% +\indexlibraryglobal{freopen}% +\indexlibraryglobal{setbuf}% +\indexlibraryglobal{setvbuf}% +\indexlibraryglobal{fprintf}% +\indexlibraryglobal{fscanf}% +\indexlibraryglobal{printf}% +\indexlibraryglobal{scanf}% +\indexlibraryglobal{snprintf}% +\indexlibraryglobal{sprintf}% +\indexlibraryglobal{sscanf}% +\indexlibraryglobal{vfprintf}% +\indexlibraryglobal{vfscanf}% +\indexlibraryglobal{vprintf}% +\indexlibraryglobal{vscanf}% +\indexlibraryglobal{vsnprintf}% +\indexlibraryglobal{vsprintf}% +\indexlibraryglobal{vsscanf}% +\indexlibraryglobal{fgetc}% +\indexlibraryglobal{fgets}% +\indexlibraryglobal{fputc}% +\indexlibraryglobal{fputs}% +\indexlibraryglobal{getc}% +\indexlibraryglobal{getchar}% +\indexlibraryglobal{putc}% +\indexlibraryglobal{putchar}% +\indexlibraryglobal{puts}% +\indexlibraryglobal{ungetc}% +\indexlibraryglobal{fread}% +\indexlibraryglobal{fwrite}% +\indexlibraryglobal{fgetpos}% +\indexlibraryglobal{fseek}% +\indexlibraryglobal{fsetpos}% +\indexlibraryglobal{ftell}% +\indexlibraryglobal{rewind}% +\indexlibraryglobal{clearerr}% +\indexlibraryglobal{feof}% +\indexlibraryglobal{ferror}% +\indexlibraryglobal{perror}% \begin{codeblock} namespace std { using size_t = @\textit{see \ref{support.types.layout}}@; @@ -16696,10 +17140,8 @@ \end{codeblock} \pnum -\indexhdr{stdio.h}% -\indexhdr{cstdio}% -The contents and meaning of the header \tcode{} -are the same as the C standard library header \tcode{}. +The contents and meaning of the header \libheader{cstdio} +are the same as the C standard library header \libheader{stdio.h}. \pnum Calls to the function \tcode{tmpnam} with an argument that is a null pointer value may @@ -16710,71 +17152,71 @@ \rSec2[cinttypes.syn]{Header \tcode{} synopsis} -\indexhdr{cinttypes}% -\indexlibrary{\idxcode{imaxdiv_t}}% -\indexlibrary{\idxcode{imaxabs}}% -\indexlibrary{\idxcode{imaxdiv}}% -\indexlibrary{\idxcode{strtoimax}}% -\indexlibrary{\idxcode{strtoumax}}% -\indexlibrary{\idxcode{wcstoimax}}% -\indexlibrary{\idxcode{wcstoumax}}% -\indexlibrary{\idxcode{abs}}% -\indexlibrary{\idxcode{div}}% -\indexlibrary{\idxcode{PRIdN}}% -\indexlibrary{\idxcode{PRIiN}}% -\indexlibrary{\idxcode{PRIoN}}% -\indexlibrary{\idxcode{PRIuN}}% -\indexlibrary{\idxcode{PRIxN}}% -\indexlibrary{\idxcode{PRIXN}}% -\indexlibrary{\idxcode{SCNdN}}% -\indexlibrary{\idxcode{SCNiN}}% -\indexlibrary{\idxcode{SCNoN}}% -\indexlibrary{\idxcode{SCNuN}}% -\indexlibrary{\idxcode{SCNxN}}% -\indexlibrary{\idxcode{PRIdLEASTN}}% -\indexlibrary{\idxcode{PRIiLEASTN}}% -\indexlibrary{\idxcode{PRIoLEASTN}}% -\indexlibrary{\idxcode{PRIuLEASTN}}% -\indexlibrary{\idxcode{PRIxLEASTN}}% -\indexlibrary{\idxcode{PRIXLEASTN}}% -\indexlibrary{\idxcode{SCNdLEASTN}}% -\indexlibrary{\idxcode{SCNiLEASTN}}% -\indexlibrary{\idxcode{SCNoLEASTN}}% -\indexlibrary{\idxcode{SCNuLEASTN}}% -\indexlibrary{\idxcode{SCNxLEASTN}}% -\indexlibrary{\idxcode{PRIdFASTN}}% -\indexlibrary{\idxcode{PRIiFASTN}}% -\indexlibrary{\idxcode{PRIoFASTN}}% -\indexlibrary{\idxcode{PRIuFASTN}}% -\indexlibrary{\idxcode{PRIxFASTN}}% -\indexlibrary{\idxcode{PRIXFASTN}}% -\indexlibrary{\idxcode{SCNdFASTN}}% -\indexlibrary{\idxcode{SCNiFASTN}}% -\indexlibrary{\idxcode{SCNoFASTN}}% -\indexlibrary{\idxcode{SCNuFASTN}}% -\indexlibrary{\idxcode{SCNxFASTN}}% -\indexlibrary{\idxcode{PRIdMAX}}% -\indexlibrary{\idxcode{PRIiMAX}}% -\indexlibrary{\idxcode{PRIoMAX}}% -\indexlibrary{\idxcode{PRIuMAX}}% -\indexlibrary{\idxcode{PRIxMAX}}% -\indexlibrary{\idxcode{PRIXMAX}}% -\indexlibrary{\idxcode{SCNdMAX}}% -\indexlibrary{\idxcode{SCNiMAX}}% -\indexlibrary{\idxcode{SCNoMAX}}% -\indexlibrary{\idxcode{SCNuMAX}}% -\indexlibrary{\idxcode{SCNxMAX}}% -\indexlibrary{\idxcode{PRIdPTR}}% -\indexlibrary{\idxcode{PRIiPTR}}% -\indexlibrary{\idxcode{PRIoPTR}}% -\indexlibrary{\idxcode{PRIuPTR}}% -\indexlibrary{\idxcode{PRIxPTR}}% -\indexlibrary{\idxcode{PRIXPTR}}% -\indexlibrary{\idxcode{SCNdPTR}}% -\indexlibrary{\idxcode{SCNiPTR}}% -\indexlibrary{\idxcode{SCNoPTR}}% -\indexlibrary{\idxcode{SCNuPTR}}% -\indexlibrary{\idxcode{SCNxPTR}}% +\indexheader{cinttypes}% +\indexlibraryglobal{imaxdiv_t}% +\indexlibraryglobal{imaxabs}% +\indexlibraryglobal{imaxdiv}% +\indexlibraryglobal{strtoimax}% +\indexlibraryglobal{strtoumax}% +\indexlibraryglobal{wcstoimax}% +\indexlibraryglobal{wcstoumax}% +\indexlibraryglobal{abs}% +\indexlibraryglobal{div}% +\indexlibraryglobal{PRIdN}% +\indexlibraryglobal{PRIiN}% +\indexlibraryglobal{PRIoN}% +\indexlibraryglobal{PRIuN}% +\indexlibraryglobal{PRIxN}% +\indexlibraryglobal{PRIXN}% +\indexlibraryglobal{SCNdN}% +\indexlibraryglobal{SCNiN}% +\indexlibraryglobal{SCNoN}% +\indexlibraryglobal{SCNuN}% +\indexlibraryglobal{SCNxN}% +\indexlibraryglobal{PRIdLEASTN}% +\indexlibraryglobal{PRIiLEASTN}% +\indexlibraryglobal{PRIoLEASTN}% +\indexlibraryglobal{PRIuLEASTN}% +\indexlibraryglobal{PRIxLEASTN}% +\indexlibraryglobal{PRIXLEASTN}% +\indexlibraryglobal{SCNdLEASTN}% +\indexlibraryglobal{SCNiLEASTN}% +\indexlibraryglobal{SCNoLEASTN}% +\indexlibraryglobal{SCNuLEASTN}% +\indexlibraryglobal{SCNxLEASTN}% +\indexlibraryglobal{PRIdFASTN}% +\indexlibraryglobal{PRIiFASTN}% +\indexlibraryglobal{PRIoFASTN}% +\indexlibraryglobal{PRIuFASTN}% +\indexlibraryglobal{PRIxFASTN}% +\indexlibraryglobal{PRIXFASTN}% +\indexlibraryglobal{SCNdFASTN}% +\indexlibraryglobal{SCNiFASTN}% +\indexlibraryglobal{SCNoFASTN}% +\indexlibraryglobal{SCNuFASTN}% +\indexlibraryglobal{SCNxFASTN}% +\indexlibraryglobal{PRIdMAX}% +\indexlibraryglobal{PRIiMAX}% +\indexlibraryglobal{PRIoMAX}% +\indexlibraryglobal{PRIuMAX}% +\indexlibraryglobal{PRIxMAX}% +\indexlibraryglobal{PRIXMAX}% +\indexlibraryglobal{SCNdMAX}% +\indexlibraryglobal{SCNiMAX}% +\indexlibraryglobal{SCNoMAX}% +\indexlibraryglobal{SCNuMAX}% +\indexlibraryglobal{SCNxMAX}% +\indexlibraryglobal{PRIdPTR}% +\indexlibraryglobal{PRIiPTR}% +\indexlibraryglobal{PRIoPTR}% +\indexlibraryglobal{PRIuPTR}% +\indexlibraryglobal{PRIxPTR}% +\indexlibraryglobal{PRIXPTR}% +\indexlibraryglobal{SCNdPTR}% +\indexlibraryglobal{SCNiPTR}% +\indexlibraryglobal{SCNoPTR}% +\indexlibraryglobal{SCNuPTR}% +\indexlibraryglobal{SCNxPTR}% \begin{codeblock} #include // see \ref{cstdint.syn} @@ -16788,8 +17230,8 @@ intmax_t wcstoimax(const wchar_t* nptr, wchar_t** endptr, int base); uintmax_t wcstoumax(const wchar_t* nptr, wchar_t** endptr, int base); - intmax_t abs(intmax_t); // optional, see below - imaxdiv_t div(intmax_t, intmax_t); // optional, see below + intmax_t abs(intmax_t); // optional, see below + imaxdiv_t div(intmax_t, intmax_t); // optional, see below } #define PRIdN @\seebelow@ @@ -16850,15 +17292,13 @@ \end{codeblock} \pnum -\indexhdr{inttypes.h}% -\indexhdr{cinttypes}% -The contents and meaning of the header \tcode{} -are the same as the C standard library header \tcode{}, +The contents and meaning of the header \libheader{cinttypes} +are the same as the C standard library header \libheader{inttypes.h}, with the following changes: \begin{itemize} \item -The header \tcode{} includes the header \tcode{} instead -of \tcode{}, and +The header \libheader{cinttypes} includes the header \libheaderref{cstdint} instead +of \libheader{stdint.h}, and \item if and only if the type \tcode{intmax_t} designates an extended integer type\iref{basic.fundamental}, the following function signatures are added: diff --git a/source/iterators.tex b/source/iterators.tex index cace82470d..5d55cb90ae 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -29,17 +29,17 @@ \rSec1[iterator.synopsis]{Header \tcode{}\ synopsis} -\indexhdr{iterator}% -\indexlibrary{\idxcode{default_sentinel}}% -\indexlibrary{\idxcode{unreachable_sentinel}}% +\indexheader{iterator}% +\indexlibraryglobal{default_sentinel}% +\indexlibraryglobal{unreachable_sentinel}% \begin{codeblock} #include namespace std { template using @\placeholder{with-reference}@ = T&; // \expos - template concept @\placeholder{can-reference}@ // \expos + template concept @\defexposconcept{can-reference}@ // \expos = requires { typename @\placeholdernc{with-reference}@; }; - template concept @\placeholder{dereferenceable}@ // \expos + template concept @\defexposconcept{dereferenceable}@ // \expos = requires(T& t) { { *t } -> @\placeholder{can-reference}@; // not required to be equality-preserving }; @@ -546,9 +546,11 @@ In addition to the requirements in this subclause, the nested \grammarterm{typedef-name}{s} specified in \ref{iterator.traits} shall be provided for the iterator type. -\begin{note} Either the iterator type must provide the \grammarterm{typedef-name}{s} directly +\begin{note} +Either the iterator type must provide the \grammarterm{typedef-name}{s} directly (in which case \tcode{iterator_traits} pick them up automatically), or -an \tcode{iterator_traits} specialization must provide them. \end{note} +an \tcode{iterator_traits} specialization must provide them. +\end{note} \pnum Just as a regular pointer to an array guarantees that there is a pointer value pointing past the last element @@ -579,7 +581,9 @@ the assignment of a non-singular value to an iterator that holds a singular value, and, for iterators that meet the \oldconcept{DefaultConstructible} requirements, using a value-initialized iterator -as the source of a copy or move operation. \begin{note} This guarantee is not +as the source of a copy or move operation. +\begin{note} +This guarantee is not offered for default-initialization, although the distinction only matters for types with trivial default constructors such as pointers or aggregates holding pointers. \end{note} @@ -677,7 +681,7 @@ \end{codeblock} be defined as the incrementable type's difference type. -\indexlibrary{\idxcode{incrementable_traits}}% +\indexlibraryglobal{incrementable_traits}% \begin{codeblock} namespace std { template struct incrementable_traits { }; @@ -710,7 +714,7 @@ } \end{codeblock} -\indexlibrary{\idxcode{iter_difference_t}}% +\indexlibraryglobal{iter_difference_t}% \pnum The type \tcode{iter_difference_t} denotes \begin{itemize} @@ -739,45 +743,45 @@ \end{codeblock} be defined as the readable type's value type. -\indexlibrary{\idxcode{readable_traits}}% +\indexlibraryglobal{readable_traits}% \begin{codeblock} - template struct @\placeholder{cond-value-type}@ { }; // \expos - template - requires is_object_v - struct @\placeholder{cond-value-type}@ { - using value_type = remove_cv_t; - }; +template struct @\placeholder{cond-value-type}@ { }; // \expos +template + requires is_object_v +struct @\placeholder{cond-value-type}@ { + using value_type = remove_cv_t; +}; - template struct readable_traits { }; +template struct readable_traits { }; - template - struct readable_traits - : @\placeholder{cond-value-type}@ { }; +template +struct readable_traits + : @\placeholder{cond-value-type}@ { }; - template - requires is_array_v - struct readable_traits { - using value_type = remove_cv_t>; - }; +template + requires is_array_v +struct readable_traits { + using value_type = remove_cv_t>; +}; - template - struct readable_traits - : readable_traits { }; +template +struct readable_traits + : readable_traits { }; - template - requires requires { typename T::value_type; } - struct readable_traits - : @\placeholder{cond-value-type}@ { }; +template + requires requires { typename T::value_type; } +struct readable_traits + : @\placeholder{cond-value-type}@ { }; - template - requires requires { typename T::element_type; } - struct readable_traits - : @\placeholder{cond-value-type}@ { }; +template + requires requires { typename T::element_type; } +struct readable_traits + : @\placeholder{cond-value-type}@ { }; - template using iter_value_t = @\seebelow@; +template using iter_value_t = @\seebelow@; \end{codeblock} -\indexlibrary{\idxcode{iter_value_t}}% +\indexlibraryglobal{iter_value_t}% \pnum The type \tcode{iter_value_t} denotes \begin{itemize} @@ -811,7 +815,7 @@ \rSec3[iterator.traits]{Iterator traits} \pnum -\indexlibrary{\idxcode{iterator_traits}}% +\indexlibraryglobal{iterator_traits}% To implement algorithms only in terms of iterators, it is sometimes necessary to determine the iterator category that corresponds to a particular iterator type. Accordingly, it is required that if @@ -920,11 +924,11 @@ \tcode{iterator_traits} has the following publicly accessible members: \begin{codeblock} - using iterator_category = typename I::iterator_category; - using value_type = typename I::value_type; - using difference_type = typename I::difference_type; - using pointer = @\seebelow@; - using reference = typename I::reference; +using iterator_category = typename I::iterator_category; +using value_type = typename I::value_type; +using difference_type = typename I::difference_type; +using pointer = @\seebelow@; +using reference = typename I::reference; \end{codeblock} If the \grammarterm{qualified-id} \tcode{I::pointer} is valid and denotes a type, then \tcode{iterator_traits::pointer} names that type; @@ -937,11 +941,11 @@ \tcode{iterator_traits} has the following publicly accessible members: \begin{codeblock} - using iterator_category = @\seebelow@; - using value_type = typename readable_traits::value_type; - using difference_type = typename incrementable_traits::difference_type; - using pointer = @\seebelow@; - using reference = @\seebelow@; +using iterator_category = @\seebelow@; +using value_type = typename readable_traits::value_type; +using difference_type = typename incrementable_traits::difference_type; +using pointer = @\seebelow@; +using reference = @\seebelow@; \end{codeblock} \begin{itemize} \item If the \grammarterm{qualified-id} \tcode{I::pointer} is valid and denotes a type, @@ -982,11 +986,11 @@ has the following publicly accessible members: \begin{codeblock} - using iterator_category = output_iterator_tag; - using value_type = void; - using difference_type = @\seebelow@; - using pointer = void; - using reference = void; +using iterator_category = output_iterator_tag; +using value_type = void; +using difference_type = @\seebelow@; +using pointer = void; +using reference = void; \end{codeblock} If the \grammarterm{qualified-id} \tcode{incrementable_traits::difference_type} is valid and denotes a type, @@ -1004,7 +1008,6 @@ \pnum \tcode{iterator_traits} is specialized for pointers as - \begin{codeblock} namespace std { template @@ -1025,7 +1028,6 @@ To implement a generic \tcode{reverse} function, a \Cpp{} program can do the following: - \begin{codeblock} template void reverse(BI first, BI last) { @@ -1047,7 +1049,7 @@ \rSec3[iterator.cust.move]{\tcode{ranges::iter_move}} -\indexlibrary{\idxcode{iter_move}}% +\indexlibraryglobal{iter_move}% \pnum The name \tcode{ranges::iter_move} denotes a customization point object\iref{customization.point.object}. @@ -1079,7 +1081,7 @@ \rSec3[iterator.cust.swap]{\tcode{ranges::iter_swap}} -\indexlibrary{\idxcode{iter_swap}}% +\indexlibraryglobal{iter_swap}% \pnum The name \tcode{ranges::iter_swap} denotes a customization point object\iref{customization.point.object} @@ -1097,7 +1099,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} iter_value_t> old_value(iter_move(x)); *x = iter_move(y); @@ -1108,7 +1111,6 @@ \pnum The expression \tcode{ranges::iter_swap(E1, E2)} for some subexpressions \tcode{E1} and \tcode{E2} is expression-equivalent to: - \begin{itemize} \item \tcode{(void)iter_swap(E1, E2)}, if that expression is valid, with overload resolution performed in a context that includes the declaration @@ -1196,10 +1198,9 @@ model the \libconcept{readable} concept, including pointers, smart pointers, and iterators. -\indexlibrary{\idxcode{readable}}% \begin{codeblock} template - concept readable = + concept @\deflibconcept{readable}@ = requires { typename iter_value_t; typename iter_reference_t; @@ -1224,17 +1225,16 @@ The \libconcept{writable} concept specifies the requirements for writing a value into an iterator's referenced object. -\indexlibrary{\idxcode{writable}}% \begin{codeblock} template - concept writable = + concept @\deflibconcept{writable}@ = requires(Out&& o, T&& t) { - *o = std::forward(t); // not required to be equality-preserving - *std::forward(o) = std::forward(t); // not required to be equality-preserving + *o = std::forward(t); // not required to be equality-preserving + *std::forward(o) = std::forward(t); // not required to be equality-preserving const_cast&&>(*o) = - std::forward(t); // not required to be equality-preserving + std::forward(t); // not required to be equality-preserving const_cast&&>(*std::forward(o)) = - std::forward(t); // not required to be equality-preserving + std::forward(t); // not required to be equality-preserving }; \end{codeblock} @@ -1242,7 +1242,6 @@ Let \tcode{E} be an an expression such that \tcode{decltype((E))} is \tcode{T}, and let \tcode{o} be a dereferenceable object of type \tcode{Out}. \tcode{Out} and \tcode{T} model \tcode{\libconcept{writable}} only if - \begin{itemize} \item If \tcode{Out} and \tcode{T} model \tcode{readable \&\& same_as, decay_t{>}}, @@ -1280,7 +1279,6 @@ The increment operations are not required to be equality-preserving, nor is the type required to be \libconcept{equality_comparable}. -\indexlibrary{\idxcode{weakly_incrementable}}% \begin{codeblock} template inline constexpr bool @\placeholder{is-integer-like}@ = @\seebelow@; @\itcorr[-2]@ // \expos @@ -1289,7 +1287,7 @@ inline constexpr bool @\placeholder{is-signed-integer-like}@ = @\seebelow@; @\itcorr[-2]@ // \expos template - concept weakly_incrementable = + concept @\deflibconcept{weakly_incrementable}@ = default_constructible && movable && requires(I i) { typename iter_difference_t; @@ -1408,7 +1406,6 @@ Let \tcode{i} be an object of type \tcode{I}. When \tcode{i} is in the domain of both pre- and post-increment, \tcode{i} is said to be \term{incrementable}. \tcode{I} models \tcode{\libconcept{weakly_incrementable}} only if - \begin{itemize} \item The expressions \tcode{++i} and \tcode{i++} have the same domain. \item If \tcode{i} is incrementable, then both \tcode{++i} @@ -1439,10 +1436,9 @@ in the definition of \tcode{weakly_incrementable}. \end{note} -\indexlibrary{\idxcode{incrementable}}% \begin{codeblock} template - concept incrementable = + concept @\deflibconcept{incrementable}@ = regular && weakly_incrementable && requires(I i) { @@ -1453,7 +1449,6 @@ \pnum Let \tcode{a} and \tcode{b} be incrementable objects of type \tcode{I}. \tcode{I} models \libconcept{incrementable} only if - \begin{itemize} \item If \tcode{bool(a == b)} then \tcode{bool(a++ == b)}. \item If \tcode{bool(a == b)} then \tcode{bool(((void)a++, a) == ++b)}. @@ -1482,10 +1477,9 @@ to provide a richer set of iterator movements (\ref{iterator.concept.forward}, \ref{iterator.concept.bidir}, \ref{iterator.concept.random.access}). -\indexlibrary{\idxcode{input_or_output_iterator}}% \begin{codeblock} template - concept input_or_output_iterator = + concept @\deflibconcept{input_or_output_iterator}@ = requires(I i) { { *i } -> @\placeholder{can-reference}@; } && @@ -1505,10 +1499,9 @@ between an \libconcept{input_or_output_iterator} type and a \libconcept{semiregular} type whose values denote a range. -\indexlibrary{\idxcode{sentinel_for}}% \begin{itemdecl} template - concept sentinel_for = + concept @\deflibconcept{sentinel_for}@ = semiregular && input_or_output_iterator && @\placeholder{weakly-equality-comparable-with}@; // See \ref{concept.equalitycomparable} @@ -1519,7 +1512,6 @@ Let \tcode{s} and \tcode{i} be values of type \tcode{S} and \tcode{I} such that \range{i}{s} denotes a range. Types \tcode{S} and \tcode{I} model \tcode{\libconcept{sentinel_for}} only if - \begin{itemize} \item \tcode{i == s} is well-defined. @@ -1545,11 +1537,9 @@ that allow the use of the \tcode{-} operator to compute the distance between them in constant time. -\indexlibrary{\idxcode{sized_sentinel_for}}% - \begin{itemdecl} template - concept sized_sentinel_for = + concept @\deflibconcept{sized_sentinel_for}@ = sentinel_for && !disable_sized_sentinel, remove_cv_t> && requires(const I& i, const S& s) { @@ -1565,7 +1555,6 @@ Let $N$ be the smallest number of applications of \tcode{++i} necessary to make \tcode{bool(i == s)} be \tcode{true}. \tcode{S} and \tcode{I} model \tcode{\libconcept{sized_sentinel_for}} only if - \begin{itemize} \item If $N$ is representable by \tcode{iter_difference_t}, then \tcode{s - i} is well-defined and equals $N$. @@ -1575,7 +1564,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{disable_sized_sentinel}}% +\indexlibraryglobal{disable_sized_sentinel}% \begin{itemdecl} template inline constexpr bool disable_sized_sentinel = false; @@ -1619,10 +1608,9 @@ equality comparison since iterators are typically compared to sentinels. \end{note} -\indexlibrary{\idxcode{input_iterator}}% \begin{codeblock} template - concept input_iterator = + concept @\deflibconcept{input_iterator}@ = input_or_output_iterator && readable && requires { typename @\placeholdernc{ITER_CONCEPT}@(I); } && @@ -1639,14 +1627,13 @@ Output iterators are not required to model \libconcept{equality_comparable}. \end{note} -\indexlibrary{\idxcode{output_iterator}}% \begin{codeblock} template - concept output_iterator = + concept @\deflibconcept{output_iterator}@ = input_or_output_iterator && writable && requires(I i, T&& t) { - *i++ = std::forward(t); // not required to be equality-preserving + *i++ = std::forward(t); // not required to be equality-preserving }; \end{codeblock} @@ -1655,8 +1642,8 @@ dereferenceable object of type \tcode{I}. \tcode{I} and \tcode{T} model \tcode{\libconcept{output_iterator}} only if \tcode{*i++ = E;} has effects equivalent to: \begin{codeblock} - *i = E; - ++i; +*i = E; +++i; \end{codeblock} \pnum @@ -1672,10 +1659,9 @@ copyability, equality comparison, and the multi-pass guarantee, specified below. -\indexlibrary{\idxcode{forward_iterator}}% \begin{codeblock} template - concept forward_iterator = + concept @\deflibconcept{forward_iterator}@ = input_iterator && derived_from<@\placeholdernc{ITER_CONCEPT}@(I), forward_iterator_tag> && incrementable && @@ -1698,7 +1684,6 @@ \pnum Two dereferenceable iterators \tcode{a} and \tcode{b} of type \tcode{X} offer the \defn{multi-pass guarantee} if: - \begin{itemize} \item \tcode{a == b} implies \tcode{++a == ++b} and \item The expression @@ -1723,10 +1708,9 @@ The \libconcept{bidirectional_iterator} concept adds the ability to move an iterator backward as well as forward. -\indexlibrary{\idxcode{bidirectional_iterator}}% \begin{codeblock} template - concept bidirectional_iterator = + concept @\deflibconcept{bidirectional_iterator}@ = forward_iterator && derived_from<@\placeholdernc{ITER_CONCEPT}@(I), bidirectional_iterator_tag> && requires(I i) { @@ -1743,7 +1727,6 @@ \pnum Let \tcode{a} and \tcode{b} be equal objects of type \tcode{I}. \tcode{I} models \libconcept{bidirectional_iterator} only if: - \begin{itemize} \item If \tcode{a} and \tcode{b} are decrementable, then all of the following are \tcode{true}: @@ -1766,10 +1749,9 @@ as well as the computation of distance in constant time with \tcode{-}. Random access iterators also support array notation via subscripting. -\indexlibrary{\idxcode{random_access_iterator}}% \begin{codeblock} template - concept random_access_iterator = + concept @\deflibconcept{random_access_iterator}@ = bidirectional_iterator && derived_from<@\placeholdernc{ITER_CONCEPT}@(I), random_access_iterator_tag> && totally_ordered && @@ -1791,7 +1773,6 @@ let \tcode{D} be \tcode{iter_difference_t}, and let \tcode{n} denote a value of type \tcode{D}. \tcode{I} models \libconcept{random_access_iterator} only if - \begin{itemize} \item \tcode{(a += n)} is equal to \tcode{b}. \item \tcode{addressof(a += n)} is equal to \tcode{addressof(a)}. @@ -1818,10 +1799,9 @@ The \libconcept{contiguous_iterator} concept provides a guarantee that the denoted elements are stored contiguously in memory. -\indexlibrary{\idxcode{contiguous_iterator}}% \begin{codeblock} template - concept @\libconcept{contiguous_iterator}@ = + concept @\deflibconcept{contiguous_iterator}@ = random_access_iterator && derived_from<@\placeholdernc{ITER_CONCEPT}@(I), contiguous_iterator_tag> && is_lvalue_reference_v> && @@ -1872,8 +1852,10 @@ \tcode{T}, \tcode{o} denotes a value of some type that is writable to the output iterator. -\begin{note} For an iterator type \tcode{X} there must be an instantiation -of \tcode{iterator_traits}\iref{iterator.traits}. \end{note} +\begin{note} +For an iterator type \tcode{X} there must be an instantiation +of \tcode{iterator_traits}\iref{iterator.traits}. +\end{note} \rSec3[iterator.iterators]{\oldconcept{Iterator}} @@ -1888,7 +1870,6 @@ \pnum A type \tcode{X} meets the \oldconcept{Iterator} requirements if: - \begin{itemize} \item \tcode{X} meets the \oldconcept{CopyConstructible}, \oldconcept{CopyAssignable}, and \oldconcept{Destructible} requirements\iref{utility.arg.requirements} and lvalues @@ -2098,7 +2079,6 @@ A class or pointer type \tcode{X} meets the requirements of a forward iterator if - \begin{itemize} \item \tcode{X} meets the \oldconcept{InputIterator} requirements\iref{input.iterators}, @@ -2118,13 +2098,14 @@ The domain of \tcode{==} for forward iterators is that of iterators over the same underlying sequence. However, value-initialized iterators may be compared and shall compare equal to other value-initialized iterators of the same type. -\begin{note} Value-initialized iterators behave as if they refer past the end of -the same empty sequence. \end{note} +\begin{note} +Value-initialized iterators behave as if they refer past the end of +the same empty sequence. +\end{note} \pnum Two dereferenceable iterators \tcode{a} and \tcode{b} of type \tcode{X} offer the \defn{multi-pass guarantee} if: - \begin{itemize} \item \tcode{a == b} implies \tcode{++a == ++b} and \item \tcode{X} is a pointer type or the expression @@ -2318,15 +2299,10 @@ The indirect callable concepts are used to constrain those algorithms that accept callable objects~(\ref{func.def}) as arguments. -\indexlibrary{\idxcode{indirectly_unary_invocable}}% -\indexlibrary{\idxcode{indirectly_regular_unary_invocable}}% -\indexlibrary{\idxcode{indirect_unary_predicate}}% -\indexlibrary{\idxcode{indirect_relation}}% -\indexlibrary{\idxcode{indirect_strict_weak_order}}% \begin{codeblock} namespace std { template - concept indirectly_unary_invocable = + concept @\deflibconcept{indirectly_unary_invocable}@ = readable && copy_constructible && invocable&> && @@ -2337,7 +2313,7 @@ invoke_result_t>>; template - concept indirectly_regular_unary_invocable = + concept @\deflibconcept{indirectly_regular_unary_invocable}@ = readable && copy_constructible && regular_invocable&> && @@ -2348,7 +2324,7 @@ invoke_result_t>>; template - concept indirect_unary_predicate = + concept @\deflibconcept{indirect_unary_predicate}@ = readable && copy_constructible && predicate&> && @@ -2356,7 +2332,7 @@ predicate>; template - concept indirect_relation = + concept @\deflibconcept{indirect_relation}@ = readable && readable && copy_constructible && relation&, iter_value_t&> && @@ -2366,7 +2342,7 @@ relation, iter_common_reference_t>; template - concept indirect_strict_weak_order = + concept @\deflibconcept{indirect_strict_weak_order}@ = readable && readable && copy_constructible && strict_weak_order&, iter_value_t&> && @@ -2387,13 +2363,13 @@ whose \tcode{reference} type is the result of applying \tcode{Proj} to the \tcode{iter_reference_t} of \tcode{I}. -\indexlibrary{\idxcode{projected}}% +\indexlibraryglobal{projected}% \begin{codeblock} namespace std { template Proj> struct projected { using value_type = remove_cvref_t>; - indirect_result_t operator*() const; // \notdef + indirect_result_t operator*() const; // \notdef }; template @@ -2438,10 +2414,9 @@ a \libconcept{readable} type and a \libconcept{writable} type between which values may be moved. -\indexlibrary{\idxcode{indirectly_movable}}% \begin{codeblock} template - concept indirectly_movable = + concept @\deflibconcept{indirectly_movable}@ = readable && writable>; \end{codeblock} @@ -2452,10 +2427,9 @@ the transfer to be performed through an intermediate object of the \libconcept{readable} type's value type. -\indexlibrary{\idxcode{indirectly_movable_storable}}% \begin{codeblock} template - concept indirectly_movable_storable = + concept @\deflibconcept{indirectly_movable_storable}@ = indirectly_movable && writable> && movable> && @@ -2482,10 +2456,9 @@ a \libconcept{readable} type and a \libconcept{writable} type between which values may be copied. -\indexlibrary{\idxcode{indirectly_copyable}}% \begin{codeblock} template - concept indirectly_copyable = + concept @\deflibconcept{indirectly_copyable}@ = readable && writable>; \end{codeblock} @@ -2497,10 +2470,9 @@ \libconcept{readable} type's value type. It also requires the capability to make copies of values. -\indexlibrary{\idxcode{indirectly_copyable_storable}}% \begin{codeblock} template - concept indirectly_copyable_storable = + concept @\deflibconcept{indirectly_copyable_storable}@ = indirectly_copyable && writable&> && copyable> && @@ -2526,10 +2498,9 @@ The \libconcept{indirectly_swappable} concept specifies a swappable relationship between the values referenced by two \libconcept{readable} types. -\indexlibrary{\idxcode{indirectly_swappable}}% \begin{codeblock} template - concept indirectly_swappable = + concept @\deflibconcept{indirectly_swappable}@ = readable && readable && requires(I1& i1, I2& i2) { ranges::iter_swap(i1, i1); @@ -2546,11 +2517,10 @@ the common requirements of algorithms that compare values from two different sequences. -\indexlibrary{\idxcode{indirectly_comparable}}% \begin{codeblock} template - concept indirectly_comparable = + concept @\deflibconcept{indirectly_comparable}@ = indirect_relation, projected>; \end{codeblock} @@ -2560,10 +2530,9 @@ The \libconcept{permutable} concept specifies the common requirements of algorithms that reorder elements in place by moving or swapping them. -\indexlibrary{\idxcode{permutable}}% \begin{codeblock} template - concept permutable = + concept @\deflibconcept{permutable}@ = forward_iterator && indirectly_movable_storable && indirectly_swappable; @@ -2575,11 +2544,10 @@ The \libconcept{mergeable} concept specifies the requirements of algorithms that merge sorted sequences into an output sequence by copying elements. -\indexlibrary{\idxcode{mergeable}}% \begin{codeblock} template - concept mergeable = + concept @\deflibconcept{mergeable}@ = input_iterator && input_iterator && weakly_incrementable && @@ -2594,10 +2562,9 @@ The \libconcept{sortable} concept specifies the common requirements of algorithms that permute sequences into ordered sequences (e.g., \tcode{sort}). -\indexlibrary{\idxcode{sortable}}% \begin{codeblock} template - concept sortable = + concept @\deflibconcept{sortable}@ = permutable && indirect_strict_weak_order>; \end{codeblock} @@ -2611,12 +2578,12 @@ \rSec2[std.iterator.tags]{Standard iterator tags} \pnum -\indexlibrary{\idxcode{output_iterator_tag}}% -\indexlibrary{\idxcode{input_iterator_tag}}% -\indexlibrary{\idxcode{forward_iterator_tag}}% -\indexlibrary{\idxcode{bidirectional_iterator_tag}}% -\indexlibrary{\idxcode{random_access_iterator_tag}}% -\indexlibrary{\idxcode{contiguous_iterator_tag}}% +\indexlibraryglobal{output_iterator_tag}% +\indexlibraryglobal{input_iterator_tag}% +\indexlibraryglobal{forward_iterator_tag}% +\indexlibraryglobal{bidirectional_iterator_tag}% +\indexlibraryglobal{random_access_iterator_tag}% +\indexlibraryglobal{contiguous_iterator_tag}% It is often desirable for a function template specialization to find out what is the most specific category of its iterator @@ -2727,7 +2694,7 @@ to provide linear time implementations. -\indexlibrary{\idxcode{advance}}% +\indexlibraryglobal{advance}% \begin{itemdecl} template constexpr void advance(InputIterator& i, Distance n); @@ -2745,7 +2712,7 @@ decrements \tcode{i} by \tcode{-n} otherwise. \end{itemdescr} -\indexlibrary{\idxcode{distance}}% +\indexlibraryglobal{distance}% \begin{itemdecl} template constexpr typename iterator_traits::difference_type @@ -2770,7 +2737,7 @@ \tcode{last}. \end{itemdescr} -\indexlibrary{\idxcode{next}}% +\indexlibraryglobal{next}% \begin{itemdecl} template constexpr InputIterator next(InputIterator x, @@ -2779,10 +2746,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{advance(x, n); return x;} +\effects +Equivalent to: \tcode{advance(x, n); return x;} \end{itemdescr} -\indexlibrary{\idxcode{prev}}% +\indexlibraryglobal{prev}% \begin{itemdecl} template constexpr BidirectionalIterator prev(BidirectionalIterator x, @@ -2791,7 +2759,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{advance(x, -n); return x;} +\effects +Equivalent to: \tcode{advance(x, -n); return x;} \end{itemdescr} \rSec2[range.iter.ops]{Range iterator operations} @@ -2841,7 +2810,7 @@ \rSec3[range.iter.op.advance]{\tcode{ranges::advance}} -\indexlibrary{\idxcode{advance}}% +\indexlibraryglobal{advance}% \begin{itemdecl} template constexpr void ranges::advance(I& i, iter_difference_t n); @@ -2864,7 +2833,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{advance}}% +\indexlibraryglobal{advance}% \begin{itemdecl} template S> constexpr void ranges::advance(I& i, S bound); @@ -2887,7 +2856,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{advance}}% +\indexlibraryglobal{advance}% \begin{itemdecl} template S> constexpr iter_difference_t ranges::advance(I& i, iter_difference_t n, S bound); @@ -2929,7 +2898,7 @@ \end{itemdescr} \rSec3[range.iter.op.distance]{\tcode{ranges::distance}} -\indexlibrary{\idxcode{distance}}% +\indexlibraryglobal{distance}% \begin{itemdecl} template S> constexpr iter_difference_t ranges::distance(I first, S last); @@ -2953,7 +2922,7 @@ \tcode{last}. \end{itemdescr} -\indexlibrary{\idxcode{distance}}% +\indexlibraryglobal{distance}% \begin{itemdecl} template constexpr range_difference_t ranges::distance(R&& r); @@ -2974,7 +2943,7 @@ \rSec3[range.iter.op.next]{\tcode{ranges::next}} -\indexlibrary{\idxcode{next}}% +\indexlibraryglobal{next}% \begin{itemdecl} template constexpr I ranges::next(I x); @@ -2982,10 +2951,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{++x; return x;} +\effects +Equivalent to: \tcode{++x; return x;} \end{itemdescr} -\indexlibrary{\idxcode{next}}% +\indexlibraryglobal{next}% \begin{itemdecl} template constexpr I ranges::next(I x, iter_difference_t n); @@ -2993,10 +2963,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{ranges::advance(x, n); return x;} +\effects +Equivalent to: \tcode{ranges::advance(x, n); return x;} \end{itemdescr} -\indexlibrary{\idxcode{next}}% +\indexlibraryglobal{next}% \begin{itemdecl} template S> constexpr I ranges::next(I x, S bound); @@ -3004,10 +2975,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{ranges::advance(x, bound); return x;} +\effects +Equivalent to: \tcode{ranges::advance(x, bound); return x;} \end{itemdescr} -\indexlibrary{\idxcode{next}}% +\indexlibraryglobal{next}% \begin{itemdecl} template S> constexpr I ranges::next(I x, iter_difference_t n, S bound); @@ -3015,11 +2987,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{ranges::advance(x, n, bound); return x;} +\effects +Equivalent to: \tcode{ranges::advance(x, n, bound); return x;} \end{itemdescr} \rSec3[range.iter.op.prev]{\tcode{ranges::prev}} -\indexlibrary{\idxcode{prev}}% +\indexlibraryglobal{prev}% \begin{itemdecl} template constexpr I ranges::prev(I x); @@ -3027,10 +3000,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{-{-}x; return x;} +\effects +Equivalent to: \tcode{-{-}x; return x;} \end{itemdescr} -\indexlibrary{\idxcode{prev}}% +\indexlibraryglobal{prev}% \begin{itemdecl} template constexpr I ranges::prev(I x, iter_difference_t n); @@ -3038,10 +3012,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{ranges::advance(x, -n); return x;} +\effects +Equivalent to: \tcode{ranges::advance(x, -n); return x;} \end{itemdescr} -\indexlibrary{\idxcode{prev}}% +\indexlibraryglobal{prev}% \begin{itemdecl} template constexpr I ranges::prev(I x, iter_difference_t n, I bound); @@ -3049,7 +3024,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{ranges::advance(x, -n, bound); return x;} +\effects +Equivalent to: \tcode{ranges::advance(x, -n, bound); return x;} \end{itemdescr} \rSec1[predef.iterators]{Iterator adaptors} @@ -3061,7 +3037,7 @@ \rSec3[reverse.iterator]{Class template \tcode{reverse_iterator}} -\indexlibrary{\idxcode{reverse_iterator}}% +\indexlibraryglobal{reverse_iterator}% \begin{codeblock} namespace std { template @@ -3172,7 +3148,7 @@ \rSec3[reverse.iter.cons]{Construction and assignment} -\indexlibrary{\idxcode{reverse_iterator}!constructor}% +\indexlibraryctor{reverse_iterator}% \begin{itemdecl} constexpr reverse_iterator(); \end{itemdecl} @@ -3187,7 +3163,7 @@ \tcode{Iterator}. \end{itemdescr} -\indexlibrary{\idxcode{reverse_iterator}!constructor}% +\indexlibraryctor{reverse_iterator}% \begin{itemdecl} constexpr explicit reverse_iterator(Iterator x); \end{itemdecl} @@ -3200,7 +3176,7 @@ with \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{reverse_iterator}!constructor}% +\indexlibraryctor{reverse_iterator}% \begin{itemdecl} template constexpr reverse_iterator(const reverse_iterator& u); \end{itemdecl} @@ -3582,14 +3558,16 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = i.base(); return ranges::iter_move(--tmp); \end{codeblock} \pnum -\remarks The expression in \tcode{noexcept} is equivalent to: +\remarks +The expression in \tcode{noexcept} is equivalent to: \begin{codeblock} is_nothrow_copy_constructible_v && noexcept(ranges::iter_move(--declval())) @@ -3606,7 +3584,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto xtmp = x.base(); auto ytmp = y.base(); @@ -3614,7 +3593,8 @@ \end{codeblock} \pnum -\remarks The expression in \tcode{noexcept} is equivalent to: +\remarks +The expression in \tcode{noexcept} is equivalent to: \begin{codeblock} is_nothrow_copy_constructible_v && is_nothrow_copy_constructible_v && @@ -3623,7 +3603,7 @@ \end{itemdescr} \indexlibrary{\idxcode{reverse_iterator}!\idxcode{make_reverse_iterator} non-member function}% -\indexlibrary{\idxcode{make_reverse_iterator}}% +\indexlibraryglobal{make_reverse_iterator}% \begin{itemdecl} template constexpr reverse_iterator make_reverse_iterator(Iterator i); @@ -3643,11 +3623,9 @@ \term{insert iterators}, are provided in the library. With regular iterator classes, - \begin{codeblock} while (first != last) *result++ = *first++; \end{codeblock} - causes a range \range{first}{last} to be copied into a range starting with result. The same code with @@ -3686,7 +3664,7 @@ \rSec3[back.insert.iterator]{Class template \tcode{back_insert_iterator}} -\indexlibrary{\idxcode{back_insert_iterator}}% +\indexlibraryglobal{back_insert_iterator}% \begin{codeblock} namespace std { template @@ -3716,7 +3694,7 @@ \rSec4[back.insert.iter.ops]{Operations} -\indexlibrary{\idxcode{back_insert_iterator}!constructor}% +\indexlibraryctor{back_insert_iterator}% \begin{itemdecl} constexpr explicit back_insert_iterator(Container& x); \end{itemdecl} @@ -3784,7 +3762,7 @@ \rSec4[back.inserter]{ \tcode{back_inserter}} -\indexlibrary{\idxcode{back_inserter}}% +\indexlibraryglobal{back_inserter}% \begin{itemdecl} template constexpr back_insert_iterator back_inserter(Container& x); @@ -3798,7 +3776,7 @@ \rSec3[front.insert.iterator]{Class template \tcode{front_insert_iterator}} -\indexlibrary{\idxcode{front_insert_iterator}}% +\indexlibraryglobal{front_insert_iterator}% \begin{codeblock} namespace std { template @@ -3828,7 +3806,7 @@ \rSec4[front.insert.iter.ops]{Operations} -\indexlibrary{\idxcode{front_insert_iterator}!constructor}% +\indexlibraryctor{front_insert_iterator}% \begin{itemdecl} constexpr explicit front_insert_iterator(Container& x); \end{itemdecl} @@ -3896,7 +3874,7 @@ \rSec4[front.inserter]{\tcode{front_inserter}} -\indexlibrary{\idxcode{front_inserter}}% +\indexlibraryglobal{front_inserter}% \begin{itemdecl} template constexpr front_insert_iterator front_inserter(Container& x); @@ -3910,7 +3888,7 @@ \rSec3[insert.iterator]{Class template \tcode{insert_iterator}} -\indexlibrary{\idxcode{insert_iterator}}% +\indexlibraryglobal{insert_iterator}% \begin{codeblock} namespace std { template @@ -3941,7 +3919,7 @@ \rSec4[insert.iter.ops]{Operations} -\indexlibrary{\idxcode{insert_iterator}!constructor}% +\indexlibraryctor{insert_iterator}% \begin{itemdecl} constexpr insert_iterator(Container& x, ranges::iterator_t i); \end{itemdecl} @@ -4019,7 +3997,7 @@ \rSec4[inserter]{\tcode{inserter}} -\indexlibrary{\idxcode{inserter}}% +\indexlibraryglobal{inserter}% \begin{itemdecl} template constexpr insert_iterator @@ -4044,7 +4022,6 @@ \pnum \begin{example} - \begin{codeblock} list s; // populate the list \tcode{s} @@ -4057,7 +4034,7 @@ \rSec3[move.iterator]{Class template \tcode{move_iterator}} -\indexlibrary{\idxcode{move_iterator}}% +\indexlibraryglobal{move_iterator}% \begin{codeblock} namespace std { template @@ -4144,43 +4121,47 @@ \rSec3[move.iter.cons]{Construction and assignment} -\indexlibrary{\idxcode{move_iterator}!constructor}% +\indexlibraryctor{move_iterator}% \begin{itemdecl} constexpr move_iterator(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs a \tcode{move_iterator}, value-initializing +\effects +Constructs a \tcode{move_iterator}, value-initializing \tcode{current}. Iterator operations applied to the resulting iterator have defined behavior if and only if the corresponding operations are defined on a value-initialized iterator of type \tcode{Iterator}. \end{itemdescr} -\indexlibrary{\idxcode{move_iterator}!constructor}% +\indexlibraryctor{move_iterator}% \begin{itemdecl} constexpr explicit move_iterator(Iterator i); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs a \tcode{move_iterator}, initializing +\effects +Constructs a \tcode{move_iterator}, initializing \tcode{current} with \tcode{std::move(i)}. \end{itemdescr} -\indexlibrary{\idxcode{move_iterator}!constructor}% +\indexlibraryctor{move_iterator}% \begin{itemdecl} template constexpr move_iterator(const move_iterator& u); \end{itemdecl} \begin{itemdescr} \pnum -\mandates \tcode{U} is convertible to \tcode{Iterator}. +\mandates +\tcode{U} is convertible to \tcode{Iterator}. \pnum -\effects Constructs a \tcode{move_iterator}, initializing +\effects +Constructs a \tcode{move_iterator}, initializing \tcode{current} with \tcode{u.base()}. \end{itemdescr} @@ -4191,10 +4172,12 @@ \begin{itemdescr} \pnum -\mandates \tcode{U} is convertible to \tcode{Iterator}. +\mandates +\tcode{U} is convertible to \tcode{Iterator}. \pnum -\effects Assigns \tcode{u.base()} to +\effects +Assigns \tcode{u.base()} to \tcode{current}. \end{itemdescr} @@ -4210,10 +4193,12 @@ \constraints \tcode{Iterator} satisfies \libconcept{copy_constructible}. \pnum -\expects \tcode{Iterator} models \libconcept{copy_constructible}. +\expects +\tcode{Iterator} models \libconcept{copy_constructible}. \pnum -\returns \tcode{current}. +\returns +\tcode{current}. \end{itemdescr} \indexlibrarymember{base}{move_iterator}% @@ -4223,7 +4208,8 @@ \begin{itemdescr} \pnum -\returns \tcode{std::move(current)}. +\returns +\tcode{std::move(current)}. \end{itemdescr} \rSec3[move.iter.elem]{Element access} @@ -4235,7 +4221,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return ranges::iter_move(current);} +\effects +Equivalent to: \tcode{return ranges::iter_move(current);} \end{itemdescr} \indexlibrarymember{operator[]}{move_iterator}% @@ -4245,7 +4232,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{ranges::iter_move(current + n);} +\effects +Equivalent to: \tcode{ranges::iter_move(current + n);} \end{itemdescr} \rSec3[move.iter.nav]{Navigation} @@ -4257,10 +4245,12 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{++current}. +\effects +As if by \tcode{++current}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator++}{move_iterator}% @@ -4287,10 +4277,12 @@ \begin{itemdescr} \pnum -\effects As if by \tcode{\dcr current}. +\effects +As if by \tcode{\dcr current}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator\dcr}{move_iterator}% @@ -4316,7 +4308,8 @@ \begin{itemdescr} \pnum -\returns \tcode{move_iterator(current + n)}. +\returns +\tcode{move_iterator(current + n)}. \end{itemdescr} \indexlibrarymember{operator+=}{move_iterator}% @@ -4326,10 +4319,12 @@ \begin{itemdescr} \pnum -\effects As if by: \tcode{current += n;} +\effects +As if by: \tcode{current += n;} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator-}{move_iterator}% @@ -4339,7 +4334,8 @@ \begin{itemdescr} \pnum -\returns \tcode{move_iterator(current - n)}. +\returns +\tcode{move_iterator(current - n)}. \end{itemdescr} \indexlibrarymember{operator-=}{move_iterator}% @@ -4349,10 +4345,12 @@ \begin{itemdescr} \pnum -\effects As if by: \tcode{current -= n;} +\effects +As if by: \tcode{current -= n;} \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \rSec3[move.iter.op.comp]{Comparisons} @@ -4374,7 +4372,8 @@ convertible to \tcode{bool}. \pnum -\returns \tcode{x.base() == y.base()}. +\returns +\tcode{x.base() == y.base()}. \end{itemdescr} \indexlibrarymember{operator<}{move_iterator}% @@ -4390,7 +4389,8 @@ convertible to \tcode{bool}. \pnum -\returns \tcode{x.base() < y.base()}. +\returns +\tcode{x.base() < y.base()}. \end{itemdescr} \indexlibrarymember{operator>}{move_iterator}% @@ -4406,7 +4406,8 @@ convertible to \tcode{bool}. \pnum -\returns \tcode{y < x}. +\returns +\tcode{y < x}. \end{itemdescr} \indexlibrarymember{operator<=}{move_iterator}% @@ -4422,7 +4423,8 @@ convertible to \tcode{bool}. \pnum -\returns \tcode{!(y < x)}. +\returns +\tcode{!(y < x)}. \end{itemdescr} \indexlibrarymember{operator>=}{move_iterator}% @@ -4438,7 +4440,8 @@ convertible to \tcode{bool}. \pnum -\returns \tcode{!(x < y)}. +\returns +\tcode{!(x < y)}. \end{itemdescr} \indexlibrarymember{operator<=>}{move_iterator}% @@ -4473,7 +4476,8 @@ \begin{itemdescr} \pnum -\returns \tcode{x.base() - y.base()}. +\returns +\tcode{x.base() - y.base()}. \end{itemdescr} \indexlibrarymember{operator+}{move_iterator}% @@ -4489,7 +4493,8 @@ \tcode{x + n} is well-formed and has type \tcode{Iterator}. \pnum -\returns \tcode{x + n}. +\returns +\tcode{x + n}. \end{itemdescr} \indexlibrarymember{iter_move}{move_iterator}% @@ -4501,7 +4506,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return ranges::iter_move(i.current);} +\effects +Equivalent to: \tcode{return ranges::iter_move(i.current);} \end{itemdescr} \indexlibrarymember{iter_swap}{move_iterator}% @@ -4514,10 +4520,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{ranges::iter_swap(x.current, y.current)}. +\effects +Equivalent to: \tcode{ranges::iter_swap(x.current, y.current)}. \end{itemdescr} -\indexlibrary{\idxcode{make_move_iterator}}% +\indexlibraryglobal{make_move_iterator}% \begin{itemdecl} template constexpr move_iterator make_move_iterator(Iterator i); @@ -4525,7 +4532,8 @@ \begin{itemdescr} \pnum -\returns \tcode{move_iterator(i)}. +\returns +\tcode{move_iterator(i)}. \end{itemdescr} \rSec3[move.sentinel]{Class template \tcode{move_sentinel}} @@ -4552,7 +4560,7 @@ \end{codeblock} \end{example} -\indexlibrary{\idxcode{move_sentinel}}% +\indexlibraryglobal{move_sentinel}% \begin{codeblock} namespace std { template @@ -4576,29 +4584,31 @@ \rSec3[move.sent.ops]{Operations} -\indexlibrary{\idxcode{move_sentinel}!constructor}% +\indexlibraryctor{move_sentinel}% \begin{itemdecl} constexpr move_sentinel(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Value-initializes \tcode{last}. +\effects +Value-initializes \tcode{last}. If \tcode{is_trivially_default_constructible_v} is \tcode{true}, then this constructor is a \tcode{constexpr} constructor. \end{itemdescr} -\indexlibrary{\idxcode{move_sentinel}!constructor}% +\indexlibraryctor{move_sentinel}% \begin{itemdecl} constexpr explicit move_sentinel(S s); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{last} with \tcode{std::move(s)}. +\effects +Initializes \tcode{last} with \tcode{std::move(s)}. \end{itemdescr} -\indexlibrary{\idxcode{move_sentinel}!constructor}% +\indexlibraryctor{move_sentinel}% \begin{itemdecl} template requires convertible_to @@ -4607,11 +4617,12 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{last} with \tcode{s.last}. +\effects +Initializes \tcode{last} with \tcode{s.last}. \end{itemdescr} -\indexlibrary{\idxcode{operator=}!\idxcode{move_sentinel}}% -\indexlibrary{\idxcode{move_sentinel}!\idxcode{operator=}}% +\indexlibrarymember{operator=}{move_sentinel}% +\indexlibrarymember{move_sentinel}{operator=}% \begin{itemdecl} template requires assignable_from @@ -4620,7 +4631,19 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{last = s.last; return *this;} +\effects +Equivalent to: \tcode{last = s.last; return *this;} +\end{itemdescr} + +\indexlibrarymember{base}{move_sentinel}% +\begin{itemdecl} +constexpr S base() const; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +\tcode{last}. \end{itemdescr} \rSec2[iterators.common]{Common iterators} @@ -4654,7 +4677,7 @@ \end{codeblock} \end{example} -\indexlibrary{\idxcode{common_iterator}}% +\indexlibraryglobal{common_iterator}% \begin{codeblock} namespace std { template S> @@ -4751,7 +4774,7 @@ \rSec3[common.iter.const]{Constructors and conversions} -\indexlibrary{\idxcode{common_iterator}!constructor}% +\indexlibraryctor{common_iterator}% \begin{itemdecl} constexpr common_iterator(I i); \end{itemdecl} @@ -4762,18 +4785,19 @@ Initializes \tcode{v_} as if by \tcode{v_\{in_place_type, std::move(i)\}}. \end{itemdescr} -\indexlibrary{\idxcode{common_iterator}!constructor}% +\indexlibraryctor{common_iterator}% \begin{itemdecl} constexpr common_iterator(S s); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{v_} as if by +\effects +Initializes \tcode{v_} as if by \tcode{v_\{in_place_type, std::move(s)\}}. \end{itemdescr} -\indexlibrary{\idxcode{common_iterator}!constructor}% +\indexlibraryctor{common_iterator}% \begin{itemdecl} template requires convertible_to && convertible_to @@ -4782,7 +4806,8 @@ \begin{itemdescr} \pnum -\expects \tcode{x.v_.valueless_by_exception()} is \tcode{false}. +\expects +\tcode{x.v_.valueless_by_exception()} is \tcode{false}. \pnum \effects @@ -4801,7 +4826,8 @@ \begin{itemdescr} \pnum -\expects \tcode{x.v_.valueless_by_exception()} is \tcode{false}. +\expects +\tcode{x.v_.valueless_by_exception()} is \tcode{false}. \pnum \effects @@ -4815,7 +4841,8 @@ where $i$ is \tcode{x.v_.index()}. \pnum -\returns \tcode{*this} +\returns +\tcode{*this} \end{itemdescr} \rSec3[common.iter.access]{Accessors} @@ -4829,10 +4856,12 @@ \begin{itemdescr} \pnum -\expects \tcode{holds_alternative(v_)}. +\expects +\tcode{holds_alternative(v_)}. \pnum -\effects Equivalent to: \tcode{return *get(v_);} +\effects +Equivalent to: \tcode{return *get(v_);} \end{itemdescr} \indexlibrarymember{operator->}{common_iterator}% @@ -4852,7 +4881,8 @@ \end{codeblock} \pnum -\expects \tcode{holds_alternative(v_)}. +\expects +\tcode{holds_alternative(v_)}. \pnum \effects @@ -4896,13 +4926,16 @@ \begin{itemdescr} \pnum -\expects \tcode{holds_alternative(v_)}. +\expects +\tcode{holds_alternative(v_)}. \pnum -\effects Equivalent to \tcode{++get(v_)}. +\effects +Equivalent to \tcode{++get(v_)}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator++}{common_iterator}% @@ -4912,7 +4945,8 @@ \begin{itemdescr} \pnum -\expects \tcode{holds_alternative(v_)}. +\expects +\tcode{holds_alternative(v_)}. \pnum \effects @@ -5001,10 +5035,12 @@ \begin{itemdescr} \pnum -\expects \tcode{holds_alternative(v_)}. +\expects +\tcode{holds_alternative(v_)}. \pnum -\effects Equivalent to: \tcode{return ranges::iter_move(get(i.v_));} +\effects +Equivalent to: \tcode{return ranges::iter_move(get(i.v_));} \end{itemdescr} \indexlibrarymember{iter_swap}{common_iterator}% @@ -5021,12 +5057,13 @@ are each \tcode{true}. \pnum -\effects Equivalent to \tcode{ranges::iter_swap(get(x.v_), get(y.v_))}. +\effects +Equivalent to \tcode{ranges::iter_swap(get(x.v_), get(y.v_))}. \end{itemdescr} \rSec2[default.sentinels]{Default sentinels} -\indexlibrary{\idxcode{default_sentinel_t}}% +\indexlibraryglobal{default_sentinel_t}% \begin{itemdecl} namespace std { struct default_sentinel_t { }; @@ -5073,7 +5110,7 @@ \tcode{next(i2.base(), i2.count())} refer to the same (possibly past-the-end) element. -\indexlibrary{\idxcode{counted_iterator}}% +\indexlibraryglobal{counted_iterator}% \begin{codeblock} namespace std { template @@ -5166,14 +5203,15 @@ \rSec3[counted.iter.const]{Constructors and conversions} -\indexlibrary{\idxcode{counted_iterator}!constructor}% +\indexlibraryctor{counted_iterator}% \begin{itemdecl} constexpr counted_iterator(I i, iter_difference_t n); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{n >= 0}. +\expects +\tcode{n >= 0}. \pnum \effects @@ -5181,7 +5219,7 @@ \tcode{length} with \tcode{n}. \end{itemdescr} -\indexlibrary{\idxcode{counted_iterator}!constructor}% +\indexlibraryctor{counted_iterator}% \begin{itemdecl} template requires convertible_to @@ -5209,7 +5247,8 @@ \tcode{x.length} to \tcode{length}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \rSec3[counted.iter.access]{Accessors} @@ -5221,7 +5260,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return current;} +\effects +Equivalent to: \tcode{return current;} \end{itemdescr} \indexlibrarymember{base}{counted_iterator}% @@ -5231,7 +5271,8 @@ \begin{itemdescr} \pnum -\returns \tcode{std::move(current)}. +\returns +\tcode{std::move(current)}. \end{itemdescr} \indexlibrarymember{count}{counted_iterator}% @@ -5241,7 +5282,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return length;} +\effects +Equivalent to: \tcode{return length;} \end{itemdescr} \rSec3[counted.iter.elem]{Element access} @@ -5255,7 +5297,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return *current;} +\effects +Equivalent to: \tcode{return *current;} \end{itemdescr} \indexlibrarymember{operator[]}{counted_iterator}% @@ -5266,10 +5309,12 @@ \begin{itemdescr} \pnum -\expects \tcode{n < length}. +\expects +\tcode{n < length}. \pnum -\effects Equivalent to: \tcode{return current[n];} +\effects +Equivalent to: \tcode{return current[n];} \end{itemdescr} \rSec3[counted.iter.nav]{Navigation} @@ -5281,10 +5326,12 @@ \begin{itemdescr} \pnum -\expects \tcode{length > 0}. +\expects +\tcode{length > 0}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} ++current; --length; @@ -5299,10 +5346,12 @@ \begin{itemdescr} \pnum -\expects \tcode{length > 0}. +\expects +\tcode{length > 0}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} --length; try { return current++; } @@ -5318,7 +5367,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} counted_iterator tmp = *this; ++*this; @@ -5334,7 +5384,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} --current; ++length; @@ -5350,7 +5401,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} counted_iterator tmp = *this; --*this; @@ -5366,7 +5418,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return counted_iterator(current + n, length - n);} +\effects +Equivalent to: \tcode{return counted_iterator(current + n, length - n);} \end{itemdescr} \indexlibrarymember{operator+}{counted_iterator}% @@ -5378,7 +5431,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x + n;} +\effects +Equivalent to: \tcode{return x + n;} \end{itemdescr} \indexlibrarymember{operator+=}{counted_iterator}% @@ -5389,10 +5443,12 @@ \begin{itemdescr} \pnum -\expects \tcode{n <= length}. +\expects +\tcode{n <= length}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} current += n; length -= n; @@ -5408,7 +5464,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return counted_iterator(current - n, length + n);} +\effects +Equivalent to: \tcode{return counted_iterator(current - n, length + n);} \end{itemdescr} \indexlibrarymember{operator-}{counted_iterator}% @@ -5425,7 +5482,8 @@ sequence\iref{counted.iterator}. \pnum -\effects Equivalent to: \tcode{return y.length - x.length;} +\effects +Equivalent to: \tcode{return y.length - x.length;} \end{itemdescr} \indexlibrarymember{operator-}{counted_iterator}% @@ -5436,7 +5494,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return -x.length;} \end{itemdescr} @@ -5448,7 +5507,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return y.length;} +\effects +Equivalent to: \tcode{return y.length;} \end{itemdescr} \indexlibrarymember{operator-=}{counted_iterator}% @@ -5459,10 +5519,12 @@ \begin{itemdescr} \pnum -\expects \tcode{-n <= length}. +\expects +\tcode{-n <= length}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} current -= n; length += n; @@ -5486,7 +5548,8 @@ elements of the same sequence\iref{counted.iterator}. \pnum -\effects Equivalent to: \tcode{return x.length == y.length;} +\effects +Equivalent to: \tcode{return x.length == y.length;} \end{itemdescr} \indexlibrarymember{operator==}{counted_iterator}% @@ -5497,7 +5560,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.length == 0;} +\effects +Equivalent to: \tcode{return x.length == 0;} \end{itemdescr} \indexlibrarymember{operator<=>}{counted_iterator}% @@ -5536,7 +5600,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return ranges::iter_move(i.current);} +\effects +Equivalent to: \tcode{return ranges::iter_move(i.current);} \end{itemdescr} \indexlibrarymember{iter_swap}{counted_iterator}% @@ -5549,14 +5614,15 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{ranges::iter_swap(x.current, y.current)}. +\effects +Equivalent to \tcode{ranges::iter_swap(x.current, y.current)}. \end{itemdescr} \rSec2[unreachable.sentinels]{Unreachable sentinel} \rSec3[unreachable.sentinel]{Class \tcode{unreachable_sentinel_t}} -\indexlibrary{\idxcode{unreachable_sentinel_t}}% +\indexlibraryglobal{unreachable_sentinel_t}% \pnum Class \tcode{unreachable_sentinel_t} can be used with any \libconcept{weakly_incrementable} type @@ -5611,7 +5677,7 @@ \rSec2[istream.iterator]{Class template \tcode{istream_iterator}} \pnum -\indexlibrary{\idxcode{istream_iterator}}% +\indexlibraryglobal{istream_iterator}% The class template \tcode{istream_iterator} is an input iterator\iref{input.iterators} that reads successive elements from the input stream for which it was constructed. @@ -5658,7 +5724,7 @@ \rSec3[istream.iterator.cons]{Constructors and destructor} -\indexlibrary{\idxcode{istream_iterator}!constructor}% +\indexlibraryctor{istream_iterator}% \begin{itemdecl} constexpr istream_iterator(); constexpr istream_iterator(default_sentinel_t); @@ -5670,7 +5736,8 @@ Constructs the end-of-stream iterator, value-initializing \tcode{value}. \pnum -\ensures \tcode{in_stream == nullptr} is \tcode{true}. +\ensures +\tcode{in_stream == nullptr} is \tcode{true}. \pnum \remarks @@ -5680,7 +5747,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{istream_iterator}!constructor}% +\indexlibraryctor{istream_iterator}% \begin{itemdecl} istream_iterator(istream_type& s); \end{itemdecl} @@ -5694,14 +5761,15 @@ \end{itemdescr} -\indexlibrary{\idxcode{istream_iterator}!constructor}% +\indexlibraryctor{istream_iterator}% \begin{itemdecl} istream_iterator(const istream_iterator& x) = default; \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{in_stream == x.in_stream} is \tcode{true}. +\ensures +\tcode{in_stream == x.in_stream} is \tcode{true}. \pnum \remarks @@ -5709,7 +5777,7 @@ then this constructor is trivial. \end{itemdescr} -\indexlibrary{\idxcode{istream_iterator}!destructor}% +\indexlibrarydtor{istream_iterator}% \begin{itemdecl} ~istream_iterator() = default; \end{itemdecl} @@ -5764,7 +5832,8 @@ \tcode{in_stream != nullptr} is \tcode{true}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} if (!(*in_stream >> value)) in_stream = nullptr; @@ -5782,10 +5851,12 @@ \begin{itemdescr} \pnum -\expects \tcode{in_stream != nullptr} is \tcode{true}. +\expects +\tcode{in_stream != nullptr} is \tcode{true}. \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} istream_iterator tmp = *this; ++*this; @@ -5820,7 +5891,7 @@ \rSec2[ostream.iterator]{Class template \tcode{ostream_iterator}} \pnum -\indexlibrary{\idxcode{ostream_iterator}}% +\indexlibraryglobal{ostream_iterator}% \tcode{ostream_iterator} writes (using \tcode{operator<<}) @@ -5847,7 +5918,7 @@ using traits_type = traits; using ostream_type = basic_ostream; - constexpr ostreambuf_iterator() noexcept = default; + constexpr ostream_iterator() noexcept = default; ostream_iterator(ostream_type& s); ostream_iterator(ostream_type& s, const charT* delimiter); ostream_iterator(const ostream_iterator& x); @@ -5868,7 +5939,7 @@ \rSec3[ostream.iterator.cons.des]{Constructors and destructor} -\indexlibrary{\idxcode{ostream_iterator}!constructor}% +\indexlibraryctor{ostream_iterator}% \begin{itemdecl} ostream_iterator(ostream_type& s); \end{itemdecl} @@ -5881,7 +5952,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{ostream_iterator}!constructor}% +\indexlibraryctor{ostream_iterator}% \begin{itemdecl} ostream_iterator(ostream_type& s, const charT* delimiter); \end{itemdecl} @@ -5974,7 +6045,7 @@ value is returned. It is impossible to assign a character via an input iterator. -\indexlibrary{\idxcode{istreambuf_iterator}}% +\indexlibraryglobal{istreambuf_iterator}% \begin{codeblock} namespace std { template> @@ -6009,7 +6080,7 @@ friend bool operator==(const istreambuf_iterator& i, default_sentinel_t s); private: - streambuf_type* sbuf_; // \expos + streambuf_type* sbuf_; // \expos }; } \end{codeblock} @@ -6030,7 +6101,7 @@ It keeps the character pointed to by the previous value of the iterator for some possible future access to get the character. -\indexlibrary{\idxcode{proxy}!\idxcode{istreambuf_iterator}}% +\indexlibrarymember{proxy}{istreambuf_iterator}% \begin{codeblock} namespace std { template @@ -6053,7 +6124,7 @@ the exposition-only member \tcode{sbuf_} is initialized with a null pointer value. -\indexlibrary{\idxcode{istreambuf_iterator}!constructor}% +\indexlibraryctor{istreambuf_iterator}% \begin{itemdecl} constexpr istreambuf_iterator() noexcept; constexpr istreambuf_iterator(default_sentinel_t) noexcept; @@ -6066,7 +6137,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{istreambuf_iterator}!constructor}% +\indexlibraryctor{istreambuf_iterator}% \begin{itemdecl} istreambuf_iterator(istream_type& s) noexcept; \end{itemdecl} @@ -6078,7 +6149,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{istreambuf_iterator}!constructor}% +\indexlibraryctor{istreambuf_iterator}% \begin{itemdecl} istreambuf_iterator(streambuf_type* s) noexcept; \end{itemdecl} @@ -6090,7 +6161,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{istreambuf_iterator}!constructor}% +\indexlibraryctor{istreambuf_iterator}% \begin{itemdecl} istreambuf_iterator(const @\placeholder{proxy}@& p) noexcept; \end{itemdecl} @@ -6178,7 +6249,8 @@ \begin{itemdescr} \pnum -\returns \tcode{i.equal(s)}. +\returns +\tcode{i.equal(s)}. \end{itemdescr} \rSec2[ostreambuf.iterator]{Class template \tcode{ostreambuf_iterator}} @@ -6188,7 +6260,7 @@ writes successive \textit{characters} onto the output stream from which it was constructed. -\indexlibrary{\idxcode{ostreambuf_iterator}}% +\indexlibraryglobal{ostreambuf_iterator}% \begin{codeblock} namespace std { template> @@ -6222,7 +6294,7 @@ \rSec3[ostreambuf.iter.cons]{Constructors} -\indexlibrary{\idxcode{ostreambuf_iterator}!constructor}% +\indexlibraryctor{ostreambuf_iterator}% \begin{itemdecl} ostreambuf_iterator(ostream_type& s) noexcept; \end{itemdecl} @@ -6239,7 +6311,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{ostreambuf_iterator}!constructor}% +\indexlibraryctor{ostreambuf_iterator}% \begin{itemdecl} ostreambuf_iterator(streambuf_type* s) noexcept; \end{itemdecl} @@ -6324,11 +6396,22 @@ \rSec1[iterator.range]{Range access} \pnum -In addition to being available via inclusion of the \tcode{} header, +In addition to being available via inclusion of the \libheader{iterator} header, the function templates in \ref{iterator.range} are available when any of the following -headers are included: \tcode{}, \tcode{}, \tcode{}, -\tcode{}, \tcode{}, \tcode{}, \tcode{}, \tcode{}, \tcode{}, -\tcode{}, \tcode{}, \tcode{}, and \tcode{}. +headers are included: +\libheaderref{array}, +\libheaderref{deque}, +\libheaderrefx{forward_list}{forward.list.syn}, +\libheaderref{list}, +\libheaderrefx{map}{associative.map.syn}, +\libheaderrefx{regex}{re.syn}, +\libheaderrefx{set}{associative.set.syn}, +\libheaderref{span}, +\libheaderref{string}, +\libheaderrefx{string_view}{string.view.synop}, +\libheaderrefx{unordered_map}{unord.map.syn}, +\libheaderrefx{unordered_set}{unord.set.syn}, and +\libheaderref{vector}. Each of these templates is a designated customization point\iref{namespace.std}. @@ -6340,7 +6423,8 @@ \begin{itemdescr} \pnum -\returns \tcode{c.begin()}. +\returns +\tcode{c.begin()}. \end{itemdescr} \indexlibrary{\idxcode{end(C\&)}}% @@ -6351,7 +6435,8 @@ \begin{itemdescr} \pnum -\returns \tcode{c.end()}. +\returns +\tcode{c.end()}. \end{itemdescr} \indexlibrary{\idxcode{begin(T (\&)[N])}}% @@ -6361,7 +6446,8 @@ \begin{itemdescr} \pnum -\returns \tcode{array}. +\returns +\tcode{array}. \end{itemdescr} \indexlibrary{\idxcode{end(T (\&)[N])}}% @@ -6371,7 +6457,8 @@ \begin{itemdescr} \pnum -\returns \tcode{array + N}. +\returns +\tcode{array + N}. \end{itemdescr} \indexlibrary{\idxcode{cbegin(const C\&)}}% @@ -6380,7 +6467,9 @@ -> decltype(std::begin(c)); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{std::begin(c)}. +\pnum +\returns +\tcode{std::begin(c)}. \end{itemdescr} \indexlibrary{\idxcode{cend(const C\&)}}% @@ -6389,7 +6478,9 @@ -> decltype(std::end(c)); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{std::end(c)}. +\pnum +\returns +\tcode{std::end(c)}. \end{itemdescr} \indexlibrary{\idxcode{rbegin(C\&)}}% @@ -6398,7 +6489,9 @@ template constexpr auto rbegin(const C& c) -> decltype(c.rbegin()); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{c.rbegin()}. +\pnum +\returns +\tcode{c.rbegin()}. \end{itemdescr} \indexlibrary{\idxcode{rend(C\&)}}% @@ -6407,7 +6500,9 @@ template constexpr auto rend(const C& c) -> decltype(c.rend()); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{c.rend()}. +\pnum +\returns +\tcode{c.rend()}. \end{itemdescr} \indexlibrary{\idxcode{rbegin(T (\&array)[N])}}% @@ -6415,7 +6510,9 @@ template constexpr reverse_iterator rbegin(T (&array)[N]); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{reverse_iterator(array + N)}. +\pnum +\returns +\tcode{reverse_iterator(array + N)}. \end{itemdescr} \indexlibrary{\idxcode{rend(T (\&array)[N])}}% @@ -6423,7 +6520,9 @@ template constexpr reverse_iterator rend(T (&array)[N]); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{reverse_iterator(array)}. +\pnum +\returns +\tcode{reverse_iterator(array)}. \end{itemdescr} \indexlibrary{\idxcode{rbegin(initializer_list)}}% @@ -6431,7 +6530,9 @@ template constexpr reverse_iterator rbegin(initializer_list il); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{reverse_iterator(il.end())}. +\pnum +\returns +\tcode{reverse_iterator(il.end())}. \end{itemdescr} \indexlibrary{\idxcode{rend(initializer_list)}}% @@ -6439,7 +6540,9 @@ template constexpr reverse_iterator rend(initializer_list il); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{reverse_iterator(il.begin())}. +\pnum +\returns +\tcode{reverse_iterator(il.begin())}. \end{itemdescr} \indexlibrary{\idxcode{crbegin(const C\& c)}}% @@ -6447,7 +6550,9 @@ template constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c)); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{std::rbegin(c)}. +\pnum +\returns +\tcode{std::rbegin(c)}. \end{itemdescr} \indexlibrary{\idxcode{crend(const C\& c)}}% @@ -6455,7 +6560,9 @@ template constexpr auto crend(const C& c) -> decltype(std::rend(c)); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{std::rend(c)}. +\pnum +\returns +\tcode{std::rend(c)}. \end{itemdescr} \indexlibrary{\idxcode{size(C\& c)}}% @@ -6463,7 +6570,9 @@ template constexpr auto size(const C& c) -> decltype(c.size()); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{c.size()}. +\pnum +\returns +\tcode{c.size()}. \end{itemdescr} \indexlibrary{\idxcode{size(T (\&array)[N])}}% @@ -6471,7 +6580,9 @@ template constexpr size_t size(const T (&array)[N]) noexcept; \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{N}. +\pnum +\returns +\tcode{N}. \end{itemdescr} \indexlibrary{\idxcode{ssize(C\& c)}}% @@ -6480,7 +6591,8 @@ -> common_type_t>; \end{itemdecl} \begin{itemdescr} -\pnum \returns +\pnum +\returns \begin{codeblock} static_cast>>(c.size()) \end{codeblock} @@ -6491,7 +6603,9 @@ template constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{N}. +\pnum +\returns +\tcode{N}. \end{itemdescr} \indexlibrary{\idxcode{empty(C\& c)}}% @@ -6499,7 +6613,9 @@ template [[nodiscard]] constexpr auto empty(const C& c) -> decltype(c.empty()); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{c.empty()}. +\pnum +\returns +\tcode{c.empty()}. \end{itemdescr} \indexlibrary{\idxcode{empty(T (\&array)[N])}}% @@ -6507,7 +6623,9 @@ template [[nodiscard]] constexpr bool empty(const T (&array)[N]) noexcept; \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{false}. +\pnum +\returns +\tcode{false}. \end{itemdescr} \indexlibrary{\idxcode{empty(initializer_list)}}% @@ -6515,7 +6633,9 @@ template [[nodiscard]] constexpr bool empty(initializer_list il) noexcept; \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{il.size() == 0}. +\pnum +\returns +\tcode{il.size() == 0}. \end{itemdescr} \indexlibrary{\idxcode{data(C\& c)}}% @@ -6524,7 +6644,9 @@ template constexpr auto data(const C& c) -> decltype(c.data()); \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{c.data()}. +\pnum +\returns +\tcode{c.data()}. \end{itemdescr} \indexlibrary{\idxcode{data(T (\&array)[N])}}% @@ -6532,7 +6654,9 @@ template constexpr T* data(T (&array)[N]) noexcept; \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{array}. +\pnum +\returns +\tcode{array}. \end{itemdescr} \indexlibrary{\idxcode{data(initializer_list)}}% @@ -6540,5 +6664,7 @@ template constexpr const E* data(initializer_list il) noexcept; \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{il.begin()}. +\pnum +\returns +\tcode{il.begin()}. \end{itemdescr} diff --git a/source/latexmkrc b/source/latexmkrc index 35a2168e65..9985d96b1e 100644 --- a/source/latexmkrc +++ b/source/latexmkrc @@ -2,3 +2,5 @@ add_cus_dep('glo', 'gls', 0, 'makeglo2gls'); sub makeglo2gls { system("makeindex -s basic.gst -o '$_[0]'.gls '$_[0]'.glo"); } + +$makeindex = 'stem=`basename %S .idx`; makeindex %O `test -f ${stem}.ist && echo "-s ${stem}.ist"` -o %D %S'; diff --git a/source/layout.tex b/source/layout.tex index 58a97cec00..fdbaeb806b 100644 --- a/source/layout.tex +++ b/source/layout.tex @@ -65,7 +65,8 @@ }}} \makeatother -\def\pnum{\parabullnum{Paras}{0pt}} +\def\pnum +{\parabullnum{Paras}{0pt}} % Leave more room for section numbers in TOC \cftsetindents{section}{1.5em}{3.0em} diff --git a/source/lex.tex b/source/lex.tex index 647871d028..fb2d3783af 100644 --- a/source/lex.tex +++ b/source/lex.tex @@ -13,8 +13,7 @@ \indextext{digraph|see{token, alternative}} \indextext{integer literal|see{literal, integer}} \indextext{character literal|see{literal, character}} -\indextext{floating literal|see{literal, floating}} -\indextext{floating-point literal|see{literal, floating}} +\indextext{floating-point literal|see{literal, floating-point}} \indextext{string literal|see{literal, string}} \indextext{boolean literal|see{literal, boolean}} \indextext{pointer literal|see{literal, pointer}} @@ -35,11 +34,13 @@ directive \tcode{\#include}, less any source lines skipped by any of the conditional inclusion\iref{cpp.cond} preprocessing directives, is called a \defn{translation unit}. -\begin{note} A \Cpp{} program need not all be translated at the same time. +\begin{note} +A \Cpp{} program need not all be translated at the same time. \end{note} \pnum -\begin{note} Previously translated translation units and instantiation +\begin{note} +Previously translated translation units and instantiation units can be preserved individually or in libraries. The separate translation units of a program communicate\iref{basic.link} by (for example) @@ -47,7 +48,8 @@ manipulation of objects whose identifiers have external or module linkage, or manipulation of data files. Translation units can be separately translated and then later linked to produce an executable -program\iref{basic.link}. \end{note}% +program\iref{basic.link}. +\end{note} \indextext{compilation!separate|)} \rSec1[lex.phases]{Phases of translation}% @@ -137,10 +139,12 @@ \item White-space characters separating tokens are no longer significant. Each preprocessing token is converted into a token\iref{lex.token}. The resulting tokens are syntactically and -semantically analyzed and translated as a translation unit. \begin{note} +semantically analyzed and translated as a translation unit. +\begin{note} The process of analyzing and translating the tokens may occasionally result in one token being replaced by a sequence of other -tokens\iref{temp.names}.\end{note} +tokens\iref{temp.names}. +\end{note} It is \impldef{whether the sources for module units and header units @@ -151,28 +155,46 @@ on which the current translation unit has an interface dependency (\ref{module.unit}, \ref{module.import}) are required to be available. -\begin{note} Source files, translation +\begin{note} +Source files, translation units and translated translation units need not necessarily be stored as files, nor need there be any one-to-one correspondence between these entities and any external representation. The description is conceptual -only, and does not specify any particular implementation. \end{note} +only, and does not specify any particular implementation. +\end{note} \item Translated translation units and instantiation units are combined -as follows: \begin{note} Some or all of these may be supplied from a -library. \end{note} Each translated translation unit is examined to -produce a list of required instantiations. \begin{note} This may include +as follows: +\begin{note} +Some or all of these may be supplied from a +library. +\end{note} +Each translated translation unit is examined to +produce a list of required instantiations. +\begin{note} +This may include instantiations which have been explicitly -requested\iref{temp.explicit}. \end{note} The definitions of the +requested\iref{temp.explicit}. +\end{note} +The definitions of the required templates are located. It is \impldef{whether source of translation units must be available to locate template definitions} whether the source of the translation units containing these definitions is required -to be available. \begin{note} An implementation could encode sufficient +to be available. +\begin{note} +An implementation could encode sufficient information into the translated translation unit so as to ensure the -source is not required here. \end{note} All the required instantiations +source is not required here. +\end{note} +All the required instantiations are performed to produce -\defn{instantiation units}. \begin{note} These are similar +\defn{instantiation units}. +\begin{note} +These are similar to translated translation units, but contain no references to -uninstantiated templates and no template definitions. \end{note} The +uninstantiated templates and no template definitions. +\end{note} +The program is ill-formed if any instantiation fails. \item All external entity references are resolved. Library @@ -292,6 +314,7 @@ \pnum A preprocessing token is the minimal lexical element of the language in translation phases 3 through 6. The categories of preprocessing token are: header names, +\keyword{import} keywords, identifiers, preprocessing numbers, character literals (including user-defined character literals), string literals (including user-defined string literals), preprocessing operators and punctuators, and single non-white-space characters that do not lexically @@ -323,7 +346,6 @@ shall apply before any \grammarterm{d-char}, \grammarterm{r-char}, or delimiting parenthesis is identified. The raw string literal is defined as the shortest sequence of characters that matches the raw-string pattern - \begin{ncbnf} \opt{encoding-prefix} \terminal{R} raw-string \end{ncbnf} @@ -362,20 +384,24 @@ has no associated grammar productions. \pnum -\begin{example} The program fragment \tcode{0xe+foo} is parsed as a -preprocessing number token (one that is not a valid floating or integer +\begin{example} +The program fragment \tcode{0xe+foo} is parsed as a +preprocessing number token (one that is not a valid integer or floating-point literal token), even though a parse as three preprocessing tokens \tcode{0xe}, \tcode{+}, and \tcode{foo} might produce a valid expression (for example, if \tcode{foo} were a macro defined as \tcode{1}). Similarly, the program fragment \tcode{1E1} is parsed as a preprocessing number (one -that is a valid floating literal token), whether or not \tcode{E} is a -macro name. \end{example} +that is a valid floating-point literal token), whether or not \tcode{E} is a +macro name. +\end{example} \pnum -\begin{example} The program fragment \tcode{x+++++y} is parsed as \tcode{x +\begin{example} +The program fragment \tcode{x+++++y} is parsed as \tcode{x ++ ++ + y}, which, if \tcode{x} and \tcode{y} have integral types, violates a constraint on increment operators, even though the parse -\tcode{x ++ + ++ y} might yield a correct expression. \end{example}% +\tcode{x ++ + ++ y} might yield a correct expression. +\end{example} \indextext{token!preprocessing|)} \rSec1[lex.digraph]{Alternative tokens} @@ -441,10 +467,12 @@ \indextext{white space}% Blanks, horizontal and vertical tabs, newlines, formfeeds, and comments (collectively, ``white space''), as described below, are ignored except -as they serve to separate tokens. \begin{note} Some white space is +as they serve to separate tokens. +\begin{note} +Some white space is required to separate otherwise adjacent identifiers, keywords, numeric literals, and alternative tokens containing alphabetic characters. -\end{note}% +\end{note} \indextext{token|)} \rSec1[lex.comment]{Comments} @@ -460,11 +488,14 @@ next new-line character. If there is a form-feed or a vertical-tab character in such a comment, only white-space characters shall appear between it and the new-line that terminates the comment; no diagnostic -is required. \begin{note} The comment characters \tcode{//}, \tcode{/*}, +is required. +\begin{note} +The comment characters \tcode{//}, \tcode{/*}, and \tcode{*/} have no special meaning within a \tcode{//} comment and are treated just like other characters. Similarly, the comment characters \tcode{//} and \tcode{/*} have no special meaning within a -\tcode{/*} comment. \end{note}% +\tcode{/*} comment. +\end{note} \indextext{comment|)} \rSec1[lex.header]{Header names} @@ -499,11 +530,13 @@ \end{bnf} \pnum -\begin{note} Header name preprocessing tokens only appear within +\begin{note} +Header name preprocessing tokens only appear within a \tcode{\#include} preprocessing directive, a \tcode{__has_include} preprocessing expression, or after certain occurrences of an \tcode{import} token -(see~\ref{lex.pptoken}). \end{note} +(see~\ref{lex.pptoken}). +\end{note} The sequences in both forms of \grammarterm{header-name}{s} are mapped in an \impldef{mapping header name to header or external source file} manner to headers or to external source file names as specified in~\ref{cpp.include}. @@ -541,12 +574,12 @@ \pnum Preprocessing number tokens lexically include all integer literal -tokens\iref{lex.icon} and all floating literal +tokens\iref{lex.icon} and all floating-point literal tokens\iref{lex.fcon}. \pnum A preprocessing number does not have a type or a value; it acquires both -after a successful conversion to an integer literal token or a floating literal +after a successful conversion to an integer literal token or a floating-point literal token.% \indextext{number!preprocessing|)} @@ -805,8 +838,10 @@ \keyword{while} \\ \end{multicolfloattable} -\begin{note} The \keyword{register} keyword is unused but -is reserved for future use.\end{note} +\begin{note} +The \keyword{register} keyword is unused but +is reserved for future use. +\end{note} \pnum Furthermore, the alternative representations shown in @@ -869,7 +904,7 @@ \nontermdef{literal}\br integer-literal\br character-literal\br - floating-literal\br + floating-point-literal\br string-literal\br boolean-literal\br pointer-literal\br @@ -990,7 +1025,8 @@ digits, which include the decimal digits and the letters \tcode{a} through \tcode{f} and \tcode{A} through \tcode{F} with decimal values ten through fifteen. -\begin{example} The number twelve can be written \tcode{12}, \tcode{014}, +\begin{example} +The number twelve can be written \tcode{12}, \tcode{014}, \tcode{0XC}, or \tcode{0b1100}. The integer literals \tcode{1048576}, \tcode{1'048'576}, \tcode{0X100000}, \tcode{0x10'0000}, and \tcode{0'004'000'000} all have the same value. @@ -1240,9 +1276,12 @@ of the \grammarterm{c-char} in the execution wide-character set, unless the \grammarterm{c-char} has no representation in the execution wide-character set, in which case the value is \impldef{value of wide-character literal with single c-char that is -not in execution wide-character set}. \begin{note} The type \tcode{wchar_t} is able to +not in execution wide-character set}. +\begin{note} +The type \tcode{wchar_t} is able to represent all members of the execution wide-character set (see~\ref{basic.fundamental}). -\end{note} The value +\end{note} +The value of a wide-character literal containing multiple \grammarterm{c-char}{s} is \impldef{value of wide-character literal containing multiple characters}. @@ -1317,32 +1356,34 @@ execution character set, of the character named. If there is no such encoding, the \grammarterm{universal-character-name} is translated to an \impldef{encoding of universal character name not in execution character set} encoding. -\begin{note} In translation phase 1, a \grammarterm{universal-character-name} is introduced whenever an +\begin{note} +In translation phase 1, a \grammarterm{universal-character-name} is introduced whenever an actual extended character is encountered in the source text. Therefore, all extended characters are described in terms of \grammarterm{universal-character-name}{s}. However, the actual compiler implementation may use its own native character set, -so long as the same results are obtained. \end{note} +so long as the same results are obtained. +\end{note} -\rSec2[lex.fcon]{Floating literals} +\rSec2[lex.fcon]{Floating-point literals} -\indextext{literal!floating}% +\indextext{literal!floating-point}% \begin{bnf} -\nontermdef{floating-literal}\br - decimal-floating-literal\br - hexadecimal-floating-literal +\nontermdef{floating-point-literal}\br + decimal-floating-point-literal\br + hexadecimal-floating-point-literal \end{bnf} \begin{bnf} -\nontermdef{decimal-floating-literal}\br - fractional-constant \opt{exponent-part} \opt{floating-suffix}\br - digit-sequence exponent-part \opt{floating-suffix} +\nontermdef{decimal-floating-point-literal}\br + fractional-constant \opt{exponent-part} \opt{floating-point-suffix}\br + digit-sequence exponent-part \opt{floating-point-suffix} \end{bnf} \begin{bnf} -\nontermdef{hexadecimal-floating-literal}\br - hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part \opt{floating-suffix}\br - hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part \opt{floating-suffix} +\nontermdef{hexadecimal-floating-point-literal}\br + hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part \opt{floating-point-suffix}\br + hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part \opt{floating-point-suffix} \end{bnf} \begin{bnf} @@ -1381,13 +1422,13 @@ \end{bnf} \begin{bnf} -\nontermdef{floating-suffix} \textnormal{one of}\br +\nontermdef{floating-point-suffix} \textnormal{one of}\br \terminal{f l F L} \end{bnf} \pnum -\indextext{literal!floating}% -A floating literal consists of +\indextext{literal!floating-point}% +A floating-point literal consists of an optional prefix specifying a base, an integer part, a radix point, @@ -1402,34 +1443,36 @@ The integer and fraction parts both consist of a sequence of decimal (base ten) digits if there is no prefix, or hexadecimal (base sixteen) digits if the prefix is \tcode{0x} or \tcode{0X}. -The floating literal is a \defnadj{decimal floating}{literal} in the former case and +The floating-point literal is a \defnadj{decimal floating-point}{literal} in the former case and a \defnadj{hexadecimal floating}{literal} in the latter case. Optional separating single quotes in a \grammarterm{digit-sequence} or \grammarterm{hexadecimal-digit-sequence} are ignored when determining its value. -\begin{example} The floating literals \tcode{1.602'176'565e-19} and \tcode{1.602176565e-19} -have the same value. \end{example} +\begin{example} +The floating-point literals \tcode{1.602'176'565e-19} and \tcode{1.602176565e-19} +have the same value. +\end{example} Either the integer part or the fraction part (not both) can be omitted. Either the radix point or the letter \tcode{e} or \tcode{E} and -the exponent (not both) can be omitted from a decimal floating literal. +the exponent (not both) can be omitted from a decimal floating-point literal. The radix point (but not the exponent) can be omitted -from a hexadecimal floating literal. +from a hexadecimal floating-point literal. The integer part, the optional radix point, and the optional fraction part, -form the \defn{significand} of the floating literal. -In a decimal floating literal, the exponent, if present, +form the \defn{significand} of the floating-point literal. +In a decimal floating-point literal, the exponent, if present, indicates the power of 10 by which the significand is to be scaled. -In a hexadecimal floating literal, the exponent +In a hexadecimal floating-point literal, the exponent indicates the power of 2 by which the significand is to be scaled. \begin{example} -The floating literals \tcode{49.625} and \tcode{0xC.68p+2} have the same value. +The floating-point literals \tcode{49.625} and \tcode{0xC.68p+2} have the same value. \end{example} If the scaled value is in the range of representable values for its type, the result is the scaled value if representable, else the larger or smaller representable value nearest the scaled value, chosen in an \impldef{choice of larger or smaller value of -floating literal} manner. +floating-point literal} manner. \indextext{literal!\idxcode{double}}% -The type of a floating literal is \tcode{double} +The type of a floating-point literal is \tcode{double} \indextext{literal!type of floating-point}% unless explicitly specified by a suffix. \indextext{literal!\idxcode{float}}% @@ -1537,15 +1580,17 @@ shall consist of at most 16 characters. \pnum -\begin{note} The characters \tcode{'('} and \tcode{')'} are permitted in a +\begin{note} +The characters \tcode{'('} and \tcode{')'} are permitted in a \grammarterm{raw-string}. Thus, \tcode{R"delimiter((a|b))delimiter"} is equivalent to -\tcode{"(a|b)"}. \end{note} +\tcode{"(a|b)"}. +\end{note} \pnum -\begin{note} A source-file new-line in a raw string literal results in a new-line in the +\begin{note} +A source-file new-line in a raw string literal results in a new-line in the resulting execution string literal. Assuming no whitespace at the beginning of lines in the following example, the assert will succeed: - \begin{codeblock} const char* p = R"(a\ b @@ -1555,21 +1600,18 @@ \end{note} \pnum -\begin{example} The raw string - +\begin{example} +The raw string \begin{codeblock} R"a( )\ a" )a" \end{codeblock} - is equivalent to \tcode{"\textbackslash n)\textbackslash \textbackslash \textbackslash na\textbackslash"\textbackslash n"}. The raw string - \begin{codeblock} R"(x = "\"y\"")" \end{codeblock} - is equivalent to \tcode{"x = \textbackslash "\textbackslash\textbackslash\textbackslash "y\textbackslash\textbackslash\textbackslash "\textbackslash ""}. \end{example} @@ -1656,7 +1698,9 @@ the same \grammarterm{encoding-prefix} as the other operand. If a UTF-8 string literal token is adjacent to a wide string literal token, the program is ill-formed. Any other concatenations are conditionally-supported with \impldef{concatenation of some types of string literals} -behavior. \begin{note} This +behavior. +\begin{note} +This concatenation is an interpretation, not a conversion. Because the interpretation happens in translation phase 6 (after each character from a string literal has been translated into a value from the appropriate character set), a @@ -1691,7 +1735,6 @@ \begin{codeblock} "\xA" "B" \end{codeblock} - contains the two characters \tcode{'\textbackslash xA'} and \tcode{'B'} after concatenation (and not the single hexadecimal character \tcode{'\textbackslash xAB'}). @@ -1723,9 +1766,13 @@ literal is the total number of escape sequences, \grammarterm{universal-character-name}{s}, and other characters, plus one for each character requiring a surrogate pair, plus one for the terminating -\tcode{u'\textbackslash 0'}. \begin{note} The size of a \tcode{char16_t} +\tcode{u'\textbackslash 0'}. +\begin{note} +The size of a \tcode{char16_t} string literal is the number of code units, not the number of -characters. \end{note} Within \tcode{char32_t} and \tcode{char16_t} +characters. +\end{note} +Within \tcode{char32_t} and \tcode{char16_t} string literals, any \grammarterm{universal-character-name}{s} shall be within the range \tcode{0x0} to \tcode{0x10FFFF}. The size of a narrow string literal is the total number of escape sequences and other characters, plus at least @@ -1743,7 +1790,8 @@ unspecified. \begin{note} \indextext{literal!string!undefined change to}% -The effect of attempting to modify a string literal is undefined. \end{note} +The effect of attempting to modify a string literal is undefined. +\end{note} \rSec2[lex.bool]{Boolean literals} @@ -1783,7 +1831,7 @@ \begin{bnf} \nontermdef{user-defined-literal}\br user-defined-integer-literal\br - user-defined-floating-literal\br + user-defined-floating-point-literal\br user-defined-string-literal\br user-defined-character-literal \end{bnf} @@ -1797,7 +1845,7 @@ \end{bnf} \begin{bnf} -\nontermdef{user-defined-floating-literal}\br +\nontermdef{user-defined-floating-point-literal}\br fractional-constant \opt{exponent-part} ud-suffix\br digit-sequence exponent-part ud-suffix\br hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part ud-suffix\br @@ -1821,9 +1869,12 @@ \pnum If a token matches both \grammarterm{user-defined-literal} and another \grammarterm{literal} kind, it -is treated as the latter. \begin{example} \tcode{123_km} +is treated as the latter. +\begin{example} +\tcode{123_km} is a \grammarterm{user-defined-literal}, but \tcode{12LL} is an -\grammarterm{integer-literal}. \end{example} +\grammarterm{integer-literal}. +\end{example} The syntactic non-terminal preceding the \grammarterm{ud-suffix} in a \grammarterm{user-defined-literal} is taken to be the longest sequence of characters that could match that non-terminal. @@ -1842,58 +1893,50 @@ without its \grammarterm{ud-suffix}. If \placeholder{S} contains a literal operator with parameter type \tcode{unsigned long long}, the literal \placeholder{L} is treated as a call of the form - \begin{codeblock} operator "" @\placeholder{X}@(@\placeholder{n}@ULL) \end{codeblock} - Otherwise, \placeholder{S} shall contain a raw literal operator or a numeric literal operator template\iref{over.literal} but not both. If \placeholder{S} contains a raw literal operator, the literal \placeholder{L} is treated as a call of the form - \begin{codeblock} operator "" @\placeholder{X}@(@"\placeholder{n}{"}@) \end{codeblock} - Otherwise (\placeholder{S} contains a numeric literal operator template), \placeholder{L} is treated as a call of the form - \begin{codeblock} operator "" @\placeholder{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>() \end{codeblock} - -where \placeholder{n} is the source character sequence $c_1c_2...c_k$. \begin{note} The sequence +where \placeholder{n} is the source character sequence $c_1c_2...c_k$. +\begin{note} +The sequence $c_1c_2...c_k$ can only contain characters from the basic source character set. \end{note} \pnum -If \placeholder{L} is a \grammarterm{user-defined-floating-literal}, let \placeholder{f} be the +If \placeholder{L} is a \grammarterm{user-defined-floating-point-literal}, let \placeholder{f} be the literal without its \grammarterm{ud-suffix}. If \placeholder{S} contains a literal operator with parameter type \tcode{long double}, the literal \placeholder{L} is treated as a call of the form - \begin{codeblock} operator "" @\placeholder{X}@(@\placeholder{f}@L) \end{codeblock} - Otherwise, \placeholder{S} shall contain a raw literal operator or a numeric literal operator template\iref{over.literal} but not both. If \placeholder{S} contains a raw literal operator, the \grammarterm{literal} \placeholder{L} is treated as a call of the form - \begin{codeblock} operator "" @\placeholder{X}@(@"\placeholder{f}{"}@) \end{codeblock} - Otherwise (\placeholder{S} contains a numeric literal operator template), \placeholder{L} is treated as a call of the form - \begin{codeblock} operator "" @\placeholder{X}@<'@$c_1$@', '@$c_2$@', ... '@$c_k$@'>() \end{codeblock} - -where \placeholder{f} is the source character sequence $c_1c_2...c_k$. \begin{note} The sequence +where \placeholder{f} is the source character sequence $c_1c_2...c_k$. +\begin{note} +The sequence $c_1c_2...c_k$ can only contain characters from the basic source character set. \end{note} @@ -1906,13 +1949,10 @@ a non-type template parameter for which \placeholder{str} is a well-formed \grammarterm{template-argument}, the literal \placeholder{L} is treated as a call of the form - \begin{codeblock} operator "" @\placeholder{X}@<@\placeholder{str}{}@>() \end{codeblock} - Otherwise, the literal \placeholder{L} is treated as a call of the form - \begin{codeblock} operator "" @\placeholder{X}@(@\placeholder{str}{}@, @\placeholder{len}{}@) \end{codeblock} @@ -1924,26 +1964,23 @@ the type of \placeholder{ch} and the literal \placeholder{L} is treated as a call of the form - \begin{codeblock} operator "" @\placeholder{X}@(@\placeholder{ch}{}@) \end{codeblock} \pnum \begin{example} - \begin{codeblock} long double operator "" _w(long double); std::string operator "" _w(const char16_t*, std::size_t); unsigned operator "" _w(const char*); int main() { - 1.2_w; // calls \tcode{operator "" _w(1.2L)} - u"one"_w; // calls \tcode{operator "" _w(u"one", 3)} - 12_w; // calls \tcode{operator "" _w("12")} - "two"_w; // error: no applicable literal operator + 1.2_w; // calls \tcode{operator "" _w(1.2L)} + u"one"_w; // calls \tcode{operator "" _w(u"one", 3)} + 12_w; // calls \tcode{operator "" _w("12")} + "two"_w; // error: no applicable literal operator } \end{codeblock} - \end{example} \pnum @@ -1960,10 +1997,10 @@ \begin{example} \begin{codeblock} int main() { - L"A" "B" "C"_x; // OK: same as \tcode{L"ABC"_x} - "P"_x "Q" "R"_y;// error: two different \grammarterm{ud-suffix}{es} + L"A" "B" "C"_x; // OK: same as \tcode{L"ABC"_x} + "P"_x "Q" "R"_y; // error: two different \grammarterm{ud-suffix}{es} } \end{codeblock} -\end{example}% +\end{example} \indextext{literal|)}% \indextext{conventions!lexical|)} diff --git a/source/lib-intro.tex b/source/lib-intro.tex index a02432e3f0..605ad1a44a 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -594,7 +594,8 @@ \end{example} \item -\mandates the conditions that, if not met, render the program ill-formed. +\mandates +the conditions that, if not met, render the program ill-formed. \begin{example} An implementation might express such a condition via the \grammarterm{constant-expression} @@ -607,33 +608,42 @@ \end{example} \item -\expects the conditions (sometimes termed preconditions) +\expects +the conditions (sometimes termed preconditions) that the function assumes to hold whenever it is called. \item -\effects the actions performed by the function. +\effects +the actions performed by the function. \item -\sync the synchronization operations\iref{intro.multithread} applicable to the function. +\sync +the synchronization operations\iref{intro.multithread} applicable to the function. \item -\ensures the conditions (sometimes termed observable results or postconditions) +\ensures +the conditions (sometimes termed observable results or postconditions) established by the function. \item -\returns a description of the value(s) returned by the function. +\returns +a description of the value(s) returned by the function. \item -\throws any exceptions thrown by the function, and the conditions that would cause the exception. +\throws +any exceptions thrown by the function, and the conditions that would cause the exception. \item -\complexity the time and/or space complexity of the function. +\complexity +the time and/or space complexity of the function. \item -\remarks additional semantic constraints on the function. +\remarks +additional semantic constraints on the function. \item -\errors the error conditions for error codes reported by the function. +\errors +the error conditions for error codes reported by the function. \end{itemize} \pnum @@ -919,11 +929,9 @@ locale, but may change during program execution by a call to \tcode{setlocale(int, const char*)},\footnote{declared in -\tcode{}\iref{c.locales}. -\indextext{\idxcode{setlocale}}% -\indexlibrary{\idxcode{setlocale}}% -\indexhdr{clocale}% -\indexhdr{clocale}} +\libheaderref{clocale}. +\indexlibraryglobal{setlocale}% +} or by a change to a \tcode{locale} object, as described in \ref{locales} and \ref{input.output}. @@ -958,11 +966,9 @@ with defined content has the value zero (the \defnx{terminating null character}{character!terminating null}); no other element in the sequence has the value zero.% -\indexhdr{cstring}% \footnote{Many of the objects manipulated by function signatures declared in -\tcode{}\iref{c.strings} are character sequences or \ntbs{}s. -\indexhdr{cstring}% +\libheaderref{cstring} are character sequences or \ntbs{}s. The size of some of these character sequences is limited by a length value, maintained separately from the character sequence.} @@ -1077,7 +1083,7 @@ followed by a comment that ends with \expos, as in: \begin{codeblock} -streambuf* sb; // \expos +streambuf* sb; // \expos \end{codeblock} \pnum @@ -1248,9 +1254,9 @@ additional headers shown in \tref{headers.cpp.c}.% \footnote{It is intentional that there is no \Cpp{} header for any of these C headers: -\tcode{}\indextext{\idxhdr{stdatomic.h}!absence thereof}, -\tcode{}\indextext{\idxhdr{stdnoreturn.h}!absence thereof}, -\tcode{}\indextext{\idxhdr{threads.h}!absence thereof}.} +\libnoheader{stdatomic.h}, +\libnoheader{stdnoreturn.h}, +\libnoheader{threads.h}.} \begin{multicolfloattable}{\Cpp{} headers for C library facilities}{headers.cpp.c} {lllllll} @@ -1295,8 +1301,8 @@ \end{note} \begin{example} \begin{codeblock} -import ; // imports the \tcode{} header unit -std::vector vi; // OK +import ; // imports the \tcode{} header unit +std::vector vi; // OK \end{codeblock} \end{example} @@ -1317,9 +1323,11 @@ \pnum Names which are defined as macros in C shall be defined as macros in the \Cpp{} standard library, even if C grants license for implementation as functions. -\begin{note} The names defined as macros in C include the following: +\begin{note} +The names defined as macros in C include the following: \tcode{assert}, \tcode{offsetof}, \tcode{setjmp}, \tcode{va_arg}, -\tcode{va_end}, and \tcode{va_start}. \end{note} +\tcode{va_end}, and \tcode{va_start}. +\end{note} \pnum Names that are defined as functions in C shall be defined as functions in the @@ -1331,7 +1339,7 @@ \pnum Identifiers that are keywords or operators in \Cpp{} shall not be defined as macros in \Cpp{} standard library headers.\footnote{In particular, including the -standard header \tcode{} has no effect.} +standard header \libheader{iso646.h} has no effect.} \pnum \ref{depr.c.headers}, C standard library headers, describes the effects of using @@ -1481,22 +1489,20 @@ \end{libsumtab} \pnum -The supplied version of the header -\tcode{} -\indexhdr{cstdlib}% +The supplied version of the header \libheaderref{cstdlib} shall declare at least the functions -\indexlibrary{\idxcode{abort}}% +\indexlibraryglobal{abort}% \tcode{abort}, -\indexlibrary{\idxcode{atexit}}% +\indexlibraryglobal{atexit}% \tcode{atexit}, -\indexlibrary{\idxcode{at_quick_exit}}% +\indexlibraryglobal{at_quick_exit}% \tcode{at_quick_exit}, -\indexlibrary{\idxcode{exit}}% +\indexlibraryglobal{exit}% \tcode{exit}, and -\indexlibrary{\idxcode{quick_exit}}% +\indexlibraryglobal{quick_exit}% \tcode{quick_exit}\iref{support.start.term}. -The supplied version of the header \tcode{} +The supplied version of the header \libheaderrefx{atomic}{atomics.syn} shall meet the same requirements as for a hosted implementation except that support for always lock-free integral atomic types\iref{atomics.lockfree} @@ -1538,15 +1544,10 @@ \indextext{unit!translation}% Each may be included more than once, with no effect different from being included exactly once, except that the effect of including either -\tcode{} -or -\tcode{} -depends each time on the lexically -\indexhdr{cassert}% -\indexhdr{assert.h}% -current definition of +\libheaderref{cassert} or \libheaderrefx{assert.h}{depr.c.headers} +depends each time on the lexically current definition of \indextext{\idxcode{NDEBUG}}% -\indexlibrary{\idxcode{NDEBUG}}% +\indexlibraryglobal{NDEBUG}% \tcode{NDEBUG}.\footnote{This is the same as the C standard library.} \pnum @@ -1685,9 +1686,12 @@ \tcode{T(rv)} is equivalent to the value of \tcode{rv} before the construction \\ \rowsep \multicolumn{2}{|p{5.3in}|}{ \tcode{rv}'s state is unspecified - \begin{note} \tcode{rv} must still meet the requirements of the library + \begin{note} +\tcode{rv} must still meet the requirements of the library component that is using it. The operations listed in those requirements must - work as specified whether \tcode{rv} has been moved from or not. \end{note}}\\ + work as specified whether \tcode{rv} has been moved from or not. +\end{note} +}\\ \end{concepttable} \indextext{requirements!\idxoldconcept{CopyConstructible}}% @@ -1710,10 +1714,13 @@ \tcode{t} is equivalent to the value of \tcode{rv} before the assignment\\ \rowsep \multicolumn{4}{|p{5.3in}|}{ \tcode{rv}'s state is unspecified. - \begin{note}\ \tcode{rv} must still meet the requirements of the library + \begin{note} +\ \tcode{rv} must still meet the requirements of the library component that is using it, whether or not \tcode{t} and \tcode{rv} refer to the same object. The operations listed in those requirements must - work as specified whether \tcode{rv} has been moved from or not. \end{note}}\\ + work as specified whether \tcode{rv} has been moved from or not. +\end{note} +}\\ \end{concepttable} \indextext{requirements!\idxoldconcept{CopyAssignable}}% @@ -1746,7 +1753,6 @@ \pnum An object \tcode{t} is \defn{swappable with} an object \tcode{u} if and only if: - \begin{itemize} \item the expressions \tcode{swap(t, u)} and \tcode{swap(u, t)} are valid when evaluated in the context described below, and @@ -1763,23 +1769,26 @@ The context in which \tcode{swap(t, u)} and \tcode{swap(u, t)} are evaluated shall ensure that a binary non-member function named ``swap'' is selected via overload resolution\iref{over.match} on a candidate set that includes: - \begin{itemize} \item the two \tcode{swap} function templates defined in -\tcode{}\iref{utility} and +\libheaderref{utility} and \item the lookup set produced by argument-dependent lookup\iref{basic.lookup.argdep}. \end{itemize} -\begin{note} If \tcode{T} and \tcode{U} are both fundamental types or arrays of -fundamental types and the declarations from the header \tcode{} are in +\begin{note} +If \tcode{T} and \tcode{U} are both fundamental types or arrays of +fundamental types and the declarations from the header \libheader{utility} are in scope, the overall lookup set described above is equivalent to that of the qualified name lookup applied to the expression \tcode{std::swap(t, u)} or -\tcode{std::swap(u, t)} as appropriate. \end{note} +\tcode{std::swap(u, t)} as appropriate. +\end{note} -\begin{note} It is unspecified whether a library component that has a swappable -requirement includes the header \tcode{} to ensure an appropriate -evaluation context. \end{note} +\begin{note} +It is unspecified whether a library component that has a swappable +requirement includes the header \libheader{utility} to ensure an appropriate +evaluation context. +\end{note} \pnum An rvalue or lvalue \tcode{t} is \defn{swappable} if and only if \tcode{t} is @@ -1792,7 +1801,8 @@ \tcode{x} of type \tcode{X}, \tcode{*x} is swappable. -\begin{example} User code can ensure that the evaluation of \tcode{swap} calls +\begin{example} +User code can ensure that the evaluation of \tcode{swap} calls is performed in an appropriate context under the various conditions as follows: \begin{codeblock} #include @@ -1841,7 +1851,6 @@ \pnum A \oldconcept{NullablePointer} type is a pointer-like type that supports null values. A type \tcode{P} meets the \oldconcept{\-Nullable\-Pointer} requirements if: - \begin{itemize} \item \tcode{P} meets the \oldconcept{EqualityComparable}, \oldconcept{DefaultConstructible}, \oldconcept{CopyConstructible}, \oldconcept{\-Copy\-Assign\-able}, @@ -1858,8 +1867,11 @@ \pnum A value-initialized object of type \tcode{P} produces the null value of the type. The null value shall be equivalent only to itself. A default-initialized object -of type \tcode{P} may have an indeterminate value. \begin{note} Operations involving -indeterminate values may cause undefined behavior. \end{note} +of type \tcode{P} may have an indeterminate value. +\begin{note} +Operations involving +indeterminate values may cause undefined behavior. +\end{note} \pnum An object \tcode{p} of type \tcode{P} can be contextually converted to @@ -1919,7 +1931,6 @@ \indextext{requirements!\idxoldconcept{Hash}} \pnum A type \tcode{H} meets the \oldconcept{Hash} requirements if: - \begin{itemize} \item it is a function object type\iref{function.objects}, \item it meets the \oldconcept{CopyConstructible} (\tref{cpp17.copyconstructible}) and @@ -1941,12 +1952,17 @@ \tcode{h(k)} & \tcode{size_t} & The value returned shall depend only on the argument \tcode{k} for the duration of - the program. \begin{note} Thus all evaluations of the expression \tcode{h(k)} with the + the program. +\begin{note} +Thus all evaluations of the expression \tcode{h(k)} with the same value for \tcode{k} yield the same result for a given execution of the program. - \end{note} \begin{note} For two different + \end{note} +\begin{note} +For two different values \tcode{t1} and \tcode{t2}, the probability that \tcode{h(t1)} and \tcode{h(t2)} compare equal should be very small, approaching \tcode{1.0 / numeric_limits::max()}. - \end{note} \\ \rowsep + \end{note} +\\ \rowsep \tcode{h(u)} & \tcode{size_t} & Shall not modify \tcode{u}. \\ @@ -2109,7 +2125,8 @@ free list.} \begin{note} If \tcode{n == 0}, the return value is unspecified. -\end{note} & \\ \rowsep +\end{note} +& \\ \rowsep \tcode{a.allocate(n, y)} & \tcode{X::pointer} & @@ -2218,12 +2235,16 @@ \pnum Note A: The member class template \tcode{rebind} in the table above is -effectively a typedef template. \begin{note} In general, if +effectively a typedef template. +\begin{note} +In general, if the name \tcode{Allocator} is bound to \tcode{SomeAllocator}, then \tcode{Allocator::rebind::other} is the same type as \tcode{SomeAllocator}, where \tcode{SomeAllocator::value_type} is \tcode{T} and -\tcode{SomeAllocator::\brk{}value_type} is \tcode{U}. \end{note} If +\tcode{SomeAllocator::\brk{}value_type} is \tcode{U}. +\end{note} +If \tcode{Allocator} is a class template instantiation of the form \tcode{SomeAllocator}, where \tcode{Args} is zero or more type arguments, and \tcode{Allocator} does not supply a \tcode{rebind} member @@ -2309,12 +2330,15 @@ If the alignment associated with a specific over-aligned type is not supported by an allocator, instantiation of the allocator for that type may fail. The allocator also may silently ignore the requested alignment. -\begin{note} Additionally, the member function \tcode{allocate} +\begin{note} +Additionally, the member function \tcode{allocate} for that type may fail by throwing an object of type -\tcode{bad_alloc}.\end{note} +\tcode{bad_alloc}. +\end{note} \pnum -\begin{example} The following is an allocator class template supporting the minimal +\begin{example} +The following is an allocator class template supporting the minimal interface that meets the requirements of \tref{cpp17.allocator}: @@ -2343,7 +2367,6 @@ If \tcode{X} is an allocator class for type \tcode{T}, \tcode{X} additionally meets the allocator completeness requirements if, whether or not \tcode{T} is a complete type: - \begin{itemize} \item \tcode{X} is a complete type, and \item all the member types of \tcode{allocator_traits}\iref{allocator.traits} @@ -2514,8 +2537,10 @@ are reserved for future standardization. The behavior of a \Cpp{} program is undefined if it adds declarations or definitions to such a namespace. -\begin{example} The top level namespace \tcode{std2} is reserved -for use by future revisions of this International Standard. \end{example} +\begin{example} +The top level namespace \tcode{std2} is reserved +for use by future revisions of this International Standard. +\end{example} \rSec3[reserved.names]{Reserved names}% \indextext{name!reserved} @@ -2542,69 +2567,74 @@ \pnum In namespace \tcode{std}, the following names are reserved for previous standardization: \begin{itemize} -\item \indexlibrary{\idxcode{auto_ptr}!zombie} \tcode{auto_ptr}, -\item \indexlibrary{\idxcode{auto_ptr_ref}!zombie} \tcode{auto_ptr_ref}, -\item \indexlibrary{\idxcode{binary_function}!zombie} \tcode{binary_function}, -\item \indexlibrary{\idxcode{binary_negate}!zombie} \tcode{binary_negate}, -\item \indexlibrary{\idxcode{bind1st}!zombie} \tcode{bind1st}, -\item \indexlibrary{\idxcode{bind2nd}!zombie} \tcode{bind2nd}, -\item \indexlibrary{\idxcode{binder1st}!zombie} \tcode{binder1st}, -\item \indexlibrary{\idxcode{binder2nd}!zombie} \tcode{binder2nd}, -\item \indexlibrary{\idxcode{const_mem_fun1_ref_t}!zombie} \tcode{const_mem_fun1_ref_t}, -\item \indexlibrary{\idxcode{const_mem_fun1_t}!zombie} \tcode{const_mem_fun1_t}, -\item \indexlibrary{\idxcode{const_mem_fun_ref_t}!zombie} \tcode{const_mem_fun_ref_t}, -\item \indexlibrary{\idxcode{const_mem_fun_t}!zombie} \tcode{const_mem_fun_t}, -\item \indexlibrary{\idxcode{get_temporary_buffer}!zombie} \tcode{get_temporary_buffer}, -\item \indexlibrary{\idxcode{get_unexpected}!zombie} \tcode{get_unexpected}, -\item \indexlibrary{\idxcode{gets}!zombie} \tcode{gets}, -\item \indexlibrary{\idxcode{is_literal_type}!zombie} \tcode{is_literal_type}, -\item \indexlibrary{\idxcode{is_literal_type_v}!zombie} \tcode{is_literal_type_v}, -\item \indexlibrary{\idxcode{mem_fun1_ref_t}!zombie} \tcode{mem_fun1_ref_t}, -\item \indexlibrary{\idxcode{mem_fun1_t}!zombie} \tcode{mem_fun1_t}, -\item \indexlibrary{\idxcode{mem_fun_ref_t}!zombie} \tcode{mem_fun_ref_t}, -\item \indexlibrary{\idxcode{mem_fun_ref}!zombie} \tcode{mem_fun_ref}, -\item \indexlibrary{\idxcode{mem_fun_t}!zombie} \tcode{mem_fun_t}, -\item \indexlibrary{\idxcode{mem_fun}!zombie} \tcode{mem_fun}, -\item \indexlibrary{\idxcode{not1}!zombie} \tcode{not1}, -\item \indexlibrary{\idxcode{not2}!zombie} \tcode{not2}, -\item \indexlibrary{\idxcode{pointer_to_binary_function}!zombie} \tcode{pointer_to_binary_function}, -\item \indexlibrary{\idxcode{pointer_to_unary_function}!zombie} \tcode{pointer_to_unary_function}, -\item \indexlibrary{\idxcode{ptr_fun}!zombie} \tcode{ptr_fun}, -\item \indexlibrary{\idxcode{random_shuffle}!zombie} \tcode{random_shuffle}, -\item \indexlibrary{\idxcode{raw_storage_iterator}!zombie} \tcode{raw_storage_iterator}, -\item \indexlibrary{\idxcode{result_of}!zombie} \tcode{result_of}, -\item \indexlibrary{\idxcode{result_of_t}!zombie} \tcode{result_of_t}, -\item \indexlibrary{\idxcode{return_temporary_buffer}!zombie} \tcode{return_temporary_buffer}, -\item \indexlibrary{\idxcode{set_unexpected}!zombie} \tcode{set_unexpected}, -\item \indexlibrary{\idxcode{unary_function}!zombie} \tcode{unary_function}, -\item \indexlibrary{\idxcode{unary_negate}!zombie} \tcode{unary_negate}, -\item \indexlibrary{\idxcode{uncaught_exception}!zombie} \tcode{uncaught_exception}, -\item \indexlibrary{\idxcode{unexpected}!zombie} \tcode{unexpected}, +\item \indexlibraryzombie{auto_ptr} \tcode{auto_ptr}, +\item \indexlibraryzombie{auto_ptr_ref} \tcode{auto_ptr_ref}, +\item \indexlibraryzombie{binary_function} \tcode{binary_function}, +\item \indexlibraryzombie{binary_negate} \tcode{binary_negate}, +\item \indexlibraryzombie{bind1st} \tcode{bind1st}, +\item \indexlibraryzombie{bind2nd} \tcode{bind2nd}, +\item \indexlibraryzombie{binder1st} \tcode{binder1st}, +\item \indexlibraryzombie{binder2nd} \tcode{binder2nd}, +\item \indexlibraryzombie{const_mem_fun1_ref_t} \tcode{const_mem_fun1_ref_t}, +\item \indexlibraryzombie{const_mem_fun1_t} \tcode{const_mem_fun1_t}, +\item \indexlibraryzombie{const_mem_fun_ref_t} \tcode{const_mem_fun_ref_t}, +\item \indexlibraryzombie{const_mem_fun_t} \tcode{const_mem_fun_t}, +\item \indexlibraryzombie{get_temporary_buffer} \tcode{get_temporary_buffer}, +\item \indexlibraryzombie{get_unexpected} \tcode{get_unexpected}, +\item \indexlibraryzombie{gets} \tcode{gets}, +\item \indexlibraryzombie{is_literal_type} \tcode{is_literal_type}, +\item \indexlibraryzombie{is_literal_type_v} \tcode{is_literal_type_v}, +\item \indexlibraryzombie{mem_fun1_ref_t} \tcode{mem_fun1_ref_t}, +\item \indexlibraryzombie{mem_fun1_t} \tcode{mem_fun1_t}, +\item \indexlibraryzombie{mem_fun_ref_t} \tcode{mem_fun_ref_t}, +\item \indexlibraryzombie{mem_fun_ref} \tcode{mem_fun_ref}, +\item \indexlibraryzombie{mem_fun_t} \tcode{mem_fun_t}, +\item \indexlibraryzombie{mem_fun} \tcode{mem_fun}, +\item \indexlibraryzombie{not1} \tcode{not1}, +\item \indexlibraryzombie{not2} \tcode{not2}, +\item \indexlibraryzombie{pointer_to_binary_function} \tcode{pointer_to_binary_function}, +\item \indexlibraryzombie{pointer_to_unary_function} \tcode{pointer_to_unary_function}, +\item \indexlibraryzombie{ptr_fun} \tcode{ptr_fun}, +\item \indexlibraryzombie{random_shuffle} \tcode{random_shuffle}, +\item \indexlibraryzombie{raw_storage_iterator} \tcode{raw_storage_iterator}, +\item \indexlibraryzombie{result_of} \tcode{result_of}, +\item \indexlibraryzombie{result_of_t} \tcode{result_of_t}, +\item \indexlibraryzombie{return_temporary_buffer} \tcode{return_temporary_buffer}, +\item \indexlibraryzombie{set_unexpected} \tcode{set_unexpected}, +\item \indexlibraryzombie{unary_function} \tcode{unary_function}, +\item \indexlibraryzombie{unary_negate} \tcode{unary_negate}, +\item \indexlibraryzombie{uncaught_exception} \tcode{uncaught_exception}, +\item \indexlibraryzombie{unexpected} \tcode{unexpected}, and -\item \indexlibrary{\idxcode{unexpected_handler}!zombie} \tcode{unexpected_handler}. +\item \indexlibraryzombie{unexpected_handler} \tcode{unexpected_handler}. \end{itemize} \pnum The following names are reserved as member types for previous standardization, and may not be used as a name for object-like macros in portable code: \begin{itemize} -\item \indexlibrary{\idxcode{argument_type}!zombie} \tcode{argument_type}, -\item \indexlibrary{\idxcode{first_argument_type}!zombie} \tcode{first_argument_type}, -\item \indexlibrary{\idxcode{io_state}!zombie} \tcode{io_state}, -\item \indexlibrary{\idxcode{open_mode}!zombie} \tcode{open_mode}, -\item \indexlibrary{\idxcode{second_argument_type}!zombie} \tcode{second_argument_type}, +\item \indexlibraryzombie{argument_type} \tcode{argument_type}, +\item \indexlibraryzombie{first_argument_type} \tcode{first_argument_type}, +\item \indexlibraryzombie{io_state} \tcode{io_state}, +\item \indexlibraryzombie{open_mode} \tcode{open_mode}, +\item \indexlibraryzombie{second_argument_type} \tcode{second_argument_type}, and -\item \indexlibrary{\idxcode{seek_dir}!zombie} \tcode{seek_dir}, +\item \indexlibraryzombie{seek_dir} \tcode{seek_dir}. \end{itemize} \pnum -The name \indexlibrary{\idxcode{stossc}!zombie} \tcode{stossc} is reserved as a +The name \indexlibraryzombie{stossc} \tcode{stossc} is reserved as a member function for previous standardization, and may not be used as a name for function-like macros in portable code. \pnum -The header names \tcode{}, \tcode{}, \tcode{}, -\tcode{}, and \tcode{} are reserved for previous standardization. +The header names +\libnoheader{ccomplex}, +\libnoheader{ciso646}, +\libnoheader{cstdalign}, +\libnoheader{cstdbool}, and +\libnoheader{ctgmath} +are reserved for previous standardization. \rSec4[macro.names]{Macro names} @@ -2633,13 +2663,8 @@ in a header is reserved to the implementation to designate that library object with external linkage,% \indextext{linkage!external}\footnote{The list of such reserved names includes -\tcode{errno}, -declared or defined in -\indexhdr{cerrno}% -\tcode{}.} -both in namespace -\tcode{std} -and in the global namespace. +\tcode{errno}, declared or defined in \libheaderref{cerrno}.} +both in namespace \tcode{std} and in the global namespace. \pnum Each @@ -2651,18 +2676,15 @@ \indextext{linkage!external}% external linkage.\footnote{The list of such reserved function signatures with external linkage includes -\indexlibrary{\idxcode{setjmp}}% +\indexlibraryglobal{setjmp}% \tcode{setjmp(jmp_buf)}, -declared or defined in -\indexhdr{csetjmp}% -\tcode{}, +declared or defined in \libheaderref{csetjmp}, and -\indexlibrary{\idxcode{va_end}}% -\indexlibrary{\idxcode{va_list}}% +\indexlibraryglobal{va_end}% +\indexlibraryglobal{va_list}% \tcode{va_end(va_list)}, declared or defined in -\indexhdr{cstdarg}% -\tcode{}.} +\libheaderref{cstdarg}.} \pnum Each name from the C standard library declared with external linkage @@ -2687,13 +2709,10 @@ \tcode{extern "C++"} linkage,\footnote{The function signatures declared in \indextext{Amendment 1}% -\indexhdr{cuchar}% -\indexhdr{cwchar}% -\indexhdr{cwctype}% -\tcode{}, -\tcode{}, +\libheaderref{cuchar}, +\libheaderref{cwchar}, and -\tcode{} +\libheaderref{cwctype} are always reserved, notwithstanding the restrictions imposed in subclause 4.5.1 of Amendment 1 to the C Standard for these headers.} or as a name of namespace scope in the global namespace. @@ -2772,7 +2791,7 @@ \tcode{}~(\ref{basic.stc.dynamic}, \ref{support.dynamic}): \indextext{\idxcode{new}!\idxcode{operator}!replaceable}% -\indexlibrary{\idxcode{new}!\idxcode{operator}}% +\indexlibrarymember{new}{operator}% \begin{codeblock} operator new(std::size_t) operator new(std::size_t, std::align_val_t) @@ -2780,7 +2799,7 @@ operator new(std::size_t, std::align_val_t, const std::nothrow_t&) \end{codeblock}% \indextext{\idxcode{delete}!\idxcode{operator}!replaceable}% -\indexlibrary{\idxcode{delete}!\idxcode{operator}}% +\indexlibrarymember{delete}{operator}% \begin{codeblock} operator delete(void*) operator delete(void*, std::size_t) @@ -2790,7 +2809,7 @@ operator delete(void*, std::align_val_t, const std::nothrow_t&) \end{codeblock}% \indextext{\idxcode{new}!\idxcode{operator}!replaceable}% -\indexlibrary{\idxcode{new}!\idxcode{operator}}% +\indexlibrarymember{new}{operator}% \begin{codeblock} operator new[](std::size_t) operator new[](std::size_t, std::align_val_t) @@ -2798,7 +2817,7 @@ operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) \end{codeblock}% \indextext{\idxcode{delete}!\idxcode{operator}!replaceable}% -\indexlibrary{\idxcode{delete}!\idxcode{operator}}% +\indexlibrarymember{delete}{operator}% \begin{codeblock} operator delete[](void*) operator delete[](void*, std::size_t) @@ -2826,7 +2845,7 @@ \begin{itemize} \item \tcode{terminate_handler} -\indexlibrary{\idxcode{terminate_handler}}% +\indexlibraryglobal{terminate_handler}% \end{itemize} \pnum @@ -2834,8 +2853,8 @@ supplying a pointer to a function defined in the program or the library as an argument to (respectively): \begin{itemize} -\item \indexlibrary{\idxcode{set_new_handler}}\tcode{set_new_handler} -\item \indexlibrary{\idxcode{set_terminate}}\tcode{set_terminate} +\item \indexlibraryglobal{set_new_handler}\tcode{set_new_handler} +\item \indexlibraryglobal{set_terminate}\tcode{set_terminate} \end{itemize} See also subclauses~\ref{alloc.errors}, Storage allocation errors, and~\ref{support.exception}, Exception handling. @@ -2846,10 +2865,10 @@ \begin{itemize} \item -\indexlibrary{\idxcode{get_new_handler}}% +\indexlibraryglobal{get_new_handler}% \tcode{get_new_handler} \item -\indexlibrary{\idxcode{get_terminate}} +\indexlibraryglobal{get_terminate} \tcode{get_terminate} \end{itemize} @@ -2951,9 +2970,12 @@ \pnum The behavior of a program is undefined if calls to standard library functions from different threads may introduce a data race. The conditions under which this may occur are specified -in~\ref{res.on.data.races}. \begin{note} Modifying an object of a standard library type that is +in~\ref{res.on.data.races}. +\begin{note} +Modifying an object of a standard library type that is shared between threads risks undefined behavior unless objects of that type are explicitly -specified as being shareable without data races or the user supplies a locking mechanism. \end{note} +specified as being shareable without data races or the user supplies a locking mechanism. +\end{note} \pnum If an object of a standard library type is accessed, and @@ -3158,9 +3180,11 @@ arguments, including \tcode{this}. \pnum -\begin{note} This means, for example, that implementations can't use a static object for +\begin{note} +This means, for example, that implementations can't use a static object for internal purposes without synchronization because it could cause a data race even in -programs that do not explicitly share objects between threads. \end{note} +programs that do not explicitly share objects between threads. +\end{note} \pnum A \Cpp{} standard library function shall not access objects indirectly accessible via its @@ -3170,8 +3194,10 @@ \pnum Operations on iterators obtained by calling a standard library container or string member function may access the underlying container, but shall not modify it. -\begin{note} In particular, container operations that invalidate iterators conflict -with operations on iterators associated with that container. \end{note} +\begin{note} +In particular, container operations that invalidate iterators conflict +with operations on iterators associated with that container. +\end{note} \pnum Implementations may share their own internal objects between threads if the objects are @@ -3183,9 +3209,11 @@ visible\iref{intro.multithread} to users. \pnum -\begin{note} This allows implementations to parallelize operations if there are no visible +\begin{note} +This allows implementations to parallelize operations if there are no visible \indextext{side effects}% -side effects. \end{note} +side effects. +\end{note} \rSec3[protection.within.classes]{Protection within classes} @@ -3214,7 +3242,6 @@ \pnum In any case: - \begin{itemize} \item Every base class described as @@ -3306,11 +3333,14 @@ \indextext{pointer!to traceable object}% Objects constructed by the standard library that may hold a user-supplied pointer value or an integer of type \tcode{std::intptr_t} shall store such values in a traceable -pointer location\iref{basic.stc.dynamic.safety}. \begin{note} Other libraries are +pointer location\iref{basic.stc.dynamic.safety}. +\begin{note} +Other libraries are strongly encouraged to do the same, since not doing so may result in accidental use of pointers that are not safely derived. Libraries that store pointers outside the user's address space should make it appear that they are stored and retrieved from a traceable -pointer location. \end{note} +pointer location. +\end{note} \rSec3[value.error.codes]{Value of error codes} @@ -3322,13 +3352,16 @@ \impldef{\tcode{error_category} for errors originating outside the operating system} \tcode{error_category} object for errors originating elsewhere. The implementation shall define the possible values of \tcode{value()} for each of these -error categories. \begin{example} For operating systems that are based on POSIX, +error categories. +\begin{example} +For operating systems that are based on POSIX, implementations should define the \tcode{std::system_category()} values as identical to the POSIX \tcode{errno} values, with additional values as defined by the operating system's documentation. Implementations for operating systems that are not based on POSIX should define values identical to the operating system's values. For errors that do not originate from the operating system, the implementation -may provide enums for the associated values. \end{example} +may provide enums for the associated values. +\end{example} \rSec3[lib.types.movedfrom]{Moved-from state of library types} diff --git a/source/libraryindex.ist b/source/libraryindex.ist new file mode 100644 index 0000000000..5892f41f12 --- /dev/null +++ b/source/libraryindex.ist @@ -0,0 +1,3 @@ +headings_flag 1 +heading_prefix "\\rSecindex{library}{" +heading_suffix "}\n" diff --git a/source/locales.tex b/source/locales.tex index 11a2836e83..ff9c241429 100644 --- a/source/locales.tex +++ b/source/locales.tex @@ -24,7 +24,7 @@ \rSec1[locale.syn]{Header \tcode{} synopsis} -\indexhdr{locale}% +\indexheader{locale}% \begin{codeblock} namespace std { // \ref{locale}, locale @@ -51,7 +51,7 @@ // \ref{category.ctype}, ctype class ctype_base; template class ctype; - template<> class ctype; // specialization + template<> class ctype; // specialization template class ctype_byname; class codecvt_base; template class codecvt; @@ -101,20 +101,16 @@ \end{codeblock} \pnum -The header -\tcode{} +The header \libheader{locale} defines classes and declares functions that encapsulate and manipulate the information peculiar to a locale.\footnote{In this subclause, the type name \tcode{struct tm} -is an incomplete type that is defined in -\indexhdr{ctime}% -\tcode{}.} +is an incomplete type that is defined in \libheaderref{ctime}.} \rSec1[locales]{Locales} \rSec2[locale]{Class \tcode{locale}} -\indexhdr{locale}% \begin{codeblock} namespace std { class locale { @@ -178,12 +174,10 @@ \pnum \begin{example} -An iostream -\tcode{operator<<} -might be implemented as:\footnote{Note that in the call to -\tcode{put} -the stream is implicitly converted to an -\tcode{ostreambuf_iterator}.} +An iostream \tcode{operator<<} might be implemented as:% +\footnote{Note that in the call to \tcode{put}, +the stream is implicitly converted +to an \tcode{ostreambuf_iterator}.} \begin{codeblock} template @@ -191,11 +185,12 @@ operator<< (basic_ostream& s, Date d) { typename basic_ostream::sentry cerberos(s); if (cerberos) { - ios_base::iostate err = ios_base::iostate::goodbit; tm tmbuf; d.extract(tmbuf); - use_facet>>( - s.getloc()).put(s, s, s.fill(), err, &tmbuf, 'x'); - s.setstate(err); // might throw + bool failed = + use_facet>>( + s.getloc()).put(s, s, s.fill(), &tmbuf, 'x').failed(); + if (failed) + s.setstate(s.badbit); // might throw } return s; } @@ -311,11 +306,9 @@ member bitmask constant \tcode{all} is defined such that the expression - \begin{codeblock} (collate | ctype | monetary | numeric | time | messages | all) == all \end{codeblock} - is \tcode{true}, and represents the union of all categories. @@ -574,7 +567,7 @@ \rSec3[locale.cons]{Constructors and destructor} -\indexlibrary{\idxcode{locale}!constructor}% +\indexlibraryctor{locale}% \begin{itemdecl} locale() noexcept; \end{itemdecl} @@ -598,7 +591,7 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{locale}!constructor}% +\indexlibraryctor{locale}% \begin{itemdecl} locale(const locale& other) noexcept; \end{itemdecl} @@ -609,7 +602,7 @@ Constructs a locale which is a copy of \tcode{other}. \end{itemdescr} -\indexlibrary{\idxcode{locale}!constructor}% +\indexlibraryctor{locale}% \begin{itemdecl} explicit locale(const char* std_name); \end{itemdecl} @@ -632,17 +625,18 @@ and any \impldef{locale names} values. \end{itemdescr} -\indexlibrary{\idxcode{locale}!constructor}% +\indexlibraryctor{locale}% \begin{itemdecl} explicit locale(const string& std_name); \end{itemdecl} \begin{itemdescr} \pnum -\effects The same as \tcode{locale(std_name.c_str())}. +\effects +The same as \tcode{locale(std_name.c_str())}. \end{itemdescr} -\indexlibrary{\idxcode{locale}!constructor}% +\indexlibraryctor{locale}% \begin{itemdecl} locale(const locale& other, const char* std_name, category); \end{itemdecl} @@ -669,17 +663,18 @@ has a name. \end{itemdescr} -\indexlibrary{\idxcode{locale}!constructor}% +\indexlibraryctor{locale}% \begin{itemdecl} locale(const locale& other, const string& std_name, category cat); \end{itemdecl} \begin{itemdescr} \pnum -\effects The same as \tcode{locale(other, std_name.c_str(), cat)}. +\effects +The same as \tcode{locale(other, std_name.c_str(), cat)}. \end{itemdescr} -\indexlibrary{\idxcode{locale}!constructor}% +\indexlibraryctor{locale}% \begin{itemdecl} template locale(const locale& other, Facet* f); \end{itemdecl} @@ -699,7 +694,7 @@ The resulting locale has no name. \end{itemdescr} -\indexlibrary{\idxcode{locale}!constructor}% +\indexlibraryctor{locale}% \begin{itemdecl} locale(const locale& other, const locale& one, category cats); \end{itemdecl} @@ -733,7 +728,7 @@ \tcode{*this}. \end{itemdescr} -\indexlibrary{\idxcode{locale}!destructor}% +\indexlibrarydtor{locale}% \begin{itemdecl} ~locale(); \end{itemdecl} @@ -866,19 +861,19 @@ \tcode{locale()} to return a copy of the argument. If the argument has a name, does - \begin{codeblock} setlocale(LC_ALL, loc.name().c_str()); \end{codeblock} - otherwise, the effect on the C locale, if any, is \impldef{effect on C locale of calling \tcode{locale::global}}. No library function other than \tcode{locale::global()} shall affect the value returned by \tcode{locale()}. -\begin{note} See~\ref{c.locales} for data race considerations when -\tcode{setlocale} is invoked. \end{note} +\begin{note} +See~\ref{c.locales} for data race considerations when +\tcode{setlocale} is invoked. +\end{note} \pnum \returns @@ -954,18 +949,18 @@ \rSec3[classification]{Character classification} -\indexlibrary{\idxcode{isspace}}% -\indexlibrary{\idxcode{isprint}}% -\indexlibrary{\idxcode{iscntrl}}% -\indexlibrary{\idxcode{isupper}}% -\indexlibrary{\idxcode{islower}}% -\indexlibrary{\idxcode{isalpha}}% -\indexlibrary{\idxcode{isdigit}}% -\indexlibrary{\idxcode{ispunct}}% -\indexlibrary{\idxcode{isxdigit}}% -\indexlibrary{\idxcode{isalnum}}% -\indexlibrary{\idxcode{isgraph}}% -\indexlibrary{\idxcode{isblank}}% +\indexlibraryglobal{isspace}% +\indexlibraryglobal{isprint}% +\indexlibraryglobal{iscntrl}% +\indexlibraryglobal{isupper}% +\indexlibraryglobal{islower}% +\indexlibraryglobal{isalpha}% +\indexlibraryglobal{isdigit}% +\indexlibraryglobal{ispunct}% +\indexlibraryglobal{isxdigit}% +\indexlibraryglobal{isalnum}% +\indexlibraryglobal{isgraph}% +\indexlibraryglobal{isblank}% \begin{itemdecl} template bool isspace (charT c, const locale& loc); template bool isprint (charT c, const locale& loc); @@ -985,11 +980,9 @@ Each of these functions \tcode{is\placeholder{F}} returns the result of the expression: - \begin{codeblock} use_facet>(loc).is(ctype_base::@\placeholder{F}@, c) \end{codeblock} - where \tcode{\placeholder{F}} is the \tcode{ctype_base::mask} value corresponding to that function\iref{category.ctype}.\footnote{When @@ -1002,7 +995,7 @@ \rSec4[conversions.character]{Character conversions} -\indexlibrary{\idxcode{toupper}}% +\indexlibraryglobal{toupper}% \begin{itemdecl} template charT toupper(charT c, const locale& loc); \end{itemdecl} @@ -1013,7 +1006,7 @@ \tcode{use_facet>(loc).toupper(c)}. \end{itemdescr} -\indexlibrary{\idxcode{tolower}}% +\indexlibraryglobal{tolower}% \begin{itemdecl} template charT tolower(charT c, const locale& loc); \end{itemdecl} @@ -1037,15 +1030,15 @@ \tcode{get()}, respectively. Each such member function takes an -\indexlibrary{\idxcode{flags}!\idxcode{ios_base}}% +\indexlibrarymember{flags}{ios_base}% \tcode{ios_base\&} argument whose members -\indexlibrary{\idxcode{flags}!\idxcode{ios_base}}% +\indexlibrarymember{flags}{ios_base}% \tcode{flags()}, -\indexlibrary{\idxcode{precision}!\idxcode{ios_base}}% +\indexlibrarymember{precision}{ios_base}% \tcode{precision()}, and -\indexlibrary{\idxcode{width}!\idxcode{ios_base}}% +\indexlibrarymember{width}{ios_base}% \tcode{width()}, specify the format of the corresponding datum\iref{ios.base}. Those functions which need to use other facets call its member @@ -1075,7 +1068,7 @@ \rSec2[category.ctype]{The \tcode{ctype} category} -\indexlibrary{\idxcode{ctype_base}}% +\indexlibraryglobal{ctype_base}% \begin{codeblock} namespace std { class ctype_base { @@ -1106,7 +1099,7 @@ \rSec3[locale.ctype]{Class template \tcode{ctype}} -\indexlibrary{\idxcode{ctype}}% +\indexlibraryglobal{ctype}% \begin{codeblock} namespace std { template @@ -1152,11 +1145,7 @@ \end{codeblock} \pnum -Class -\tcode{ctype} -encapsulates the C library -\tcode{} -features. +Class \tcode{ctype} encapsulates the C library \libheader{cctype} features. \tcode{istream} members are required to use \tcode{ctype<>} @@ -1457,7 +1446,6 @@ For any character \tcode{c} in the basic source character set\iref{lex.charset} the transformation is such that - \begin{codeblock} do_widen(do_narrow(c, 0)) == c \end{codeblock} @@ -1499,7 +1487,7 @@ \rSec3[locale.ctype.byname]{Class template \tcode{ctype_byname}} -\indexlibrary{\idxcode{ctype_byname}}% +\indexlibraryglobal{ctype_byname}% \begin{codeblock} namespace std { template @@ -1517,7 +1505,7 @@ \rSec3[facet.ctype.special]{\tcode{ctype} specialization} -\indexlibrary{\idxcode{ctype}}% +\indexlibraryglobal{ctype}% \begin{codeblock} namespace std { template<> @@ -1586,7 +1574,7 @@ \rSec4[facet.ctype.char.dtor]{Destructor} -\indexlibrary{\idxcode{ctype}!destructor}% +\indexlibrarydtor{ctype}% \begin{itemdecl} ~ctype(); \end{itemdecl} @@ -1602,7 +1590,7 @@ \rSec4[facet.ctype.char.members]{Members} \pnum -\indexlibrary{\idxcode{ctype}!\idxcode{ctype}}% +\indexlibrarymember{ctype}{ctype}% In the following member descriptions, for \tcode{unsigned char} values \tcode{v} where \tcode{v >= table_size}, @@ -1610,7 +1598,7 @@ implementation-specific value (possibly different for each such value \tcode{v}) without performing the array lookup. -\indexlibrary{\idxcode{ctype}!constructor}% +\indexlibraryctor{ctype}% \begin{itemdecl} explicit ctype(const mask* tbl = nullptr, bool del = false, size_t refs = 0); \end{itemdecl} @@ -1734,7 +1722,7 @@ \returns \tcode{do_widen(c)} or -\indexlibrary{\idxcode{do_widen}}% +\indexlibraryglobal{do_widen}% \tcode{do_widen(low, high, to)}, respectively. \end{itemdescr} @@ -1748,10 +1736,10 @@ \begin{itemdescr} \pnum \returns -\indexlibrary{\idxcode{do_narrow}}% +\indexlibraryglobal{do_narrow}% \tcode{do_narrow(c, dfault)} or -\indexlibrary{\idxcode{do_narrow}}% +\indexlibraryglobal{do_narrow}% \tcode{do_narrow(low, high, dfault, to)}, respectively. \end{itemdescr} @@ -1810,7 +1798,7 @@ \rSec3[locale.codecvt]{Class template \tcode{codecvt}} -\indexlibrary{\idxcode{codecvt}}% +\indexlibraryglobal{codecvt}% \begin{codeblock} namespace std { class codecvt_base { @@ -2087,7 +2075,9 @@ \tcode{basic_filebuf} must be able to translate characters one internal character at a time. } -\begin{note} As a result of operations on \tcode{state}, it can return \tcode{ok} or \tcode{partial} and set \tcode{from_next == from} and \tcode{to_next != to}. \end{note} +\begin{note} +As a result of operations on \tcode{state}, it can return \tcode{ok} or \tcode{partial} and set \tcode{from_next == from} and \tcode{to_next != to}. +\end{note} \pnum \remarks @@ -2269,7 +2259,7 @@ \rSec3[locale.codecvt.byname]{Class template \tcode{codecvt_byname}} -\indexlibrary{\idxcode{codecvt_byname}}% +\indexlibraryglobal{codecvt_byname}% \begin{codeblock} namespace std { template @@ -2335,7 +2325,7 @@ \rSec3[locale.num.get]{Class template \tcode{num_get}} -\indexlibrary{\idxcode{num_get}}% +\indexlibraryglobal{num_get}% \begin{codeblock} namespace std { template> @@ -2501,7 +2491,6 @@ \begin{description} \stage{1} The function initializes local variables via - \begin{codeblock} fmtflags flags = str.flags(); fmtflags basefield = (flags & ios_base::basefield); @@ -2558,7 +2547,6 @@ Otherwise a \tcode{charT} is taken from \tcode{in} and local variables are initialized as if by - \begin{codeblock} char_type ct = *in; char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms]; @@ -2568,19 +2556,16 @@ ct == use_facet>(loc).thousands_sep() && use_facet>(loc).grouping().length() != 0; \end{codeblock} - where the values \tcode{src} and \tcode{atoms} are defined as if by: - \begin{codeblock} static const char src[] = "0123456789abcdefxABCDEFX+-"; char_type atoms[sizeof(src)]; use_facet>(loc).widen(src, src + sizeof(src), atoms); \end{codeblock} - for this value of \tcode{loc}. @@ -2602,7 +2587,7 @@ and processing returns to the beginning of stage 2. \stage{3} -The sequence of \tcode{char}{s} accumulated in stage 2 (the field) is converted to a numeric value by the rules of one of the functions declared in the header \tcode{}: +The sequence of \tcode{char}{s} accumulated in stage 2 (the field) is converted to a numeric value by the rules of one of the functions declared in the header \libheader{cstdlib}: \begin{itemize} \item For a signed integer value, the function \tcode{strtoll}. @@ -2617,7 +2602,6 @@ \end{itemize} The numeric value to be stored can be one of: - \begin{itemize} \item zero, if the conversion function does not convert the entire field. @@ -2749,7 +2733,7 @@ \rSec3[locale.nm.put]{Class template \tcode{num_put}} -\indexlibrary{\idxcode{num_put}}% +\indexlibraryglobal{num_put}% \begin{codeblock} namespace std { template> @@ -2844,11 +2828,9 @@ determine the characters that would be printed by \tcode{printf}\iref{c.files} given this conversion specifier for - \begin{codeblock} printf(spec, val) \end{codeblock} - assuming that the current locale is the \tcode{"C"} locale. \item @@ -2858,7 +2840,7 @@ determined by stage 1 to a \tcode{charT} using a conversion and values returned by members of -\tcode{use_facet>(loc)} +\tcode{use_facet>(loc)}. \item Stage 3: Determine where padding is required. @@ -2996,7 +2978,6 @@ \stage{3} A local variable is initialized as - \begin{codeblock} fmtflags adjustfield = (flags & (ios_base::adjustfield)); \end{codeblock} @@ -3039,7 +3020,6 @@ The sequence of \tcode{charT}'s at the end of stage 3 are output via - \begin{codeblock} *out++ = c \end{codeblock} @@ -3082,7 +3062,7 @@ \rSec3[locale.numpunct]{Class template \tcode{numpunct}} -\indexlibrary{\idxcode{numpunct}}% +\indexlibraryglobal{numpunct}% \begin{codeblock} namespace std { template @@ -3102,12 +3082,12 @@ static locale::id id; protected: - ~numpunct(); // virtual + ~numpunct(); // virtual virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; - virtual string_type do_truename() const; // for \tcode{bool} - virtual string_type do_falsename() const; // for \tcode{bool} + virtual string_type do_truename() const; // for \tcode{bool} + virtual string_type do_falsename() const; // for \tcode{bool} }; } \end{codeblock} @@ -3128,44 +3108,61 @@ a call to \tcode{widen}. +% FIXME: For now, keep the locale grammar productions out of the index; +% they are conceptually unrelated to the main C++ grammar. +% Consider renaming these en masse (to locale-* ?) to avoid this problem. +\newcommand{\locnontermdef}[1]{{\BnfNontermshape#1\itcorr}\textnormal{:}} +\newcommand{\locgrammarterm}[1]{\gterm{#1}} + \pnum -The syntax for number formats is as follows, where -\tcode{digit} -represents the radix set specified by the -\tcode{fmtflags} -argument value, and -\tcode{thousands-sep} -and -\tcode{decimal-point} -are the results of corresponding -\tcode{numpunct} -members. +The syntax for number formats is as follows, +where \locgrammarterm{digit} represents the radix set specified by +the \tcode{fmtflags} argument value, and +\locgrammarterm{thousands-sep} and \locgrammarterm{decimal-point} +are the results of corresponding \tcode{numpunct} members. Integer values have the format: - -\begin{codeblock} -integer ::= [sign] units -sign ::= plusminus -plusminus ::= '+' | '-' -units ::= digits [thousands-sep units] -digits ::= digit [digits] -\end{codeblock} - +\begin{ncbnf} +\locnontermdef{intval}\br + \opt{sign} units +\end{ncbnf} +\begin{ncbnf} +\locnontermdef{sign}\br + \terminal{+}\br + \terminal{-} +\end{ncbnf} +\begin{ncbnf} +\locnontermdef{units}\br + digits\br + digits thousands-sep units +\end{ncbnf} +\begin{ncbnf} +\locnontermdef{digits}\br + digit \opt{digits} +\end{ncbnf} and floating-point values have: - -\begin{codeblock} -floatval ::= [sign] units [decimal-point [digits]] [e [sign] digits] | - [sign] decimal-point digits [e [sign] digits] -e ::= 'e' | 'E' -\end{codeblock} - -where the number of digits between -\tcode{thousands-sep}s -is as specified by -\tcode{do_grouping()}. -For parsing, if the -\tcode{digits} -portion contains no thousands-separators, no grouping constraint -is applied. +\begin{ncbnf} +\locnontermdef{floatval}\br + \opt{sign} units \opt{fractional} \opt{exponent}\br + \opt{sign} decimal-point digits \opt{exponent} +\end{ncbnf} +\begin{ncbnf} +\locnontermdef{fractional}\br + decimal-point \opt{digits} +\end{ncbnf} +\begin{ncbnf} +\locnontermdef{exponent}\br + e \opt{sign} digits +\end{ncbnf} +\begin{ncbnf} +\locnontermdef{e}\br + \terminal{e}\br + \terminal{E} +\end{ncbnf} +where the number of digits between \locgrammarterm{thousands-sep}{s} +is as specified by \tcode{do_grouping()}. +For parsing, +if the \locgrammarterm{digits} portion contains no thousands-separators, +no grouping constraint is applied. \rSec4[facet.numpunct.members]{Members} @@ -3297,7 +3294,7 @@ \rSec3[locale.numpunct.byname]{Class template \tcode{numpunct_byname}} -\indexlibrary{\idxcode{numpunct_byname}}% +\indexlibraryglobal{numpunct_byname}% \begin{codeblock} namespace std { template @@ -3320,7 +3317,7 @@ \rSec3[locale.collate]{Class template \tcode{collate}} -\indexlibrary{\idxcode{collate}}% +\indexlibraryglobal{collate}% \begin{codeblock} namespace std { template @@ -3468,7 +3465,7 @@ \rSec3[locale.collate.byname]{Class template \tcode{collate_byname}} -\indexlibrary{\idxcode{collate_byname}}% +\indexlibraryglobal{collate_byname}% \begin{codeblock} namespace std { template @@ -3511,7 +3508,7 @@ \rSec3[locale.time.get]{Class template \tcode{time_get}} -\indexlibrary{\idxcode{time_get}}% +\indexlibraryglobal{time_get}% \begin{codeblock} namespace std { class time_base { @@ -3668,7 +3665,8 @@ \begin{itemdescr} \pnum -\returns \tcode{do_get(s, end, f, err, t, format, modifier)}. +\returns +\tcode{do_get(s, end, f, err, t, format, modifier)}. \end{itemdescr} \indexlibrarymember{get}{time_get}% @@ -3682,7 +3680,8 @@ \requires \range{fmt}{fmtend} shall be a valid range. \pnum -\effects The function starts by evaluating +\effects +The function starts by evaluating \tcode{err = ios_base::goodbit}. It then enters a loop, reading zero or more characters from \tcode{s} at each iteration. Unless otherwise specified below, the loop terminates when the first of the following conditions holds: @@ -3726,14 +3725,17 @@ \end{itemize} \pnum -\begin{note} The function uses the \tcode{ctype} +\begin{note} +The function uses the \tcode{ctype} facet installed in \tcode{f}'s locale to determine valid whitespace characters. It is unspecified by what means the function performs case-insensitive comparison or whether -multi-character sequences are considered while doing so. \end{note} +multi-character sequences are considered while doing so. +\end{note} \pnum -\returns \tcode{s}. +\returns +\tcode{s}. \end{itemdescr} \rSec4[locale.time.get.virtuals]{Virtual functions} @@ -3884,7 +3886,8 @@ \tcode{t} shall point to an object. \pnum -\effects The function starts by evaluating +\effects +The function starts by evaluating \tcode{err = ios_base::goodbit}. It then reads characters starting at \tcode{s} until it encounters an error, or until it has extracted and assigned those \tcode{struct tm} members, and any @@ -3909,21 +3912,23 @@ and may be outside their valid range. \pnum -\remarks It is unspecified whether multiple calls to +\remarks +It is unspecified whether multiple calls to \tcode{do_get()} with the address of the same \tcode{struct tm} object will update the current contents of the object or simply overwrite its members. Portable programs should zero out the object before invoking the function. \pnum -\returns An iterator pointing immediately beyond the last character +\returns +An iterator pointing immediately beyond the last character recognized as possibly part of a valid input sequence for the given \tcode{format} and \tcode{modifier}. \end{itemdescr} \rSec3[locale.time.get.byname]{Class template \tcode{time_get_byname}} -\indexlibrary{\idxcode{time_get_byname}}% +\indexlibraryglobal{time_get_byname}% \begin{codeblock} namespace std { template> @@ -3943,7 +3948,7 @@ \rSec3[locale.time.put]{Class template \tcode{time_put}} -\indexlibrary{\idxcode{time_put}}% +\indexlibraryglobal{time_put}% \begin{codeblock} namespace std { template> @@ -4053,7 +4058,7 @@ Formatting is controlled by the parameters \tcode{format} and \tcode{modifier}, interpreted identically as the format specifiers in the string argument to the standard library function -\indexlibrary{\idxcode{strftime}}% +\indexlibraryglobal{strftime}% \tcode{strftime()}\footnote{Interpretation of the \tcode{modifier} argument is implementation-defined, but should follow POSIX conventions.}, @@ -4076,7 +4081,7 @@ \rSec3[locale.time.put.byname]{Class template \tcode{time_put_byname}} -\indexlibrary{\idxcode{time_put_byname}}% +\indexlibraryglobal{time_put_byname}% \begin{codeblock} namespace std { template> @@ -4122,7 +4127,7 @@ \rSec3[locale.money.get]{Class template \tcode{money_get}} -\indexlibrary{\idxcode{money_get}}% +\indexlibraryglobal{money_get}% \begin{codeblock} namespace std { template> @@ -4315,14 +4320,12 @@ \tcode{units} is produced as if by\footnote{The semantics here are different from \tcode{ct.narrow}.} - \begin{codeblock} for (int i = 0; i < n; ++i) buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms]; buf2[n] = 0; sscanf(buf2, "%Lf", &units); \end{codeblock} - where \tcode{n} is the number of characters placed in @@ -4333,7 +4336,6 @@ and \tcode{atoms} are defined as if by - \begin{codeblock} static const char src[] = "0123456789-"; charT atoms[sizeof(src)]; @@ -4348,7 +4350,7 @@ \rSec3[locale.money.put]{Class template \tcode{money_put}} -\indexlibrary{\idxcode{money_put}}% +\indexlibraryglobal{money_put}% \begin{codeblock} namespace std { template> @@ -4421,11 +4423,9 @@ The argument \tcode{units} is transformed into a sequence of wide characters as if by - \begin{codeblock} ct.widen(buf1, buf1 + sprintf(buf1, "%.0Lf", units), buf2) \end{codeblock} - for character buffers \tcode{buf1} and @@ -4496,7 +4496,7 @@ \rSec3[locale.moneypunct]{Class template \tcode{moneypunct}} -\indexlibrary{\idxcode{moneypunct}}% +\indexlibraryglobal{moneypunct}% \begin{codeblock} namespace std { class money_base { @@ -4618,65 +4618,49 @@ \pnum The format of the numeric monetary value is a decimal number: - -\begin{codeblock} -value ::= units [ decimal-point [ digits ]] | - decimal-point digits -\end{codeblock} - -if -\tcode{frac_digits()} -returns a positive value, or - -\begin{codeblock} -value ::= units -\end{codeblock} - +\begin{ncbnf} +\locnontermdef{value}\br + units \opt{fractional}\br + decimal-point digits +\end{ncbnf} +\begin{ncbnf} +\locnontermdef{fractional}\br + decimal-point \opt{digits} +\end{ncbnf} +if \tcode{frac_digits()} returns a positive value, or +\begin{ncbnf} +\locnontermdef{value}\br + units +\end{ncbnf} otherwise. -The symbol -\tcode{decimal-point} -indicates the character returned by -\tcode{decimal_point()}. +The symbol \locgrammarterm{decimal-point} +indicates the character returned by \tcode{decimal_point()}. The other symbols are defined as follows: -\begin{codeblock} -units ::= digits [ thousands-sep units ] -digits ::= adigit [ digits ] -\end{codeblock} - -In the syntax specification, the symbol -\tcode{adigit} -is any of the values -\tcode{ct.widen(c)} -for -\tcode{c} -in the range -\tcode{'0'} -through -\tcode{'9'} -(inclusive) and -\tcode{ct} -is a reference of type -\tcode{const ctype\&} -obtained as described in the definitions of -\tcode{money_get<>} -and -\tcode{money_put<>}. -The symbol -\tcode{thousands-sep} -is the character returned by -\tcode{thousands_sep()}. -The space character used is the value -\tcode{ct.widen(' ')}. -White space characters are those characters -\tcode{c} -for which -\tcode{ci.is(space, c)} -returns -\tcode{true}. +\begin{ncbnf} +\locnontermdef{units}\br + digits\br + digits thousands-sep units +\end{ncbnf} + +\begin{ncbnf} +\locnontermdef{digits}\br + adigit \opt{digits} +\end{ncbnf} + +In the syntax specification, the symbol \locgrammarterm{adigit} +is any of the values \tcode{ct.widen(c)} +for \tcode{c} in the range \tcode{'0'} through \tcode{'9'} (inclusive) and +\tcode{ct} is a reference of type \tcode{const ctype\&} +obtained as described in the definitions +of \tcode{money_get<>} and \tcode{money_put<>}. +The symbol \locgrammarterm{thousands-sep} +is the character returned by \tcode{thousands_sep()}. +The space character used is the value \tcode{ct.widen(' ')}. +White space characters are those characters \tcode{c} +for which \tcode{ci.is(space, c)} returns \tcode{true}. The number of digits required after the decimal point (if any) -is exactly the value returned by -\tcode{frac_digits()}. +is exactly the value returned by \tcode{frac_digits()}. \pnum The placement of thousands-separator characters (if any) @@ -4834,7 +4818,7 @@ \rSec3[locale.moneypunct.byname]{Class template \tcode{moneypunct_byname}} -\indexlibrary{\idxcode{moneypunct_byname}}% +\indexlibraryglobal{moneypunct_byname}% \begin{codeblock} namespace std { template @@ -4861,7 +4845,7 @@ \rSec3[locale.messages]{Class template \tcode{messages}} -\indexlibrary{\idxcode{messages}}% +\indexlibraryglobal{messages}% \begin{codeblock} namespace std { class messages_base { @@ -5010,7 +4994,7 @@ \rSec3[locale.messages.byname]{Class template \tcode{messages_byname}} -\indexlibrary{\idxcode{messages_byname}}% +\indexlibraryglobal{messages_byname}% \begin{codeblock} namespace std { template @@ -5032,17 +5016,16 @@ \rSec2[clocale.syn]{Header \tcode{} synopsis} -\indexhdr{cassert}% -\indexlibrary{\idxcode{lconv}}% -\indexlibrary{\idxcode{setlocale}}% -\indexlibrary{\idxcode{localeconv}}% -\indexlibrary{\idxcode{NULL}}% -\indexlibrary{\idxcode{LC_ALL}}% -\indexlibrary{\idxcode{LC_COLLATE}}% -\indexlibrary{\idxcode{LC_CTYPE}}% -\indexlibrary{\idxcode{LC_MONETARY}}% -\indexlibrary{\idxcode{LC_NUMERIC}}% -\indexlibrary{\idxcode{LC_TIME}}% +\indexlibraryglobal{lconv}% +\indexlibraryglobal{setlocale}% +\indexlibraryglobal{localeconv}% +\indexlibraryglobal{NULL}% +\indexlibraryglobal{LC_ALL}% +\indexlibraryglobal{LC_COLLATE}% +\indexlibraryglobal{LC_CTYPE}% +\indexlibraryglobal{LC_MONETARY}% +\indexlibraryglobal{LC_NUMERIC}% +\indexlibraryglobal{LC_TIME}% \begin{codeblock} namespace std { struct lconv; @@ -5061,9 +5044,8 @@ \end{codeblock} \pnum -\indexhdr{locale.h}% -The contents and meaning of the header \tcode{} -are the same as the C standard library header \tcode{}. +The contents and meaning of the header \libheaderdef{clocale} +are the same as the C standard library header \libheader{locale.h}. \pnum Calls to the function \tcode{setlocale} may introduce a data diff --git a/source/macros.tex b/source/macros.tex index 5e81f4df44..c43cd373cb 100644 --- a/source/macros.tex +++ b/source/macros.tex @@ -110,10 +110,14 @@ %%-------------------------------------------------- % Indexing +% Layout of general index +\newcommand{\rSecindex}[2]{\section*{#2}\pdfbookmark[1]{#2}{pdf.idx.#1.#2}\label{idx.#1.#2}} + % locations \newcommand{\indextext}[1]{\index[generalindex]{#1}} \newcommand{\indexlibrary}[1]{\index[libraryindex]{#1}} \newcommand{\indexhdr}[1]{\indextext{\idxhdr{#1}}\index[headerindex]{\idxhdr{#1}}} +\newcommand{\indexconcept}[1]{\index[conceptindex]{#1}} \newcommand{\indexgram}[1]{\index[grammarindex]{#1}} % Collation helper: When building an index key, replace all macro definitions @@ -163,13 +167,35 @@ % appearance \newcommand{\idxcode}[1]{#1@\tcode{#1}} -\newcommand{\idxhdr}[1]{#1@\tcode{<#1>}} + +% avoid \tcode to avoid falling victim of \tcode redefinition in CodeBlockSetup +\newcommand{\idxconcept}[1]{#1@\CodeStylex{#1}} +\newcommand{\idxexposconcept}[1]{#1@\CodeStylex{\placeholder{#1}}} +\newcommand{\idxhdr}[1]{#1@\CodeStylex{<#1>}} \newcommand{\idxgram}[1]{#1@\gterm{#1}} \newcommand{\idxterm}[1]{#1@\term{#1}} \newcommand{\idxxname}[1]{__#1@\xname{#1}} +% library index entries +\newcommand{\indexlibraryglobal}[1]{\indexlibrary{\idxcode{#1}}} +\newcommand{\indexlibraryctor}[1]{\indexlibrary{\idxcode{#1}!constructor}} +\newcommand{\indexlibrarydtor}[1]{\indexlibrary{\idxcode{#1}!destructor}} + % class member library index \newcommand{\indexlibrarymember}[2]{\indexlibrary{\idxcode{#1}!\idxcode{#2}}\indexlibrary{\idxcode{#2}!\idxcode{#1}}} +\newcommand{\indexlibraryzombie}[1]{\indexlibrary{\idxcode{#1}!zombie}} + +\newcommand{\libglobal}[1]{\indexlibraryglobal{#1}#1} +\newcommand{\libmember}[2]{\indexlibrarymember{#1}{#2}#1} + +% index for library headers +\newcommand{\libheader}[1]{\indexhdr{#1}\tcode{<#1>}} +\newcommand{\indexheader}[1]{\indextext{\idxhdr{#1}}\index[headerindex]{\idxhdr{#1}|idxbfpage}} +\newcommand{\libheaderdef}[1]{\indexheader{#1}\tcode{<#1>}} +\newcommand{\libnoheader}[1]{\indextext{\idxhdr{#1}!absence thereof}\tcode{<#1>}} +\newcommand{\libheaderrefx}[2]{\libheader{#1}\iref{#2}} +\newcommand{\libheaderref}[1]{\libheaderrefx{#1}{#1.syn}} +\newcommand{\libdeprheaderref}[1]{\libheaderrefx{#1}{depr.#1.syn}} %%-------------------------------------------------- % General code style @@ -188,6 +214,7 @@ \newcommand{\keyword}[1]{\tcode{#1}\indextext{\idxcode{#1}}} \newcommand{\grammarterm}[1]{\indexgram{\idxgram{#1}}\gterm{#1}} \newcommand{\grammartermnc}[1]{\indexgram{\idxgram{#1}}\gterm{#1\nocorr}} +\newcommand{\regrammarterm}[1]{\gterm{#1}} \newcommand{\placeholder}[1]{\textit{#1}} \newcommand{\placeholdernc}[1]{\textit{#1\nocorr}} \newcommand{\exposid}[1]{\tcode{\placeholder{#1}}} @@ -338,7 +365,14 @@ \newcommand{\newoldconceptdefn}[1]{\defn{#1}} \newcommand{\idxnewoldconcept}[1]{#1@\textit{#1}} -\newcommand{\libconcept}[1]{\tcode{#1}} +\newcommand{\cname}[1]{\tcode{#1}} +\newcommand{\ecname}[1]{\tcode{\placeholder{#1}}} +\newcommand{\libconceptx}[2]{\cname{#1}\indexconcept{\idxconcept{#2}}} +\newcommand{\libconcept}[1]{\libconceptx{#1}{#1}} +\newcommand{\deflibconcept}[1]{\cname{#1}\indexlibrary{\idxconcept{#1}}\indexconcept{\idxconcept{#1}|idxbfpage}} +\newcommand{\exposconcept}[1]{\ecname{#1}\indexconcept{\idxexposconcept{#1}}} +\newcommand{\exposconceptnc}[1]{\indexconcept{\idxexposconcept{#1}}\ecname{#1\nocorr}} +\newcommand{\defexposconcept}[1]{\ecname{#1}\indexconcept{\idxexposconcept{#1}|idxbfpage}} %% Ranges \newcommand{\Range}[4]{\tcode{#1#3,\penalty2000{} #4#2}} @@ -368,7 +402,8 @@ \cs_set_eq:NN \diffrefs \diffref \ExplSyntaxOff % \nodiffref swallows a following \change and removes the preceding line break. -\def\nodiffref\change{\pnum\diffhead{Change}} +\def\nodiffref\change{\pnum +\diffhead{Change}} \newcommand{\change}{\diffdef{Change}} \newcommand{\rationale}{\diffdef{Rationale}} \newcommand{\effect}{\diffdef{Effect on original feature}} @@ -497,6 +532,7 @@ \newenvironment{bnfbase} { \newcommand{\nontermdef}[1]{{\BnfNontermshape##1\itcorr}\indexgrammar{\idxgram{##1}}\textnormal{:}} + \newcommand{\renontermdef}[1]{{\BnfNontermshape##1\itcorr}\,\textnormal{::}} \newcommand{\terminal}[1]{{\BnfTermshape ##1}} \renewcommand{\keyword}[1]{\terminal{##1}\indextext{\idxcode{##1}}} \renewcommand{\exposid}[1]{\terminal{\placeholder{##1}}} diff --git a/source/numerics.tex b/source/numerics.tex index 7dbfdb9854..559d5ec913 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -80,32 +80,32 @@ \rSec1[cfenv]{The floating-point environment} \rSec2[cfenv.syn]{Header \tcode{} synopsis} -\indexhdr{cfenv}% - -\indexlibrary{\idxcode{fenv_t}}% -\indexlibrary{\idxcode{fexcept_t}}% -\indexlibrary{\idxcode{feclearexcept}}% -\indexlibrary{\idxcode{fegetexceptflag}}% -\indexlibrary{\idxcode{feraiseexcept}}% -\indexlibrary{\idxcode{fesetexceptflag}}% -\indexlibrary{\idxcode{fetestexcept}}% -\indexlibrary{\idxcode{fegetround}}% -\indexlibrary{\idxcode{fesetround}}% -\indexlibrary{\idxcode{fegetenv}}% -\indexlibrary{\idxcode{feholdexcept}}% -\indexlibrary{\idxcode{fesetenv}}% -\indexlibrary{\idxcode{feupdateenv}}% -\indexlibrary{\idxcode{FE_ALL_EXCEPT}}% -\indexlibrary{\idxcode{FE_DIVBYZERO}}% -\indexlibrary{\idxcode{FE_INEXACT}}% -\indexlibrary{\idxcode{FE_INVALID}}% -\indexlibrary{\idxcode{FE_OVERFLOW}}% -\indexlibrary{\idxcode{FE_UNDERFLOW}}% -\indexlibrary{\idxcode{FE_DOWNWARD}}% -\indexlibrary{\idxcode{FE_TONEAREST}}% -\indexlibrary{\idxcode{FE_TOWARDZERO}}% -\indexlibrary{\idxcode{FE_UPWARD}}% -\indexlibrary{\idxcode{FE_DFL_ENV}}% + +\indexheader{cfenv}% +\indexlibraryglobal{fenv_t}% +\indexlibraryglobal{fexcept_t}% +\indexlibraryglobal{feclearexcept}% +\indexlibraryglobal{fegetexceptflag}% +\indexlibraryglobal{feraiseexcept}% +\indexlibraryglobal{fesetexceptflag}% +\indexlibraryglobal{fetestexcept}% +\indexlibraryglobal{fegetround}% +\indexlibraryglobal{fesetround}% +\indexlibraryglobal{fegetenv}% +\indexlibraryglobal{feholdexcept}% +\indexlibraryglobal{fesetenv}% +\indexlibraryglobal{feupdateenv}% +\indexlibraryglobal{FE_ALL_EXCEPT}% +\indexlibraryglobal{FE_DIVBYZERO}% +\indexlibraryglobal{FE_INEXACT}% +\indexlibraryglobal{FE_INVALID}% +\indexlibraryglobal{FE_OVERFLOW}% +\indexlibraryglobal{FE_UNDERFLOW}% +\indexlibraryglobal{FE_DOWNWARD}% +\indexlibraryglobal{FE_TONEAREST}% +\indexlibraryglobal{FE_TOWARDZERO}% +\indexlibraryglobal{FE_UPWARD}% +\indexlibraryglobal{FE_DFL_ENV}% \begin{codeblock} #define FE_ALL_EXCEPT @\seebelow@ #define FE_DIVBYZERO @\seebelow@ // optional @@ -144,8 +144,8 @@ \end{codeblock} \pnum -The contents and meaning of the header \tcode{} -are the same as the C standard library header \tcode{}. +The contents and meaning of the header \libheader{cfenv} +are the same as the C standard library header \libheader{fenv.h}. \begin{note} This document does not require an implementation to support the \tcode{FENV_ACCESS} pragma; @@ -166,8 +166,11 @@ the corresponding \tcode{thread} object\iref{thread.thread.class} or \tcode{jthread} object\iref{thread.jthread.class} at the time it -constructed the object. \begin{note} That is, the child thread gets the floating-point -state of the parent thread at the time of the child's creation. \end{note} +constructed the object. +\begin{note} +That is, the child thread gets the floating-point +state of the parent thread at the time of the child's creation. +\end{note} \pnum A separate floating-point environment shall be maintained for each thread. Each function @@ -178,11 +181,7 @@ \rSec1[complex.numbers]{Complex numbers} \pnum -The header -\indexhdr{complex}% -\tcode{} -defines a -class template, +The header \libheader{complex} defines a class template, and numerous functions for representing and manipulating complex numbers. \pnum @@ -201,7 +200,6 @@ \pnum If \tcode{z} is an lvalue of type \cv{} \tcode{complex} then: - \begin{itemize} \item the expression \tcode{reinterpret_cast<\cv{} T(\&)[2]>(z)} shall be well-formed, \item \tcode{reinterpret_cast<\cv{} T(\&)[2]>(z)[0]} shall designate the real part of \tcode{z}, and @@ -209,7 +207,6 @@ \end{itemize} Moreover, if \tcode{a} is an expression of type \cv{}~\tcode{complex*} and the expression \tcode{a[i]} is well-defined for an integer expression \tcode{i}, then: - \begin{itemize} \item \tcode{reinterpret_cast<\cv{} T*>(a)[2*i]} shall designate the real part of \tcode{a[i]}, and \item \tcode{reinterpret_cast<\cv{} T*>(a)[2*i + 1]} shall designate the imaginary part of \tcode{a[i]}. @@ -217,7 +214,7 @@ \rSec2[complex.syn]{Header \tcode{} synopsis} -\indexhdr{complex}% +\indexheader{complex}% \begin{codeblock} namespace std { // \ref{complex}, class template \tcode{complex} @@ -310,7 +307,7 @@ \rSec2[complex]{Class template \tcode{complex}} -\indexlibrary{\idxcode{complex}}% +\indexlibraryglobal{complex}% \indexlibrarymember{value_type}{complex}% \begin{codeblock} namespace std { @@ -446,7 +443,7 @@ \rSec2[complex.members]{Member functions} -\indexlibrary{\idxcode{complex}!constructor}% +\indexlibraryctor{complex}% \begin{itemdecl} template constexpr complex(const T& re = T(), const T& im = T()); \end{itemdecl} @@ -469,7 +466,8 @@ \begin{itemdescr} \pnum -\returns The value of the real component. +\returns +The value of the real component. \end{itemdescr} \indexlibrarymember{real}{complex}% @@ -479,7 +477,8 @@ \begin{itemdescr} \pnum -\effects Assigns \tcode{val} to the real component. +\effects +Assigns \tcode{val} to the real component. \end{itemdescr} \indexlibrarymember{imag}{complex}% @@ -489,7 +488,8 @@ \begin{itemdescr} \pnum -\returns The value of the imaginary component. +\returns +The value of the imaginary component. \end{itemdescr} \indexlibrarymember{imag}{complex}% @@ -499,7 +499,8 @@ \begin{itemdescr} \pnum -\effects Assigns \tcode{val} to the imaginary component. +\effects +Assigns \tcode{val} to the imaginary component. \end{itemdescr} \rSec2[complex.member.ops]{Member operators} @@ -829,7 +830,7 @@ \rSec2[complex.value.ops]{Value operations} -\indexlibrary{\idxcode{real}!\idxcode{complex}}% +\indexlibrarymember{real}{complex}% \begin{itemdecl} template constexpr T real(const complex& x); \end{itemdecl} @@ -840,7 +841,7 @@ \tcode{x.real()}. \end{itemdescr} -\indexlibrary{\idxcode{imag}!\idxcode{complex}}% +\indexlibrarymember{imag}{complex}% \begin{itemdecl} template constexpr T imag(const complex& x); \end{itemdecl} @@ -851,7 +852,7 @@ \tcode{x.imag()}. \end{itemdescr} -\indexlibrary{\idxcode{abs}!\idxcode{complex}}% +\indexlibrarymember{abs}{complex}% \begin{itemdecl} template T abs(const complex& x); \end{itemdecl} @@ -862,7 +863,7 @@ The magnitude of \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{arg}!\idxcode{complex}}% +\indexlibrarymember{arg}{complex}% \begin{itemdecl} template T arg(const complex& x); \end{itemdecl} @@ -873,7 +874,7 @@ The phase angle of \tcode{x}, or \tcode{atan2(imag(x), real(x))}. \end{itemdescr} -\indexlibrary{\idxcode{norm}!\idxcode{complex}}% +\indexlibrarymember{norm}{complex}% \begin{itemdecl} template constexpr T norm(const complex& x); \end{itemdecl} @@ -884,7 +885,7 @@ The squared magnitude of \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{conj}!\idxcode{complex}}% +\indexlibrarymember{conj}{complex}% \begin{itemdecl} template constexpr complex conj(const complex& x); \end{itemdecl} @@ -895,14 +896,15 @@ The complex conjugate of \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{proj}!\idxcode{complex}}% +\indexlibrarymember{proj}{complex}% \begin{itemdecl} template complex proj(const complex& x); \end{itemdecl} \begin{itemdescr} \pnum -\returns The projection of \tcode{x} onto the Riemann sphere. +\returns +The projection of \tcode{x} onto the Riemann sphere. \pnum \remarks @@ -910,7 +912,7 @@ \xrefc{7.3.9.5} \end{itemdescr} -\indexlibrary{\idxcode{polar}!\idxcode{complex}}% +\indexlibrarymember{polar}{complex}% \begin{itemdecl} template complex polar(const T& rho, const T& theta = T()); \end{itemdecl} @@ -931,15 +933,16 @@ \rSec2[complex.transcendentals]{Transcendentals} -\indexlibrary{\idxcode{acos}!\idxcode{complex}}% -\indexlibrary{\idxcode{cacos}!\idxcode{complex}}% +\indexlibrarymember{acos}{complex}% +\indexlibrarymember{cacos}{complex}% \begin{itemdecl} template complex acos(const complex& x); \end{itemdecl} \begin{itemdescr} \pnum -\returns The complex arc cosine of \tcode{x}. +\returns +The complex arc cosine of \tcode{x}. \pnum \remarks @@ -947,15 +950,16 @@ \xrefc{7.3.5.1} \end{itemdescr} -\indexlibrary{\idxcode{asin}!\idxcode{complex}}% -\indexlibrary{\idxcode{casin}!\idxcode{complex}}% +\indexlibrarymember{asin}{complex}% +\indexlibrarymember{casin}{complex}% \begin{itemdecl} template complex asin(const complex& x); \end{itemdecl} \begin{itemdescr} \pnum -\returns The complex arc sine of \tcode{x}. +\returns +The complex arc sine of \tcode{x}. \pnum \remarks @@ -963,15 +967,16 @@ \xrefc{7.3.5.2} \end{itemdescr} -\indexlibrary{\idxcode{atan}!\idxcode{complex}}% -\indexlibrary{\idxcode{catan}!\idxcode{complex}}% +\indexlibrarymember{atan}{complex}% +\indexlibrarymember{catan}{complex}% \begin{itemdecl} template complex atan(const complex& x); \end{itemdecl} \begin{itemdescr} \pnum -\returns The complex arc tangent of \tcode{x}. +\returns +The complex arc tangent of \tcode{x}. \pnum \remarks @@ -979,15 +984,16 @@ \xrefc{7.3.5.3} \end{itemdescr} -\indexlibrary{\idxcode{acosh}!\idxcode{complex}}% -\indexlibrary{\idxcode{cacosh}!\idxcode{complex}}% +\indexlibrarymember{acosh}{complex}% +\indexlibrarymember{cacosh}{complex}% \begin{itemdecl} template complex acosh(const complex& x); \end{itemdecl} \begin{itemdescr} \pnum -\returns The complex arc hyperbolic cosine of \tcode{x}. +\returns +The complex arc hyperbolic cosine of \tcode{x}. \pnum \remarks @@ -995,15 +1001,16 @@ \xrefc{7.3.6.1} \end{itemdescr} -\indexlibrary{\idxcode{asinh}!\idxcode{complex}}% -\indexlibrary{\idxcode{casinh}!\idxcode{complex}}% +\indexlibrarymember{asinh}{complex}% +\indexlibrarymember{casinh}{complex}% \begin{itemdecl} template complex asinh(const complex& x); \end{itemdecl} \begin{itemdescr} \pnum -\returns The complex arc hyperbolic sine of \tcode{x}. +\returns +The complex arc hyperbolic sine of \tcode{x}. \pnum \remarks @@ -1011,15 +1018,16 @@ \xrefc{7.3.6.2} \end{itemdescr} -\indexlibrary{\idxcode{atanh}!\idxcode{complex}}% -\indexlibrary{\idxcode{catanh}!\idxcode{complex}}% +\indexlibrarymember{atanh}{complex}% +\indexlibrarymember{catanh}{complex}% \begin{itemdecl} template complex atanh(const complex& x); \end{itemdecl} \begin{itemdescr} \pnum -\returns The complex arc hyperbolic tangent of \tcode{x}. +\returns +The complex arc hyperbolic tangent of \tcode{x}. \pnum \remarks @@ -1027,7 +1035,7 @@ \xrefc{7.3.6.3} \end{itemdescr} -\indexlibrary{\idxcode{cos}!\idxcode{complex}}% +\indexlibrarymember{cos}{complex}% \begin{itemdecl} template complex cos(const complex& x); \end{itemdecl} @@ -1038,7 +1046,7 @@ The complex cosine of \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{cosh}!\idxcode{complex}}% +\indexlibrarymember{cosh}{complex}% \begin{itemdecl} template complex cosh(const complex& x); \end{itemdecl} @@ -1049,7 +1057,7 @@ The complex hyperbolic cosine of \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{exp}!\idxcode{complex}}% +\indexlibrarymember{exp}{complex}% \begin{itemdecl} template complex exp(const complex& x); \end{itemdecl} @@ -1060,7 +1068,7 @@ The complex base-$e$ exponential of \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{log}!\idxcode{complex}}% +\indexlibrarymember{log}{complex}% \begin{itemdecl} template complex log(const complex& x); \end{itemdecl} @@ -1080,7 +1088,7 @@ The branch cuts are along the negative real axis. \end{itemdescr} -\indexlibrary{\idxcode{log10}!\idxcode{complex}}% +\indexlibrarymember{log10}{complex}% \begin{itemdecl} template complex log10(const complex& x); \end{itemdecl} @@ -1096,7 +1104,7 @@ The branch cuts are along the negative real axis. \end{itemdescr} -\indexlibrary{\idxcode{pow}!\idxcode{complex}}% +\indexlibrarymember{pow}{complex}% \begin{itemdecl} template complex pow(const complex& x, const complex& y); template complex pow(const complex& x, const T& y); @@ -1118,7 +1126,7 @@ The branch cuts are along the negative real axis. \end{itemdescr} -\indexlibrary{\idxcode{sin}!\idxcode{complex}}% +\indexlibrarymember{sin}{complex}% \begin{itemdecl} template complex sin(const complex& x); \end{itemdecl} @@ -1129,7 +1137,7 @@ The complex sine of \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{sinh}!\idxcode{complex}}% +\indexlibrarymember{sinh}{complex}% \begin{itemdecl} template complex sinh(const complex& x); \end{itemdecl} @@ -1140,7 +1148,7 @@ The complex hyperbolic sine of \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{sqrt}!\idxcode{complex}}% +\indexlibrarymember{sqrt}{complex}% \begin{itemdecl} template complex sqrt(const complex& x); \end{itemdecl} @@ -1160,7 +1168,7 @@ The branch cuts are along the negative real axis. \end{itemdescr} -\indexlibrary{\idxcode{tan}!\idxcode{complex}}% +\indexlibrarymember{tan}{complex}% \begin{itemdecl} template complex tan(const complex& x); \end{itemdecl} @@ -1171,7 +1179,7 @@ The complex tangent of \tcode{x}. \end{itemdescr} -\indexlibrary{\idxcode{tanh}!\idxcode{complex}}% +\indexlibrarymember{tanh}{complex}% \begin{itemdecl} template complex tanh(const complex& x); \end{itemdecl} @@ -1185,11 +1193,11 @@ \rSec2[cmplx.over]{Additional overloads} \pnum -\indexlibrary{\idxcode{arg}}% -\indexlibrary{\idxcode{conj}}% -\indexlibrary{\idxcode{imag}}% -\indexlibrary{\idxcode{norm}}% -\indexlibrary{\idxcode{real}}% +\indexlibraryglobal{arg}% +\indexlibraryglobal{conj}% +\indexlibraryglobal{imag}% +\indexlibraryglobal{norm}% +\indexlibraryglobal{real}% The following function templates shall have additional overloads: \begin{codeblock} arg norm @@ -1201,7 +1209,6 @@ \pnum \indextext{overloads!floating-point}% The additional overloads shall be sufficient to ensure: - \begin{itemize} \item If the argument has type \tcode{long double}, then it is effectively cast to \tcode{complex}. @@ -1212,12 +1219,10 @@ \end{itemize} \pnum -\indexlibrary{\idxcode{pow}}% +\indexlibraryglobal{pow}% Function template \tcode{pow} shall have additional overloads sufficient to ensure, for a call with at least one argument of type \tcode{complex}: - \begin{itemize} - \item If either argument has type \tcode{complex} or type \tcode{long double}, then both arguments are effectively cast to \tcode{complex}. @@ -1280,11 +1285,11 @@ \rSec2[bit.general]{General} \pnum -The header \tcode{} provides components to access, +The header \libheaderdef{bit} provides components to access, manipulate and process both individual bits and bit sequences. \rSec2[bit.syn]{Header \tcode{} synopsis} -\indexhdr{bit}% + \begin{codeblock} namespace std { // \ref{bit.cast}, \tcode{bit_cast} @@ -1330,7 +1335,7 @@ \rSec2[bit.cast]{Function template \tcode{bit_cast}} -\indexlibrary{\idxcode{bit_cast}}% +\indexlibraryglobal{bit_cast}% \begin{itemdecl} template constexpr To bit_cast(const From& from) noexcept; @@ -1369,7 +1374,7 @@ \rSec2[bit.pow.two]{Integral powers of 2} -\indexlibrary{\idxcode{ispow2}}% +\indexlibraryglobal{ispow2}% \begin{itemdecl} template constexpr bool ispow2(T x) noexcept; @@ -1387,7 +1392,7 @@ unless \tcode{T} is an unsigned integer type\iref{basic.fundamental}. \end{itemdescr} -\indexlibrary{\idxcode{ceil2}}% +\indexlibraryglobal{ceil2}% \begin{itemdecl} template constexpr T ceil2(T x); @@ -1420,7 +1425,7 @@ is not a core constant expression\iref{expr.const}. \end{itemdescr} -\indexlibrary{\idxcode{floor2}}% +\indexlibraryglobal{floor2}% \begin{itemdecl} template constexpr T floor2(T x) noexcept; @@ -1439,7 +1444,7 @@ unless \tcode{T} is an unsigned integer type\iref{basic.fundamental}. \end{itemdescr} -\indexlibrary{\idxcode{log2p1}}% +\indexlibraryglobal{log2p1}% \begin{itemdecl} template constexpr T log2p1(T x) noexcept; @@ -1468,7 +1473,7 @@ [[nodiscard]] constexpr T rotl(T x, int s) noexcept; \end{itemdecl} -\indexlibrary{\idxcode{rotl}}% +\indexlibraryglobal{rotl}% \begin{itemdescr} \pnum \constraints @@ -1489,7 +1494,7 @@ [[nodiscard]] constexpr T rotr(T x, int s) noexcept; \end{itemdecl} -\indexlibrary{\idxcode{rotr}}% +\indexlibraryglobal{rotr}% \begin{itemdescr} \pnum \constraints @@ -1515,7 +1520,7 @@ constexpr int countl_zero(T x) noexcept; \end{itemdecl} -\indexlibrary{\idxcode{countl_zero}}% +\indexlibraryglobal{countl_zero}% \begin{itemdescr} \pnum \constraints @@ -1535,7 +1540,7 @@ constexpr int countl_one(T x) noexcept; \end{itemdecl} -\indexlibrary{\idxcode{countl_one}}% +\indexlibraryglobal{countl_one}% \begin{itemdescr} \pnum \constraints @@ -1555,7 +1560,7 @@ constexpr int countr_zero(T x) noexcept; \end{itemdecl} -\indexlibrary{\idxcode{countr_zero}}% +\indexlibraryglobal{countr_zero}% \begin{itemdescr} \pnum \constraints @@ -1575,7 +1580,7 @@ constexpr int countr_one(T x) noexcept; \end{itemdecl} -\indexlibrary{\idxcode{countr_one}}% +\indexlibraryglobal{countr_one}% \begin{itemdescr} \pnum \constraints @@ -1595,7 +1600,7 @@ constexpr int popcount(T x) noexcept; \end{itemdecl} -\indexlibrary{\idxcode{popcount}}% +\indexlibraryglobal{popcount}% \begin{itemdescr} \pnum \constraints @@ -1617,7 +1622,7 @@ in ascending order. This subclause describes the endianness of the scalar types of the execution environment. -\indexlibrary{\idxcode{endian}}% +\indexlibraryglobal{endian}% \indexlibrarymember{little}{endian}% \indexlibrarymember{big}{endian}% \indexlibrarymember{native}{endian}% @@ -1708,7 +1713,7 @@ if \tcode{numeric_limits::is_integer} is \tcode{true}; \item otherwise - as \term{floating} or equivalently as \term{real-valued}. + as \term{floating-point} or equivalently as \term{real-valued}. \end{itemize} \noindent If integer-valued, @@ -1728,7 +1733,6 @@ \bitand, \bitor, and \xor{} denote the respective conventional bitwise operations. Further: - \begin{itemize} \item the operator \rightshift{} denotes a bitwise right shift @@ -1749,8 +1753,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\rSec2[rand.synopsis]{Header \tcode{} synopsis}% -\indexhdr{random} +\rSec2[rand.synopsis]{Header \tcode{} synopsis} + +\indexheader{random} \indextext{random number generation!synopsis|(} \begin{codeblock} @@ -2163,7 +2168,6 @@ \pnum Let \tcode{g} be an object of type \tcode{G}. \tcode{G} models \libconcept{uniform_random_bit_generator} only if - \begin{itemize} \item both \tcode{G::min()} and \tcode{G::max()} are constant expressions\iref{expr.const}, @@ -2490,7 +2494,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects The base engine is initialized as if by its default constructor. \end{itemdescr} @@ -2500,7 +2505,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns +\pnum +\returns \tcode{true} if \tcode{a1}'s base engine is equal to \tcode{a2}'s base engine. Otherwise returns \tcode{false}. \end{itemdescr} @@ -2511,7 +2517,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects The base engine is initialized with \tcode{s}. \end{itemdescr} @@ -2522,7 +2529,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects The base engine is initialized with \tcode{q}. \end{itemdescr} @@ -2532,7 +2540,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects With \tcode{b} as the base engine, invokes \tcode{b.seed()}. \end{itemdescr} @@ -2541,7 +2550,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects With \tcode{b} as the base engine, invokes \tcode{b.seed(s)}. \end{itemdescr} @@ -2550,7 +2560,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects With \tcode{b} as the base engine, invokes \tcode{b.seed(q)}. \end{itemdescr} @@ -2947,7 +2958,6 @@ \pnum For every random number engine and for every random number engine adaptor \tcode{X} defined in this subclause\iref{rand.eng} and in subclause~\ref{rand.adapt}: - \begin{itemize} \item if the constructor @@ -2974,7 +2984,7 @@ % linear_congruential_engine engine: \rSec3[rand.eng.lcong]{Class template \tcode{linear_congruential_engine}}% -\indexlibrary{\idxcode{linear_congruential_engine}}% +\indexlibraryglobal{linear_congruential_engine}% \indextext{random number engine!\idxcode{linear_congruential_engine}} \pnum @@ -2997,7 +3007,8 @@ \indextext{generation algorithm!\idxcode{linear_congruential_engine}} is $\mathsf{GA}(\state{x}{i}) = \state{x}{i+1}$. -\indexlibrary{\idxcode{linear_congruential_engine}}% +\indexlibraryglobal{linear_congruential_engine}% +\indexlibrarymember{result_type}{linear_congruential_engine}% \begin{codeblock} template class linear_congruential_engine { @@ -3046,30 +3057,35 @@ and \tcode{c < m}. -\pnum The textual representation% +\pnum +The textual representation% \indextext{\idxcode{linear_congruential_engine}!textual representation} consists of the value of \state{x}{i}. -\indexlibrary{\idxcode{linear_congruential_engine}!constructor}% +\indexlibraryctor{linear_congruential_engine}% \begin{itemdecl} explicit linear_congruential_engine(result_type s); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{linear_congruential_engine} object. +\pnum +\effects +Constructs a \tcode{linear_congruential_engine} object. If $c \bmod m$ is $0$ and $\tcode{s} \bmod m$ is $0$, sets the engine's state to $1$, otherwise sets the engine's state to $\tcode{s} \bmod m$. \end{itemdescr} -\indexlibrary{\idxcode{linear_congruential_engine}!constructor}% +\indexlibraryctor{linear_congruential_engine}% \begin{itemdecl} template explicit linear_congruential_engine(Sseq& q); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{linear_congruential_engine} object. +\pnum +\effects +Constructs a \tcode{linear_congruential_engine} object. With $k = \left\lceil \frac{\log_2 m}{32} \right\rceil$ and $a$ an array (or equivalent) @@ -3087,7 +3103,7 @@ % mersenne_twister_engine engine: \rSec3[rand.eng.mers]{Class template \tcode{mersenne_twister_engine}}% -\indexlibrary{\idxcode{mersenne_twister_engine}}% +\indexlibraryglobal{mersenne_twister_engine}% \indextext{random number engine!\idxcode{mersenne_twister_engine}} \pnum @@ -3153,7 +3169,8 @@ Let $z_4 = z_3 \xor ( z_3 \rightshift \ell )$. \end{itemize} -\indexlibrary{\idxcode{mersenne_twister_engine}}% +\indexlibraryglobal{mersenne_twister_engine}% +\indexlibrarymember{result_type}{mersenne_twister_engine}% \begin{codeblock} template explicit mersenne_twister_engine(Sseq& q); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{mersenne_twister_engine} object. +\pnum +\effects +Constructs a \tcode{mersenne_twister_engine} object. With $k = \left\lceil w / 32 \right\rceil$ and $a$ an array (or equivalent) @@ -3268,7 +3291,7 @@ % subtract_with_carry_engine engine: \rSec3[rand.eng.sub]{Class template \tcode{subtract_with_carry_engine}}% -\indexlibrary{\idxcode{subtract_with_carry_engine}}% +\indexlibraryglobal{subtract_with_carry_engine}% \indextext{random number engine!\idxcode{subtract_with_carry_engine}} \pnum @@ -3324,7 +3347,8 @@ where $y$ is the value produced as a result of advancing the engine's state as described above. -\indexlibrary{\idxcode{subtract_with_carry_engine}}% +\indexlibraryglobal{subtract_with_carry_engine}% +\indexlibrarymember{result_type}{subtract_with_carry_engine}% \begin{codeblock} template class subtract_with_carry_engine { @@ -3370,13 +3394,15 @@ in that order, followed by $c$. -\indexlibrary{\idxcode{subtract_with_carry_engine}!constructor}% +\indexlibraryctor{subtract_with_carry_engine}% \begin{itemdecl} explicit subtract_with_carry_engine(result_type value); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{subtract_with_carry_engine} object. +\pnum +\effects +Constructs a \tcode{subtract_with_carry_engine} object. Sets the values of $X_{-r}, \dotsc, X_{-1}$, in that order, as specified below. @@ -3397,19 +3423,23 @@ of \tcode{e} taken modulo $2^{32}$. Set $X_k$ to $\left( \sum_{j=0}^{n-1} z_j \cdot 2^{32j}\right) \bmod m$. -\pnum\complexity Exactly $n \cdot \tcode{r}$ invocations +\pnum +\complexity +Exactly $n \cdot \tcode{r}$ invocations of \tcode{e}. \end{itemdescr} -\indexlibrary{\idxcode{subtract_with_carry_engine}!constructor}% +\indexlibraryctor{subtract_with_carry_engine}% \begin{itemdecl} template explicit subtract_with_carry_engine(Sseq& q); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{subtract_with_carry_engine} object. +\pnum +\effects +Constructs a \tcode{subtract_with_carry_engine} object. With $k = \left\lceil w / 32 \right\rceil$ and $a$ an array (or equivalent) @@ -3485,7 +3515,7 @@ % discard_block_engine engine adaptor: \rSec3[rand.adapt.disc]{Class template \tcode{discard_block_engine}}% -\indexlibrary{\idxcode{discard_block_engine}}% +\indexlibraryglobal{discard_block_engine}% \indextext{random number engine adaptor!\idxcode{discard_block_engine}} \pnum @@ -3524,7 +3554,8 @@ yields the value returned by the last invocation of \tcode{e()} while advancing \tcode{e}'s state as described above. -\indexlibrary{\idxcode{discard_block_engine}}% +\indexlibraryglobal{discard_block_engine}% +\indexlibrarymember{result_type}{discard_block_engine}% \begin{codeblock} template class discard_block_engine { @@ -3580,7 +3611,7 @@ In addition to its behavior pursuant to subclause~\ref{rand.req.adapt}, each constructor% -\indexlibrary{\idxcode{discard_block_engine}!constructor} +\indexlibraryctor{discard_block_engine} that is not a copy constructor sets \tcode{n} to $0$. @@ -3588,7 +3619,7 @@ % independent_bits_engine engine adaptor: \rSec3[rand.adapt.ibits]{Class template \tcode{independent_bits_engine}}% -\indexlibrary{\idxcode{independent_bits_engine}}% +\indexlibraryglobal{independent_bits_engine}% \indextext{random number engine adaptor!\idxcode{independent_bits_engine}} \pnum @@ -3671,7 +3702,8 @@ } \end{codeblock} -\indexlibrary{\idxcode{independent_bits_engine}}% +\indexlibraryglobal{independent_bits_engine}% +\indexlibrarymember{result_type}{independent_bits_engine}% \begin{codeblock} template class independent_bits_engine { @@ -3723,7 +3755,7 @@ % shuffle_order_engine engine adaptor: \rSec3[rand.adapt.shuf]{Class template \tcode{shuffle_order_engine}}% -\indexlibrary{\idxcode{shuffle_order_engine}}% +\indexlibraryglobal{shuffle_order_engine}% \indextext{random number engine adaptor!\idxcode{shuffle_order_engine}} \pnum @@ -3770,7 +3802,8 @@ yields the last value of \tcode{Y} produced while advancing \tcode{e}'s state as described above. -\indexlibrary{\idxcode{shuffle_order_engine}}% +\indexlibraryglobal{shuffle_order_engine}% +\indexlibrarymember{result_type}{shuffle_order_engine}% \begin{codeblock} template class shuffle_order_engine { @@ -3826,7 +3859,7 @@ In addition to its behavior pursuant to subclause~\ref{rand.req.adapt}, each constructor% -\indexlibrary{\idxcode{shuffle_order_engine}!constructor} +\indexlibraryctor{shuffle_order_engine} that is not a copy constructor initializes $\tcode{V[0]}, \dotsc, \tcode{V[k-1]}$ and $Y$, in that order, @@ -3848,73 +3881,74 @@ \indextext{random number engine adaptor!with predefined parameters|(}% \indextext{random number generation!predefined engines and adaptors|(} -\indexlibrary{\idxcode{minstd_rand0}}% +\indexlibraryglobal{minstd_rand0}% \indextext{engines with predefined parameters!\idxcode{minstd_rand0}}% \begin{itemdecl} using minstd_rand0 = - linear_congruential_engine; + linear_congruential_engine; \end{itemdecl} \begin{itemdescr} -\pnum\required +\pnum +\required The $10000^\text{th}$ consecutive invocation of a default-constructed object of type \tcode{minstd_rand0} shall produce the value $1043618065$. \end{itemdescr} -\indexlibrary{\idxcode{minstd_rand}}% +\indexlibraryglobal{minstd_rand}% \indextext{engines with predefined parameters!\idxcode{minstd_rand}}% \begin{itemdecl} using minstd_rand = - linear_congruential_engine; + linear_congruential_engine; \end{itemdecl} \begin{itemdescr} -\pnum\required +\pnum +\required The $10000^\text{th}$ consecutive invocation of a default-constructed object of type \tcode{minstd_rand} shall produce the value $399268537$. \end{itemdescr} -\indexlibrary{\idxcode{mt19937}}% +\indexlibraryglobal{mt19937}% \indextext{engines with predefined parameters!\idxcode{mt19937}}% \begin{itemdecl} using mt19937 = - mersenne_twister_engine; + mersenne_twister_engine; \end{itemdecl} \begin{itemdescr} -\pnum\required +\pnum +\required The $10000^\text{th}$ consecutive invocation of a default-constructed object of type \tcode{mt19937} shall produce the value $4123659995$. \end{itemdescr} -\indexlibrary{\idxcode{mt19937_64}}% +\indexlibraryglobal{mt19937_64}% \indextext{engines with predefined parameters!\idxcode{mt19937_64}}% \begin{itemdecl} using mt19937_64 = - mersenne_twister_engine; + mersenne_twister_engine; \end{itemdecl} \begin{itemdescr} -\pnum\required +\pnum +\required The $10000^\text{th}$ consecutive invocation of a default-constructed object of type \tcode{mt19937_64} shall produce the value $9981545732273789042$. \end{itemdescr} -\indexlibrary{\idxcode{ranlux24_base}}% +\indexlibraryglobal{ranlux24_base}% \indextext{engines with predefined parameters!\idxcode{ranlux24_base}}% \begin{itemdecl} using ranlux24_base = @@ -3922,7 +3956,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\required +\pnum +\required The $10000^\text{th}$ consecutive invocation of a default-constructed object of type \tcode{ran\-lux24_base} @@ -3930,7 +3965,7 @@ $7937952$. \end{itemdescr} -\indexlibrary{\idxcode{ranlux48_base}}% +\indexlibraryglobal{ranlux48_base}% \indextext{engines with predefined parameters!\idxcode{ranlux48_base}}% \begin{itemdecl} using ranlux48_base = @@ -3938,7 +3973,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\required +\pnum +\required The $10000^\text{th}$ consecutive invocation of a default-constructed object of type \tcode{ran\-lux48_base} @@ -3946,14 +3982,15 @@ $61839128582725$. \end{itemdescr} -\indexlibrary{\idxcode{ranlux24}}% +\indexlibraryglobal{ranlux24}% \indextext{engines with predefined parameters!\idxcode{ranlux24}}% \begin{itemdecl} using ranlux24 = discard_block_engine; \end{itemdecl} \begin{itemdescr} -\pnum\required +\pnum +\required The $10000^\text{th}$ consecutive invocation of a default-constructed object of type \tcode{ranlux24} @@ -3961,14 +3998,15 @@ $9901578$. \end{itemdescr} -\indexlibrary{\idxcode{ranlux48}}% +\indexlibraryglobal{ranlux48}% \indextext{engines with predefined parameters!\idxcode{ranlux48}}% \begin{itemdecl} using ranlux48 = discard_block_engine; \end{itemdecl} \begin{itemdescr} -\pnum\required +\pnum +\required The $10000^\text{th}$ consecutive invocation of a default-constructed object of type \tcode{ranlux48} @@ -3976,28 +4014,30 @@ $249142670248501$. \end{itemdescr} -\indexlibrary{\idxcode{knuth_b}}% +\indexlibraryglobal{knuth_b}% \indextext{engines with predefined parameters!\idxcode{knuth_b}}% \begin{itemdecl} using knuth_b = shuffle_order_engine; \end{itemdecl} \begin{itemdescr} -\pnum\required +\pnum +\required The $10000^\text{th}$ consecutive invocation of a default-constructed object of type \tcode{knuth_b} shall produce the value $1112339016$. \end{itemdescr}% -\indexlibrary{\idxcode{default_random_engine}}% +\indexlibraryglobal{default_random_engine}% \indextext{engines with predefined parameters!\idxcode{default_random_engine}}% \begin{itemdecl} using default_random_engine = @\textit{\impldef{type of \tcode{default_random_engine}}}@; \end{itemdecl} \begin{itemdescr} -\pnum\remarks +\pnum +\remarks The choice of engine type named by this \tcode{typedef} is \impldef{type of \tcode{default_random_engine}}. @@ -4031,7 +4071,7 @@ \rSec2[rand.device]{Class \tcode{random_device}}% -\indexlibrary{\idxcode{random_device}}% +\indexlibraryglobal{random_device}% \pnum A \tcode{random_device} @@ -4044,7 +4084,8 @@ prevent generating nondeterministic random numbers, the implementation may employ a random number engine. -\indexlibrary{\idxcode{random_device}}% +\indexlibraryglobal{random_device}% +\indexlibrarymember{result_type}{random_device}% \begin{codeblock} class random_device { public: @@ -4072,13 +4113,15 @@ \end{codeblock} -\indexlibrary{\idxcode{random_device}!constructor}% +\indexlibraryctor{random_device}% \begin{itemdecl} explicit random_device(const string& token); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{random_device} +\pnum +\effects +Constructs a \tcode{random_device} nondeterministic uniform random bit generator object. The semantics of the \tcode{token} parameter and the token value used by the default constructor are @@ -4089,7 +4132,8 @@ } \pnum -\throws A value of an \impldef{exception type when \tcode{random_device} constructor fails} type +\throws +A value of an \impldef{exception type when \tcode{random_device} constructor fails} type derived from \tcode{exception} if the \tcode{random_device} could not be initialized. \end{itemdescr} @@ -4100,7 +4144,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns If the implementation employs a random number engine, +\pnum +\returns +If the implementation employs a random number engine, returns $0.0$. Otherwise, returns an entropy estimate\footnote{If a device has $n$ states whose respective probabilities are @@ -4120,14 +4166,17 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns A nondeterministic random value, +\pnum +\returns +A nondeterministic random value, uniformly distributed between \tcode{min()} and \tcode{max()} (inclusive). It is \impldef{how \tcode{random_device::operator()} generates values} how these values are generated. \pnum -\throws A value of an \impldef{exception type when \tcode{random_device::operator()} fails} +\throws +A value of an \impldef{exception type when \tcode{random_device::operator()} fails} type derived from \tcode{exception} if a random number could not be obtained. \end{itemdescr} @@ -4150,7 +4199,8 @@ \rSec3[rand.util.seedseq]{Class \tcode{seed_seq}}% -\indexlibrary{\idxcode{seed_seq}}% +\indexlibraryglobal{seed_seq}% +\indexlibrarymember{result_type}{seed_seq}% \begin{codeblock} class seed_seq { public: @@ -4178,54 +4228,62 @@ void operator=(const seed_seq&) = delete; private: - vector v; // \expos + vector v; // \expos }; \end{codeblock}% -\indexlibrary{\idxcode{seed_seq}!constructor}% +\indexlibraryctor{seed_seq}% \begin{itemdecl} seed_seq(); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{seed_seq} object +\pnum +\effects +Constructs a \tcode{seed_seq} object as if by default-constructing its member \tcode{v}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} -\indexlibrary{\idxcode{seed_seq}!constructor}% +\indexlibraryctor{seed_seq}% \begin{itemdecl} template seed_seq(initializer_list il); \end{itemdecl} \begin{itemdescr} -\pnum\requires \tcode{T} shall be an integer type. +\pnum +\requires \tcode{T} shall be an integer type. -\pnum\effects +\pnum +\effects Same as \tcode{seed_seq(il.begin(), il.end())}. \end{itemdescr} -\indexlibrary{\idxcode{seed_seq}!constructor}% +\indexlibraryctor{seed_seq}% \begin{itemdecl} template seed_seq(InputIterator begin, InputIterator end); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires \tcode{InputIterator} shall meet the \oldconcept{InputIterator} requirements\iref{input.iterators}. Moreover, \tcode{iterator_traits::value_type} shall denote an integer type. -\pnum\effects Constructs a \tcode{seed_seq} object +\pnum +\effects +Constructs a \tcode{seed_seq} object by the following algorithm: \begin{codeblock} for (InputIterator s = begin; s != end; ++s) @@ -4240,7 +4298,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\requires \tcode{RandomAccessIterator} +\pnum +\requires \tcode{RandomAccessIterator} shall meet the \oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators} and the requirements of a mutable iterator. @@ -4249,7 +4308,8 @@ shall denote an unsigned integer type capable of accommodating 32-bit quantities. -\pnum\effects +\pnum +\effects Does nothing if \tcode{begin == end}. Otherwise, with $s = \tcode{v.size()}$ @@ -4322,7 +4382,8 @@ set \tcode{begin[$k$]} to $r_4$. \end{itemize} -\pnum\throws +\pnum +\throws What and when \tcode{RandomAccessIterator} operations of \tcode{begin} and \tcode{end} throw. \end{itemdescr} @@ -4333,11 +4394,15 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The number of 32-bit units +\pnum +\returns +The number of 32-bit units that would be returned by a call to \tcode{param()}. -\pnum\complexity Constant time. +\pnum +\complexity +Constant time. \end{itemdescr} \indexlibrarymember{param}{seed_seq}% @@ -4347,7 +4412,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires \tcode{OutputIterator} shall meet the \oldconcept{OutputIterator} requirements\iref{output.iterators}. Moreover, @@ -4355,14 +4421,17 @@ \tcode{*dest = rt} shall be valid for a value \tcode{rt} of type \tcode{result_type}. -\pnum\effects Copies the sequence of prepared 32-bit units +\pnum +\effects +Copies the sequence of prepared 32-bit units to the given destination, as if by executing the following statement: \begin{codeblock} copy(v.begin(), v.end(), dest); \end{codeblock} -\pnum\throws +\pnum +\throws What and when \tcode{OutputIterator} operations of \tcode{dest} throw. \end{itemdescr} @@ -4370,7 +4439,7 @@ % generate_canonical function template: \rSec3[rand.util.canonical]{Function template \tcode{generate_canonical}}% -\indexlibrary{\idxcode{generate_canonical}}% +\indexlibraryglobal{generate_canonical}% \pnum Each function instantiated @@ -4399,14 +4468,16 @@ that can be delivered by a random number distribution. \end{note} -\indexlibrary{\idxcode{generate_canonical}}% +\indexlibraryglobal{generate_canonical}% \begin{itemdecl} template RealType generate_canonical(URBG& g); \end{itemdecl} \begin{itemdescr} -\pnum\complexity Exactly +\pnum +\complexity +Exactly $k = \max(1, \left\lceil b / \log_2 R \right\rceil)$ invocations of \tcode{g}, @@ -4419,7 +4490,8 @@ and $R$ is the value of $\tcode{g.max()} - \tcode{g.min()} + 1$. -\pnum\effects +\pnum +\effects Invokes \tcode{g()} $k$ times to obtain values $g_0, \dotsc, g_{k-1}$, respectively. Calculates a quantity @@ -4431,9 +4503,12 @@ \tcode{RealType}. \pnum -\returns $S / R^k$. +\returns +$S / R^k$. -\pnum\throws What and when \tcode{g} throws. +\pnum +\throws +What and when \tcode{g} throws. \end{itemdescr}% \indextext{random number generation!utilities|)} @@ -4496,7 +4571,7 @@ % uniform_int_distribution distribution: \rSec4[rand.dist.uni.int]{Class template \tcode{uniform_int_distribution}}% -\indexlibrary{\idxcode{uniform_int_distribution}}% +\indexlibraryglobal{uniform_int_distribution}% \indextext{random number distribution!\idxcode{uniform_int_distribution}}% \pnum @@ -4509,7 +4584,8 @@ \indextext{\idxcode{uniform_int_distribution}!discrete probability function}% \[ P(i\,|\,a,b) = 1 / (b - a + 1) \text{ .} \] -\indexlibrary{\idxcode{uniform_int_distribution}}% +\indexlibraryglobal{uniform_int_distribution}% +\indexlibrarymember{result_type}{uniform_int_distribution}% \begin{codeblock} template class uniform_int_distribution { @@ -4541,16 +4617,19 @@ \end{codeblock} -\indexlibrary{\idxcode{uniform_int_distribution}!constructor}% +\indexlibraryctor{uniform_int_distribution}% \begin{itemdecl} explicit uniform_int_distribution(IntType a, IntType b = numeric_limits::max()); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires $\tcode{a} \leq \tcode{b}$. -\pnum\effects Constructs a \tcode{uniform_int_distribution} object; +\pnum +\effects +Constructs a \tcode{uniform_int_distribution} object; \tcode{a} and \tcode{b} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -4561,7 +4640,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{a} parameter +\pnum +\returns +The value of the \tcode{a} parameter with which the object was constructed. \end{itemdescr} @@ -4571,7 +4652,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{b} parameter +\pnum +\returns +The value of the \tcode{b} parameter with which the object was constructed. \end{itemdescr} @@ -4579,7 +4662,7 @@ % uniform_real distribution: \rSec4[rand.dist.uni.real]{Class template \tcode{uniform_real_distribution}}% -\indexlibrary{\idxcode{uniform_real_distribution}}% +\indexlibraryglobal{uniform_real_distribution}% \indextext{random number distribution!\idxcode{uniform_real_distribution}}% \pnum @@ -4595,7 +4678,8 @@ This implies that $p(x\,|\,a,b)$ is undefined when \tcode{a == b}. \end{note} -\indexlibrary{\idxcode{uniform_real_distribution}}% +\indexlibraryglobal{uniform_real_distribution}% +\indexlibrarymember{result_type}{uniform_real_distribution}% \begin{codeblock} template class uniform_real_distribution { @@ -4627,18 +4711,21 @@ \end{codeblock} -\indexlibrary{\idxcode{uniform_real_distribution}!constructor}% +\indexlibraryctor{uniform_real_distribution}% \begin{itemdecl} explicit uniform_real_distribution(RealType a, RealType b = 1.0); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires $\tcode{a} \leq \tcode{b}$ and $\tcode{b} - \tcode{a} \leq \tcode{numeric_limits::max()}$. -\pnum\effects Constructs a \tcode{uniform_real_distribution} object; +\pnum +\effects +Constructs a \tcode{uniform_real_distribution} object; \tcode{a} and \tcode{b} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -4649,7 +4736,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{a} parameter +\pnum +\returns +The value of the \tcode{a} parameter with which the object was constructed. \end{itemdescr} @@ -4659,7 +4748,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{b} parameter +\pnum +\returns +The value of the \tcode{b} parameter with which the object was constructed. \end{itemdescr}% \indextext{random number distributions!uniform|)}% @@ -4680,7 +4771,7 @@ % bernoulli_distribution \rSec4[rand.dist.bern.bernoulli]{Class \tcode{bernoulli_distribution}}% -\indexlibrary{\idxcode{bernoulli_distribution}}% +\indexlibraryglobal{bernoulli_distribution}% \indextext{random number distribution!\idxcode{bernoulli_distribution}}% \pnum @@ -4696,7 +4787,8 @@ \end{array}\right. \] -\indexlibrary{\idxcode{bernoulli_distribution}}% +\indexlibraryglobal{bernoulli_distribution}% +\indexlibrarymember{result_type}{bernoulli_distribution}% \begin{codeblock} class bernoulli_distribution { public: @@ -4726,16 +4818,19 @@ \end{codeblock} -\indexlibrary{\idxcode{bernoulli_distribution}!constructor}% +\indexlibraryctor{bernoulli_distribution}% \begin{itemdecl} explicit bernoulli_distribution(double p); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires $0 \leq \tcode{p} \leq 1$. -\pnum\effects Constructs a \tcode{bernoulli_distribution} object; +\pnum +\effects +Constructs a \tcode{bernoulli_distribution} object; \tcode{p} corresponds to the parameter of the distribution. \end{itemdescr} @@ -4746,7 +4841,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{p} parameter +\pnum +\returns +The value of the \tcode{p} parameter with which the object was constructed. \end{itemdescr} @@ -4754,7 +4851,7 @@ % binomial_distribution \rSec4[rand.dist.bern.bin]{Class template \tcode{binomial_distribution}}% -\indexlibrary{\idxcode{binomial_distribution}}% +\indexlibraryglobal{binomial_distribution}% \indextext{random number distribution!\idxcode{binomial_distribution}}% \pnum @@ -4766,7 +4863,8 @@ \indextext{\idxcode{binomial_distribution}!discrete probability function}% \[ P(i\,|\,t,p) = \binom{t}{i} \cdot p^i \cdot (1-p)^{t-i} \text{ .} \] -\indexlibrary{\idxcode{binomial_distribution}}% +\indexlibraryglobal{binomial_distribution}% +\indexlibrarymember{result_type}{binomial_distribution}% \begin{codeblock} template class binomial_distribution { @@ -4798,16 +4896,19 @@ \end{codeblock} -\indexlibrary{\idxcode{binomial_distribution}!constructor}% +\indexlibraryctor{binomial_distribution}% \begin{itemdecl} explicit binomial_distribution(IntType t, double p = 0.5); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires $0 \leq \tcode{p} \leq 1$ and $0 \leq \tcode{t} $. -\pnum\effects Constructs a \tcode{binomial_distribution} object; +\pnum +\effects +Constructs a \tcode{binomial_distribution} object; \tcode{t} and \tcode{p} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -4817,7 +4918,9 @@ IntType t() const; \end{itemdecl}% \begin{itemdescr} -\pnum\returns The value of the \tcode{t} parameter +\pnum +\returns +The value of the \tcode{t} parameter with which the object was constructed. \end{itemdescr} @@ -4827,7 +4930,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{p} parameter +\pnum +\returns +The value of the \tcode{p} parameter with which the object was constructed. \end{itemdescr} @@ -4835,7 +4940,7 @@ % geometric_distribution \rSec4[rand.dist.bern.geo]{Class template \tcode{geometric_distribution}} -\indexlibrary{\idxcode{geometric_distribution}}% +\indexlibraryglobal{geometric_distribution}% \indextext{random number distribution!\idxcode{geometric_distribution}}% \pnum @@ -4847,7 +4952,8 @@ \indextext{\idxcode{geometric_distribution}!discrete probability function}% \[ P(i\,|\,p) = p \cdot (1-p)^{i} \text{ .} \] -\indexlibrary{\idxcode{geometric_distribution}}% +\indexlibraryglobal{geometric_distribution}% +\indexlibrarymember{result_type}{geometric_distribution}% \begin{codeblock} template class geometric_distribution { @@ -4878,16 +4984,19 @@ \end{codeblock} -\indexlibrary{\idxcode{geometric_distribution}!constructor}% +\indexlibraryctor{geometric_distribution}% \begin{itemdecl} explicit geometric_distribution(double p); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires $0 < \tcode{p} < 1$. -\pnum\effects Constructs a \tcode{geometric_distribution} object; +\pnum +\effects +Constructs a \tcode{geometric_distribution} object; \tcode{p} corresponds to the parameter of the distribution. \end{itemdescr} @@ -4898,7 +5007,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{p} parameter +\pnum +\returns +The value of the \tcode{p} parameter with which the object was constructed. \end{itemdescr} @@ -4907,7 +5018,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.bern.negbin]{Class template \tcode{negative_binomial_distribution}} -\indexlibrary{\idxcode{negative_binomial_distribution}}% +\indexlibraryglobal{negative_binomial_distribution}% \indextext{random number distribution!\idxcode{negative_binomial_distribution}}% \pnum @@ -4922,7 +5033,8 @@ This implies that $P(i\,|\,k,p)$ is undefined when \tcode{p == 1}. \end{note} -\indexlibrary{\idxcode{negative_binomial_distribution}}% +\indexlibraryglobal{negative_binomial_distribution}% +\indexlibrarymember{result_type}{negative_binomial_distribution}% \begin{codeblock} template class negative_binomial_distribution { @@ -4954,17 +5066,20 @@ \end{codeblock} -\indexlibrary{\idxcode{negative_binomial_distribution}!constructor}% +\indexlibraryctor{negative_binomial_distribution}% \begin{itemdecl} explicit negative_binomial_distribution(IntType k, double p = 0.5); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires $0 < \tcode{p} \leq 1$ and $0 < \tcode{k} $. -\pnum\effects Constructs a \tcode{negative_binomial_distribution} object; +\pnum +\effects +Constructs a \tcode{negative_binomial_distribution} object; \tcode{k} and \tcode{p} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -4975,7 +5090,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{k} parameter +\pnum +\returns +The value of the \tcode{k} parameter with which the object was constructed. \end{itemdescr} @@ -4985,7 +5102,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{p} parameter +\pnum +\returns +The value of the \tcode{p} parameter with which the object was constructed. \end{itemdescr}% \indextext{random number distributions!Bernoulli|)}% @@ -5006,7 +5125,7 @@ % poisson_distribution \rSec4[rand.dist.pois.poisson]{Class template \tcode{poisson_distribution}}% -\indexlibrary{\idxcode{poisson_distribution}}% +\indexlibraryglobal{poisson_distribution}% \indextext{random number distribution!\idxcode{poisson_distribution}}% \pnum @@ -5023,7 +5142,8 @@ \indextext{\idxcode{poisson_distribution}!mean}% . -\indexlibrary{\idxcode{poisson_distribution}}% +\indexlibraryglobal{poisson_distribution}% +\indexlibrarymember{result_type}{poisson_distribution}% \begin{codeblock} template class poisson_distribution @@ -5054,7 +5174,7 @@ }; \end{codeblock} -\indexlibrary{\idxcode{poisson_distribution}!constructor}% +\indexlibraryctor{poisson_distribution}% \begin{itemdecl} explicit poisson_distribution(double mean); \end{itemdecl} @@ -5064,7 +5184,8 @@ \requires $0 < \tcode{mean}$. \pnum -\effects Constructs a \tcode{poisson_distribution} object; +\effects +Constructs a \tcode{poisson_distribution} object; \tcode{mean} corresponds to the parameter of the distribution. \end{itemdescr} @@ -5074,7 +5195,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{mean} parameter +\pnum +\returns +The value of the \tcode{mean} parameter with which the object was constructed. \end{itemdescr} @@ -5082,7 +5205,7 @@ % exponential_distribution \rSec4[rand.dist.pois.exp]{Class template \tcode{exponential_distribution}}% -\indexlibrary{\idxcode{exponential_distribution}}% +\indexlibraryglobal{exponential_distribution}% \indextext{random number distribution!\idxcode{exponential_distribution}}% \pnum @@ -5094,7 +5217,8 @@ \indextext{\idxcode{exponential_distribution}!probability density function}% \[ p(x\,|\,\lambda) = \lambda e^{-\lambda x} \text{ .} \] -\indexlibrary{\idxcode{exponential_distribution}}% +\indexlibraryglobal{exponential_distribution}% +\indexlibrarymember{result_type}{exponential_distribution}% \begin{codeblock} template class exponential_distribution { @@ -5125,7 +5249,7 @@ \end{codeblock} -\indexlibrary{\idxcode{exponential_distribution}!constructor}% +\indexlibraryctor{exponential_distribution}% \begin{itemdecl} explicit exponential_distribution(RealType lambda); \end{itemdecl} @@ -5135,7 +5259,8 @@ \requires $0 < \tcode{lambda}$. \pnum -\effects Constructs an \tcode{exponential_distribution} object; +\effects +Constructs an \tcode{exponential_distribution} object; \tcode{lambda} corresponds to the parameter of the distribution. \end{itemdescr} @@ -5145,7 +5270,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{lambda} parameter +\pnum +\returns +The value of the \tcode{lambda} parameter with which the object was constructed. \end{itemdescr} @@ -5153,7 +5280,7 @@ % gamma_distribution \rSec4[rand.dist.pois.gamma]{Class template \tcode{gamma_distribution}}% -\indexlibrary{\idxcode{gamma_distribution}}% +\indexlibraryglobal{gamma_distribution}% \indextext{random number distribution!\idxcode{gamma_distribution}}% \pnum @@ -5167,7 +5294,8 @@ \frac{e^{-x/\beta}}{\beta^{\alpha} \cdot \Gamma(\alpha)} \, \cdot \, x^{\, \alpha-1} \text{ .} \] -\indexlibrary{\idxcode{gamma_distribution}}% +\indexlibraryglobal{gamma_distribution}% +\indexlibrarymember{result_type}{gamma_distribution}% \begin{codeblock} template class gamma_distribution { @@ -5199,7 +5327,7 @@ \end{codeblock} -\indexlibrary{\idxcode{gamma_distribution}!constructor}% +\indexlibraryctor{gamma_distribution}% \begin{itemdecl} explicit gamma_distribution(RealType alpha, RealType beta = 1.0); \end{itemdecl} @@ -5209,7 +5337,8 @@ \requires $0 < \tcode{alpha}$ and $0 < \tcode{beta}$. \pnum -\effects Constructs a \tcode{gamma_distribution} object; +\effects +Constructs a \tcode{gamma_distribution} object; \tcode{alpha} and \tcode{beta} correspond to the parameters of the distribution. \end{itemdescr} @@ -5220,7 +5349,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{alpha} parameter +\pnum +\returns +The value of the \tcode{alpha} parameter with which the object was constructed. \end{itemdescr} @@ -5230,7 +5361,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{beta} parameter +\pnum +\returns +The value of the \tcode{beta} parameter with which the object was constructed. \end{itemdescr} @@ -5239,7 +5372,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.pois.weibull]{Class template \tcode{weibull_distribution}}% -\indexlibrary{\idxcode{weibull_distribution}}% +\indexlibraryglobal{weibull_distribution}% \indextext{random number distribution!\idxcode{weibull_distribution}}% \pnum @@ -5254,7 +5387,8 @@ \cdot \, \exp\left( -\left(\frac{x}{b}\right)^a\right) \text{ .} \] -\indexlibrary{\idxcode{weibull_distribution}}% +\indexlibraryglobal{weibull_distribution}% +\indexlibrarymember{result_type}{weibull_distribution}% \begin{codeblock} template class weibull_distribution { @@ -5285,7 +5419,7 @@ }; \end{codeblock} -\indexlibrary{\idxcode{weibull_distribution}!constructor}% +\indexlibraryctor{weibull_distribution}% \begin{itemdecl} explicit weibull_distribution(RealType a, RealType b = 1.0); \end{itemdecl}% @@ -5295,7 +5429,8 @@ \requires $0 < \tcode{a}$ and $0 < \tcode{b}$. \pnum -\effects Constructs a \tcode{weibull_distribution} object; +\effects +Constructs a \tcode{weibull_distribution} object; \tcode{a} and \tcode{b} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -5306,7 +5441,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{a} parameter +\pnum +\returns +The value of the \tcode{a} parameter with which the object was constructed. \end{itemdescr} @@ -5316,7 +5453,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{b} parameter +\pnum +\returns +The value of the \tcode{b} parameter with which the object was constructed. \end{itemdescr} @@ -5325,7 +5464,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.pois.extreme]{Class template \tcode{extreme_value_distribution}} -\indexlibrary{\idxcode{extreme_value_distribution}}% +\indexlibraryglobal{extreme_value_distribution}% \indextext{random number distribution!\idxcode{extreme_value_distribution}}% \pnum @@ -5346,7 +5485,8 @@ \cdot \exp\left(\frac{a-x}{b} - \exp\left(\frac{a-x}{b}\right)\right) \text{ .} \] -\indexlibrary{\idxcode{extreme_value_distribution}}% +\indexlibraryglobal{extreme_value_distribution}% +\indexlibrarymember{result_type}{extreme_value_distribution}% \begin{codeblock} template class extreme_value_distribution { @@ -5378,7 +5518,7 @@ \end{codeblock} -\indexlibrary{\idxcode{extreme_value_distribution}!constructor}% +\indexlibraryctor{extreme_value_distribution}% \begin{itemdecl} explicit extreme_value_distribution(RealType a, RealType b = 1.0); \end{itemdecl} @@ -5388,7 +5528,8 @@ \requires $0 < \tcode{b}$. \pnum -\effects Constructs an \tcode{extreme_value_distribution} object; +\effects +Constructs an \tcode{extreme_value_distribution} object; \tcode{a} and \tcode{b} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -5399,7 +5540,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{a} parameter +\pnum +\returns +The value of the \tcode{a} parameter with which the object was constructed. \end{itemdescr} @@ -5409,7 +5552,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{b} parameter +\pnum +\returns +The value of the \tcode{b} parameter with which the object was constructed. \end{itemdescr}% \indextext{random number distributions!Poisson|)}% @@ -5430,7 +5575,7 @@ % normal_distribution \rSec4[rand.dist.norm.normal]{Class template \tcode{normal_distribution}}% -\indexlibrary{\idxcode{normal_distribution}}% +\indexlibraryglobal{normal_distribution}% \indextext{random number distribution!\idxcode{normal_distribution}}% \pnum @@ -5460,7 +5605,8 @@ \indextext{\idxcode{normal_distribution}!standard deviation}% . -\indexlibrary{\idxcode{normal_distribution}}% +\indexlibraryglobal{normal_distribution}% +\indexlibrarymember{result_type}{normal_distribution}% \begin{codeblock} template class normal_distribution { @@ -5492,7 +5638,7 @@ \end{codeblock} -\indexlibrary{\idxcode{normal_distribution}!constructor}% +\indexlibraryctor{normal_distribution}% \begin{itemdecl} explicit normal_distribution(RealType mean, RealType stddev = 1.0); \end{itemdecl} @@ -5502,7 +5648,8 @@ \requires $0 < \tcode{stddev}$. \pnum -\effects Constructs a \tcode{normal_distribution} object; +\effects +Constructs a \tcode{normal_distribution} object; \tcode{mean} and \tcode{stddev} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -5513,7 +5660,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{mean} parameter +\pnum +\returns +The value of the \tcode{mean} parameter with which the object was constructed. \end{itemdescr} @@ -5523,7 +5672,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{stddev} parameter +\pnum +\returns +The value of the \tcode{stddev} parameter with which the object was constructed. \end{itemdescr} @@ -5532,7 +5683,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.norm.lognormal]{Class template \tcode{lognormal_distribution}}% -\indexlibrary{\idxcode{lognormal_distribution}}% +\indexlibraryglobal{lognormal_distribution}% \indextext{random number distribution!\idxcode{lognormal_distribution}}% \pnum @@ -5546,7 +5697,8 @@ \cdot \exp{\left(-\frac{(\ln{x} - m)^2}{2 s^2}\right)} \text{ .} \] -\indexlibrary{\idxcode{lognormal_distribution}}% +\indexlibraryglobal{lognormal_distribution}% +\indexlibrarymember{result_type}{lognormal_distribution}% \begin{codeblock} template class lognormal_distribution { @@ -5578,7 +5730,7 @@ \end{codeblock} -\indexlibrary{\idxcode{lognormal_distribution}!constructor}% +\indexlibraryctor{lognormal_distribution}% \begin{itemdecl} explicit lognormal_distribution(RealType m, RealType s = 1.0); \end{itemdecl} @@ -5588,7 +5740,8 @@ \requires $0 < \tcode{s}$. \pnum -\effects Constructs a \tcode{lognormal_distribution} object; +\effects +Constructs a \tcode{lognormal_distribution} object; \tcode{m} and \tcode{s} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -5599,7 +5752,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{m} parameter +\pnum +\returns +The value of the \tcode{m} parameter with which the object was constructed. \end{itemdescr} @@ -5609,7 +5764,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{s} parameter +\pnum +\returns +The value of the \tcode{s} parameter with which the object was constructed. \end{itemdescr} @@ -5618,7 +5775,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.norm.chisq]{Class template \tcode{chi_squared_distribution}}% -\indexlibrary{\idxcode{chi_squared_distribution}}% +\indexlibraryglobal{chi_squared_distribution}% \indextext{random number distribution!\idxcode{chi_squared_distribution}}% \pnum @@ -5630,7 +5787,8 @@ \indextext{\idxcode{chi_squared_distribution}!probability density function}% \[ p(x\,|\,n) = \frac{x^{(n/2)-1} \cdot e^{-x/2}}{\Gamma(n/2) \cdot 2^{n/2}} \text{ .} \] -\indexlibrary{\idxcode{chi_squared_distribution}}% +\indexlibraryglobal{chi_squared_distribution}% +\indexlibrarymember{result_type}{chi_squared_distribution}% \begin{codeblock} template class chi_squared_distribution { @@ -5640,7 +5798,7 @@ using param_type = @\unspec@; // constructor and reset functions - chi_squared_distribution() : chi_squared_distribution(1) {} + chi_squared_distribution() : chi_squared_distribution(1.0) {} explicit chi_squared_distribution(RealType n); explicit chi_squared_distribution(const param_type& parm); void reset(); @@ -5661,7 +5819,7 @@ \end{codeblock} -\indexlibrary{\idxcode{chi_squared_distribution}!constructor}% +\indexlibraryctor{chi_squared_distribution}% \begin{itemdecl} explicit chi_squared_distribution(RealType n); \end{itemdecl} @@ -5671,7 +5829,8 @@ \requires $0 < \tcode{n}$. \pnum -\effects Constructs a \tcode{chi_squared_distribution} object; +\effects +Constructs a \tcode{chi_squared_distribution} object; \tcode{n} corresponds to the parameter of the distribution. \end{itemdescr} @@ -5681,7 +5840,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{n} parameter +\pnum +\returns +The value of the \tcode{n} parameter with which the object was constructed. \end{itemdescr} @@ -5690,7 +5851,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.norm.cauchy]{Class template \tcode{cauchy_distribution}}% -\indexlibrary{\idxcode{cauchy_distribution}}% +\indexlibraryglobal{cauchy_distribution}% \indextext{random number distribution!\idxcode{cauchy_distribution}}% \pnum @@ -5702,7 +5863,8 @@ \indextext{\idxcode{cauchy_distribution}!probability density function}% \[ p(x\,|\,a,b) = \left(\pi b \left(1 + \left(\frac{x-a}{b} \right)^2 \, \right)\right)^{-1} \text{ .} \] -\indexlibrary{\idxcode{cauchy_distribution}}% +\indexlibraryglobal{cauchy_distribution}% +\indexlibrarymember{result_type}{cauchy_distribution}% \begin{codeblock} template class cauchy_distribution { @@ -5734,7 +5896,7 @@ \end{codeblock} -\indexlibrary{\idxcode{cauchy_distribution}!constructor}% +\indexlibraryctor{cauchy_distribution}% \begin{itemdecl} explicit cauchy_distribution(RealType a, RealType b = 1.0); \end{itemdecl} @@ -5744,7 +5906,8 @@ \requires $0 < \tcode{b}$. \pnum -\effects Constructs a \tcode{cauchy_distribution} object; +\effects +Constructs a \tcode{cauchy_distribution} object; \tcode{a} and \tcode{b} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -5755,7 +5918,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{a} parameter +\pnum +\returns +The value of the \tcode{a} parameter with which the object was constructed. \end{itemdescr} @@ -5765,7 +5930,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{b} parameter +\pnum +\returns +The value of the \tcode{b} parameter with which the object was constructed. \end{itemdescr} @@ -5774,7 +5941,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.norm.f]{Class template \tcode{fisher_f_distribution}}% -\indexlibrary{\idxcode{fisher_f_distribution}}% +\indexlibraryglobal{fisher_f_distribution}% \indextext{random number distribution!\idxcode{fisher_f_distribution}}% \pnum @@ -5790,7 +5957,8 @@ \cdot \left(1 + \frac{m x}{n}\right)^{-(m + n)/2} \text{ .} \] -\indexlibrary{\idxcode{fisher_f_distribution}}% +\indexlibraryglobal{fisher_f_distribution}% +\indexlibrarymember{result_type}{fisher_distribution}% \begin{codeblock} template class fisher_f_distribution { @@ -5800,8 +5968,8 @@ using param_type = @\unspec@; // constructor and reset functions - fisher_f_distribution() : fisher_f_distribution(1) {} - explicit fisher_f_distribution(RealType m, RealType n = 1); + fisher_f_distribution() : fisher_f_distribution(1.0) {} + explicit fisher_f_distribution(RealType m, RealType n = 1.0); explicit fisher_f_distribution(const param_type& parm); void reset(); @@ -5822,7 +5990,7 @@ \end{codeblock} -\indexlibrary{\idxcode{fisher_f_distribution}!constructor}% +\indexlibraryctor{fisher_f_distribution}% \begin{itemdecl} explicit fisher_f_distribution(RealType m, RealType n = 1); \end{itemdecl} @@ -5832,7 +6000,8 @@ \requires $0 < \tcode{m}$ and $0 < \tcode{n}$. \pnum -\effects Constructs a \tcode{fisher_f_distribution} object; +\effects +Constructs a \tcode{fisher_f_distribution} object; \tcode{m} and \tcode{n} correspond to the respective parameters of the distribution. \end{itemdescr} @@ -5843,7 +6012,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{m} parameter +\pnum +\returns +The value of the \tcode{m} parameter with which the object was constructed. \end{itemdescr} @@ -5853,7 +6024,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{n} parameter +\pnum +\returns +The value of the \tcode{n} parameter with which the object was constructed. \end{itemdescr} @@ -5862,7 +6035,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.norm.t]{Class template \tcode{student_t_distribution}}% -\indexlibrary{\idxcode{student_t_distribution}}% +\indexlibraryglobal{student_t_distribution}% \indextext{random number distribution!\idxcode{student_t_distribution}}% \pnum @@ -5877,7 +6050,8 @@ \cdot \left(1 + \frac{x^2}{n} \right)^{-(n+1)/2} \text{ .} \] -\indexlibrary{\idxcode{student_t_distribution}}% +\indexlibraryglobal{student_t_distribution}% +\indexlibrarymember{result_type}{student_t_distribution}% \begin{codeblock} template class student_t_distribution { @@ -5887,7 +6061,7 @@ using param_type = @\unspec@; // constructor and reset functions - student_t_distribution() : student_t_distribution(1) {} + student_t_distribution() : student_t_distribution(1.0) {} explicit student_t_distribution(RealType n); explicit student_t_distribution(const param_type& parm); void reset(); @@ -5908,7 +6082,7 @@ \end{codeblock} -\indexlibrary{\idxcode{student_t_distribution}!constructor}% +\indexlibraryctor{student_t_distribution}% \begin{itemdecl} explicit student_t_distribution(RealType n); \end{itemdecl} @@ -5918,7 +6092,8 @@ \requires $0 < \tcode{n}$. \pnum -\effects Constructs a \tcode{student_t_distribution} object; +\effects +Constructs a \tcode{student_t_distribution} object; \tcode{n} corresponds to the parameter of the distribution. \end{itemdescr} @@ -5928,7 +6103,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The value of the \tcode{n} parameter +\pnum +\returns +The value of the \tcode{n} parameter with which the object was constructed. \end{itemdescr}% \indextext{random number distributions!normal|)}% @@ -5951,7 +6128,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.samp.discrete]{Class template \tcode{discrete_distribution}}% -\indexlibrary{\idxcode{discrete_distribution}}% +\indexlibraryglobal{discrete_distribution}% \indextext{random number distribution!\idxcode{discrete_distribution}}% \pnum @@ -5975,7 +6152,8 @@ Moreover, the following relation shall hold: $0 < S = w_0 + \dotsb + w_{n - 1}$. -\indexlibrary{\idxcode{discrete_distribution}}% +\indexlibraryglobal{discrete_distribution}% +\indexlibrarymember{result_type}{discrete_distribution}% \begin{codeblock} template class discrete_distribution { @@ -6009,13 +6187,15 @@ }; \end{codeblock} -\indexlibrary{\idxcode{discrete_distribution}!constructor} +\indexlibraryctor{discrete_distribution} \begin{itemdecl} discrete_distribution(); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{discrete_distribution} object +\pnum +\effects +Constructs a \tcode{discrete_distribution} object with $n = 1$ and $p_0 = 1$. \begin{note} Such an object will always deliver the value $0$. @@ -6023,7 +6203,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{discrete_distribution}!constructor}% +\indexlibraryctor{discrete_distribution}% \begin{itemdecl} template discrete_distribution(InputIterator firstW, InputIterator lastW); @@ -6044,29 +6224,32 @@ shall form a sequence $w$ of length $n > 0$. \pnum -\effects Constructs a \tcode{discrete_distribution} object +\effects +Constructs a \tcode{discrete_distribution} object with probabilities given by the formula above. \end{itemdescr} -\indexlibrary{\idxcode{discrete_distribution}!constructor}% +\indexlibraryctor{discrete_distribution}% \begin{itemdecl} discrete_distribution(initializer_list wl); \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects Same as \tcode{discrete_distribution(wl.begin(), wl.end())}. \end{itemdescr} -\indexlibrary{\idxcode{discrete_distribution}!constructor} +\indexlibraryctor{discrete_distribution} \begin{itemdecl} template discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires Each instance of type \tcode{UnaryOperation} shall be a function object\iref{function.objects} whose return type shall be convertible to \tcode{double}. @@ -6078,7 +6261,9 @@ $0 < \delta = (\tcode{xmax} - \tcode{xmin}) / n$ shall hold. -\pnum\effects Constructs a \tcode{discrete_distribution} object +\pnum +\effects +Constructs a \tcode{discrete_distribution} object with probabilities given by the formula above, using the following values: If $\tcode{nw} = 0$, @@ -6087,7 +6272,8 @@ let $w_k = \tcode{fw}(\tcode{xmin} + k \cdot \delta + \delta / 2)$ for $k = 0, \dotsc, n - 1$. -\pnum\complexity +\pnum +\complexity The number of invocations of \tcode{fw} shall not exceed $n$. \end{itemdescr} @@ -6097,7 +6283,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns A \tcode{vector} +\pnum +\returns +A \tcode{vector} whose \tcode{size} member returns $n$ and whose \tcode{operator[]} member returns $p_k$ when invoked with argument $k$ for $k = 0, \dotsc, n - 1$. @@ -6109,7 +6297,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.samp.pconst]{Class template \tcode{piecewise_constant_distribution}}% -\indexlibrary{\idxcode{piecewise_constant_distribution}}% +\indexlibraryglobal{piecewise_constant_distribution}% \indextext{random number distribution!\idxcode{piecewise_constant_distribution}}% \pnum @@ -6142,7 +6330,8 @@ Moreover, the following relation shall hold: $0 < S = w_0 + \dotsb + w_{n-1}$. -\indexlibrary{\idxcode{piecewise_constant_distribution}}% +\indexlibraryglobal{piecewise_constant_distribution}% +\indexlibrarymember{result_type}{piecewise_constant_distribution}% \begin{codeblock} template class piecewise_constant_distribution { @@ -6181,13 +6370,15 @@ \end{codeblock} -\indexlibrary{\idxcode{piecewise_constant_distribution}!constructor}% +\indexlibraryctor{piecewise_constant_distribution}% \begin{itemdecl} piecewise_constant_distribution(); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{piecewise_constant_distribution} object +\pnum +\effects +Constructs a \tcode{piecewise_constant_distribution} object with $n = 1$, $\rho_0 = 1$, $b_0 = 0$, @@ -6195,7 +6386,7 @@ \end{itemdescr} -\indexlibrary{\idxcode{piecewise_constant_distribution}!constructor}% +\indexlibraryctor{piecewise_constant_distribution}% \begin{itemdecl} template piecewise_constant_distribution(InputIteratorB firstB, InputIteratorB lastB, @@ -6203,7 +6394,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires \tcode{InputIteratorB} and \tcode{InputIteratorW} shall each meet the \oldconcept{InputIterator} requirements\iref{input.iterators}. @@ -6225,19 +6417,22 @@ shall be at least $n$, and any $w_k$ for $k \geq n$ shall be ignored by the distribution. -\pnum\effects Constructs a \tcode{piecewise_constant_distribution} object +\pnum +\effects +Constructs a \tcode{piecewise_constant_distribution} object with parameters as specified above. \end{itemdescr} -\indexlibrary{\idxcode{piecewise_constant_distribution}!constructor}% +\indexlibraryctor{piecewise_constant_distribution}% \begin{itemdecl} template piecewise_constant_distribution(initializer_list bl, UnaryOperation fw); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires Each instance of type \tcode{UnaryOperation} shall be a function object\iref{function.objects} whose return type shall be convertible to \tcode{double}. @@ -6245,7 +6440,9 @@ \tcode{double} shall be convertible to the type of \tcode{UnaryOperation}'s sole parameter. -\pnum\effects Constructs a \tcode{piecewise_constant_distribution} object +\pnum +\effects +Constructs a \tcode{piecewise_constant_distribution} object with parameters taken or calculated from the following values: If $\tcode{bl.size()} < 2$, @@ -6260,19 +6457,21 @@ let $w_k = \tcode{fw}\bigl(\bigl(b_{k+1} + b_k\bigr) / 2\bigr)$ for $k = 0, \dotsc, n - 1$. -\pnum\complexity +\pnum +\complexity The number of invocations of \tcode{fw} shall not exceed $n$. \end{itemdescr} -\indexlibrary{\idxcode{piecewise_constant_distribution}!constructor}% +\indexlibraryctor{piecewise_constant_distribution}% \begin{itemdecl} template piecewise_constant_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires Each instance of type \tcode{UnaryOperation} shall be a function object\iref{function.objects} whose return type shall be convertible to \tcode{double}. @@ -6283,13 +6482,16 @@ The relation $0 < \delta = (\tcode{xmax} - \tcode{xmin}) / n$ shall hold. -\pnum\effects Constructs a \tcode{piecewise_constant_distribution} object +\pnum +\effects +Constructs a \tcode{piecewise_constant_distribution} object with parameters taken or calculated from the following values: Let $b_k = \tcode{xmin} + k \cdot \delta $ for $ k = 0, \dotsc, n$, and $w_k = \tcode{fw}(b_k + \delta / 2) $ for $ k = 0, \dotsc, n - 1$. -\pnum\complexity +\pnum +\complexity The number of invocations of \tcode{fw} shall not exceed $n$. \end{itemdescr} @@ -6299,7 +6501,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns A \tcode{vector} +\pnum +\returns +A \tcode{vector} whose \tcode{size} member returns $n + 1$ and whose $ \tcode{operator[]} $ member returns $b_k$ when invoked with argument $k$ for $k = 0, \dotsc, n $. @@ -6311,7 +6515,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns A \tcode{vector} +\pnum +\returns +A \tcode{vector} whose \tcode{size} member returns $n$ and whose $ \tcode{operator[]} $ member returns $\rho_k$ when invoked with argument $k$ for $k = 0, \dotsc, n - 1$. @@ -6323,7 +6529,7 @@ % ---------------------------------------------------------------------- \rSec4[rand.dist.samp.plinear]{Class template \tcode{piecewise_linear_distribution}}% -\indexlibrary{\idxcode{piecewise_linear_distribution}}% +\indexlibraryglobal{piecewise_linear_distribution}% \indextext{random number distribution!\idxcode{piecewise_linear_distribution}}% \pnum @@ -6356,7 +6562,8 @@ Moreover, the following relation shall hold: \[ 0 < S = \frac{1}{2} \cdot \sum_{k=0}^{n-1} (w_k + w_{k+1}) \cdot (b_{k+1} - b_k) \text{ .} \] -\indexlibrary{\idxcode{piecewise_linear_distribution}}% +\indexlibraryglobal{piecewise_linear_distribution}% +\indexlibrarymember{result_type}{piecewise_linear_distribution}% \begin{codeblock} template class piecewise_linear_distribution { @@ -6393,20 +6600,22 @@ }; \end{codeblock} -\indexlibrary{\idxcode{piecewise_linear_distribution}!constructor} +\indexlibraryctor{piecewise_linear_distribution} \begin{itemdecl} piecewise_linear_distribution(); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a \tcode{piecewise_linear_distribution} object +\pnum +\effects +Constructs a \tcode{piecewise_linear_distribution} object with $n = 1$, $\rho_0 = \rho_1 = 1$, $b_0 = 0$, and $b_1 = 1$. \end{itemdescr} -\indexlibrary{\idxcode{piecewise_linear_distribution}!constructor} +\indexlibraryctor{piecewise_linear_distribution} \begin{itemdecl} template piecewise_linear_distribution(InputIteratorB firstB, InputIteratorB lastB, @@ -6414,7 +6623,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires \tcode{InputIteratorB} and \tcode{InputIteratorW} shall each meet the \oldconcept{InputIterator} requirements\iref{input.iterators}. @@ -6436,19 +6646,22 @@ shall be at least $n+1$, and any $w_k$ for $k \geq n + 1$ shall be ignored by the distribution. -\pnum\effects Constructs a \tcode{piecewise_linear_distribution} object +\pnum +\effects +Constructs a \tcode{piecewise_linear_distribution} object with parameters as specified above. \end{itemdescr} -\indexlibrary{\idxcode{piecewise_linear_distribution}!constructor}% +\indexlibraryctor{piecewise_linear_distribution}% \begin{itemdecl} template piecewise_linear_distribution(initializer_list bl, UnaryOperation fw); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires Each instance of type \tcode{UnaryOperation} shall be a function object\iref{function.objects} whose return type shall be convertible to \tcode{double}. @@ -6456,7 +6669,9 @@ \tcode{double} shall be convertible to the type of \tcode{UnaryOperation}'s sole parameter. -\pnum\effects Constructs a \tcode{piecewise_linear_distribution} object +\pnum +\effects +Constructs a \tcode{piecewise_linear_distribution} object with parameters taken or calculated from the following values: If $\tcode{bl.size()} < 2$, @@ -6471,19 +6686,21 @@ let $w_k = \tcode{fw}(b_k)$ for $k = 0, \dotsc, n$. -\pnum\complexity +\pnum +\complexity The number of invocations of \tcode{fw} shall not exceed $n+1$. \end{itemdescr} -\indexlibrary{\idxcode{piecewise_linear_distribution}!constructor}% +\indexlibraryctor{piecewise_linear_distribution}% \begin{itemdecl} template piecewise_linear_distribution(size_t nw, RealType xmin, RealType xmax, UnaryOperation fw); \end{itemdecl} \begin{itemdescr} -\pnum\requires +\pnum +\requires Each instance of type \tcode{UnaryOperation} shall be a function object\iref{function.objects} whose return type shall be convertible to \tcode{double}. @@ -6494,13 +6711,16 @@ The relation $0 < \delta = (\tcode{xmax} - \tcode{xmin}) / n$ shall hold. -\pnum\effects Constructs a \tcode{piecewise_linear_distribution} object +\pnum +\effects +Constructs a \tcode{piecewise_linear_distribution} object with parameters taken or calculated from the following values: Let $b_k = \tcode{xmin} + k \cdot \delta$ for $k = 0, \dotsc, n$, and $w_k = \tcode{fw}(b_k)$ for $k = 0, \dotsc, n$. -\pnum\complexity +\pnum +\complexity The number of invocations of \tcode{fw} shall not exceed $n+1$. \end{itemdescr} @@ -6510,7 +6730,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns A \tcode{vector} +\pnum +\returns +A \tcode{vector} whose \tcode{size} member returns $n + 1$ and whose $ \tcode{operator[]} $ member returns $b_k$ when invoked with argument $k$ for $k = 0, \dotsc, n$. @@ -6522,7 +6744,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns A \tcode{vector} +\pnum +\returns +A \tcode{vector} whose \tcode{size} member returns $n$ and whose $ \tcode{operator[]} $ member returns $\rho_k$ when invoked with argument $k$ for $k = 0, \dotsc, n$. @@ -6535,14 +6759,13 @@ \rSec2[c.math.rand]{Low-quality random number generation} \pnum -\indexhdr{cstdlib}% \begin{note} -The header \tcode{}\iref{cstdlib.syn} +The header \libheaderref{cstdlib} declares the functions described in this subclause. \end{note} -\indexlibrary{\idxcode{rand}}% -\indexlibrary{\idxcode{srand}}% +\indexlibraryglobal{rand}% +\indexlibraryglobal{srand}% \begin{itemdecl} int rand(); void srand(unsigned int seed); @@ -6582,7 +6805,7 @@ \rSec1[numarray]{Numeric arrays} \rSec2[valarray.syn]{Header \tcode{} synopsis} -\indexhdr{valarray}% +\indexheader{valarray}% \begin{codeblock} #include @@ -6736,10 +6959,7 @@ \end{codeblock} \pnum -The header -\tcode{} -defines five -class templates +The header \libheader{valarray} defines five class templates (\tcode{valarray}, \tcode{slice_array}, \tcode{gslice_array}, @@ -6816,7 +7036,7 @@ \rSec3[template.valarray.overview]{Overview} -\indexlibrary{\idxcode{valarray}}% +\indexlibraryglobal{valarray}% \begin{codeblock} namespace std { template class valarray { @@ -6935,7 +7155,7 @@ \rSec3[valarray.cons]{Constructors} -\indexlibrary{\idxcode{valarray}!constructor}% +\indexlibraryctor{valarray}% \begin{itemdecl} valarray(); \end{itemdecl} @@ -6953,7 +7173,7 @@ member function.} \end{itemdescr} -\indexlibrary{\idxcode{valarray}!constructor}% +\indexlibraryctor{valarray}% \begin{itemdecl} explicit valarray(size_t n); \end{itemdecl} @@ -6965,7 +7185,7 @@ Each element of the array is value-initialized\iref{dcl.init}. \end{itemdescr} -\indexlibrary{\idxcode{valarray}!constructor}% +\indexlibraryctor{valarray}% \begin{itemdecl} valarray(const T& v, size_t n); \end{itemdecl} @@ -6977,7 +7197,7 @@ Each element of the array is initialized with \tcode{v}. \end{itemdescr} -\indexlibrary{\idxcode{valarray}!constructor}% +\indexlibraryctor{valarray}% \begin{itemdecl} valarray(const T* p, size_t n); \end{itemdecl} @@ -6999,7 +7219,7 @@ object.} \end{itemdescr} -\indexlibrary{\idxcode{valarray}!constructor}% +\indexlibraryctor{valarray}% \begin{itemdecl} valarray(const valarray& v); \end{itemdecl} @@ -7016,7 +7236,7 @@ conceptually distinct.} \end{itemdescr} -\indexlibrary{\idxcode{valarray}!constructor}% +\indexlibraryctor{valarray}% \begin{itemdecl} valarray(valarray&& v) noexcept; \end{itemdecl} @@ -7029,20 +7249,22 @@ elements of \tcode{v}. \pnum -\complexity Constant. +\complexity +Constant. \end{itemdescr} -\indexlibrary{\idxcode{valarray}!constructor}% +\indexlibraryctor{valarray}% \begin{itemdecl} valarray(initializer_list il); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to \tcode{valarray(il.begin(), il.size())}. +\effects +Equivalent to \tcode{valarray(il.begin(), il.size())}. \end{itemdescr} -\indexlibrary{\idxcode{valarray}!constructor}% +\indexlibraryctor{valarray}% \begin{itemdecl} valarray(const slice_array&); valarray(const gslice_array&); @@ -7057,7 +7279,7 @@ \tcode{valarray}. \end{itemdescr} -\indexlibrary{\idxcode{valarray}!destructor}% +\indexlibrarydtor{valarray}% \begin{itemdecl} ~valarray(); \end{itemdecl} @@ -7088,10 +7310,12 @@ as if by calling \tcode{resize(v.size())}, before performing the assignment. \pnum -\ensures \tcode{size() == v.size()}. +\ensures +\tcode{size() == v.size()}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator=}{valarray}% @@ -7101,14 +7325,17 @@ \begin{itemdescr} \pnum -\effects \tcode{*this} obtains the value of \tcode{v}. +\effects +\tcode{*this} obtains the value of \tcode{v}. The value of \tcode{v} after the assignment is not specified. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \pnum -\complexity Linear. +\complexity +Linear. \end{itemdescr} \indexlibrarymember{operator=}{valarray}% @@ -7118,7 +7345,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return *this = valarray(il);} +\effects +Equivalent to: \tcode{return *this = valarray(il);} \end{itemdescr} @@ -7133,7 +7361,8 @@ Assigns \tcode{v} to each element of \tcode{*this}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{operator=}{valarray}% @@ -7192,7 +7421,8 @@ \tcode{size_t i} and \tcode{size_t j} such that \tcode{i < a.size()} and \tcode{j < b.size()}. -\begin{note} This property indicates an absence of aliasing and may be used to +\begin{note} +This property indicates an absence of aliasing and may be used to advantage by optimizing compilers. Compilers may take advantage of inlining, constant propagation, loop fusion, tracking of pointers obtained from @@ -7228,7 +7458,8 @@ \begin{itemdescr} \pnum -\returns A \tcode{valarray} containing those +\returns +A \tcode{valarray} containing those elements of the controlled sequence designated by \tcode{slicearr}. \begin{example} \begin{codeblock} @@ -7245,8 +7476,10 @@ \begin{itemdescr} \pnum -\returns An object that holds references to elements of the controlled -sequence selected by \tcode{slicearr}. \begin{example} +\returns +An object that holds references to elements of the controlled +sequence selected by \tcode{slicearr}. +\begin{example} \begin{codeblock} valarray v0("abcdefghijklmnop", 16); valarray v1("ABCDE", 5); @@ -7263,7 +7496,8 @@ \begin{itemdescr} \pnum -\returns A \tcode{valarray} containing those +\returns +A \tcode{valarray} containing those elements of the controlled sequence designated by \tcode{gslicearr}. \begin{example} \begin{codeblock} @@ -7284,8 +7518,10 @@ \begin{itemdescr} \pnum -\returns An object that holds references to elements of the controlled -sequence selected by \tcode{gslicearr}. \begin{example} +\returns +An object that holds references to elements of the controlled +sequence selected by \tcode{gslicearr}. +\begin{example} \begin{codeblock} valarray v0("abcdefghijklmnop", 16); valarray v1("ABCDEF", 6); @@ -7305,7 +7541,8 @@ \begin{itemdescr} \pnum -\returns A \tcode{valarray} containing those +\returns +A \tcode{valarray} containing those elements of the controlled sequence designated by \tcode{boolarr}. \begin{example} \begin{codeblock} @@ -7324,8 +7561,10 @@ \begin{itemdescr} \pnum -\returns An object that holds references to elements of the controlled -sequence selected by \tcode{boolarr}. \begin{example} +\returns +An object that holds references to elements of the controlled +sequence selected by \tcode{boolarr}. +\begin{example} \begin{codeblock} valarray v0("abcdefghijklmnop", 16); valarray v1("ABC", 3); @@ -7343,7 +7582,8 @@ \begin{itemdescr} \pnum -\returns A \tcode{valarray} containing those +\returns +A \tcode{valarray} containing those elements of the controlled sequence designated by \tcode{indarr}. \begin{example} \begin{codeblock} @@ -7362,8 +7602,10 @@ \begin{itemdescr} \pnum -\returns An object that holds references to elements of the controlled -sequence selected by \tcode{indarr}. \begin{example} +\returns +An object that holds references to elements of the controlled +sequence selected by \tcode{indarr}. +\begin{example} \begin{codeblock} valarray v0("abcdefghijklmnop", 16); valarray v1("ABCDE", 5); @@ -7397,7 +7639,8 @@ \tcode{T} (\tcode{bool} for \tcode{operator!}). \pnum -\returns A \tcode{valarray} whose length is \tcode{size()}. +\returns +A \tcode{valarray} whose length is \tcode{size()}. Each element of the returned array is initialized with the result of applying the indicated operator to the corresponding element of the array. \end{itemdescr} @@ -7507,11 +7750,13 @@ \begin{itemdescr} \pnum -\effects \tcode{*this} obtains the value of +\effects +\tcode{*this} obtains the value of \tcode{v}. \tcode{v} obtains the value of \tcode{*this}. \pnum -\complexity Constant. +\complexity +Constant. \end{itemdescr} \indexlibrarymember{size}{valarray}% @@ -7521,10 +7766,12 @@ \begin{itemdescr} \pnum -\returns The number of elements in the array. +\returns +The number of elements in the array. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} \indexlibrarymember{sum}{valarray}% @@ -7876,22 +8123,22 @@ \rSec3[valarray.transcend]{Transcendentals} -\indexlibrary{\idxcode{abs}!\idxcode{valarray}}% -\indexlibrary{\idxcode{acos}!\idxcode{valarray}}% -\indexlibrary{\idxcode{asin}!\idxcode{valarray}}% -\indexlibrary{\idxcode{atan}!\idxcode{valarray}}% -\indexlibrary{\idxcode{atan2}!\idxcode{valarray}}% -\indexlibrary{\idxcode{cos}!\idxcode{valarray}}% -\indexlibrary{\idxcode{cosh}!\idxcode{valarray}}% -\indexlibrary{\idxcode{exp}!\idxcode{valarray}}% -\indexlibrary{\idxcode{log}!\idxcode{valarray}}% -\indexlibrary{\idxcode{log10}!\idxcode{valarray}}% -\indexlibrary{\idxcode{pow}!\idxcode{valarray}}% -\indexlibrary{\idxcode{sin}!\idxcode{valarray}}% -\indexlibrary{\idxcode{sinh}!\idxcode{valarray}}% -\indexlibrary{\idxcode{sqrt}!\idxcode{valarray}}% -\indexlibrary{\idxcode{tan}!\idxcode{valarray}}% -\indexlibrary{\idxcode{tanh}!\idxcode{valarray}}% +\indexlibrarymember{abs}{valarray}% +\indexlibrarymember{acos}{valarray}% +\indexlibrarymember{asin}{valarray}% +\indexlibrarymember{atan}{valarray}% +\indexlibrarymember{atan2}{valarray}% +\indexlibrarymember{cos}{valarray}% +\indexlibrarymember{cosh}{valarray}% +\indexlibrarymember{exp}{valarray}% +\indexlibrarymember{log}{valarray}% +\indexlibrarymember{log10}{valarray}% +\indexlibrarymember{pow}{valarray}% +\indexlibrarymember{sin}{valarray}% +\indexlibrarymember{sinh}{valarray}% +\indexlibrarymember{sqrt}{valarray}% +\indexlibrarymember{tan}{valarray}% +\indexlibrarymember{tanh}{valarray}% \begin{itemdecl} template valarray abs (const valarray&); template valarray acos (const valarray&); @@ -7933,7 +8180,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{x.swap(y)}. +\effects +Equivalent to \tcode{x.swap(y)}. \end{itemdescr} @@ -7941,7 +8189,7 @@ \rSec3[class.slice.overview]{Overview} -\indexlibrary{\idxcode{slice}}% +\indexlibraryglobal{slice}% \begin{codeblock} namespace std { class slice { @@ -7975,7 +8223,7 @@ \rSec3[cons.slice]{Constructors} -\indexlibrary{\idxcode{slice}!constructor}% +\indexlibraryctor{slice}% \begin{itemdecl} slice(); slice(size_t start, size_t length, size_t stride); @@ -8008,11 +8256,13 @@ \begin{itemdescr} \pnum -\returns The start, length, or stride specified +\returns +The start, length, or stride specified by a \tcode{slice} object. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} \rSec3[slice.ops]{Operators} @@ -8035,7 +8285,7 @@ \rSec3[template.slice.array.overview]{Overview} -\indexlibrary{\idxcode{slice_array}}% +\indexlibraryglobal{slice_array}% \indexlibrarymember{value_type}{slice_array}% \begin{codeblock} namespace std { @@ -8060,7 +8310,7 @@ const slice_array& operator=(const slice_array&) const; void operator=(const T&) const; - slice_array() = delete; // as implied by declaring copy constructor above + slice_array() = delete; // as implied by declaring copy constructor above }; } \end{codeblock} @@ -8091,7 +8341,7 @@ \rSec3[slice.arr.assign]{Assignment} -\indexlibrary{\idxcode{operator=}!\idxcode{slice_array}}% +\indexlibrarymember{operator=}{slice_array}% \begin{itemdecl} void operator=(const valarray&) const; const slice_array& operator=(const slice_array&) const; @@ -8165,7 +8415,7 @@ \rSec3[class.gslice.overview]{Overview} -\indexlibrary{\idxcode{gslice}}% +\indexlibraryglobal{gslice}% \begin{codeblock} namespace std { class gslice { @@ -8273,7 +8523,7 @@ \rSec3[gslice.cons]{Constructors} -\indexlibrary{\idxcode{gslice}!constructor}% +\indexlibraryctor{gslice}% \begin{itemdecl} gslice(); gslice(size_t start, const valarray& lengths, @@ -8304,11 +8554,13 @@ \begin{itemdescr} \pnum -\returns The representation of the +\returns +The representation of the start, lengths, or strides specified for the \tcode{gslice}. \pnum -\complexity \tcode{start()} is constant time. \tcode{size()} and \tcode{stride()} +\complexity +\tcode{start()} is constant time. \tcode{size()} and \tcode{stride()} are linear in the number of strides. \end{itemdescr} @@ -8316,7 +8568,7 @@ \rSec3[template.gslice.array.overview]{Overview} -\indexlibrary{\idxcode{gslice_array}}% +\indexlibraryglobal{gslice_array}% \indexlibrarymember{value_type}{gslice_array}% \begin{codeblock} namespace std { @@ -8341,7 +8593,7 @@ const gslice_array& operator=(const gslice_array&) const; void operator=(const T&) const; - gslice_array() = delete; // as implied by declaring copy constructor above + gslice_array() = delete; // as implied by declaring copy constructor above }; } \end{codeblock} @@ -8351,8 +8603,8 @@ \tcode{gslice} subscript operator -\indexlibrary{\idxcode{gslice_array}}% -\indexlibrary{\idxcode{valarray}}% +\indexlibraryglobal{gslice_array}% +\indexlibraryglobal{valarray}% \begin{itemdecl} gslice_array valarray::operator[](const gslice&); \end{itemdecl} @@ -8444,7 +8696,7 @@ \rSec3[template.mask.array.overview]{Overview} -\indexlibrary{\idxcode{mask_array}}% +\indexlibraryglobal{mask_array}% \indexlibrarymember{value_type}{mask_array}% \begin{codeblock} namespace std { @@ -8469,7 +8721,7 @@ const mask_array& operator=(const mask_array&) const; void operator=(const T&) const; - mask_array() = delete; // as implied by declaring copy constructor above + mask_array() = delete; // as implied by declaring copy constructor above }; } \end{codeblock} @@ -8561,7 +8813,7 @@ \rSec3[template.indirect.array.overview]{Overview} -\indexlibrary{\idxcode{indirect_array}}% +\indexlibraryglobal{indirect_array}% \indexlibrarymember{value_type}{indirect_array}% \begin{codeblock} namespace std { @@ -8586,7 +8838,7 @@ const indirect_array& operator=(const indirect_array&) const; void operator=(const T&) const; - indirect_array() = delete; // as implied by declaring copy constructor above + indirect_array() = delete; // as implied by declaring copy constructor above }; } \end{codeblock} @@ -8730,7 +8982,7 @@ array or until the lifetime of that array ends, whichever happens first. -\indexlibrary{\idxcode{begin}!\idxcode{valarray}}% +\indexlibrarymember{begin}{valarray}% \begin{itemdecl} template @\unspec{1}@ begin(valarray& v); template @\unspec{2}@ begin(const valarray& v); @@ -8738,10 +8990,11 @@ \begin{itemdescr} \pnum -\returns An iterator referencing the first value in the array. +\returns +An iterator referencing the first value in the array. \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{valarray}}% +\indexlibrarymember{end}{valarray}% \begin{itemdecl} template @\unspec{1}@ end(valarray& v); template @\unspec{2}@ end(const valarray& v); @@ -8749,218 +9002,219 @@ \begin{itemdescr} \pnum -\returns An iterator referencing one past the last value in the array. +\returns +An iterator referencing one past the last value in the array. \end{itemdescr} \rSec1[c.math]{Mathematical functions for floating-point types} \rSec2[cmath.syn]{Header \tcode{} synopsis} -\indexhdr{cmath}% -\indexlibrary{\idxcode{FP_FAST_FMA}}% -\indexlibrary{\idxcode{FP_FAST_FMAF}}% -\indexlibrary{\idxcode{FP_FAST_FMAL}}% -\indexlibrary{\idxcode{FP_ILOGB0}}% -\indexlibrary{\idxcode{FP_ILOGBNAN}}% -\indexlibrary{\idxcode{FP_INFINITE}}% -\indexlibrary{\idxcode{FP_NAN}}% -\indexlibrary{\idxcode{FP_NORMAL}}% -\indexlibrary{\idxcode{FP_SUBNORMAL}}% -\indexlibrary{\idxcode{FP_ZERO}}% -\indexlibrary{\idxcode{HUGE_VAL}}% -\indexlibrary{\idxcode{HUGE_VALF}}% -\indexlibrary{\idxcode{HUGE_VALL}}% -\indexlibrary{\idxcode{INFINITY}}% -\indexlibrary{\idxcode{MATH_ERREXCEPT}}% -\indexlibrary{\idxcode{MATH_ERRNO}}% -\indexlibrary{\idxcode{NAN}}% -\indexlibrary{\idxcode{abs}}% -\indexlibrary{\idxcode{acos}}% -\indexlibrary{\idxcode{acosf}}% -\indexlibrary{\idxcode{acosh}}% -\indexlibrary{\idxcode{acoshf}}% -\indexlibrary{\idxcode{acoshl}}% -\indexlibrary{\idxcode{acosl}}% -\indexlibrary{\idxcode{asin}}% -\indexlibrary{\idxcode{asinf}}% -\indexlibrary{\idxcode{asinh}}% -\indexlibrary{\idxcode{asinhf}}% -\indexlibrary{\idxcode{asinhl}}% -\indexlibrary{\idxcode{asinl}}% -\indexlibrary{\idxcode{atan}}% -\indexlibrary{\idxcode{atan2}}% -\indexlibrary{\idxcode{atan2f}}% -\indexlibrary{\idxcode{atan2l}}% -\indexlibrary{\idxcode{atanf}}% -\indexlibrary{\idxcode{atanh}}% -\indexlibrary{\idxcode{atanhf}}% -\indexlibrary{\idxcode{atanhl}}% -\indexlibrary{\idxcode{atanl}}% -\indexlibrary{\idxcode{cbrt}}% -\indexlibrary{\idxcode{cbrtf}}% -\indexlibrary{\idxcode{cbrtl}}% -\indexlibrary{\idxcode{ceil}}% -\indexlibrary{\idxcode{ceilf}}% -\indexlibrary{\idxcode{ceill}}% -\indexlibrary{\idxcode{copysign}}% -\indexlibrary{\idxcode{copysignf}}% -\indexlibrary{\idxcode{copysignl}}% -\indexlibrary{\idxcode{cos}}% -\indexlibrary{\idxcode{cosf}}% -\indexlibrary{\idxcode{cosh}}% -\indexlibrary{\idxcode{coshf}}% -\indexlibrary{\idxcode{coshl}}% -\indexlibrary{\idxcode{cosl}}% -\indexlibrary{\idxcode{double_t}}% -\indexlibrary{\idxcode{erf}}% -\indexlibrary{\idxcode{erfc}}% -\indexlibrary{\idxcode{erfcf}}% -\indexlibrary{\idxcode{erfcl}}% -\indexlibrary{\idxcode{erff}}% -\indexlibrary{\idxcode{erfl}}% -\indexlibrary{\idxcode{exp}}% -\indexlibrary{\idxcode{exp2}}% -\indexlibrary{\idxcode{exp2f}}% -\indexlibrary{\idxcode{exp2l}}% -\indexlibrary{\idxcode{expf}}% -\indexlibrary{\idxcode{expl}}% -\indexlibrary{\idxcode{expm1}}% -\indexlibrary{\idxcode{expm1f}}% -\indexlibrary{\idxcode{expm1l}}% -\indexlibrary{\idxcode{fabs}}% -\indexlibrary{\idxcode{fabsf}}% -\indexlibrary{\idxcode{fabsl}}% -\indexlibrary{\idxcode{fdim}}% -\indexlibrary{\idxcode{fdimf}}% -\indexlibrary{\idxcode{fdiml}}% -\indexlibrary{\idxcode{float_t}}% -\indexlibrary{\idxcode{floor}}% -\indexlibrary{\idxcode{floorf}}% -\indexlibrary{\idxcode{floorl}}% -\indexlibrary{\idxcode{fma}}% -\indexlibrary{\idxcode{fmaf}}% -\indexlibrary{\idxcode{fmal}}% -\indexlibrary{\idxcode{fmax}}% -\indexlibrary{\idxcode{fmaxf}}% -\indexlibrary{\idxcode{fmaxl}}% -\indexlibrary{\idxcode{fmin}}% -\indexlibrary{\idxcode{fminf}}% -\indexlibrary{\idxcode{fminl}}% -\indexlibrary{\idxcode{fmod}}% -\indexlibrary{\idxcode{fmodf}}% -\indexlibrary{\idxcode{fmodl}}% -\indexlibrary{\idxcode{fpclassify}}% -\indexlibrary{\idxcode{frexp}}% -\indexlibrary{\idxcode{frexpf}}% -\indexlibrary{\idxcode{frexpl}}% -\indexlibrary{\idxcode{hypot}}% -\indexlibrary{\idxcode{hypotf}}% -\indexlibrary{\idxcode{hypotl}}% -\indexlibrary{\idxcode{ilogb}}% -\indexlibrary{\idxcode{ilogbf}}% -\indexlibrary{\idxcode{ilogbl}}% -\indexlibrary{\idxcode{isfinite}}% -\indexlibrary{\idxcode{isgreater}}% -\indexlibrary{\idxcode{isgreaterequal}}% -\indexlibrary{\idxcode{isinf}}% -\indexlibrary{\idxcode{isless}}% -\indexlibrary{\idxcode{islessequal}}% -\indexlibrary{\idxcode{islessgreater}}% -\indexlibrary{\idxcode{isnan}}% -\indexlibrary{\idxcode{isnormal}}% -\indexlibrary{\idxcode{isunordered}}% -\indexlibrary{\idxcode{ldexp}}% -\indexlibrary{\idxcode{ldexpf}}% -\indexlibrary{\idxcode{ldexpl}}% -\indexlibrary{\idxcode{lgamma}}% -\indexlibrary{\idxcode{lgammaf}}% -\indexlibrary{\idxcode{lgammal}}% -\indexlibrary{\idxcode{llrint}}% -\indexlibrary{\idxcode{llrintf}}% -\indexlibrary{\idxcode{llrintl}}% -\indexlibrary{\idxcode{llround}}% -\indexlibrary{\idxcode{llroundf}}% -\indexlibrary{\idxcode{llroundl}}% -\indexlibrary{\idxcode{log}}% -\indexlibrary{\idxcode{log10}}% -\indexlibrary{\idxcode{log10f}}% -\indexlibrary{\idxcode{log10l}}% -\indexlibrary{\idxcode{log1p}}% -\indexlibrary{\idxcode{log1pf}}% -\indexlibrary{\idxcode{log1pl}}% -\indexlibrary{\idxcode{log2}}% -\indexlibrary{\idxcode{log2f}}% -\indexlibrary{\idxcode{log2l}}% -\indexlibrary{\idxcode{logb}}% -\indexlibrary{\idxcode{logbf}}% -\indexlibrary{\idxcode{logbl}}% -\indexlibrary{\idxcode{logf}}% -\indexlibrary{\idxcode{logl}}% -\indexlibrary{\idxcode{lrint}}% -\indexlibrary{\idxcode{lrintf}}% -\indexlibrary{\idxcode{lrintl}}% -\indexlibrary{\idxcode{lround}}% -\indexlibrary{\idxcode{lroundf}}% -\indexlibrary{\idxcode{lroundl}}% -\indexlibrary{\idxcode{math_errhandling}}% -\indexlibrary{\idxcode{modf}}% -\indexlibrary{\idxcode{modff}}% -\indexlibrary{\idxcode{modfl}}% -\indexlibrary{\idxcode{nan}}% -\indexlibrary{\idxcode{nanf}}% -\indexlibrary{\idxcode{nanl}}% -\indexlibrary{\idxcode{nearbyint}}% -\indexlibrary{\idxcode{nearbyintf}}% -\indexlibrary{\idxcode{nearbyintl}}% -\indexlibrary{\idxcode{nextafter}}% -\indexlibrary{\idxcode{nextafterf}}% -\indexlibrary{\idxcode{nextafterl}}% -\indexlibrary{\idxcode{nexttoward}}% -\indexlibrary{\idxcode{nexttowardf}}% -\indexlibrary{\idxcode{nexttowardl}}% -\indexlibrary{\idxcode{pow}}% -\indexlibrary{\idxcode{powf}}% -\indexlibrary{\idxcode{powl}}% -\indexlibrary{\idxcode{remainder}}% -\indexlibrary{\idxcode{remainderf}}% -\indexlibrary{\idxcode{remainderl}}% -\indexlibrary{\idxcode{remquo}}% -\indexlibrary{\idxcode{remquof}}% -\indexlibrary{\idxcode{remquol}}% -\indexlibrary{\idxcode{rint}}% -\indexlibrary{\idxcode{rintf}}% -\indexlibrary{\idxcode{rintl}}% -\indexlibrary{\idxcode{round}}% -\indexlibrary{\idxcode{roundf}}% -\indexlibrary{\idxcode{roundl}}% -\indexlibrary{\idxcode{scalbln}}% -\indexlibrary{\idxcode{scalblnf}}% -\indexlibrary{\idxcode{scalblnl}}% -\indexlibrary{\idxcode{scalbn}}% -\indexlibrary{\idxcode{scalbnf}}% -\indexlibrary{\idxcode{scalbnl}}% -\indexlibrary{\idxcode{signbit}}% -\indexlibrary{\idxcode{sin}}% -\indexlibrary{\idxcode{sinf}}% -\indexlibrary{\idxcode{sinh}}% -\indexlibrary{\idxcode{sinhf}}% -\indexlibrary{\idxcode{sinhl}}% -\indexlibrary{\idxcode{sinl}}% -\indexlibrary{\idxcode{sqrt}}% -\indexlibrary{\idxcode{sqrtf}}% -\indexlibrary{\idxcode{sqrtl}}% -\indexlibrary{\idxcode{tan}}% -\indexlibrary{\idxcode{tanf}}% -\indexlibrary{\idxcode{tanh}}% -\indexlibrary{\idxcode{tanhf}}% -\indexlibrary{\idxcode{tanhl}}% -\indexlibrary{\idxcode{tanl}}% -\indexlibrary{\idxcode{tgamma}}% -\indexlibrary{\idxcode{tgammaf}}% -\indexlibrary{\idxcode{tgammal}}% -\indexlibrary{\idxcode{trunc}}% -\indexlibrary{\idxcode{truncf}}% -\indexlibrary{\idxcode{truncl}}% +\indexheader{cmath}% +\indexlibraryglobal{FP_FAST_FMA}% +\indexlibraryglobal{FP_FAST_FMAF}% +\indexlibraryglobal{FP_FAST_FMAL}% +\indexlibraryglobal{FP_ILOGB0}% +\indexlibraryglobal{FP_ILOGBNAN}% +\indexlibraryglobal{FP_INFINITE}% +\indexlibraryglobal{FP_NAN}% +\indexlibraryglobal{FP_NORMAL}% +\indexlibraryglobal{FP_SUBNORMAL}% +\indexlibraryglobal{FP_ZERO}% +\indexlibraryglobal{HUGE_VAL}% +\indexlibraryglobal{HUGE_VALF}% +\indexlibraryglobal{HUGE_VALL}% +\indexlibraryglobal{INFINITY}% +\indexlibraryglobal{MATH_ERREXCEPT}% +\indexlibraryglobal{MATH_ERRNO}% +\indexlibraryglobal{NAN}% +\indexlibraryglobal{abs}% +\indexlibraryglobal{acos}% +\indexlibraryglobal{acosf}% +\indexlibraryglobal{acosh}% +\indexlibraryglobal{acoshf}% +\indexlibraryglobal{acoshl}% +\indexlibraryglobal{acosl}% +\indexlibraryglobal{asin}% +\indexlibraryglobal{asinf}% +\indexlibraryglobal{asinh}% +\indexlibraryglobal{asinhf}% +\indexlibraryglobal{asinhl}% +\indexlibraryglobal{asinl}% +\indexlibraryglobal{atan}% +\indexlibraryglobal{atan2}% +\indexlibraryglobal{atan2f}% +\indexlibraryglobal{atan2l}% +\indexlibraryglobal{atanf}% +\indexlibraryglobal{atanh}% +\indexlibraryglobal{atanhf}% +\indexlibraryglobal{atanhl}% +\indexlibraryglobal{atanl}% +\indexlibraryglobal{cbrt}% +\indexlibraryglobal{cbrtf}% +\indexlibraryglobal{cbrtl}% +\indexlibraryglobal{ceil}% +\indexlibraryglobal{ceilf}% +\indexlibraryglobal{ceill}% +\indexlibraryglobal{copysign}% +\indexlibraryglobal{copysignf}% +\indexlibraryglobal{copysignl}% +\indexlibraryglobal{cos}% +\indexlibraryglobal{cosf}% +\indexlibraryglobal{cosh}% +\indexlibraryglobal{coshf}% +\indexlibraryglobal{coshl}% +\indexlibraryglobal{cosl}% +\indexlibraryglobal{double_t}% +\indexlibraryglobal{erf}% +\indexlibraryglobal{erfc}% +\indexlibraryglobal{erfcf}% +\indexlibraryglobal{erfcl}% +\indexlibraryglobal{erff}% +\indexlibraryglobal{erfl}% +\indexlibraryglobal{exp}% +\indexlibraryglobal{exp2}% +\indexlibraryglobal{exp2f}% +\indexlibraryglobal{exp2l}% +\indexlibraryglobal{expf}% +\indexlibraryglobal{expl}% +\indexlibraryglobal{expm1}% +\indexlibraryglobal{expm1f}% +\indexlibraryglobal{expm1l}% +\indexlibraryglobal{fabs}% +\indexlibraryglobal{fabsf}% +\indexlibraryglobal{fabsl}% +\indexlibraryglobal{fdim}% +\indexlibraryglobal{fdimf}% +\indexlibraryglobal{fdiml}% +\indexlibraryglobal{float_t}% +\indexlibraryglobal{floor}% +\indexlibraryglobal{floorf}% +\indexlibraryglobal{floorl}% +\indexlibraryglobal{fma}% +\indexlibraryglobal{fmaf}% +\indexlibraryglobal{fmal}% +\indexlibraryglobal{fmax}% +\indexlibraryglobal{fmaxf}% +\indexlibraryglobal{fmaxl}% +\indexlibraryglobal{fmin}% +\indexlibraryglobal{fminf}% +\indexlibraryglobal{fminl}% +\indexlibraryglobal{fmod}% +\indexlibraryglobal{fmodf}% +\indexlibraryglobal{fmodl}% +\indexlibraryglobal{fpclassify}% +\indexlibraryglobal{frexp}% +\indexlibraryglobal{frexpf}% +\indexlibraryglobal{frexpl}% +\indexlibraryglobal{hypot}% +\indexlibraryglobal{hypotf}% +\indexlibraryglobal{hypotl}% +\indexlibraryglobal{ilogb}% +\indexlibraryglobal{ilogbf}% +\indexlibraryglobal{ilogbl}% +\indexlibraryglobal{isfinite}% +\indexlibraryglobal{isgreater}% +\indexlibraryglobal{isgreaterequal}% +\indexlibraryglobal{isinf}% +\indexlibraryglobal{isless}% +\indexlibraryglobal{islessequal}% +\indexlibraryglobal{islessgreater}% +\indexlibraryglobal{isnan}% +\indexlibraryglobal{isnormal}% +\indexlibraryglobal{isunordered}% +\indexlibraryglobal{ldexp}% +\indexlibraryglobal{ldexpf}% +\indexlibraryglobal{ldexpl}% +\indexlibraryglobal{lgamma}% +\indexlibraryglobal{lgammaf}% +\indexlibraryglobal{lgammal}% +\indexlibraryglobal{llrint}% +\indexlibraryglobal{llrintf}% +\indexlibraryglobal{llrintl}% +\indexlibraryglobal{llround}% +\indexlibraryglobal{llroundf}% +\indexlibraryglobal{llroundl}% +\indexlibraryglobal{log}% +\indexlibraryglobal{log10}% +\indexlibraryglobal{log10f}% +\indexlibraryglobal{log10l}% +\indexlibraryglobal{log1p}% +\indexlibraryglobal{log1pf}% +\indexlibraryglobal{log1pl}% +\indexlibraryglobal{log2}% +\indexlibraryglobal{log2f}% +\indexlibraryglobal{log2l}% +\indexlibraryglobal{logb}% +\indexlibraryglobal{logbf}% +\indexlibraryglobal{logbl}% +\indexlibraryglobal{logf}% +\indexlibraryglobal{logl}% +\indexlibraryglobal{lrint}% +\indexlibraryglobal{lrintf}% +\indexlibraryglobal{lrintl}% +\indexlibraryglobal{lround}% +\indexlibraryglobal{lroundf}% +\indexlibraryglobal{lroundl}% +\indexlibraryglobal{math_errhandling}% +\indexlibraryglobal{modf}% +\indexlibraryglobal{modff}% +\indexlibraryglobal{modfl}% +\indexlibraryglobal{nan}% +\indexlibraryglobal{nanf}% +\indexlibraryglobal{nanl}% +\indexlibraryglobal{nearbyint}% +\indexlibraryglobal{nearbyintf}% +\indexlibraryglobal{nearbyintl}% +\indexlibraryglobal{nextafter}% +\indexlibraryglobal{nextafterf}% +\indexlibraryglobal{nextafterl}% +\indexlibraryglobal{nexttoward}% +\indexlibraryglobal{nexttowardf}% +\indexlibraryglobal{nexttowardl}% +\indexlibraryglobal{pow}% +\indexlibraryglobal{powf}% +\indexlibraryglobal{powl}% +\indexlibraryglobal{remainder}% +\indexlibraryglobal{remainderf}% +\indexlibraryglobal{remainderl}% +\indexlibraryglobal{remquo}% +\indexlibraryglobal{remquof}% +\indexlibraryglobal{remquol}% +\indexlibraryglobal{rint}% +\indexlibraryglobal{rintf}% +\indexlibraryglobal{rintl}% +\indexlibraryglobal{round}% +\indexlibraryglobal{roundf}% +\indexlibraryglobal{roundl}% +\indexlibraryglobal{scalbln}% +\indexlibraryglobal{scalblnf}% +\indexlibraryglobal{scalblnl}% +\indexlibraryglobal{scalbn}% +\indexlibraryglobal{scalbnf}% +\indexlibraryglobal{scalbnl}% +\indexlibraryglobal{signbit}% +\indexlibraryglobal{sin}% +\indexlibraryglobal{sinf}% +\indexlibraryglobal{sinh}% +\indexlibraryglobal{sinhf}% +\indexlibraryglobal{sinhl}% +\indexlibraryglobal{sinl}% +\indexlibraryglobal{sqrt}% +\indexlibraryglobal{sqrtf}% +\indexlibraryglobal{sqrtl}% +\indexlibraryglobal{tan}% +\indexlibraryglobal{tanf}% +\indexlibraryglobal{tanh}% +\indexlibraryglobal{tanhf}% +\indexlibraryglobal{tanhl}% +\indexlibraryglobal{tanl}% +\indexlibraryglobal{tgamma}% +\indexlibraryglobal{tgammaf}% +\indexlibraryglobal{tgammal}% +\indexlibraryglobal{trunc}% +\indexlibraryglobal{truncf}% +\indexlibraryglobal{truncl}% \begin{codeblock} namespace std { using float_t = @\seebelow@; @@ -9000,159 +9254,159 @@ float asinf(float x); long double asinl(long double x); - float atan(float x); // see \ref{library.c} + float atan(float x); // see \ref{library.c} double atan(double x); - long double atan(long double x); // see \ref{library.c} + long double atan(long double x); // see \ref{library.c} float atanf(float x); long double atanl(long double x); - float atan2(float y, float x); // see \ref{library.c} + float atan2(float y, float x); // see \ref{library.c} double atan2(double y, double x); long double atan2(long double y, long double x); // see \ref{library.c} float atan2f(float y, float x); long double atan2l(long double y, long double x); - float cos(float x); // see \ref{library.c} + float cos(float x); // see \ref{library.c} double cos(double x); - long double cos(long double x); // see \ref{library.c} + long double cos(long double x); // see \ref{library.c} float cosf(float x); long double cosl(long double x); - float sin(float x); // see \ref{library.c} + float sin(float x); // see \ref{library.c} double sin(double x); - long double sin(long double x); // see \ref{library.c} + long double sin(long double x); // see \ref{library.c} float sinf(float x); long double sinl(long double x); - float tan(float x); // see \ref{library.c} + float tan(float x); // see \ref{library.c} double tan(double x); - long double tan(long double x); // see \ref{library.c} + long double tan(long double x); // see \ref{library.c} float tanf(float x); long double tanl(long double x); - float acosh(float x); // see \ref{library.c} + float acosh(float x); // see \ref{library.c} double acosh(double x); - long double acosh(long double x); // see \ref{library.c} + long double acosh(long double x); // see \ref{library.c} float acoshf(float x); long double acoshl(long double x); - float asinh(float x); // see \ref{library.c} + float asinh(float x); // see \ref{library.c} double asinh(double x); - long double asinh(long double x); // see \ref{library.c} + long double asinh(long double x); // see \ref{library.c} float asinhf(float x); long double asinhl(long double x); - float atanh(float x); // see \ref{library.c} + float atanh(float x); // see \ref{library.c} double atanh(double x); - long double atanh(long double x); // see \ref{library.c} + long double atanh(long double x); // see \ref{library.c} float atanhf(float x); long double atanhl(long double x); - float cosh(float x); // see \ref{library.c} + float cosh(float x); // see \ref{library.c} double cosh(double x); - long double cosh(long double x); // see \ref{library.c} + long double cosh(long double x); // see \ref{library.c} float coshf(float x); long double coshl(long double x); - float sinh(float x); // see \ref{library.c} + float sinh(float x); // see \ref{library.c} double sinh(double x); - long double sinh(long double x); // see \ref{library.c} + long double sinh(long double x); // see \ref{library.c} float sinhf(float x); long double sinhl(long double x); - float tanh(float x); // see \ref{library.c} + float tanh(float x); // see \ref{library.c} double tanh(double x); - long double tanh(long double x); // see \ref{library.c} + long double tanh(long double x); // see \ref{library.c} float tanhf(float x); long double tanhl(long double x); - float exp(float x); // see \ref{library.c} + float exp(float x); // see \ref{library.c} double exp(double x); - long double exp(long double x); // see \ref{library.c} + long double exp(long double x); // see \ref{library.c} float expf(float x); long double expl(long double x); - float exp2(float x); // see \ref{library.c} + float exp2(float x); // see \ref{library.c} double exp2(double x); - long double exp2(long double x); // see \ref{library.c} + long double exp2(long double x); // see \ref{library.c} float exp2f(float x); long double exp2l(long double x); - float expm1(float x); // see \ref{library.c} + float expm1(float x); // see \ref{library.c} double expm1(double x); - long double expm1(long double x); // see \ref{library.c} + long double expm1(long double x); // see \ref{library.c} float expm1f(float x); long double expm1l(long double x); - float frexp(float value, int* exp); // see \ref{library.c} + float frexp(float value, int* exp); // see \ref{library.c} double frexp(double value, int* exp); - long double frexp(long double value, int* exp); // see \ref{library.c} + long double frexp(long double value, int* exp); // see \ref{library.c} float frexpf(float value, int* exp); long double frexpl(long double value, int* exp); - int ilogb(float x); // see \ref{library.c} + int ilogb(float x); // see \ref{library.c} int ilogb(double x); - int ilogb(long double x); // see \ref{library.c} + int ilogb(long double x); // see \ref{library.c} int ilogbf(float x); int ilogbl(long double x); - float ldexp(float x, int exp); // see \ref{library.c} + float ldexp(float x, int exp); // see \ref{library.c} double ldexp(double x, int exp); - long double ldexp(long double x, int exp); // see \ref{library.c} + long double ldexp(long double x, int exp); // see \ref{library.c} float ldexpf(float x, int exp); long double ldexpl(long double x, int exp); - float log(float x); // see \ref{library.c} + float log(float x); // see \ref{library.c} double log(double x); - long double log(long double x); // see \ref{library.c} + long double log(long double x); // see \ref{library.c} float logf(float x); long double logl(long double x); - float log10(float x); // see \ref{library.c} + float log10(float x); // see \ref{library.c} double log10(double x); - long double log10(long double x); // see \ref{library.c} + long double log10(long double x); // see \ref{library.c} float log10f(float x); long double log10l(long double x); - float log1p(float x); // see \ref{library.c} + float log1p(float x); // see \ref{library.c} double log1p(double x); - long double log1p(long double x); // see \ref{library.c} + long double log1p(long double x); // see \ref{library.c} float log1pf(float x); long double log1pl(long double x); - float log2(float x); // see \ref{library.c} + float log2(float x); // see \ref{library.c} double log2(double x); - long double log2(long double x); // see \ref{library.c} + long double log2(long double x); // see \ref{library.c} float log2f(float x); long double log2l(long double x); - float logb(float x); // see \ref{library.c} + float logb(float x); // see \ref{library.c} double logb(double x); - long double logb(long double x); // see \ref{library.c} + long double logb(long double x); // see \ref{library.c} float logbf(float x); long double logbl(long double x); - float modf(float value, float* iptr); // see \ref{library.c} + float modf(float value, float* iptr); // see \ref{library.c} double modf(double value, double* iptr); - long double modf(long double value, long double* iptr); // see \ref{library.c} + long double modf(long double value, long double* iptr); // see \ref{library.c} float modff(float value, float* iptr); long double modfl(long double value, long double* iptr); - float scalbn(float x, int n); // see \ref{library.c} + float scalbn(float x, int n); // see \ref{library.c} double scalbn(double x, int n); - long double scalbn(long double x, int n); // see \ref{library.c} + long double scalbn(long double x, int n); // see \ref{library.c} float scalbnf(float x, int n); long double scalbnl(long double x, int n); - float scalbln(float x, long int n); // see \ref{library.c} + float scalbln(float x, long int n); // see \ref{library.c} double scalbln(double x, long int n); - long double scalbln(long double x, long int n); // see \ref{library.c} + long double scalbln(long double x, long int n); // see \ref{library.c} float scalblnf(float x, long int n); long double scalblnl(long double x, long int n); - float cbrt(float x); // see \ref{library.c} + float cbrt(float x); // see \ref{library.c} double cbrt(double x); - long double cbrt(long double x); // see \ref{library.c} + long double cbrt(long double x); // see \ref{library.c} float cbrtf(float x); long double cbrtl(long double x); @@ -9164,13 +9418,13 @@ double abs(double j); long double abs(long double j); - float fabs(float x); // see \ref{library.c} + float fabs(float x); // see \ref{library.c} double fabs(double x); - long double fabs(long double x); // see \ref{library.c} + long double fabs(long double x); // see \ref{library.c} float fabsf(float x); long double fabsl(long double x); - float hypot(float x, float y); // see \ref{library.c} + float hypot(float x, float y); // see \ref{library.c} double hypot(double x, double y); long double hypot(long double x, long double y); // see \ref{library.c} float hypotf(float x, float y); @@ -9181,123 +9435,123 @@ double hypot(double x, double y, double z); long double hypot(long double x, long double y, long double z); - float pow(float x, float y); // see \ref{library.c} + float pow(float x, float y); // see \ref{library.c} double pow(double x, double y); - long double pow(long double x, long double y); // see \ref{library.c} + long double pow(long double x, long double y); // see \ref{library.c} float powf(float x, float y); long double powl(long double x, long double y); - float sqrt(float x); // see \ref{library.c} + float sqrt(float x); // see \ref{library.c} double sqrt(double x); - long double sqrt(long double x); // see \ref{library.c} + long double sqrt(long double x); // see \ref{library.c} float sqrtf(float x); long double sqrtl(long double x); - float erf(float x); // see \ref{library.c} + float erf(float x); // see \ref{library.c} double erf(double x); - long double erf(long double x); // see \ref{library.c} + long double erf(long double x); // see \ref{library.c} float erff(float x); long double erfl(long double x); - float erfc(float x); // see \ref{library.c} + float erfc(float x); // see \ref{library.c} double erfc(double x); - long double erfc(long double x); // see \ref{library.c} + long double erfc(long double x); // see \ref{library.c} float erfcf(float x); long double erfcl(long double x); - float lgamma(float x); // see \ref{library.c} + float lgamma(float x); // see \ref{library.c} double lgamma(double x); - long double lgamma(long double x); // see \ref{library.c} + long double lgamma(long double x); // see \ref{library.c} float lgammaf(float x); long double lgammal(long double x); - float tgamma(float x); // see \ref{library.c} + float tgamma(float x); // see \ref{library.c} double tgamma(double x); - long double tgamma(long double x); // see \ref{library.c} + long double tgamma(long double x); // see \ref{library.c} float tgammaf(float x); long double tgammal(long double x); - float ceil(float x); // see \ref{library.c} + float ceil(float x); // see \ref{library.c} double ceil(double x); - long double ceil(long double x); // see \ref{library.c} + long double ceil(long double x); // see \ref{library.c} float ceilf(float x); long double ceill(long double x); - float floor(float x); // see \ref{library.c} + float floor(float x); // see \ref{library.c} double floor(double x); - long double floor(long double x); // see \ref{library.c} + long double floor(long double x); // see \ref{library.c} float floorf(float x); long double floorl(long double x); - float nearbyint(float x); // see \ref{library.c} + float nearbyint(float x); // see \ref{library.c} double nearbyint(double x); - long double nearbyint(long double x); // see \ref{library.c} + long double nearbyint(long double x); // see \ref{library.c} float nearbyintf(float x); long double nearbyintl(long double x); - float rint(float x); // see \ref{library.c} + float rint(float x); // see \ref{library.c} double rint(double x); - long double rint(long double x); // see \ref{library.c} + long double rint(long double x); // see \ref{library.c} float rintf(float x); long double rintl(long double x); - long int lrint(float x); // see \ref{library.c} + long int lrint(float x); // see \ref{library.c} long int lrint(double x); - long int lrint(long double x); // see \ref{library.c} + long int lrint(long double x); // see \ref{library.c} long int lrintf(float x); long int lrintl(long double x); - long long int llrint(float x); // see \ref{library.c} + long long int llrint(float x); // see \ref{library.c} long long int llrint(double x); long long int llrint(long double x); // see \ref{library.c} long long int llrintf(float x); long long int llrintl(long double x); - float round(float x); // see \ref{library.c} + float round(float x); // see \ref{library.c} double round(double x); - long double round(long double x); // see \ref{library.c} + long double round(long double x); // see \ref{library.c} float roundf(float x); long double roundl(long double x); - long int lround(float x); // see \ref{library.c} + long int lround(float x); // see \ref{library.c} long int lround(double x); - long int lround(long double x); // see \ref{library.c} + long int lround(long double x); // see \ref{library.c} long int lroundf(float x); long int lroundl(long double x); - long long int llround(float x); // see \ref{library.c} + long long int llround(float x); // see \ref{library.c} long long int llround(double x); - long long int llround(long double x); // see \ref{library.c} + long long int llround(long double x); // see \ref{library.c} long long int llroundf(float x); long long int llroundl(long double x); - float trunc(float x); // see \ref{library.c} + float trunc(float x); // see \ref{library.c} double trunc(double x); - long double trunc(long double x); // see \ref{library.c} + long double trunc(long double x); // see \ref{library.c} float truncf(float x); long double truncl(long double x); - float fmod(float x, float y); // see \ref{library.c} + float fmod(float x, float y); // see \ref{library.c} double fmod(double x, double y); - long double fmod(long double x, long double y); // see \ref{library.c} + long double fmod(long double x, long double y); // see \ref{library.c} float fmodf(float x, float y); long double fmodl(long double x, long double y); - float remainder(float x, float y); // see \ref{library.c} + float remainder(float x, float y); // see \ref{library.c} double remainder(double x, double y); long double remainder(long double x, long double y); // see \ref{library.c} float remainderf(float x, float y); long double remainderl(long double x, long double y); - float remquo(float x, float y, int* quo); // see \ref{library.c} + float remquo(float x, float y, int* quo); // see \ref{library.c} double remquo(double x, double y, int* quo); - long double remquo(long double x, long double y, int* quo); // see \ref{library.c} + long double remquo(long double x, long double y, int* quo); // see \ref{library.c} float remquof(float x, float y, int* quo); long double remquol(long double x, long double y, int* quo); - float copysign(float x, float y); // see \ref{library.c} + float copysign(float x, float y); // see \ref{library.c} double copysign(double x, double y); - long double copysign(long double x, long double y); // see \ref{library.c} + long double copysign(long double x, long double y); // see \ref{library.c} float copysignf(float x, float y); long double copysignl(long double x, long double y); @@ -9305,39 +9559,39 @@ float nanf(const char* tagp); long double nanl(const char* tagp); - float nextafter(float x, float y); // see \ref{library.c} + float nextafter(float x, float y); // see \ref{library.c} double nextafter(double x, double y); long double nextafter(long double x, long double y); // see \ref{library.c} float nextafterf(float x, float y); long double nextafterl(long double x, long double y); - float nexttoward(float x, long double y); // see \ref{library.c} + float nexttoward(float x, long double y); // see \ref{library.c} double nexttoward(double x, long double y); - long double nexttoward(long double x, long double y); // see \ref{library.c} + long double nexttoward(long double x, long double y); // see \ref{library.c} float nexttowardf(float x, long double y); long double nexttowardl(long double x, long double y); - float fdim(float x, float y); // see \ref{library.c} + float fdim(float x, float y); // see \ref{library.c} double fdim(double x, double y); - long double fdim(long double x, long double y); // see \ref{library.c} + long double fdim(long double x, long double y); // see \ref{library.c} float fdimf(float x, float y); long double fdiml(long double x, long double y); - float fmax(float x, float y); // see \ref{library.c} + float fmax(float x, float y); // see \ref{library.c} double fmax(double x, double y); - long double fmax(long double x, long double y); // see \ref{library.c} + long double fmax(long double x, long double y); // see \ref{library.c} float fmaxf(float x, float y); long double fmaxl(long double x, long double y); - float fmin(float x, float y); // see \ref{library.c} + float fmin(float x, float y); // see \ref{library.c} double fmin(double x, double y); - long double fmin(long double x, long double y); // see \ref{library.c} + long double fmin(long double x, long double y); // see \ref{library.c} float fminf(float x, float y); long double fminl(long double x, long double y); - float fma(float x, float y, float z); // see \ref{library.c} + float fma(float x, float y, float z); // see \ref{library.c} double fma(double x, double y, double z); - long double fma(long double x, long double y, long double z); // see \ref{library.c} + long double fma(long double x, long double y, long double z); // see \ref{library.c} float fmaf(float x, float y, float z); long double fmal(long double x, long double y, long double z); @@ -9507,8 +9761,8 @@ \end{codeblock} \pnum -The contents and meaning of the header \tcode{} -are the same as the C standard library header \tcode{}, +The contents and meaning of the header \libheader{cmath} +are the same as the C standard library header \libheader{math.h}, with the addition of a three-dimensional hypotenuse function~(\ref{c.math.hypot3}) and the mathematical special functions described in \ref{sf.cmath}. @@ -9518,7 +9772,7 @@ \end{note} \pnum -For each set of overloaded functions within \tcode{}, +For each set of overloaded functions within \libheader{cmath}, with the exception of \tcode{abs}, there shall be additional overloads sufficient to ensure: \begin{enumerate} @@ -9549,15 +9803,13 @@ \rSec2[c.math.abs]{Absolute values} \pnum -\indexhdr{cstdlib}% -\indexhdr{cmath}% \begin{note} -The headers \tcode{}\iref{cstdlib.syn} and -\tcode{}\iref{cmath.syn} +The headers \libheaderref{cstdlib} and +\libheaderref{cmath} declare the functions described in this subclause. \end{note} -\indexlibrary{\idxcode{abs}}% +\indexlibraryglobal{abs}% \begin{itemdecl} int abs(int j); long int abs(long int j); @@ -9599,12 +9851,13 @@ \begin{itemdescr} \pnum -\returns $\sqrt{x^2+y^2+z^2}$. +\returns +$\sqrt{x^2+y^2+z^2}$. \end{itemdescr} \rSec2[c.math.lerp]{Linear interpolation} -\indexlibrary{\idxcode{lerp}}% +\indexlibraryglobal{lerp}% \begin{itemdecl} constexpr float lerp(float a, float b, float t); constexpr double lerp(double a, double b, double t); @@ -9648,7 +9901,8 @@ \rSec2[sf.cmath]{Mathematical special functions}% \indextext{mathematical special functions|(}% -\pnum\indextext{NaN}\indextext{domain error}% +\pnum +\indextext{NaN}\indextext{domain error}% If any argument value to any of the functions specified in this subclause is a NaN (Not a Number), @@ -9658,7 +9912,6 @@ the function shall report a domain error for just those argument values for which: - \begin{itemize} \item the function description's \returns clause @@ -9696,9 +9949,9 @@ and for positive infinity. \rSec3[sf.cmath.assoc.laguerre]{Associated Laguerre polynomials}% -\indexlibrary{\idxcode{assoc_laguerre}}% -\indexlibrary{\idxcode{assoc_laguerref}}% -\indexlibrary{\idxcode{assoc_laguerrel}}% +\indexlibraryglobal{assoc_laguerre}% +\indexlibraryglobal{assoc_laguerref}% +\indexlibraryglobal{assoc_laguerrel}% \indextext{Laguerre polynomials!$\mathsf{L}_n^m$}% \indextext{L nm@$\mathsf{L}_n^m$ (associated Laguerre polynomials)}% \begin{itemdecl} @@ -9733,9 +9986,9 @@ \end{itemdescr} \rSec3[sf.cmath.assoc.legendre]{Associated Legendre functions}% -\indexlibrary{\idxcode{assoc_legendre}}% -\indexlibrary{\idxcode{assoc_legendref}}% -\indexlibrary{\idxcode{assoc_legendrel}}% +\indexlibraryglobal{assoc_legendre}% +\indexlibraryglobal{assoc_legendref}% +\indexlibraryglobal{assoc_legendrel}% \indextext{Legendre polynomials!$\mathsf{P}_\ell^m$}% \indextext{P lm@$\mathsf{P}_\ell^m$ (associated Legendre polynomials)}% \begin{itemdecl} @@ -9746,7 +9999,8 @@ \begin{itemdescr} -\pnum\effects +\pnum +\effects These functions compute the associated Legendre functions of their respective arguments @@ -9770,9 +10024,9 @@ \end{itemdescr} \rSec3[sf.cmath.beta]{Beta function}% -\indexlibrary{\idxcode{beta}}% -\indexlibrary{\idxcode{betaf}}% -\indexlibrary{\idxcode{betal}}% +\indexlibraryglobal{beta}% +\indexlibraryglobal{betaf}% +\indexlibraryglobal{betal}% \indextext{Eulerian integral of the first kind|see{\tcode{beta}}}% \indextext{beta functions $\mathsf{B}$}% \begin{itemdecl} @@ -9799,9 +10053,9 @@ \end{itemdescr} \rSec3[sf.cmath.comp.ellint.1]{Complete elliptic integral of the first kind}% -\indexlibrary{\idxcode{comp_ellint_1}}% -\indexlibrary{\idxcode{comp_ellint_1f}}% -\indexlibrary{\idxcode{comp_ellint_1l}}% +\indexlibraryglobal{comp_ellint_1}% +\indexlibraryglobal{comp_ellint_1f}% +\indexlibraryglobal{comp_ellint_1l}% \indextext{elliptic integrals!complete $\mathsf{K}$}% \indextext{K complete@$\mathsf{K}$ (complete elliptic integrals)}% \begin{itemdecl} @@ -9829,9 +10083,9 @@ \end{itemdescr} \rSec3[sf.cmath.comp.ellint.2]{Complete elliptic integral of the second kind}% -\indexlibrary{\idxcode{comp_ellint_2}}% -\indexlibrary{\idxcode{comp_ellint_2f}}% -\indexlibrary{\idxcode{comp_ellint_2l}}% +\indexlibraryglobal{comp_ellint_2}% +\indexlibraryglobal{comp_ellint_2f}% +\indexlibraryglobal{comp_ellint_2l}% \indextext{elliptic integrals!complete $\mathsf{E}$}% \indextext{E complete@$\mathsf{E}$ (complete elliptic integrals)}% \begin{itemdecl} @@ -9859,9 +10113,9 @@ \end{itemdescr} \rSec3[sf.cmath.comp.ellint.3]{Complete elliptic integral of the third kind}% -\indexlibrary{\idxcode{comp_ellint_3}}% -\indexlibrary{\idxcode{comp_ellint_3f}}% -\indexlibrary{\idxcode{comp_ellint_3l}}% +\indexlibraryglobal{comp_ellint_3}% +\indexlibraryglobal{comp_ellint_3f}% +\indexlibraryglobal{comp_ellint_3l}% \indextext{elliptic integrals!complete $\mathsf{\Pi}$}% \indextext{Pi complete@$\mathsf{\Pi}$ (complete elliptic integrals)}% \begin{itemdecl} @@ -9890,9 +10144,9 @@ \end{itemdescr} \rSec3[sf.cmath.cyl.bessel.i]{Regular modified cylindrical Bessel functions}% -\indexlibrary{\idxcode{cyl_bessel_i}}% -\indexlibrary{\idxcode{cyl_bessel_if}}% -\indexlibrary{\idxcode{cyl_bessel_il}}% +\indexlibraryglobal{cyl_bessel_i}% +\indexlibraryglobal{cyl_bessel_if}% +\indexlibraryglobal{cyl_bessel_il}% \indextext{Bessel functions!$\mathsf{I}_\nu$}% \indextext{I nu@$\mathsf{I}_\nu$ (Bessell functions)}% \begin{itemdecl} @@ -9930,9 +10184,9 @@ \end{itemdescr} \rSec3[sf.cmath.cyl.bessel.j]{Cylindrical Bessel functions of the first kind}% -\indexlibrary{\idxcode{cyl_bessel_j}}% -\indexlibrary{\idxcode{cyl_bessel_jf}}% -\indexlibrary{\idxcode{cyl_bessel_jl}}% +\indexlibraryglobal{cyl_bessel_j}% +\indexlibraryglobal{cyl_bessel_jf}% +\indexlibraryglobal{cyl_bessel_jl}% \indextext{Bessel functions!$\mathsf{J}_\nu$}% \indextext{J nu@$\mathsf{J}_\nu$ (Bessell functions)}% \begin{itemdecl} @@ -9943,13 +10197,15 @@ \begin{itemdescr} -\pnum\effects +\pnum +\effects These functions compute the cylindrical Bessel functions of the first kind of their respective arguments \tcode{nu} and \tcode{x}. -\pnum\returns +\pnum +\returns \[ \mathsf{J}_\nu(x) = \sum_{k=0}^\infty \frac{(-1)^k (x/2)^{\nu+2k}}{k! \: \Gamma(\nu+k+1)} \text{ ,\quad for $x \ge 0$,} \] @@ -9957,16 +10213,17 @@ $\nu$ is \tcode{nu} and $x$ is \tcode{x}. -\pnum\remarks +\pnum +\remarks The effect of calling each of these functions is \impldef{effect of calling cylindrical Bessel functions of the first kind with \tcode{nu >= 128}} if \tcode{nu >= 128}. \end{itemdescr} \rSec3[sf.cmath.cyl.bessel.k]{Irregular modified cylindrical Bessel functions}% -\indexlibrary{\idxcode{cyl_bessel_k}}% -\indexlibrary{\idxcode{cyl_bessel_kf}}% -\indexlibrary{\idxcode{cyl_bessel_kl}}% +\indexlibraryglobal{cyl_bessel_k}% +\indexlibraryglobal{cyl_bessel_kf}% +\indexlibraryglobal{cyl_bessel_kl}% \indextext{Bessel functions!$\mathsf{K}_\nu$}% \indextext{K nu@$\mathsf{K}_\nu$ (Bessell functions)}% \begin{itemdecl} @@ -9977,13 +10234,15 @@ \begin{itemdescr} -\pnum\effects +\pnum +\effects These functions compute the irregular modified cylindrical Bessel functions of their respective arguments \tcode{nu} and \tcode{x}. -\pnum\returns +\pnum +\returns \[% \mathsf{K}_\nu(x) = (\pi/2)\mathrm{i}^{\nu+1} ( \mathsf{J}_\nu(\mathrm{i}x) @@ -10011,18 +10270,20 @@ $\nu$ is \tcode{nu} and $x$ is \tcode{x}. -\pnum\remarks +\pnum +\remarks The effect of calling each of these functions is \impldef{effect of calling irregular modified cylindrical Bessel functions with \tcode{nu >= 128}} if \tcode{nu >= 128}. -\pnum See also \ref{sf.cmath.cyl.bessel.i}, \ref{sf.cmath.cyl.bessel.j}, \ref{sf.cmath.cyl.neumann}. +\pnum +See also \ref{sf.cmath.cyl.bessel.i}, \ref{sf.cmath.cyl.bessel.j}, \ref{sf.cmath.cyl.neumann}. \end{itemdescr} \rSec3[sf.cmath.cyl.neumann]{Cylindrical Neumann functions}% -\indexlibrary{\idxcode{cyl_neumann}}% -\indexlibrary{\idxcode{cyl_neumannf}}% -\indexlibrary{\idxcode{cyl_neumannl}}% +\indexlibraryglobal{cyl_neumann}% +\indexlibraryglobal{cyl_neumannf}% +\indexlibraryglobal{cyl_neumannl}% \indextext{Bessel functions!$\mathsf{N}_\nu$}% \indextext{Neumann functions!$\mathsf{N}_\nu$}% \indextext{N nu@$\mathsf{N}_\nu$ (Neumann functions)}% @@ -10034,13 +10295,15 @@ \begin{itemdescr} -\pnum\effects +\pnum +\effects These functions compute the cylindrical Neumann functions, also known as the cylindrical Bessel functions of the second kind, of their respective arguments \tcode{nu} and \tcode{x}. -\pnum\returns +\pnum +\returns \[% \mathsf{N}_\nu(x) = \left\{ @@ -10062,18 +10325,20 @@ $\nu$ is \tcode{nu} and $x$ is \tcode{x}. -\pnum\remarks +\pnum +\remarks The effect of calling each of these functions is \impldef{effect of calling cylindrical Neumann functions with \tcode{nu >= 128}} if \tcode{nu >= 128}. -\pnum See also \ref{sf.cmath.cyl.bessel.j}. +\pnum +See also \ref{sf.cmath.cyl.bessel.j}. \end{itemdescr} \rSec3[sf.cmath.ellint.1]{Incomplete elliptic integral of the first kind}% -\indexlibrary{\idxcode{ellint_1}}% -\indexlibrary{\idxcode{ellint_1f}}% -\indexlibrary{\idxcode{ellint_1l}}% +\indexlibraryglobal{ellint_1}% +\indexlibraryglobal{ellint_1f}% +\indexlibraryglobal{ellint_1l}% \indextext{elliptic integrals!incomplete $\mathsf{F}$}% \indextext{F incomplete@$\mathsf{F}$ (incomplete elliptic integrals)}% \begin{itemdecl} @@ -10101,9 +10366,9 @@ \end{itemdescr} \rSec3[sf.cmath.ellint.2]{Incomplete elliptic integral of the second kind}% -\indexlibrary{\idxcode{ellint_2}}% -\indexlibrary{\idxcode{ellint_2f}}% -\indexlibrary{\idxcode{ellint_2l}}% +\indexlibraryglobal{ellint_2}% +\indexlibraryglobal{ellint_2f}% +\indexlibraryglobal{ellint_2l}% \indextext{elliptic integrals!incomplete $\mathsf{E}$}% \indextext{E incomplete@$\mathsf{E}$ (incomplete elliptic integrals)}% \begin{itemdecl} @@ -10130,9 +10395,9 @@ \end{itemdescr} \rSec3[sf.cmath.ellint.3]{Incomplete elliptic integral of the third kind}% -\indexlibrary{\idxcode{ellint_3}}% -\indexlibrary{\idxcode{ellint_3f}}% -\indexlibrary{\idxcode{ellint_3l}}% +\indexlibraryglobal{ellint_3}% +\indexlibraryglobal{ellint_3f}% +\indexlibraryglobal{ellint_3l}% \indextext{elliptic integrals!incomplete $\mathsf{\Pi}$}% \indextext{Pi incomplete@$\mathsf{\Pi}$ (incomplete elliptic integrals)}% \begin{itemdecl} @@ -10143,7 +10408,8 @@ \begin{itemdescr} -\pnum\effects +\pnum +\effects These functions compute the incomplete elliptic integral of the third kind of their respective arguments @@ -10160,9 +10426,9 @@ \end{itemdescr} \rSec3[sf.cmath.expint]{Exponential integral}% -\indexlibrary{\idxcode{expint}}% -\indexlibrary{\idxcode{expintf}}% -\indexlibrary{\idxcode{expintl}}% +\indexlibraryglobal{expint}% +\indexlibraryglobal{expintf}% +\indexlibraryglobal{expintl}% \indextext{exponential integrals $\mathsf{Ei}$}% \indextext{Ei@$\mathsf{Ei}$ (exponential integrals)}% \begin{itemdecl} @@ -10173,12 +10439,14 @@ \begin{itemdescr} -\pnum\effects +\pnum +\effects These functions compute the exponential integral of their respective arguments \tcode{x}. -\pnum\returns +\pnum +\returns \[% \mathsf{Ei}(x) = - \int_{-x}^\infty \frac{e^{-t}} @@ -10191,9 +10459,9 @@ \end{itemdescr} \rSec3[sf.cmath.hermite]{Hermite polynomials}% -\indexlibrary{\idxcode{hermite}}% -\indexlibrary{\idxcode{hermitef}}% -\indexlibrary{\idxcode{hermitel}}% +\indexlibraryglobal{hermite}% +\indexlibraryglobal{hermitef}% +\indexlibraryglobal{hermitel}% \indextext{Hermite polynomials $\mathsf{H}_n$}% \indextext{H n@$\mathsf{H}_n$ (Hermite polynomials)}% \begin{itemdecl} @@ -10203,12 +10471,14 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects These functions compute the Hermite polynomials of their respective arguments \tcode{n} and \tcode{x}. -\pnum\returns +\pnum +\returns \[% \mathsf{H}_n(x) = (-1)^n e^{x^2} \frac{ \mathsf{d} ^n} @@ -10219,16 +10489,17 @@ $n$ is \tcode{n} and $x$ is \tcode{x}. -\pnum\remarks +\pnum +\remarks The effect of calling each of these functions is \impldef{effect of calling Hermite polynomials with \tcode{n >= 128}} if \tcode{n >= 128}. \end{itemdescr} \rSec3[sf.cmath.laguerre]{Laguerre polynomials}% -\indexlibrary{\idxcode{laguerre}}% -\indexlibrary{\idxcode{laguerref}}% -\indexlibrary{\idxcode{laguerrel}}% +\indexlibraryglobal{laguerre}% +\indexlibraryglobal{laguerref}% +\indexlibraryglobal{laguerrel}% \indextext{Laguerre polynomials!$\mathsf{L}_n$}% \indextext{L n@$\mathsf{L}_n$ (Laguerre polynomials)}% \begin{itemdecl} @@ -10261,9 +10532,9 @@ \end{itemdescr} \rSec3[sf.cmath.legendre]{Legendre polynomials}% -\indexlibrary{\idxcode{legendre}}% -\indexlibrary{\idxcode{legendref}}% -\indexlibrary{\idxcode{legendrel}}% +\indexlibraryglobal{legendre}% +\indexlibraryglobal{legendref}% +\indexlibraryglobal{legendrel}% \indextext{Legendre polynomials!$\mathsf{P}_\ell$}% \indextext{P l@$\mathsf{P}_\ell$ (Legendre polynomials)}% \begin{itemdecl} @@ -10297,9 +10568,9 @@ \end{itemdescr} \rSec3[sf.cmath.riemann.zeta]{Riemann zeta function}% -\indexlibrary{\idxcode{riemann_zeta}}% -\indexlibrary{\idxcode{riemann_zetaf}}% -\indexlibrary{\idxcode{riemann_zetal}}% +\indexlibraryglobal{riemann_zeta}% +\indexlibraryglobal{riemann_zetaf}% +\indexlibraryglobal{riemann_zetal}% \indextext{zeta functions $\zeta$}% \begin{itemdecl} double riemann_zeta(double x); @@ -10309,12 +10580,14 @@ \begin{itemdescr} -\pnum\effects +\pnum +\effects These functions compute the Riemann zeta function of their respective arguments \tcode{x}. -\pnum\returns +\pnum +\returns \[% \mathsf{\zeta}(x) = \left\{ @@ -10343,9 +10616,9 @@ \end{itemdescr} \rSec3[sf.cmath.sph.bessel]{Spherical Bessel functions of the first kind}% -\indexlibrary{\idxcode{sph_bessel}}% -\indexlibrary{\idxcode{sph_besself}}% -\indexlibrary{\idxcode{sph_bessell}}% +\indexlibraryglobal{sph_bessel}% +\indexlibraryglobal{sph_besself}% +\indexlibraryglobal{sph_bessell}% \indextext{Bessel functions!$\mathsf{j}_n$}% \indextext{j n@$\mathsf{j}_n$ (spherical Bessel functions)}% \begin{itemdecl} @@ -10369,18 +10642,20 @@ $n$ is \tcode{n} and $x$ is \tcode{x}. -\pnum\remarks +\pnum +\remarks The effect of calling each of these functions is \impldef{effect of calling spherical Bessel functions with \tcode{n >= 128}} if \tcode{n >= 128}. -\pnum See also \ref{sf.cmath.cyl.bessel.j}. +\pnum +See also \ref{sf.cmath.cyl.bessel.j}. \end{itemdescr} \rSec3[sf.cmath.sph.legendre]{Spherical associated Legendre functions}% -\indexlibrary{\idxcode{sph_legendre}}% -\indexlibrary{\idxcode{sph_legendref}}% -\indexlibrary{\idxcode{sph_legendrel}}% +\indexlibraryglobal{sph_legendre}% +\indexlibraryglobal{sph_legendref}% +\indexlibraryglobal{sph_legendrel}% \indextext{spherical harmonics $\mathsf{Y}_\ell^m$}% \indextext{Legendre functions $\mathsf{Y}_\ell^m$}% \indextext{Y lm@$\mathsf{Y}_\ell^m$ (spherical associated Legendre functions)}% @@ -10422,9 +10697,9 @@ \end{itemdescr} \rSec3[sf.cmath.sph.neumann]{Spherical Neumann functions}% -\indexlibrary{\idxcode{sph_neumann}}% -\indexlibrary{\idxcode{sph_neumannf}}% -\indexlibrary{\idxcode{sph_neumannl}}% +\indexlibraryglobal{sph_neumann}% +\indexlibraryglobal{sph_neumannf}% +\indexlibraryglobal{sph_neumannl}% \indextext{Bessel functions!$\mathsf{n}_n$}% \indextext{Neumann functions!$\mathsf{n}_n$}% \indextext{n n spherical@$\mathsf{n}_n$ (spherical Neumann functions)}% @@ -10465,8 +10740,8 @@ \rSec1[numbers]{Numbers} \rSec2[numbers.syn]{Header \tcode{} synopsis} -\indexhdr{numbers}% +\indexheader{numbers}% \begin{codeblock} namespace std::numbers { template inline constexpr T e_v = @\unspec@; diff --git a/source/overloading.tex b/source/overloading.tex index ec51c9720a..e9429a5132 100644 --- a/source/overloading.tex +++ b/source/overloading.tex @@ -4,6 +4,8 @@ \gramSec[gram.over]{Overloading} +\rSec1[over.pre]{Preamble} + \pnum \indextext{overloaded function|see{overloading}}% \indextext{function!overloaded|see{overloading}}% @@ -26,7 +28,6 @@ This function selection process is called \defn{overload resolution} and is defined in~\ref{over.match}. \begin{example} - \indextext{overloading!example of}% \begin{codeblock} double abs(double); @@ -109,8 +110,8 @@ parameter-type-list\iref{dcl.fct} as well as member function template declarations with the same name, the same parameter-type-list, and the same template parameter lists cannot be overloaded if any of them, but not -all, have a \grammarterm{ref-qualifier}\iref{dcl.fct}. \begin{example} - +all, have a \grammarterm{ref-qualifier}\iref{dcl.fct}. +\begin{example} \begin{codeblock} class Y { void h() &; @@ -181,7 +182,6 @@ Only the second and subsequent array dimensions are significant in parameter types\iref{dcl.array}. \begin{example} - \begin{codeblock} int f(char*); int f(char[]); // same as \tcode{f(char*);} @@ -202,7 +202,6 @@ and the other is a pointer to the same function type are equivalent. That is, the function type is adjusted to become a pointer to function type\iref{dcl.fct}. \begin{example} - \begin{codeblock} void h(int()); void h(int (*)()); // redeclaration of \tcode{h(int())} @@ -313,7 +312,6 @@ \textit{not} in the same scope as a function member of the same name in a base class. \begin{example} - \begin{codeblock} struct B { int f(int); @@ -347,7 +345,6 @@ A locally declared function is not in the same scope as a function in a containing scope. \begin{example} - \begin{codeblock} void f(const char*); void g() { @@ -372,7 +369,6 @@ Different versions of an overloaded member function can be given different access rules. \begin{example} - \begin{codeblock} class buffer { private: @@ -417,7 +413,6 @@ \indextext{overloading!resolution!contexts}% Overload resolution selects the function to call in seven distinct contexts within the language: - \begin{itemize} \item invocation of a function named in the function call syntax\iref{over.call.func}; @@ -520,7 +515,6 @@ \pnum For non-static member functions, the type of the implicit object parameter is - \begin{itemize} \item ``lvalue reference to \cv{}~\tcode{X}'' for functions declared without a \grammarterm{ref-qualifier} or with the @@ -528,7 +522,6 @@ \item ``rvalue reference to \cv{}~\tcode{X}'' for functions declared with the \tcode{\&\&} \grammarterm{ref-qualifier} \end{itemize} - where \tcode{X} is the class of which the function is a member and @@ -573,19 +566,14 @@ match with it. \indextext{implied object argument!non-static member function and}% For non-static member functions declared without a \grammarterm{ref-qualifier}, -an additional rule applies: - -\begin{itemize} -\item -even if the implicit object parameter is not -const-qualified, +even if the implicit object parameter is not const-qualified, an rvalue can be bound to the parameter as long as in all other respects the argument can be converted to the type of the implicit object parameter. -\begin{note} The fact that such an argument is an rvalue does not +\begin{note} +The fact that such an argument is an rvalue does not affect the ranking of implicit conversion sequences\iref{over.ics.rank}. \end{note} -\end{itemize} \pnum Because other than in list-initialization only one user-defined conversion @@ -595,7 +583,6 @@ the best user-defined conversion~(\ref{over.match.best}, \ref{over.best.ics}). \begin{example} - \begin{codeblock} class T { public: @@ -680,11 +667,9 @@ \pnum In a function call\iref{expr.call} - \begin{ncsimplebnf} postfix-expression \terminal{(} \opt{expression-list} \terminal{)} \end{ncsimplebnf} - if the \grammarterm{postfix-expression} denotes a set of overloaded functions and/or function templates, overload resolution is applied as specified in \ref{over.call.func}. If the \grammarterm{postfix-expression} denotes an object of class type, overload @@ -694,8 +679,11 @@ If the \grammarterm{postfix-expression} denotes the address of a set of overloaded functions and/or function templates, overload resolution is applied using that set as described above. If the function selected by overload resolution is a non-static member -function, the program is ill-formed. \begin{note} The resolution of the address of an -overload set in other contexts is described in \ref{over.over}. \end{note} +function, the program is ill-formed. +\begin{note} +The resolution of the address of an +overload set in other contexts is described in \ref{over.over}. +\end{note} \rSec4[over.call.func]{Call to named function} @@ -849,11 +837,9 @@ \pnum In addition, for each non-explicit conversion function declared in \tcode{T} of the form - \begin{ncsimplebnf} \keyword{operator} conversion-type-id \terminal{(\,)} \opt{cv-qualifier-seq} \opt{ref-qualifier} \opt{noexcept-specifier} \opt{attribute-specifier-seq} \terminal{;} \end{ncsimplebnf} - where the optional \grammarterm{cv-qualifier-seq} is the same cv-qualification as, or a greater cv-qualification than, @@ -869,12 +855,10 @@ returning \tcode{R}'', a \defn{surrogate call function} with the unique name \placeholder{call-function} and having the form - \begin{ncbnf} \terminal{R} \placeholder{call-function} \terminal{(} conversion-type-id \ % \terminal{F, P$_1$ a$_1$, $\dotsc$, P$_n$ a$_n$)} \terminal{\{ return F (a$_1$, $\dotsc$, a$_n$); \}} \end{ncbnf} - is also considered as a candidate function. Similarly, surrogate call functions are added to the set of candidate functions for @@ -923,7 +907,6 @@ parameter. \end{note} \begin{example} - \begin{codeblock} int f1(int); int f2(float); @@ -935,7 +918,7 @@ } a; int i = a(1); // calls \tcode{f1} via pointer returned from conversion function \end{codeblock} -\end{example}% +\end{example} \indextext{overloading!resolution!function call syntax|)} \rSec3[over.match.oper]{Operators in expressions}% @@ -960,7 +943,6 @@ have class or enumeration type\iref{expr.cond}. \end{note} \begin{example} - \begin{codeblock} struct String { String (const String&); @@ -1063,7 +1045,6 @@ For all other operators, the built-in candidates include all of the candidate operator functions defined in~\ref{over.built} that, compared to the given operator, - \begin{itemize} \item have the same operator name, and @@ -1120,7 +1101,6 @@ \pnum For the built-in assignment operators, conversions of the left operand are restricted as follows: - \begin{itemize} \item no temporaries are introduced to hold the left operand, and @@ -1151,7 +1131,6 @@ and~\ref{over.match.best}.\footnote{If the set of candidate functions is empty, overload resolution is unsuccessful.} \begin{example} - \begin{codeblock} struct A { operator int(); @@ -1311,9 +1290,11 @@ type of the object being initialized. Overload resolution is used to select the user-defined conversion to be invoked. -\begin{note} The conversion performed for indirect binding to a reference to a possibly +\begin{note} +The conversion performed for indirect binding to a reference to a possibly cv-qualified class type is determined in terms of a corresponding non-reference -copy-initialization. \end{note} +copy-initialization. +\end{note} Assuming that ``\cvqual{cv1} \tcode{T}'' is the type of the object being initialized, with \tcode{T} @@ -1486,12 +1467,14 @@ If the initializer list has no elements and \tcode{T} has a default constructor, the first phase is omitted. In copy-list-initialization, if an explicit constructor is -chosen, the initialization is ill-formed. \begin{note} +chosen, the initialization is ill-formed. +\begin{note} This differs from other situations~(\ref{over.match.ctor}, \ref{over.match.copy}), where only converting constructors are considered for copy-initialization. This restriction only applies if this initialization is part of the final result of overload -resolution. \end{note} +resolution. +\end{note} \rSec3[over.match.class.deduct]{Class template argument deduction}% \indextext{deduction!class template arguments}% @@ -1797,7 +1780,7 @@ deduces_B>> auto f2_prime_for_B(W *, U) -> C>; \end{codeblock} -\end{example}% +\end{example} \indextext{overloading!argument lists|)}% \indextext{overloading!candidate functions|)} @@ -2030,10 +2013,10 @@ \begin{example} \begin{codeblock} struct S { - friend auto operator<=>(const S&, const S&) = default; // \#1 - friend bool operator<(const S&, const S&); // \#2 + friend auto operator<=>(const S&, const S&) = default; // \#1 + friend bool operator<(const S&, const S&); // \#2 }; -bool b = S() < S(); // calls \#2 +bool b = S() < S(); // calls \#2 \end{codeblock} \end{example} or, if not that, @@ -2046,10 +2029,10 @@ \begin{example} \begin{codeblock} struct S { - friend std::weak_ordering operator<=>(const S&, int); // \#1 - friend std::weak_ordering operator<=>(int, const S&); // \#2 + friend std::weak_ordering operator<=>(const S&, int); // \#1 + friend std::weak_ordering operator<=>(int, const S&); // \#2 }; -bool b = 1 < S(); // calls \#2 +bool b = 1 < S(); // calls \#2 \end{codeblock} \end{example} or, if not that @@ -2213,7 +2196,6 @@ A well-formed implicit conversion sequence is one of the following forms: - \begin{itemize} \item a standard conversion sequence\iref{over.ics.scs}, @@ -2248,14 +2230,14 @@ \end{note} \begin{example} \begin{codeblock} - struct Y { Y(int); }; - struct A { operator int(); }; - Y y1 = A(); // error: \tcode{A::operator int()} is not a candidate - - struct X { X(); }; - struct B { operator X(); }; - B b; - X x{{b}}; // error: \tcode{B::operator X()} is not a candidate +struct Y { Y(int); }; +struct A { operator int(); }; +Y y1 = A(); // error: \tcode{A::operator int()} is not a candidate + +struct X { X(); }; +struct B { operator X(); }; +B b; +X x{{b}}; // error: \tcode{B::operator X()} is not a candidate \end{codeblock} \end{example} @@ -2476,7 +2458,6 @@ type, in which case the implicit conversion sequence is a derived-to-base Conversion\iref{over.best.ics}. \begin{example} - \begin{codeblock} struct A {}; struct B : public A {} b; @@ -2601,7 +2582,8 @@ conversion sequence is the worst conversion necessary to convert an element of the list to \tcode{X}, or if the initializer list has no elements, the identity conversion. This conversion can be a user-defined conversion even in -the context of a call to an initializer-list constructor. \begin{example} +the context of a call to an initializer-list constructor. +\begin{example} \begin{codeblock} void f(std::initializer_list); f( {} ); // OK: \tcode{f(initializer_list)} identity conversion @@ -2694,7 +2676,8 @@ the initializer list according to the rules for aggregate initialization\iref{dcl.init.aggr}, the implicit conversion sequence is a user-defined conversion sequence with the second standard conversion -sequence an identity conversion. \begin{example} +sequence an identity conversion. +\begin{example} \begin{codeblock} struct A { int m1; @@ -2708,9 +2691,12 @@ \end{example} \pnum -Otherwise, if the parameter is a reference, see~\ref{over.ics.ref}. \begin{note} +Otherwise, if the parameter is a reference, see~\ref{over.ics.ref}. +\begin{note} The rules in this subclause will apply for initializing the underlying temporary -for the reference. \end{note} \begin{example} +for the reference. +\end{note} +\begin{example} \begin{codeblock} struct A { int m1; @@ -2728,11 +2714,11 @@ \pnum Otherwise, if the parameter type is not a class: - \begin{itemize} \item if the initializer list has one element that is not itself an initializer list, the implicit conversion sequence is the one required to convert the element to -the parameter type; \begin{example} +the parameter type; +\begin{example} \begin{codeblock} void f(int); f( {'a'} ); // OK: same conversion as \tcode{char} to \tcode{int} @@ -2741,7 +2727,8 @@ \end{example} \item if the initializer list has no elements, the implicit conversion sequence -is the identity conversion. \begin{example} +is the identity conversion. +\begin{example} \begin{codeblock} void f(int); f( { } ); // OK: identity conversion @@ -2773,7 +2760,6 @@ \pnum When comparing the basic forms of implicit conversion sequences (as defined in~\ref{over.best.ics}) - \begin{itemize} \item a standard conversion sequence\iref{over.ics.scs} is a better @@ -2794,7 +2780,6 @@ \item List-initialization sequence \tcode{L1} is a better conversion sequence than list-initialization sequence \tcode{L2} if - \begin{itemize} \item \tcode{L1} converts to \tcode{std::initializer_list} for some \tcode{X} and @@ -2840,7 +2825,6 @@ sequence than standard conversion sequence \tcode{S2} if - \begin{itemize} \item \indextext{subsequence rule!overloading}% @@ -2926,7 +2910,6 @@ \end{codeblock} \end{example} or, if not that, - \item \tcode{S1} and @@ -2976,7 +2959,6 @@ the second standard conversion sequence of \tcode{U2}. \begin{example} - \begin{codeblock} struct A { operator short(); @@ -3040,7 +3022,6 @@ \tcode{C} is derived directly or indirectly from \tcode{B}, - \begin{itemize} \item conversion of @@ -3052,7 +3033,6 @@ to \tcode{A*}, \begin{example} - \begin{codeblock} struct A {}; struct B : public A {}; @@ -3162,7 +3142,6 @@ pointer-to-member-function type. \end{note} The target can be - \begin{itemize} \item an object or reference being initialized~(\ref{dcl.init}, \ref{dcl.init.ref}, @@ -3314,7 +3293,6 @@ \begin{note} Even if \tcode{B} is a public base of \tcode{D}, we have - \begin{codeblock} D* f(); B* (*p1)() = &f; // error @@ -3399,7 +3377,6 @@ \grammarterm{operator-function-id} as the name of the function in the function call syntax\iref{expr.call}. \begin{example} - \begin{codeblock} complex z = a.operator+(b); // \tcode{complex z = a+b;} void* p = operator new(sizeof(int)*n); @@ -3558,7 +3535,6 @@ \tcode{B}'s virtual copy/move assignment operator. \begin{example} - \begin{codeblock} struct B { virtual int operator= (int); @@ -3593,11 +3569,9 @@ parameters. It can have default arguments. It implements the function call syntax - \begin{ncsimplebnf} postfix-expression \terminal{(} \opt{expression-list} \terminal{)} \end{ncsimplebnf} - where the \grammarterm{postfix-expression} evaluates to a class object and the possibly empty @@ -3628,7 +3602,6 @@ \tcode{operator[]} shall be a non-static member function with exactly one parameter. It implements the subscripting syntax - \begin{ncsimplebnf} postfix-expression \terminal{[} expr-or-braced-init-list \terminal{]} \end{ncsimplebnf} @@ -3722,7 +3695,6 @@ is \tcode{2}.} \begin{example} - \begin{codeblock} struct X { X& operator++(); // prefix \tcode{++a} @@ -3830,7 +3802,8 @@ Literal operators and literal operator templates shall not have C language linkage. \pnum -\begin{note} Literal operators and literal operator templates are usually invoked +\begin{note} +Literal operators and literal operator templates are usually invoked implicitly through user-defined literals\iref{lex.ext}. However, except for the constraints described above, they are ordinary namespace-scope functions and function templates. In particular, they are looked up like ordinary functions @@ -3838,7 +3811,8 @@ they can be declared \tcode{inline} or \tcode{constexpr}, they may have internal, module, or external linkage, they can be called explicitly, their addresses can be -taken, etc. \end{note} +taken, etc. +\end{note} \pnum \begin{example} @@ -3856,7 +3830,7 @@ template int operator "" _j(const char*); // error: invalid \grammarterm{parameter-declaration-clause} extern "C" void operator "" _m(long double); // error: C language linkage \end{codeblock} -\end{example}% +\end{example} \indextext{overloading!operator|)} \rSec1[over.built]{Built-in operators}% @@ -3923,7 +3897,6 @@ \tcode{\placeholder{T}} is an arithmetic type other than \tcode{bool}, there exist candidate operator functions of the form - \begin{codeblock} @\cvqual{vq} \placeholder{T}@& operator++(@\cvqual{vq} \placeholder{T}@&); @\placeholder{T}@ operator++(@\cvqual{vq} \placeholder{T}@&, int); @@ -3938,7 +3911,6 @@ is an arithmetic type other than \tcode{bool}, there exist candidate operator functions of the form - \begin{codeblock} @\cvqual{vq} \placeholder{T}@& operator--(@\cvqual{vq} \placeholder{T}@&); @\placeholder{T}@ operator--(@\cvqual{vq} \placeholder{T}@&, int); @@ -3952,7 +3924,6 @@ \tcode{\placeholder{T}} is a cv-qualified or cv-unqualified object type, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@*@\cvqual{vq}@& operator++(@\placeholder{T}@*@\cvqual{vq}@&); @\placeholder{T}@*@\cvqual{vq}@& operator--(@\placeholder{T}@*@\cvqual{vq}@&); @@ -3964,7 +3935,6 @@ For every cv-qualified or cv-unqualified object type \tcode{\placeholder{T}}, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@& operator*(@\placeholder{T}@*); \end{codeblock} @@ -3973,14 +3943,12 @@ For every function type \tcode{\placeholder{T}} that does not have cv-qualifiers or a \grammarterm{ref-qualifier}, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@& operator*(@\placeholder{T}@*); \end{codeblock} \pnum For every type \tcode{\placeholder{T}} there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@* operator+(@\placeholder{T}@*); \end{codeblock} @@ -3989,7 +3957,6 @@ For every promoted arithmetic type \tcode{\placeholder{T}}, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@ operator+(@\placeholder{T}@); @\placeholder{T}@ operator-(@\placeholder{T}@); @@ -3999,7 +3966,6 @@ For every promoted integral type \tcode{\placeholder{T}}, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@ operator~(@\placeholder{T}@); \end{codeblock} @@ -4019,11 +3985,9 @@ \tcode{\placeholder{T}} is an object type or a function type, there exist candidate operator functions of the form - \begin{codeblock} @\cvqual{cv12} \placeholder{T}@& operator->*(@\cvqual{cv1} \placeholder{C1}@*, @\cvqual{cv2} \placeholder{T C2}@::*); \end{codeblock} - where \cvqual{cv12} is the union of \cvqual{cv1} and \cvqual{cv2}. The return type is shown for exposition only; see~\ref{expr.mptr.oper} for the determination of the operator's result type. @@ -4034,7 +3998,6 @@ and \tcode{\placeholder{R}}, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{LR}@ operator*(@\placeholder{L}@, @\placeholder{R}@); @\placeholder{LR}@ operator/(@\placeholder{L}@, @\placeholder{R}@); @@ -4047,7 +4010,6 @@ bool operator<=(@\placeholder{L}@, @\placeholder{R}@); bool operator>=(@\placeholder{L}@, @\placeholder{R}@); \end{codeblock} - where \tcode{\placeholder{LR}} is the result of the usual arithmetic conversions\iref{expr.arith.conv} between types @@ -4058,7 +4020,6 @@ \pnum For every integral type \tcode{\placeholder{T}} there exists a candidate operator function of the form - \begin{codeblock} std::strong_ordering operator<=>(@\placeholder{T}@, @\placeholder{T}@); \end{codeblock} @@ -4067,7 +4028,6 @@ For every pair of floating-point types \tcode{\placeholder{L}} and \tcode{\placeholder{R}}, there exists a candidate operator function of the form - \begin{codeblock} std::partial_ordering operator<=>(@\placeholder{L}@, @\placeholder{R}@); \end{codeblock} @@ -4076,7 +4036,6 @@ For every cv-qualified or cv-unqualified object type \tcode{\placeholder{T}} there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@* operator+(@\placeholder{T}@*, std::ptrdiff_t); @\placeholder{T}@& operator[](@\placeholder{T}@*, std::ptrdiff_t); @@ -4092,7 +4051,6 @@ \tcode{\placeholder{T}} is a pointer to object type, there exist candidate operator functions of the form - \begin{codeblock} std::ptrdiff_t operator-(@\placeholder{T}@, @\placeholder{T}@); \end{codeblock} @@ -4100,7 +4058,6 @@ \pnum For every \tcode{\placeholder{T}}, where \tcode{\placeholder{T}} is an enumeration type or a pointer type, there exist candidate operator functions of the form - \begin{codeblock} bool operator==(@\placeholder{T}@, @\placeholder{T}@); bool operator!=(@\placeholder{T}@, @\placeholder{T}@); @@ -4110,14 +4067,12 @@ bool operator>=(@\placeholder{T}@, @\placeholder{T}@); @\placeholdernc{R}@ operator<=>(@\placeholder{T}@, @\placeholder{T}@); \end{codeblock} - where \tcode{\placeholder{R}} is the result type specified in \ref{expr.spaceship}. \pnum For every \tcode{\placeholder{T}}, where \tcode{\placeholder{T}} is a pointer-to-member type or \tcode{std::nullptr_t}, there exist candidate operator functions of the form - \begin{codeblock} bool operator==(@\placeholder{T}@, @\placeholder{T}@); bool operator!=(@\placeholder{T}@, @\placeholder{T}@); @@ -4130,7 +4085,6 @@ and \tcode{\placeholder{R}}, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{LR}@ operator%(@\placeholder{L}@, @\placeholder{R}@); @\placeholder{LR}@ operator&(@\placeholder{L}@, @\placeholder{R}@); @@ -4139,7 +4093,6 @@ @\placeholder{L}@ operator<<(@\placeholder{L}@, @\placeholder{R}@); @\placeholder{L}@ operator>>(@\placeholder{L}@, @\placeholder{R}@); \end{codeblock} - where \tcode{\placeholder{LR}} is the result of the usual arithmetic conversions\iref{expr.arith.conv} between types @@ -4159,7 +4112,6 @@ \tcode{\placeholder{R}} is a promoted arithmetic type, there exist candidate operator functions of the form - \begin{codeblock} @\cvqual{vq} \placeholder{L}@& operator=(@\cvqual{vq} \placeholder{L}@&, @\placeholder{R}@); @\cvqual{vq} \placeholder{L}@& operator*=(@\cvqual{vq} \placeholder{L}@&, @\placeholder{R}@); @@ -4172,7 +4124,6 @@ For every pair (\tcode{\placeholder{T}}, \cvqual{vq}), where \tcode{\placeholder{T}} is any type, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@*@\cvqual{vq}@& operator=(@\placeholder{T}@*@\cvqual{vq}@&, @\placeholder{T}@*); \end{codeblock} @@ -4185,7 +4136,6 @@ \tcode{\placeholder{T}} is an enumeration or pointer-to-member type, there exist candidate operator functions of the form - \begin{codeblock} @\cvqual{vq} \placeholder{T}@& operator=(@\cvqual{vq} \placeholder{T}@&, @\placeholder{T}@); \end{codeblock} @@ -4198,7 +4148,6 @@ \tcode{\placeholder{T}} is a cv-qualified or cv-unqualified object type, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@*@\cvqual{vq}@& operator+=(@\placeholder{T}@*@\cvqual{vq}@&, std::ptrdiff_t); @\placeholder{T}@*@\cvqual{vq}@& operator-=(@\placeholder{T}@*@\cvqual{vq}@&, std::ptrdiff_t); @@ -4215,7 +4164,6 @@ \tcode{\placeholder{R}} is a promoted integral type, there exist candidate operator functions of the form - \begin{codeblock} @\cvqual{vq} \placeholder{L}@& operator%=(@\cvqual{vq} \placeholder{L}@&, @\placeholder{R}@); @\cvqual{vq} \placeholder{L}@& operator<<=(@\cvqual{vq} \placeholder{L}@&, @\placeholder{R}@); @@ -4227,7 +4175,6 @@ \pnum There also exist candidate operator functions of the form - \begin{codeblock} bool operator!(bool); bool operator&&(bool, bool); @@ -4240,11 +4187,9 @@ and \tcode{\placeholder{R}}, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{LR}@ operator?:(bool, @\placeholder{L}@, @\placeholder{R}@); \end{codeblock} - where \tcode{\placeholder{LR}} is the result of the usual arithmetic conversions\iref{expr.arith.conv} between types @@ -4266,7 +4211,6 @@ \tcode{\placeholder{T}} is a pointer, pointer-to-member, or scoped enumeration type, there exist candidate operator functions of the form - \begin{codeblock} @\placeholder{T}@ operator?:(bool, @\placeholder{T}@, @\placeholder{T}@); \end{codeblock}% diff --git a/source/preprocessor.tex b/source/preprocessor.tex index 1e8d2a83a0..7379ef7615 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -8,6 +8,8 @@ \gramSec[gram.cpp]{Preprocessing directives} +\rSec1[cpp.pre]{Preamble} + \pnum A \defn{preprocessing directive} consists of a sequence of preprocessing tokens that satisfies the following constraints: @@ -176,17 +178,17 @@ The preprocessing tokens within a preprocessing directive are not subject to macro expansion unless otherwise stated. -\begin{example} In: - +\begin{example} +In: \begin{codeblock} #define EMPTY EMPTY # include \end{codeblock} - the sequence of preprocessing tokens on the second line is \textit{not} a preprocessing directive, because it does not begin with a \tcode{\#} at the start of translation phase 4, even though it will do so after the macro \tcode{EMPTY} -has been replaced.\end{example} +has been replaced. +\end{example} \rSec1[cpp.cond]{Conditional inclusion}% \indextext{preprocessing directive!conditional inclusion}% @@ -530,11 +532,9 @@ \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\# include <} h-char-sequence \terminal{>} new-line \end{ncsimplebnf} - searches a sequence of \impldef{sequence of places searched for a header} places @@ -575,11 +575,9 @@ \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\# include} pp-tokens new-line \end{ncsimplebnf} - (that does not match one of the two previous forms) is permitted. The preprocessing tokens after \tcode{include} @@ -914,12 +912,10 @@ \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\# define} identifier replacement-list new-line \indextext{\idxcode{\#define}}% \end{ncsimplebnf} - defines an \defnadj{object-like}{macro} that causes each subsequent instance of the macro name\footnote{Since, by macro-replacement time, @@ -1191,7 +1187,8 @@ \tcode{\#\#} operators is unspecified. -\begin{example} In the following fragment: +\begin{example} +In the following fragment: \begin{codeblock} #define hash_hash # ## # @@ -1213,7 +1210,8 @@ In other words, expanding \tcode{hash_hash} produces a new token, consisting of two adjacent sharp signs, but this new token is not the -\tcode{\#\#} operator. \end{example} +\tcode{\#\#} operator. +\end{example} \rSec2[cpp.rescan]{Rescanning and further replacement}% \indextext{macro!rescanning and replacement}% @@ -1261,12 +1259,10 @@ \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\# undef} identifier new-line \indextext{\idxcode{\#undef}}% \end{ncsimplebnf} - causes the specified identifier no longer to be defined as a macro name. It is ignored if the specified identifier is not currently defined as a macro name. @@ -1308,7 +1304,6 @@ \begin{example} To illustrate the rules for redefinition and reexamination, the sequence - \begin{codeblock} #define x 3 #define f(a) f(x * (a)) @@ -1331,9 +1326,7 @@ p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; char c[2][6] = { str(hello), str() }; \end{codeblock} - results in - \begin{codeblock} f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1); @@ -1347,7 +1340,6 @@ To illustrate the rules for creating character string literals and concatenating tokens, the sequence - \begin{codeblock} #define str(s) # s #define xstr(s) str(s) @@ -1366,9 +1358,7 @@ glue(HIGH, LOW); xglue(HIGH, LOW) \end{codeblock} - results in - \begin{codeblock} printf("x" "1" "= %d, x" "2" "= %s", x1, x2); fputs("strncmp(@\textbackslash@"abc@\textbackslash\textbackslash@0d@\textbackslash@", @\textbackslash@"abc@\textbackslash@", '@\textbackslash\textbackslash@4') == 0" ": @\atsign\textbackslash@n", s); @@ -1376,9 +1366,7 @@ "hello"; "hello" ", world" \end{codeblock} - or, after concatenation of the character string literals, - \begin{codeblock} printf("x1= %d, x2= %s", x1, x2); fputs("strncmp(@\textbackslash@"abc@\textbackslash\textbackslash@0d@\textbackslash@", @\textbackslash@"abc@\textbackslash@", '@\textbackslash\textbackslash@4') == 0: @\atsign\textbackslash@n", s); @@ -1397,15 +1385,12 @@ \pnum \begin{example} To illustrate the rules for placemarker preprocessing tokens, the sequence - \begin{codeblock} #define t(x,y,z) x ## y ## z int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), t(10,,), t(,11,), t(,,12), t(,,) }; \end{codeblock} - results in - \begin{codeblock} int j[] = { 123, 45, 67, 89, 10, 11, 12, }; @@ -1427,7 +1412,6 @@ \end{codeblock} But the following redefinitions are invalid: - \begin{codeblock} #define OBJ_LIKE (0) // different token sequence #define OBJ_LIKE (1 - 1) // different white space @@ -1439,7 +1423,6 @@ \pnum \begin{example} Finally, to show the variable argument list macro facilities: - \begin{codeblock} #define debug(...) fprintf(stderr, @\mname{VA_ARGS}@) #define showlist(...) puts(#@\mname{VA_ARGS}@) @@ -1449,9 +1432,7 @@ showlist(The first, second, and third items.); report(x>y, "x is %d but y is %d", x, y); \end{codeblock} - results in - \begin{codeblock} fprintf(stderr, "Flag"); fprintf(stderr, "X = %d\n", x); @@ -1482,11 +1463,9 @@ \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\# line} digit-sequence new-line \end{ncsimplebnf} - causes the implementation to behave as if the following sequence of source lines begins with a source line that has a line number as specified @@ -1497,22 +1476,18 @@ \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\# line} digit-sequence \terminal{"} \opt{s-char-sequence} \terminal{"} new-line \end{ncsimplebnf} - sets the presumed line number similarly and changes the presumed name of the source file to be the contents of the character string literal. \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\# line} pp-tokens new-line \end{ncsimplebnf} - (that does not match one of the two previous forms) is permitted. The preprocessing tokens after @@ -1530,11 +1505,9 @@ \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\# error} \opt{pp-tokens} new-line \end{ncsimplebnf} - causes the implementation to produce a diagnostic message that includes the specified sequence of preprocessing tokens, and renders the program ill-formed. @@ -1545,11 +1518,9 @@ \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\# pragma} \opt{pp-tokens} new-line \end{ncsimplebnf} - causes the implementation to behave in an \impldef{\tcode{\#pragma}} manner. The behavior might cause translation to fail or cause the translator or @@ -1561,11 +1532,9 @@ \pnum A preprocessing directive of the form - \begin{ncsimplebnf} \terminal{\#} new-line \end{ncsimplebnf} - has no effect. \rSec1[cpp.predefined]{Predefined macro names} @@ -1785,11 +1754,9 @@ \pnum A unary operator expression of the form: - \begin{ncbnf} \terminal{_Pragma} \terminal{(} string-literal \terminal{)} \end{ncbnf} - is processed as follows: The string literal is \defnx{destringized}{destringization} by deleting the \tcode{L} prefix, if present, deleting the leading and trailing double-quotes, replacing each escape sequence \tcode{\textbackslash"} by a double-quote, and @@ -1816,5 +1783,5 @@ LISTING( ..\listing.dir ) \end{codeblock} -\end{example}% +\end{example} \indextext{preprocessing directive|)} diff --git a/source/ranges.tex b/source/ranges.tex index 1c03d71922..e07f4aaf47 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -23,7 +23,7 @@ \rSec1[ranges.syn]{Header \tcode{} synopsis} -\indexlibrary{\idxhdr{ranges}}% +\indexheader{ranges}% \begin{codeblock} #include #include @@ -213,7 +213,7 @@ // \ref{range.split}, split view template - concept @\placeholder{tiny-range}@ = @\seebelow@; // \expos + concept @\exposconcept{tiny-range}@ = @\seebelow@; // \expos template requires view && view && @@ -299,9 +299,9 @@ \rSec1[range.access]{Range access} \pnum -In addition to being available via inclusion of the \tcode{} +In addition to being available via inclusion of the \libheader{ranges} header, the customization point objects in \ref{range.access} are -available when \tcode{} is included. +available when \libheaderrefx{iterator}{iterator.synopsis} is included. \rSec2[range.access.begin]{\tcode{ranges::begin}} \pnum @@ -309,7 +309,6 @@ object\iref{customization.point.object}. The expression \tcode{ranges::\brk{}begin(E)} for some subexpression \tcode{E} is expression-equivalent to: - \begin{itemize} \item \tcode{E + 0} if \tcode{E} is an lvalue of array type\iref{basic.compound}. @@ -326,10 +325,9 @@ \libconcept{input_or_output_iterator} with overload resolution performed in a context that includes the declarations: \begin{codeblock} - template void begin(T&&) = delete; - template void begin(initializer_list&&) = delete; +template void begin(T&&) = delete; +template void begin(initializer_list&&) = delete; \end{codeblock} - and does not include a declaration of \tcode{ranges::begin}. \item @@ -352,7 +350,6 @@ object\iref{customization.point.object}. The expression \tcode{ranges::end(E)} for some subexpression \tcode{E} is expression-equivalent to: - \begin{itemize} \item \tcode{E + extent_v} if \tcode{E} is an lvalue of array @@ -363,22 +360,21 @@ \tcode{\placeholdernc{decay-copy}(E.end())} if it is a valid expression and its type \tcode{S} models \begin{codeblock} - sentinel_for +sentinel_for \end{codeblock} \item Otherwise, \tcode{\placeholdernc{decay-copy}(end(E))} if it is a valid expression and its type \tcode{S} models \begin{codeblock} - sentinel_for +sentinel_for \end{codeblock} with overload resolution performed in a context that includes the declarations: \begin{codeblock} - template void end(T&&) = delete; - template void end(initializer_list&&) = delete; +template void end(T&&) = delete; +template void end(initializer_list&&) = delete; \end{codeblock} - and does not include a declaration of \tcode{ranges::end}. \item @@ -420,7 +416,6 @@ object\iref{customization.point.object}. The expression \tcode{ranges::cend(E)} for some subexpression \tcode{E} of type \tcode{T} is expression-equivalent to: - \begin{itemize} \item \tcode{ranges::end(static_cast(E))} if \tcode{E} is an lvalue. \item Otherwise, \tcode{ranges::end(static_cast(E))}. @@ -440,7 +435,6 @@ object\iref{customization.point.object}. The expression \tcode{ranges::\brk{}rbegin(E)} for some subexpression \tcode{E} is expression-equivalent to: - \begin{itemize} \item If \tcode{E} is an lvalue, \tcode{\placeholdernc{decay-copy}(E.rbegin())} @@ -453,9 +447,8 @@ \libconcept{input_or_output_iterator} with overload resolution performed in a context that includes the declaration: \begin{codeblock} - template void rbegin(T&&) = delete; +template void rbegin(T&&) = delete; \end{codeblock} - and does not include a declaration of \tcode{ranges::rbegin}. \item @@ -484,27 +477,25 @@ object\iref{customization.point.object}. The expression \tcode{ranges::rend(E)} for some subexpression \tcode{E} is expression-equivalent to: - \begin{itemize} \item If \tcode{E} is an lvalue, \tcode{\placeholdernc{decay-copy}(E.rend())} if it is a valid expression and its type \tcode{S} models \begin{codeblock} - sentinel_for +sentinel_for \end{codeblock} \item Otherwise, \tcode{\placeholdernc{decay-copy}(rend(E))} if it is a valid expression and its type \tcode{S} models \begin{codeblock} - sentinel_for +sentinel_for \end{codeblock} with overload resolution performed in a context that includes the declaration: \begin{codeblock} - template void rend(T&&) = delete; +template void rend(T&&) = delete; \end{codeblock} - and does not include a declaration of \tcode{ranges::rend}. \item @@ -573,7 +564,6 @@ object\iref{customization.point.object}. The expression \tcode{ranges::size(E)} for some subexpression \tcode{E} with type \tcode{T} is expression-equivalent to: - \begin{itemize} \item \tcode{\placeholdernc{decay-copy}(extent_v)} if \tcode{T} is an array @@ -596,9 +586,8 @@ with overload resolution performed in a context that includes the declaration: \begin{codeblock} - template void size(T&&) = delete; +template void size(T&&) = delete; \end{codeblock} - and does not include a declaration of \tcode{ranges::size}. \end{itemize} @@ -631,7 +620,6 @@ object\iref{customization.point.object}. The expression \tcode{ranges::empty(E)} for some subexpression \tcode{E} is expression-equivalent to: - \begin{itemize} \item \tcode{bool((E).empty())} if it is a valid expression. @@ -666,7 +654,6 @@ object\iref{customization.point.object}. The expression \tcode{ranges::data(E)} for some subexpression \tcode{E} is expression-equivalent to: - \begin{itemize} \item If \tcode{E} is an lvalue, \tcode{\placeholdernc{decay-copy}(E.data())} @@ -755,21 +742,20 @@ iteration over its elements by providing an iterator and sentinel that denote the elements of the range. -\indexlibrary{\idxcode{range}}% \begin{itemdecl} template - concept @\placeholder{range-impl}@ = // \expos + concept @\defexposconcept{range-impl}@ = // \expos requires(T&& t) { ranges::begin(std::forward(t)); // sometimes equality-preserving (see below) ranges::end(std::forward(t)); }; template - concept range = @\placeholdernc{range-impl}@; + concept @\deflibconcept{range}@ = @\exposconcept{range-impl}@; template - concept @\placeholder{forwarding-range}@ = // \expos - range && @\placeholder{range-impl}@; + concept @\defexposconcept{forwarding-range}@ = // \expos + range && @\exposconcept{range-impl}@; \end{itemdecl} \begin{itemdescr} @@ -778,13 +764,12 @@ \tcode{ranges::begin(std::forward(t))} and \tcode{ranges::end(std::forward<\brk{}T>(t))} -of the \tcode{\placeholder{range-impl}} concept +of the \exposconcept{range-impl} concept do not require implicit expression variations\iref{concepts.equality}. \pnum Given an expression \tcode{E} such that \tcode{decltype((E))} is \tcode{T}, \tcode{T} models \tcode{\placeholder{range-impl}} only if - \begin{itemize} \item \range{ranges::begin(E)}{ranges::end(E)} denotes a range\iref{iterator.requirements.general}, @@ -815,7 +800,7 @@ \pnum Given an expression \tcode{E} such that \tcode{decltype((E))} is \tcode{T} and an lvalue \tcode{t} that denotes the same object as \tcode{E}, -\tcode{T} models \tcode{\placeholdernc{forwarding-range}} only if +\tcode{T} models \exposconcept{forwarding-range} only if \begin{itemize} \item \tcode{ranges::begin(E)} and \tcode{ranges::begin(t)} are expression-equivalent, @@ -828,7 +813,7 @@ \pnum \begin{note} Since the validity of iterators is not tied to the lifetime of -an object whose type models \tcode{\placeholdernc{forwarding-range}}, +an object whose type models \exposconceptnc{forwarding-range}, a function can accept arguments of such a type by value and return iterators obtained from it without danger of dangling. \end{note} @@ -836,10 +821,10 @@ \pnum \begin{example} Specializations of class template \tcode{subrange}\iref{range.subrange} -model \tcode{\placeholdernc{forwarding-range}}. \tcode{subrange} provides +model \exposconceptnc{forwarding-range}. \tcode{subrange} provides non-member rvalue overloads of \tcode{begin} and \tcode{end} with the same semantics as its member lvalue overloads, and \tcode{subrange}'s iterators -- since they are ``borrowed'' from some other range - +-- since they are ``borrowed'' from some other range -- do not have validity tied to the lifetime of a \tcode{subrange} object. \end{example} \end{itemdescr} @@ -851,10 +836,9 @@ of a \libconcept{range} type that knows its size in constant time with the \tcode{size} function. -\indexlibrary{\idxcode{sized_range}}% \begin{itemdecl} template - concept sized_range = + concept @\deflibconcept{sized_range}@ = range && !disable_sized_range> && requires(T& t) { ranges::size(t); }; @@ -864,7 +848,6 @@ \pnum Given an lvalue \tcode{t} of type \tcode{remove_reference_t}, \tcode{T} models \libconcept{sized_range} only if - \begin{itemize} \item \tcode{ranges::size(t)} is \bigoh{1}, does not modify \tcode{t}, and is equal to \tcode{ranges::distance(t)}, and @@ -890,7 +873,7 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{disable_sized_range}}% +\indexlibraryglobal{disable_sized_range}% \begin{itemdecl} template inline constexpr bool disable_sized_range = false; @@ -915,10 +898,9 @@ \rSec2[range.view]{Views} -\indexlibrary{\idxcode{view}}% \begin{itemdecl} template - concept view = + concept @\deflibconcept{view}@ = range && semiregular && enable_view; \end{itemdecl} @@ -933,7 +915,6 @@ \pnum \begin{example} Examples of \tcode{view}s are: - \begin{itemize} \item A \libconcept{range} type that wraps a pair of iterators. @@ -953,7 +934,7 @@ Since the difference between \libconcept{range} and \libconcept{view} is largely semantic, the two are differentiated with the help of \tcode{enable_view}. -\indexlibrary{\idxcode{enable_view}}% +\indexlibraryglobal{enable_view}% \begin{itemdecl} template inline constexpr bool enable_view = @\seebelow@; @@ -1003,42 +984,36 @@ \libconcept{input_range}, \libconcept{forward_range}, \libconcept{bidirectional_range}, and \libconcept{random_access_range} are defined similarly. -\indexlibrary{\idxcode{output_range}}% -\indexlibrary{\idxcode{input_range}}% -\indexlibrary{\idxcode{forward_range}}% -\indexlibrary{\idxcode{bidirectional_range}}% -\indexlibrary{\idxcode{random_access_range}}% \begin{itemdecl} template - concept output_range = + concept @\deflibconcept{output_range}@ = range && output_iterator, T>; template - concept input_range = + concept @\deflibconcept{input_range}@ = range && input_iterator>; template - concept forward_range = + concept @\deflibconcept{forward_range}@ = input_range && forward_iterator>; template - concept bidirectional_range = + concept @\deflibconcept{bidirectional_range}@ = forward_range && bidirectional_iterator>; template - concept random_access_range = + concept @\deflibconcept{random_access_range}@ = bidirectional_range && random_access_iterator>; \end{itemdecl} \pnum -\tcode{contiguous_range} additionally requires that +\libconcept{contiguous_range} additionally requires that the \tcode{ranges::data} customization point\iref{range.prim.data} is usable with the range. -\indexlibrary{\idxcode{contiguous_range}}% \begin{itemdecl} template - concept contiguous_range = + concept @\deflibconcept{contiguous_range}@ = random_access_range && contiguous_iterator> && requires(T& t) { { ranges::data(t) } -> same_as>>; @@ -1053,10 +1028,9 @@ The standard containers\iref{containers} model \libconcept{common_range}. \end{example} -\indexlibrary{\idxcode{common_range}}% \begin{itemdecl} template - concept common_range = + concept @\deflibconcept{common_range}@ = range && same_as, sentinel_t>; \end{itemdecl} @@ -1064,10 +1038,9 @@ The \libconcept{viewable_range} concept specifies the requirements of a \libconcept{range} type that can be converted to a \libconcept{view} safely. -\indexlibrary{\idxcode{viewable_range}}% \begin{itemdecl} template - concept viewable_range = + concept @\deflibconcept{viewable_range}@ = range && (@\placeholder{forwarding-range}@ || view>); \end{itemdecl} @@ -1085,17 +1058,17 @@ \begin{codeblock} template - concept @\placeholder{simple-view}@ = // \expos + concept @\defexposconcept{simple-view}@ = // \expos view && range && same_as, iterator_t> && same_as, sentinel_t>; template - concept @\placeholder{has-arrow}@ = // \expos + concept @\defexposconcept{has-arrow}@ = // \expos is_pointer_v || requires(I i) { i.operator->(); }; template - concept @\placeholder{not-same-as}@ = // \expos + concept @\defexposconcept{not-same-as}@ = // \expos !same_as, remove_cvref_t>; \end{codeblock} @@ -1106,7 +1079,7 @@ \tcode{view}-like types that offer a container-like interface. It is parameterized with the type that is derived from it. -\indexlibrary{\idxcode{view_interface}}% +\indexlibraryglobal{view_interface}% \begin{codeblock} namespace std::ranges { template @@ -1181,7 +1154,7 @@ \rSec3[view.interface.members]{Members} -\indexlibrary{\idxcode{view_interface}!\idxcode{front}}% +\indexlibrarymember{front}{view_interface}% \begin{itemdecl} constexpr decltype(auto) front() requires forward_range; constexpr decltype(auto) front() const requires forward_range; @@ -1189,13 +1162,15 @@ \begin{itemdescr} \pnum -\expects \tcode{!empty()}. +\expects +\tcode{!empty()}. \pnum -\effects Equivalent to: \tcode{return *ranges::begin(derived());} +\effects +Equivalent to: \tcode{return *ranges::begin(derived());} \end{itemdescr} -\indexlibrary{\idxcode{view_interface}!\idxcode{back}}% +\indexlibrarymember{back}{view_interface}% \begin{itemdecl} constexpr decltype(auto) back() requires bidirectional_range && common_range; constexpr decltype(auto) back() const @@ -1204,10 +1179,12 @@ \begin{itemdescr} \pnum -\expects \tcode{!empty()}. +\expects +\tcode{!empty()}. \pnum -\effects Equivalent to: \tcode{return *ranges::prev(ranges::end(derived()));} +\effects +Equivalent to: \tcode{return *ranges::prev(ranges::end(derived()));} \end{itemdescr} \rSec2[range.subrange]{Sub-ranges} @@ -1219,11 +1196,11 @@ \libconcept{sized_range} concept when the final template parameter is \tcode{subrange_kind::sized}. -\indexlibrary{\idxcode{subrange}}% +\indexlibraryglobal{subrange}% \begin{codeblock} namespace std::ranges { template - concept @\placeholdernc{pair-like}@ = // \expos + concept @\defexposconcept{pair-like}@ = // \expos !is_reference_v && requires(T t) { typename tuple_size::type; // ensures \tcode{tuple_size} is complete requires derived_from, integral_constant>; @@ -1234,20 +1211,20 @@ }; template - concept @\placeholdernc{pair-like-convertible-to}@ = // \expos - !range && @\placeholder{pair-like}@> && + concept @\defexposconcept{pair-like-convertible-to}@ = // \expos + !range && @\exposconcept{pair-like}@> && requires(T&& t) { { get<0>(std::forward(t)) } -> convertible_to; { get<1>(std::forward(t)) } -> convertible_to; }; template - concept @\placeholdernc{pair-like-convertible-from}@ = // \expos - !range && @\placeholdernc{pair-like}@ && constructible_from; + concept @\defexposconcept{pair-like-convertible-from}@ = // \expos + !range && @\exposconcept{pair-like}@ && constructible_from; template - concept @\placeholdernc{iterator-sentinel-pair}@ = // \expos - !range && @\placeholdernc{pair-like}@ && + concept @\defexposconcept{iterator-sentinel-pair}@ = // \expos + !range && @\exposconcept{pair-like}@ && sentinel_for, tuple_element_t<0, T>>; template S = I, subrange_kind K = @@ -1255,12 +1232,12 @@ requires (K == subrange_kind::sized || !sized_sentinel_for) class subrange : public view_interface> { private: - static constexpr bool StoreSize = // \expos + static constexpr bool StoreSize = // \expos K == subrange_kind::sized && !sized_sentinel_for; - I begin_ = I(); // \expos - S end_ = S(); // \expos + I begin_ = I(); // \expos + S end_ = S(); // \expos @\placeholdernc{make-unsigned-like-t}@(iter_difference_t) size_ = 0; // \expos; present only - // when \tcode{StoreSize} is \tcode{true} + // when \tcode{StoreSize} is \tcode{true} public: subrange() = default; @@ -1269,34 +1246,34 @@ constexpr subrange(I i, S s, @\placeholdernc{make-unsigned-like-t}@(iter_difference_t) n) requires (K == subrange_kind::sized); - template<@\placeholdernc{not-same-as}@ R> - requires @\placeholdernc{forwarding-range}@ && + template<@\exposconcept{not-same-as}@ R> + requires @\exposconcept{forwarding-range}@ && convertible_to, I> && convertible_to, S> constexpr subrange(R&& r) requires (!StoreSize || sized_range); - template<@\placeholdernc{forwarding-range}@ R> + template<@\exposconcept{forwarding-range}@ R> requires convertible_to, I> && convertible_to, S> constexpr subrange(R&& r, @\placeholdernc{make-unsigned-like-t}@(iter_difference_t) n) requires (K == subrange_kind::sized) : subrange{ranges::begin(r), ranges::end(r), n} {} - template<@\placeholdernc{not-same-as}@ PairLike> - requires @\placeholdernc{pair-like-convertible-to}@ + template<@\exposconcept{not-same-as}@ PairLike> + requires @\exposconcept{pair-like-convertible-to}@ constexpr subrange(PairLike&& r) requires (!StoreSize) : subrange{std::get<0>(std::forward(r)), std::get<1>(std::forward(r))} {} - template<@\placeholdernc{pair-like-convertible-to}@ PairLike> + template<@\exposconcept{pair-like-convertible-to}@ PairLike> constexpr subrange(PairLike&& r, @\placeholdernc{make-unsigned-like-t}@(iter_difference_t) n) requires (K == subrange_kind::sized) : subrange{std::get<0>(std::forward(r)), std::get<1>(std::forward(r)), n} {} - template<@\placeholdernc{not-same-as}@ PairLike> - requires @\placeholdernc{pair-like-convertible-from}@ + template<@\exposconcept{not-same-as}@ PairLike> + requires @\exposconcept{pair-like-convertible-from}@ constexpr operator PairLike() const; constexpr I begin() const; @@ -1348,21 +1325,23 @@ \rSec3[range.subrange.ctor]{Constructors and conversions} -\indexlibrary{\idxcode{subrange}!\idxcode{subrange}}% +\indexlibraryctor{subrange}% \begin{itemdecl} constexpr subrange(I i, S s) requires (!StoreSize); \end{itemdecl} \begin{itemdescr} \pnum -\expects \range{i}{s} is a valid range. +\expects +\range{i}{s} is a valid range. \pnum -\effects Initializes \tcode{begin_} with \tcode{i} and \tcode{end_} with +\effects +Initializes \tcode{begin_} with \tcode{i} and \tcode{end_} with \tcode{s}. \end{itemdescr} -\indexlibrary{\idxcode{subrange}!\idxcode{subrange}}% +\indexlibraryctor{subrange}% \begin{itemdecl} constexpr subrange(I i, S s, @\placeholdernc{make-unsigned-like-t}@(iter_difference_t) n) requires (K == subrange_kind::sized); @@ -1370,11 +1349,13 @@ \begin{itemdescr} \pnum -\expects \range{i}{s} is a valid range, and +\expects +\range{i}{s} is a valid range, and \tcode{n == \placeholdernc{make-unsigned-like}(ranges::distance(i, s))}. \pnum -\effects Initializes \tcode{begin_} with \tcode{i} and \tcode{end_} with +\effects +Initializes \tcode{begin_} with \tcode{i} and \tcode{end_} with \tcode{s}. If \tcode{StoreSize} is \tcode{true}, initializes \tcode{size_} with \tcode{n}. @@ -1387,17 +1368,18 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{subrange}!\idxcode{subrange}}% +\indexlibraryctor{subrange}% \begin{itemdecl} -template<@\placeholdernc{not-same-as}@ R> - requires @\placeholdernc{forwarding-range}@ && +template<@\exposconcept{not-same-as}@ R> + requires @\exposconcept{forwarding-range}@ && convertible_to, I> && convertible_to, S> constexpr subrange(R&& r) requires (!StoreSize || sized_range); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{itemize} \item If \tcode{StoreSize} is \tcode{true}, \tcode{subrange\{ranges::begin(r), ranges::end(r), ranges::size(r)\}}. @@ -1405,51 +1387,55 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{operator \placeholder{PairLike}}!\idxcode{subrange}}% +\indexlibrarymember{operator \placeholder{PairLike}}{subrange}% \begin{itemdecl} -template<@\placeholdernc{not-same-as}@ PairLike> - requires @\placeholdernc{pair-like-convertible-from}@ +template<@\exposconcept{not-same-as}@ PairLike> + requires @\exposconcept{pair-like-convertible-from}@ constexpr operator PairLike() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return PairLike(begin_, end_);} +\effects +Equivalent to: \tcode{return PairLike(begin_, end_);} \end{itemdescr} \rSec3[range.subrange.access]{Accessors} -\indexlibrary{\idxcode{begin}!\idxcode{subrange}}% +\indexlibrarymember{begin}{subrange}% \begin{itemdecl} constexpr I begin() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return begin_;} +\effects +Equivalent to: \tcode{return begin_;} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{subrange}}% +\indexlibrarymember{end}{subrange}% \begin{itemdecl} constexpr S end() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return end_;} +\effects +Equivalent to: \tcode{return end_;} \end{itemdescr} -\indexlibrary{\idxcode{empty}!\idxcode{subrange}}% +\indexlibrarymember{empty}{subrange}% \begin{itemdecl} constexpr bool empty() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return begin_ == end_;} +\effects +Equivalent to: \tcode{return begin_ == end_;} \end{itemdescr} -\indexlibrary{\idxcode{size}!\idxcode{subrange}}% +\indexlibrarymember{size}{subrange}% \begin{itemdecl} constexpr @\placeholdernc{make-unsigned-like-t}@(iter_difference_t) size() const requires (K == subrange_kind::sized); @@ -1464,14 +1450,15 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{next}!\idxcode{subrange}}% +\indexlibrarymember{next}{subrange}% \begin{itemdecl} [[nodiscard]] constexpr subrange next(iter_difference_t n = 1) const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; tmp.advance(n); @@ -1485,7 +1472,7 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{prev}!\idxcode{subrange}}% +\indexlibrarymember{prev}{subrange}% \begin{itemdecl} [[nodiscard]] constexpr subrange prev(iter_difference_t n = 1) const requires bidirectional_iterator; @@ -1493,7 +1480,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; tmp.advance(-n); @@ -1501,14 +1489,15 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{advance}!\idxcode{subrange}}% +\indexlibrarymember{advance}{subrange}% \begin{itemdecl} constexpr subrange& advance(iter_difference_t n); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{itemize} \item If \tcode{StoreSize} is \tcode{true}, \begin{codeblock} @@ -1527,7 +1516,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{get}!\idxcode{subrange}}% +\indexlibrarymember{get}{subrange}% \begin{itemdecl} template requires (N < 2) @@ -1536,7 +1525,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} if constexpr (N == 0) return r.begin(); @@ -1556,6 +1546,7 @@ which could potentially reference a range whose lifetime has ended for a particular rvalue \tcode{range} argument which does not model \tcode{\placeholder{forwarding-range}}\iref{range.range}. +\indexlibraryglobal{dangling}% \begin{codeblock} namespace std::ranges { struct dangling { @@ -1615,6 +1606,7 @@ \rSec3[range.empty.view]{Class template \tcode{empty_view}} +\indexlibraryglobal{empty_view}% \begin{codeblock} namespace std::ranges { template @@ -1646,12 +1638,13 @@ \begin{codeblock} single_view s{4}; for (int i : s) - cout << i; // prints \tcode{4} + cout << i; // prints \tcode{4} \end{codeblock} \end{example} \rSec3[range.single.view]{Class template \tcode{single_view}} +\indexlibraryglobal{single_view}% \begin{codeblock} namespace std::ranges { template @@ -1678,27 +1671,29 @@ } \end{codeblock} -\indexlibrary{\idxcode{single_view}!\idxcode{single_view}}% +\indexlibraryctor{single_view}% \begin{itemdecl} constexpr explicit single_view(const T& t); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{value_} with \tcode{t}. +\effects +Initializes \tcode{value_} with \tcode{t}. \end{itemdescr} -\indexlibrary{\idxcode{single_view}!\idxcode{single_view}}% +\indexlibraryctor{single_view}% \begin{itemdecl} constexpr explicit single_view(T&& t); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{value_} with \tcode{std::move(t)}. +\effects +Initializes \tcode{value_} with \tcode{std::move(t)}. \end{itemdescr} -\indexlibrary{\idxcode{single_view}!\idxcode{single_view}}% +\indexlibraryctor{single_view}% \begin{itemdecl} template constexpr single_view(in_place_t, Args&&... args); @@ -1706,11 +1701,12 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{value_} as if by +\effects +Initializes \tcode{value_} as if by \tcode{value_\{in_place, std::forward(args)...\}}. \end{itemdescr} -\indexlibrary{\idxcode{begin}!\idxcode{single_view}}% +\indexlibrarymember{begin}{single_view}% \begin{itemdecl} constexpr T* begin() noexcept; constexpr const T* begin() const noexcept; @@ -1718,10 +1714,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return data();} +\effects +Equivalent to: \tcode{return data();} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{single_view}}% +\indexlibrarymember{end}{single_view}% \begin{itemdecl} constexpr T* end() noexcept; constexpr const T* end() const noexcept; @@ -1729,20 +1726,22 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return data() + 1;} +\effects +Equivalent to: \tcode{return data() + 1;} \end{itemdescr} -\indexlibrary{\idxcode{size}!\idxcode{single_view}}% +\indexlibrarymember{size}{single_view}% \begin{itemdecl} static constexpr size_t size() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return 1;} +\effects +Equivalent to: \tcode{return 1;} \end{itemdescr} -\indexlibrary{\idxcode{data}!\idxcode{single_view}}% +\indexlibrarymember{data}{single_view}% \begin{itemdecl} constexpr T* data() noexcept; constexpr const T* data() const noexcept; @@ -1750,7 +1749,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return value_.operator->();} +\effects +Equivalent to: \tcode{return value_.operator->();} \end{itemdescr} \rSec3[range.single.adaptor]{\tcode{views::single}} @@ -1780,17 +1780,18 @@ \rSec3[range.iota.view]{Class template \tcode{iota_view}} +\indexlibraryglobal{iota_view}% \begin{codeblock} namespace std::ranges { template - concept @\placeholdernc{decrementable}@ = // \expos + concept @\exposconcept{decrementable}@ = // \expos @\seebelow@; template - concept @\placeholdernc{advanceable}@ = // \expos + concept @\exposconcept{advanceable}@ = // \expos @\seebelow@; template - requires @\placeholdernc{weakly-equality-comparable-with}@ + requires @\exposconcept{weakly-equality-comparable-with}@ class iota_view : public view_interface> { private: // \ref{range.iota.iterator}, class \tcode{iota_view::iterator} @@ -1813,8 +1814,8 @@ }; template - requires (!@\placeholdernc{is-integer-like}@ || !@\placeholdernc{is-integer-like}@ || - (@\placeholdernc{is-signed-integer-like}@ == @\placeholdernc{is-signed-integer-like}@)) + requires (!@\exposconcept{is-integer-like}@ || !@\exposconcept{is-integer-like}@ || + (@\exposconcept{is-signed-integer-like}@ == @\exposconcept{is-signed-integer-like}@)) iota_view(W, Bound) -> iota_view; } \end{codeblock} @@ -1842,10 +1843,10 @@ \end{itemize} \pnum -The exposition-only \tcode{\placeholder{decrementable}} concept is equivalent to: +The exposition-only \defexposconcept{decrementable} concept is equivalent to: \begin{itemdecl} template - concept @\placeholder{decrementable}@ = + concept @\defexposconcept{decrementable}@ = incrementable && requires(I i) { { --i } -> same_as; { i-- } -> same_as; @@ -1859,7 +1860,7 @@ \pnum Let \tcode{a} and \tcode{b} be equal objects of type \tcode{I}. -\tcode{I} models \tcode{\placeholdernc{decrementable}} only if +\tcode{I} models \exposconcept{decrementable} only if \begin{itemize} \item If \tcode{a} and \tcode{b} are decrementable, then the following are all true: @@ -1875,11 +1876,11 @@ \end{itemdescr} \pnum -The exposition-only \tcode{\placeholder{advanceable}} concept is equivalent to: +The exposition-only \defexposconcept{advanceable} concept is equivalent to: \begin{itemdecl} template - concept @\placeholder{advanceable}@ = - @\placeholdernc{decrementable}@ && totally_ordered && + concept @\defexposconcept{advanceable}@ = + @\exposconcept{decrementable}@ && totally_ordered && requires(I i, const I j, const @\placeholdernc{IOTA-DIFF-T}@(I) n) { { i += n } -> same_as; { i -= n } -> same_as; @@ -1895,7 +1896,7 @@ \tcode{b} is reachable from \tcode{a} after \tcode{n} applications of \tcode{++a}, for some value \tcode{n} of type \tcode{D}. -\tcode{I} models \tcode{\placeholdernc{advanceable}} only if +\tcode{I} models \exposconcept{advanceable} only if \begin{itemize} \item \tcode{(a += n)} is equal to \tcode{b}. \item \tcode{addressof(a += n)} is equal to \tcode{addressof(a)}. @@ -1916,7 +1917,7 @@ \item \tcode{bool(a <= b)} is \tcode{true}. \end{itemize} -\indexlibrary{\idxcode{iota_view}!\idxcode{iota_view}}% +\indexlibraryctor{iota_view}% \begin{itemdecl} constexpr explicit iota_view(W value); \end{itemdecl} @@ -1928,10 +1929,11 @@ \tcode{Bound()} is reachable from \tcode{value}. \pnum -\effects Initializes \tcode{value_} with \tcode{value}. +\effects +Initializes \tcode{value_} with \tcode{value}. \end{itemdescr} -\indexlibrary{\idxcode{iota_view}!\idxcode{iota_view}}% +\indexlibraryctor{iota_view}% \begin{itemdecl} constexpr iota_view(type_identity_t value, type_identity_t bound); \end{itemdecl} @@ -1945,28 +1947,31 @@ then \tcode{bool(value <= bound)} is \tcode{true}. \pnum -\effects Initializes \tcode{value_} with \tcode{value} and +\effects +Initializes \tcode{value_} with \tcode{value} and \tcode{bound_} with \tcode{bound}. \end{itemdescr} -\indexlibrary{\idxcode{begin}!\idxcode{iota_view}}% +\indexlibrarymember{begin}{iota_view}% \begin{itemdecl} constexpr iterator begin() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return iterator\{value_\};} +\effects +Equivalent to: \tcode{return iterator\{value_\};} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{iota_view}}% +\indexlibrarymember{end}{iota_view}% \begin{itemdecl} constexpr auto end() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} if constexpr (same_as) return unreachable_sentinel; @@ -1975,14 +1980,15 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{iota_view}}% +\indexlibrarymember{end}{iota_view}% \begin{itemdecl} constexpr iterator end() const requires same_as; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return iterator\{bound_\};} +\effects +Equivalent to: \tcode{return iterator\{bound_\};} \end{itemdescr} \indexlibrarymember{size}{iota_view}% @@ -1992,9 +1998,10 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} -if constexpr (@\placeholdernc{is-integer-like}@ && @\placeholdernc{is-integer-like}@) +if constexpr (@\exposconcept{is-integer-like}@ && @\exposconcept{is-integer-like}@) return (value_ < 0) ? ((bound_ < 0) ? @\placeholdernc{make-unsigned-like}@(-value_) - @\placeholdernc{make-unsigned-like}@(-bound_) @@ -2005,7 +2012,8 @@ \end{codeblock} \pnum -\remarks The expression in the \grammarterm{requires-clause} is equivalent to +\remarks +The expression in the \grammarterm{requires-clause} is equivalent to \begin{codeblock} (same_as && @\placeholder{advanceable}@) || (integral && integral) || sized_sentinel_for @@ -2014,6 +2022,7 @@ \rSec3[range.iota.iterator]{Class \tcode{iota_view::iterator}} +\indexlibraryglobal{iota_view::iterator}% \begin{codeblock} namespace std::ranges { template @@ -2034,15 +2043,15 @@ constexpr void operator++(int); constexpr iterator operator++(int) requires incrementable; - constexpr iterator& operator--() requires @\placeholdernc{decrementable}@; - constexpr iterator operator--(int) requires @\placeholdernc{decrementable}@; + constexpr iterator& operator--() requires @\exposconcept{decrementable}@; + constexpr iterator operator--(int) requires @\exposconcept{decrementable}@; constexpr iterator& operator+=(difference_type n) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; constexpr iterator& operator-=(difference_type n) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; constexpr W operator[](difference_type n) const - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; friend constexpr bool operator==(const iterator& x, const iterator& y) requires equality_comparable; @@ -2060,14 +2069,14 @@ requires totally_ordered && three_way_comparable; friend constexpr iterator operator+(iterator i, difference_type n) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; friend constexpr iterator operator+(difference_type n, iterator i) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; friend constexpr iterator operator-(iterator i, difference_type n) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; friend constexpr difference_type operator-(const iterator& x, const iterator& y) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; }; } \end{codeblock} @@ -2077,7 +2086,7 @@ \begin{itemize} \item If \tcode{W} models \tcode{\placeholder{advanceable}}, then \tcode{iterator_category} is \tcode{random_access_iterator_tag}. -\item Otherwise, if \tcode{W} models \tcode{\placeholder{decrementable}}, then +\item Otherwise, if \tcode{W} models \exposconcept{decrementable}, then \tcode{iterator_category} is \tcode{bidirectional_iterator_tag}. \item Otherwise, if \tcode{W} models \libconcept{incrementable}, then \tcode{iterator_category} is \tcode{forward_iterator_tag}. @@ -2089,24 +2098,26 @@ Overloads for \tcode{iter_move} and \tcode{iter_swap} are omitted intentionally. \end{note} -\indexlibrary{\idxcode{iterator}!\idxcode{iota_view::iterator}} +\indexlibraryctor{iota_view::iterator} \begin{itemdecl} constexpr explicit iterator(W value); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{value_} with \tcode{value}. +\effects +Initializes \tcode{value_} with \tcode{value}. \end{itemdescr} -\indexlibrary{\idxcode{operator*}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator*}{iota_view::iterator} \begin{itemdecl} constexpr W operator*() const noexcept(is_nothrow_copy_constructible_v); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return value_;} +\effects +Equivalent to: \tcode{return value_;} \pnum \begin{note} @@ -2115,38 +2126,41 @@ \end{note} \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator++}{iota_view::iterator} \begin{itemdecl} constexpr iterator& operator++(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} ++value_; return *this; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator++}{iota_view::iterator} \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to \tcode{++*this}. +\effects +Equivalent to \tcode{++*this}. \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator++}{iota_view::iterator} \begin{itemdecl} constexpr iterator operator++(int) requires incrementable; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; ++*this; @@ -2154,28 +2168,30 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator\dcr}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator\dcr}{iota_view::iterator} \begin{itemdecl} -constexpr iterator& operator--() requires @\placeholdernc{decrementable}@; +constexpr iterator& operator--() requires @\exposconcept{decrementable}@; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} --value_; return *this; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator\dcr}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator\dcr}{iota_view::iterator} \begin{itemdecl} -constexpr iterator operator--(int) requires @\placeholdernc{decrementable}@; +constexpr iterator operator--(int) requires @\exposconcept{decrementable}@; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; --*this; @@ -2183,17 +2199,18 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator+=}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator+=}{iota_view::iterator} \begin{itemdecl} constexpr iterator& operator+=(difference_type n) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} -if constexpr (@\placeholdernc{is-integer-like}@ && !@\placeholdernc{is-signed-integer-like}@) { +if constexpr (@\exposconcept{is-integer-like}@ && !@\exposconcept{is-signed-integer-like}@) { if (n >= difference_type(0)) value_ += static_cast(n); else @@ -2205,17 +2222,18 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator-=}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator-=}{iota_view::iterator} \begin{itemdecl} constexpr iterator& operator-=(difference_type n) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} -if constexpr (@\placeholdernc{is-integer-like}@ && !@\placeholdernc{is-signed-integer-like}@) { +if constexpr (@\exposconcept{is-integer-like}@ && !@\exposconcept{is-signed-integer-like}@) { if (n >= difference_type(0)) value_ -= static_cast(n); else @@ -2227,18 +2245,19 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator[]}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator[]}{iota_view::iterator} \begin{itemdecl} constexpr W operator[](difference_type n) const - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return W(value_ + n);} +\effects +Equivalent to: \tcode{return W(value_ + n);} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator==}{iota_view::iterator} \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const iterator& y) requires equality_comparable; @@ -2246,10 +2265,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.value_ == y.value_;} +\effects +Equivalent to: \tcode{return x.value_ == y.value_;} \end{itemdescr} -\indexlibrary{\idxcode{operator<}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator<}{iota_view::iterator} \begin{itemdecl} friend constexpr bool operator<(const iterator& x, const iterator& y) requires totally_ordered; @@ -2257,10 +2277,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.value_ < y.value_;} +\effects +Equivalent to: \tcode{return x.value_ < y.value_;} \end{itemdescr} -\indexlibrary{\idxcode{operator>}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator>}{iota_view::iterator} \begin{itemdecl} friend constexpr bool operator>(const iterator& x, const iterator& y) requires totally_ordered; @@ -2268,10 +2289,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return y < x;} +\effects +Equivalent to: \tcode{return y < x;} \end{itemdescr} -\indexlibrary{\idxcode{operator<=}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator<=}{iota_view::iterator} \begin{itemdecl} friend constexpr bool operator<=(const iterator& x, const iterator& y) requires totally_ordered; @@ -2279,10 +2301,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return !(y < x);} +\effects +Equivalent to: \tcode{return !(y < x);} \end{itemdescr} -\indexlibrary{\idxcode{operator>=}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator>=}{iota_view::iterator} \begin{itemdecl} friend constexpr bool operator>=(const iterator& x, const iterator& y) requires totally_ordered; @@ -2290,10 +2313,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return !(x < y);} +\effects +Equivalent to: \tcode{return !(x < y);} \end{itemdescr} -\indexlibrary{\idxcode{operator<=>}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator<=>}{iota_view::iterator} \begin{itemdecl} friend constexpr compare_three_way_result_t operator<=>(const iterator& x, const iterator& y) @@ -2306,48 +2330,52 @@ Equivalent to: \tcode{return x.value_ <=> y.value_;} \end{itemdescr} -\indexlibrary{\idxcode{operator+}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator+}{iota_view::iterator} \begin{itemdecl} friend constexpr iterator operator+(iterator i, difference_type n) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return i += n;} +\effects +Equivalent to: \tcode{return i += n;} \end{itemdescr} -\indexlibrary{\idxcode{operator+}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator+}{iota_view::iterator} \begin{itemdecl} friend constexpr iterator operator+(difference_type n, iterator i) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return i + n;} +\effects +Equivalent to: \tcode{return i + n;} \end{itemdescr} -\indexlibrary{\idxcode{operator-}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator-}{iota_view::iterator} \begin{itemdecl} friend constexpr iterator operator-(iterator i, difference_type n) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return i -= n;} +\effects +Equivalent to: \tcode{return i -= n;} \end{itemdescr} -\indexlibrary{\idxcode{operator-}!\idxcode{iota_view::iterator}} +\indexlibrarymember{operator-}{iota_view::iterator} \begin{itemdecl} friend constexpr difference_type operator-(const iterator& x, const iterator& y) - requires @\placeholdernc{advanceable}@; + requires @\exposconcept{advanceable}@; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} using D = difference_type; if constexpr (@\placeholder{is-integer-like}@) { @@ -2365,6 +2393,7 @@ \rSec3[range.iota.sentinel]{Class \tcode{iota_view::sentinel}} +\indexlibraryglobal{iota_view::sentinel}% \begin{codeblock} namespace std::ranges { template @@ -2385,24 +2414,26 @@ } \end{codeblock} -\indexlibrary{\idxcode{sentinel}!\idxcode{iota_view::sentinel}} +\indexlibraryctor{iota_view::sentinel} \begin{itemdecl} constexpr explicit sentinel(Bound bound); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{bound_} with \tcode{bound}. +\effects +Initializes \tcode{bound_} with \tcode{bound}. \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{iota_view::sentinel}} +\indexlibrarymember{operator==}{iota_view::sentinel} \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const sentinel& y); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.value_ == y.bound_;} +\effects +Equivalent to: \tcode{return x.value_ == y.bound_;} \end{itemdescr} \begin{itemdecl} @@ -2412,7 +2443,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.value_ - y.bound_;} +\effects +Equivalent to: \tcode{return x.value_ - y.bound_;} \end{itemdescr} \begin{itemdecl} @@ -2422,7 +2454,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return -(y - x);} +\effects +Equivalent to: \tcode{return -(y - x);} \end{itemdescr} \rSec3[range.iota.adaptor]{\tcode{views::iota}} @@ -2517,7 +2550,6 @@ an exposition-only class template \tcode{\placeholder{semiregular-box}}. \tcode{\placeholder{semiregular-box}} behaves exactly like \tcode{optional} with the following differences: - \begin{itemize} \item \tcode{\placeholder{semiregular-box}} constrains its type parameter \tcode{T} with @@ -2567,7 +2599,6 @@ range adaptor object\iref{range.adaptor.object}. For some subexpression \tcode{E}, the expression \tcode{views::all(E)} is expression-equivalent to: - \begin{itemize} \item \tcode{\placeholdernc{decay-copy}(E)} if the decayed type of \tcode{E} models \libconcept{view}. @@ -2581,6 +2612,7 @@ \pnum \tcode{ref_view} is a \tcode{view} of the elements of some other \tcode{range}. +\indexlibraryglobal{ref_view}% \begin{codeblock} namespace std::ranges { template @@ -2621,7 +2653,7 @@ } \end{codeblock} -\indexlibrary{\idxcode{ref_view}}% +\indexlibraryglobal{ref_view}% \begin{itemdecl} template<@\placeholder{not-same-as}@ T> requires @\seebelow@ @@ -2630,7 +2662,8 @@ \begin{itemdescr} \pnum -\remarks Let \tcode{\placeholder{FUN}} denote the exposition-only functions +\remarks +Let \tcode{\placeholder{FUN}} denote the exposition-only functions \begin{codeblock} void @\placeholder{FUN}@(R&); void @\placeholder{FUN}@(R&&) = delete; @@ -2667,19 +2700,20 @@ \rSec3[range.filter.view]{Class template \tcode{filter_view}} +\indexlibraryglobal{filter_view}% \begin{codeblock} namespace std::ranges { template> Pred> requires view && is_object_v class filter_view : public view_interface> { private: - V base_ = V(); // \expos + V base_ = V(); // \expos @\placeholdernc{semiregular-box}@ pred_; // \expos // \ref{range.filter.iterator}, class \tcode{filter_view::iterator} - class iterator; // \expos + class iterator; // \expos // \ref{range.filter.sentinel}, class \tcode{filter_view::sentinel} - class sentinel; // \expos + class sentinel; // \expos public: filter_view() = default; @@ -2704,18 +2738,19 @@ } \end{codeblock} -\indexlibrary{\idxcode{filter_view}!\idxcode{filter_view}}% +\indexlibraryctor{filter_view}% \begin{itemdecl} constexpr filter_view(V base, Pred pred); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{std::move(base)} and initializes +\effects +Initializes \tcode{base_} with \tcode{std::move(base)} and initializes \tcode{pred_} with \tcode{std::move(pred)}. \end{itemdescr} -\indexlibrary{\idxcode{filter_view}!\idxcode{filter_view}}% +\indexlibraryctor{filter_view}% \begin{itemdecl} template requires viewable_range && constructible_from> @@ -2724,21 +2759,23 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{views::all(std::forward(r))} +\effects +Initializes \tcode{base_} with \tcode{views::all(std::forward(r))} and initializes \tcode{pred_} with \tcode{std::\brk{}move(pred)}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{filter_view}}% +\indexlibrarymember{base}{filter_view}% \begin{itemdecl} constexpr V base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return base_;} +\effects +Equivalent to: \tcode{return base_;} \end{itemdescr} -\indexlibrary{\idxcode{begin}!\idxcode{filter_view}}% +\indexlibrarymember{begin}{filter_view}% \begin{itemdecl} constexpr iterator begin(); \end{itemdecl} @@ -2753,14 +2790,15 @@ \tcode{\{*this, ranges::find_if(base_, ref(*pred_))\}}. \pnum -\remarks In order to provide the amortized constant time complexity required by +\remarks +In order to provide the amortized constant time complexity required by the \libconcept{range} concept, this function caches the result within the \tcode{filter_view} for use on subsequent calls. \end{itemdescr} \rSec3[range.filter.iterator]{Class \tcode{filter_view::iterator}} -\indexlibrary{\idxcode{iterator}!\idxcode{filter_view}}% +\indexlibrarymember{iterator}{filter_view}% \begin{codeblock} namespace std::ranges { template @@ -2835,38 +2873,41 @@ \item Otherwise, \tcode{iterator_category} denotes \tcode{input_iterator_tag}. \end{itemize} -\indexlibrary{\idxcode{iterator}!\idxcode{filter_view::iterator}}% +\indexlibraryctor{filter_view::iterator}% \begin{itemdecl} constexpr iterator(filter_view& parent, iterator_t current); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{current_} with \tcode{current} and +\effects +Initializes \tcode{current_} with \tcode{current} and \tcode{parent_} with \tcode{addressof(parent)}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{base}{filter_view::iterator}% \begin{itemdecl} constexpr iterator_t base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return current_;} +\effects +Equivalent to: \tcode{return current_;} \end{itemdescr} -\indexlibrary{\idxcode{operator*}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{operator*}{filter_view::iterator}% \begin{itemdecl} constexpr range_reference_t operator*() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return *current_;} +\effects +Equivalent to: \tcode{return *current_;} \end{itemdescr} -\indexlibrary{\idxcode{operator->}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{operator->}{filter_view::iterator}% \begin{itemdecl} constexpr iterator_t operator->() const requires @\placeholder{has-arrow}@>; @@ -2878,38 +2919,41 @@ Equivalent to: \tcode{return current_;} \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{operator++}{filter_view::iterator}% \begin{itemdecl} constexpr iterator& operator++(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} current_ = ranges::find_if(++current_, ranges::end(parent_->base_), ref(*parent_->pred_)); return *this; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{operator++}{filter_view::iterator}% \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to \tcode{++*this}. +\effects +Equivalent to \tcode{++*this}. \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{operator++}{filter_view::iterator}% \begin{itemdecl} constexpr iterator operator++(int) requires forward_range; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; ++*this; @@ -2917,14 +2961,15 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator\dcr}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{operator\dcr}{filter_view::iterator}% \begin{itemdecl} constexpr iterator& operator--() requires bidirectional_range; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} do --current_; @@ -2933,14 +2978,15 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator\dcr}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{operator\dcr}{filter_view::iterator}% \begin{itemdecl} constexpr iterator operator--(int) requires bidirectional_range; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; --*this; @@ -2948,7 +2994,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{operator==}{filter_view::iterator}% \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const iterator& y) requires equality_comparable>; @@ -2956,10 +3002,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.current_ == y.current_;} +\effects +Equivalent to: \tcode{return x.current_ == y.current_;} \end{itemdescr} -\indexlibrary{\idxcode{iter_move}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{iter_move}{filter_view::iterator}% \begin{itemdecl} friend constexpr range_rvalue_reference_t iter_move(const iterator& i) noexcept(noexcept(ranges::iter_move(i.current_))); @@ -2967,10 +3014,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return ranges::iter_move(i.current_);} +\effects +Equivalent to: \tcode{return ranges::iter_move(i.current_);} \end{itemdescr} -\indexlibrary{\idxcode{iter_swap}!\idxcode{filter_view::iterator}}% +\indexlibrarymember{iter_swap}{filter_view::iterator}% \begin{itemdecl} friend constexpr void iter_swap(const iterator& x, const iterator& y) noexcept(noexcept(ranges::iter_swap(x.current_, y.current_))) @@ -2979,12 +3027,13 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{ranges::iter_swap(x.current_, y.current_)}. +\effects +Equivalent to \tcode{ranges::iter_swap(x.current_, y.current_)}. \end{itemdescr} \rSec3[range.filter.sentinel]{Class \tcode{filter_view::sentinel}} -\indexlibrary{\idxcode{sentinel}!\idxcode{filter_view}}% +\indexlibrarymember{sentinel}{filter_view}% \begin{codeblock} namespace std::ranges { template @@ -3002,34 +3051,37 @@ } \end{codeblock} -\indexlibrary{\idxcode{sentinel}!\idxcode{filter_view::sentinel}}% +\indexlibraryctor{filter_view::sentinel}% \begin{itemdecl} constexpr explicit sentinel(filter_view& parent); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{end_} with \tcode{ranges::end(parent.base_)}. +\effects +Initializes \tcode{end_} with \tcode{ranges::end(parent.base_)}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{filter_view::sentinel}}% +\indexlibrarymember{base}{filter_view::sentinel}% \begin{itemdecl} constexpr sentinel_t base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return end_;} +\effects +Equivalent to: \tcode{return end_;} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{filter_view::sentinel}}% +\indexlibrarymember{operator==}{filter_view::sentinel}% \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const sentinel& y); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.current_ == y.end_;} +\effects +Equivalent to: \tcode{return x.current_ == y.end_;} \end{itemdescr} \rSec3[range.filter.adaptor]{\tcode{views::filter}} @@ -3063,6 +3115,7 @@ \rSec3[range.transform.view]{Class template \tcode{transform_view}} +\indexlibraryglobal{transform_view}% \begin{codeblock} namespace std::ranges { template @@ -3111,18 +3164,19 @@ } \end{codeblock} -\indexlibrary{\idxcode{transform_view}!\idxcode{transform_view}}% +\indexlibraryctor{transform_view}% \begin{itemdecl} constexpr transform_view(V base, F fun); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{std::move(base)} and +\effects +Initializes \tcode{base_} with \tcode{std::move(base)} and \tcode{fun_} with \tcode{std::move(fun)}. \end{itemdescr} -\indexlibrary{\idxcode{transform_view}!\idxcode{transform_view}}% +\indexlibraryctor{transform_view}% \begin{itemdecl} template requires viewable_range && constructible_from> @@ -3131,34 +3185,37 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{views::all(std::forward(r))} +\effects +Initializes \tcode{base_} with \tcode{views::all(std::forward(r))} and \tcode{fun_} with \tcode{std::move(fun)}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{transform_view}}% +\indexlibrarymember{base}{transform_view}% \begin{itemdecl} constexpr V base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return base_;} +\effects +Equivalent to: \tcode{return base_;} \end{itemdescr} -\indexlibrary{\idxcode{begin}!\idxcode{transform_view}}% +\indexlibrarymember{begin}{transform_view}% \begin{itemdecl} constexpr iterator begin(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return iterator{*this, ranges::begin(base_)}; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{begin}!\idxcode{transform_view}}% +\indexlibrarymember{begin}{transform_view}% \begin{itemdecl} constexpr iterator begin() const requires range && @@ -3167,39 +3224,42 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return iterator{*this, ranges::begin(base_)}; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{transform_view}}% +\indexlibrarymember{end}{transform_view}% \begin{itemdecl} constexpr sentinel end(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return sentinel{ranges::end(base_)}; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{transform_view}}% +\indexlibrarymember{end}{transform_view}% \begin{itemdecl} constexpr iterator end() requires common_range; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return iterator{*this, ranges::end(base_)}; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{transform_view}}% +\indexlibrarymember{end}{transform_view}% \begin{itemdecl} constexpr sentinel end() const requires range && @@ -3208,13 +3268,14 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return sentinel{ranges::end(base_)}; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{transform_view}}% +\indexlibrarymember{end}{transform_view}% \begin{itemdecl} constexpr iterator end() const requires common_range && @@ -3223,7 +3284,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return iterator{*this, ranges::end(base_)}; \end{codeblock} @@ -3231,6 +3293,7 @@ \rSec3[range.transform.iterator]{Class template \tcode{transform_view::iterator}} +\indexlibraryglobal{transform_view::iterator}% \begin{codeblock} namespace std::ranges { template @@ -3339,18 +3402,19 @@ \tcode{random_access_iterator_tag}; otherwise, \tcode{iterator_category} denotes \tcode{C}. -\indexlibrary{\idxcode{iterator}!\idxcode{transform_view::iterator}} +\indexlibrarymember{iterator}{transform_view::iterator} \begin{itemdecl} constexpr iterator(Parent& parent, iterator_t current); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{current_} with \tcode{current} and +\effects +Initializes \tcode{current_} with \tcode{current} and \tcode{parent_} with \tcode{addressof(parent)}. \end{itemdescr} -\indexlibrary{\idxcode{iterator}!\idxcode{transform_view::iterator}}% +\indexlibraryctor{transform_view::iterator}% \begin{itemdecl} constexpr iterator(iterator i) requires Const && convertible_to, iterator_t>; @@ -3358,52 +3422,57 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{current_} with \tcode{std::move(i.current_)} and +\effects +Initializes \tcode{current_} with \tcode{std::move(i.current_)} and \tcode{parent_} with \tcode{i.parent_}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{transform_view::iterator}} +\indexlibrarymember{base}{transform_view::iterator}% \begin{itemdecl} constexpr iterator_t base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return current_;} +\effects +Equivalent to: \tcode{return current_;} \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{transform_view::iterator}} +\indexlibrarymember{operator++}{transform_view::iterator}% \begin{itemdecl} constexpr iterator& operator++(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} ++current_; return *this; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{transform_view::iterator}} +\indexlibrarymember{operator++}{transform_view::iterator}% \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to \tcode{++current_}. +\effects +Equivalent to \tcode{++current_}. \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{transform_view::iterator}} +\indexlibrarymember{operator++}{transform_view::iterator}% \begin{itemdecl} constexpr iterator operator++(int) requires forward_range; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; ++*this; @@ -3411,28 +3480,30 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator\dcr}!\idxcode{transform_view::iterator}} +\indexlibrarymember{operator\dcr}{transform_view::iterator}% \begin{itemdecl} constexpr iterator& operator--() requires bidirectional_range; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} --current_; return *this; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator\dcr}!\idxcode{transform_view::iterator}} +\indexlibrarymember{operator\dcr}{transform_view::iterator}% \begin{itemdecl} constexpr iterator operator--(int) requires bidirectional_range; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; --*this; @@ -3440,7 +3511,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator+=}!\idxcode{transform_view::iterator}} +\indexlibrarymember{operator+=}{transform_view::iterator}% \begin{itemdecl} constexpr iterator& operator+=(difference_type n) requires random_access_range; @@ -3448,14 +3519,15 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} current_ += n; return *this; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator-=}!\idxcode{transform_view::iterator}}% +\indexlibrarymember{operator-=}{transform_view::iterator}% \begin{itemdecl} constexpr iterator& operator-=(difference_type n) requires random_access_range; @@ -3463,14 +3535,15 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} current_ -= n; return *this; \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{transform_view::iterator}} +\indexlibrarymember{operator==}{transform_view::iterator}% \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const iterator& y) requires equality_comparable>; @@ -3478,10 +3551,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.current_ == y.current_;} +\effects +Equivalent to: \tcode{return x.current_ == y.current_;} \end{itemdescr} -\indexlibrary{\idxcode{operator<}!\idxcode{transform_view::iterator}}% +\indexlibrarymember{operator<}{transform_view::iterator}% \begin{itemdecl} friend constexpr bool operator<(const iterator& x, const iterator& y) requires random_access_range; @@ -3489,10 +3563,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.current_ < y.current_;} +\effects +Equivalent to: \tcode{return x.current_ < y.current_;} \end{itemdescr} -\indexlibrary{\idxcode{operator>}!\idxcode{transform_view::iterator}}% +\indexlibrarymember{operator>}{transform_view::iterator}% \begin{itemdecl} friend constexpr bool operator>(const iterator& x, const iterator& y) requires random_access_range; @@ -3500,10 +3575,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return y < x;} +\effects +Equivalent to: \tcode{return y < x;} \end{itemdescr} -\indexlibrary{\idxcode{operator<=}!\idxcode{transform_view::iterator}}% +\indexlibrarymember{operator<=}{transform_view::iterator}% \begin{itemdecl} friend constexpr bool operator<=(const iterator& x, const iterator& y) requires random_access_range; @@ -3511,10 +3587,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return !(y < x);} +\effects +Equivalent to: \tcode{return !(y < x);} \end{itemdescr} -\indexlibrary{\idxcode{operator>=}!\idxcode{transform_view::iterator}}% +\indexlibrarymember{operator>=}{transform_view::iterator}% \begin{itemdecl} friend constexpr bool operator>=(const iterator& x, const iterator& y) requires random_access_range; @@ -3522,10 +3599,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return !(x < y);} +\effects +Equivalent to: \tcode{return !(x < y);} \end{itemdescr} -\indexlibrary{\idxcode{operator<=>}!\idxcode{transform_view::iterator}}% +\indexlibrarymember{operator<=>}{transform_view::iterator}% \begin{itemdecl} friend constexpr compare_three_way_result_t> operator<=>(const iterator& x, const iterator& y) @@ -3534,10 +3612,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.current_ <=> y.current_;} +\effects +Equivalent to: \tcode{return x.current_ <=> y.current_;} \end{itemdescr} -\indexlibrary{\idxcode{operator+}!\idxcode{transform_view::iterator}} +\indexlibrarymember{operator+}{transform_view::iterator}% \begin{itemdecl} friend constexpr iterator operator+(iterator i, difference_type n) requires random_access_range; @@ -3547,10 +3626,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return iterator\{*i.parent_, i.current_ + n\};} +\effects +Equivalent to: \tcode{return iterator\{*i.parent_, i.current_ + n\};} \end{itemdescr} -\indexlibrary{\idxcode{operator-}!\idxcode{transform_view::iterator}}% +\indexlibrarymember{operator-}{transform_view::iterator}% \begin{itemdecl} friend constexpr iterator operator-(iterator i, difference_type n) requires random_access_range; @@ -3558,10 +3638,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return iterator\{*i.parent_, i.current_ - n\};} +\effects +Equivalent to: \tcode{return iterator\{*i.parent_, i.current_ - n\};} \end{itemdescr} -\indexlibrary{\idxcode{operator-}!\idxcode{transform_view::iterator}}% +\indexlibrarymember{operator-}{transform_view::iterator}% \begin{itemdecl} friend constexpr difference_type operator-(const iterator& x, const iterator& y) requires random_access_range; @@ -3569,10 +3650,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.current_ - y.current_;} +\effects +Equivalent to: \tcode{return x.current_ - y.current_;} \end{itemdescr} -\indexlibrary{\idxcode{iter_swap}!\idxcode{transform_view::iterator}} +\indexlibrarymember{iter_swap}{transform_view::iterator}% \begin{itemdecl} friend constexpr void iter_swap(const iterator& x, const iterator& y) noexcept(noexcept(ranges::iter_swap(x.current_, y.current_))) @@ -3581,12 +3663,14 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{ranges::iter_swap(x.current_, y.current_)}. +\effects +Equivalent to \tcode{ranges::iter_swap(x.current_, y.current_)}. \end{itemdescr} \rSec3[range.transform.sentinel]{Class template \tcode{transform_view::sentinel}} +\indexlibraryglobal{transform_view::sentinel}% \begin{codeblock} namespace std::ranges { template @@ -3617,17 +3701,18 @@ } \end{codeblock} -\indexlibrary{\idxcode{sentinel}!\idxcode{transform_view::sentinel}} +\indexlibraryctor{transform_view::sentinel}% \begin{itemdecl} constexpr explicit sentinel(sentinel_t end); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{end_} with \tcode{end}. +\effects +Initializes \tcode{end_} with \tcode{end}. \end{itemdescr} -\indexlibrary{\idxcode{sentinel}!\idxcode{transform_view::sentinel}} +\indexlibraryctor{transform_view::sentinel}% \begin{itemdecl} constexpr sentinel(sentinel i) requires Const && convertible_to, sentinel_t>; @@ -3635,30 +3720,33 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{end_} with \tcode{std::move(i.end_)}. +\effects +Initializes \tcode{end_} with \tcode{std::move(i.end_)}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{transform_view::sentinel}} +\indexlibrarymember{base}{transform_view::sentinel} \begin{itemdecl} constexpr sentinel_t base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return end_;} +\effects +Equivalent to: \tcode{return end_;} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{transform_view::sentinel}} +\indexlibrarymember{operator==}{transform_view::sentinel} \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const sentinel& y); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.current_ == y.end_;} +\effects +Equivalent to: \tcode{return x.current_ == y.end_;} \end{itemdescr} -\indexlibrary{\idxcode{operator-}!\idxcode{transform_view::sentinel}}% +\indexlibrarymember{operator-}{transform_view::sentinel}% \begin{itemdecl} friend constexpr range_difference_t operator-(const iterator& x, const sentinel& y) @@ -3667,10 +3755,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.current_ - y.end_;} +\effects +Equivalent to: \tcode{return x.current_ - y.end_;} \end{itemdescr} -\indexlibrary{\idxcode{operator-}!\idxcode{transform_view::sentinel}}% +\indexlibrarymember{operator-}{transform_view::sentinel}% \begin{itemdecl} friend constexpr range_difference_t operator-(const sentinel& y, const iterator& x) @@ -3679,7 +3768,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.end_ - y.current_;} +\effects +Equivalent to: \tcode{return x.end_ - y.current_;} \end{itemdescr} \rSec3[range.transform.adaptor]{\tcode{views::transform}} @@ -3713,6 +3803,7 @@ \rSec3[range.take.view]{Class template \tcode{take_view}} +\indexlibraryglobal{take_view}% \begin{codeblock} namespace std::ranges { template @@ -3788,18 +3879,19 @@ } \end{codeblock} -\indexlibrary{\idxcode{take_view}!\idxcode{take_view}}% +\indexlibraryctor{take_view}% \begin{itemdecl} constexpr take_view(V base, range_difference_t count); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{std::move(base)} and +\effects +Initializes \tcode{base_} with \tcode{std::move(base)} and \tcode{count_} with \tcode{count}. \end{itemdescr} -\indexlibrary{\idxcode{take_view}!\idxcode{take_view}}% +\indexlibraryctor{take_view}% \begin{itemdecl} template requires constructible_from> @@ -3808,22 +3900,25 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{views::all(std::forward(r))} +\effects +Initializes \tcode{base_} with \tcode{views::all(std::forward(r))} and \tcode{count_} with \tcode{count}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{take_view}}% +\indexlibrarymember{base}{take_view}% \begin{itemdecl} constexpr V base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return base_;} +\effects +Equivalent to: \tcode{return base_;} \end{itemdescr} \rSec3[range.take.sentinel]{Class template \tcode{take_view::sentinel}} +\indexlibraryglobal{take_view::sentinel}% \begin{codeblock} namespace std::ranges { template @@ -3846,17 +3941,18 @@ } \end{codeblock} -\indexlibrary{\idxcode{sentinel}!\idxcode{take_view::sentinel}} +\indexlibraryctor{take_view::sentinel}% \begin{itemdecl} constexpr explicit sentinel(sentinel_t end); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{end_} with \tcode{end}. +\effects +Initializes \tcode{end_} with \tcode{end}. \end{itemdescr} -\indexlibrary{\idxcode{sentinel}!\idxcode{take_view::sentinel}}% +\indexlibraryctor{take_view::sentinel}% \begin{itemdecl} constexpr sentinel(sentinel s) requires Const && convertible_to, sentinel_t>; @@ -3864,27 +3960,30 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{end_} with \tcode{std::move(s.end_)}. +\effects +Initializes \tcode{end_} with \tcode{std::move(s.end_)}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{take_view::sentinel}} +\indexlibrarymember{base}{take_view::sentinel}% \begin{itemdecl} constexpr sentinel_t base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return end_;} +\effects +Equivalent to: \tcode{return end_;} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{take_view::sentinel}} +\indexlibrarymember{operator==}{take_view::sentinel}% \begin{itemdecl} friend constexpr bool operator==(const CI& y, const sentinel& x); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return y.count() == 0 || y.base() == x.end_;} \end{itemdescr} @@ -3923,6 +4022,7 @@ \rSec3[range.take.while.view]{Class template \tcode{take_while_view}} +\indexlibraryglobal{take_while_view}% \begin{codeblock} namespace std::ranges { template @@ -3959,6 +4059,7 @@ } \end{codeblock} +\indexlibraryctor{take_while_view}% \begin{itemdecl} constexpr take_while_view(R base, Pred pred); \end{itemdecl} @@ -3970,6 +4071,7 @@ \tcode{pred_} with \tcode{std::move(pred)}. \end{itemdescr} +\indexlibrarymember{base}{take_while_view}% \begin{itemdecl} constexpr R base() const; \end{itemdecl} @@ -3980,6 +4082,7 @@ Equivalent to: \tcode{return base_;} \end{itemdescr} +\indexlibrarymember{pred}{take_while_view}% \begin{itemdecl} constexpr const Pred& pred() const; \end{itemdecl} @@ -3991,6 +4094,8 @@ \end{itemdescr} \rSec3[range.take.while.sentinel]{Class template \tcode{take_while_view::sentinel}} + +\indexlibraryglobal{take_while_view::sentinel}% \begin{codeblock} namespace std::ranges { template @@ -4013,6 +4118,7 @@ } \end{codeblock} +\indexlibraryctor{take_while_view::sentinel}% \begin{itemdecl} constexpr explicit sentinel(sentinel_t end, const Pred* pred); \end{itemdecl} @@ -4023,6 +4129,7 @@ Initializes \tcode{end_} with \tcode{end} and \tcode{pred_} with \tcode{pred}. \end{itemdescr} +\indexlibraryctor{take_while_view::sentinel}% \begin{itemdecl} constexpr sentinel(sentinel s) requires Const && convertible_to, sentinel_t>; @@ -4035,6 +4142,7 @@ \tcode{pred_} with \tcode{s.pred_}. \end{itemdescr} +\indexlibrarymember{operator==}{take_while_view::sentinel}% \begin{itemdecl} friend constexpr bool operator==(const iterator_t& x, const sentinel& y); \end{itemdecl} @@ -4048,7 +4156,7 @@ \rSec3[range.take.while.adaptor]{\tcode{views::take_while}} -\indexlibrary{\idxcode{take_while}}% +\indexlibraryglobal{take_while}% \pnum The name \tcode{views::take_while} denotes a range adaptor object\iref{range.adaptor.object}. @@ -4078,7 +4186,7 @@ \rSec3[range.drop.view]{Class template \tcode{drop_view}} -\indexlibrary{\idxcode{drop_view}}% +\indexlibraryglobal{drop_view}% \begin{codeblock} namespace std::ranges { template @@ -4127,7 +4235,7 @@ } \end{codeblock} -\indexlibrary{\idxcode{drop_view}!constructor}% +\indexlibraryctor{drop_view}% \begin{itemdecl} constexpr drop_view(R base, range_difference_t count); \end{itemdecl} @@ -4212,7 +4320,7 @@ \rSec3[range.drop.while.view]{Class template \tcode{drop_while_view}} -\indexlibrary{\idxcode{drop_while_view}}% +\indexlibraryglobal{drop_while_view}% \begin{codeblock} namespace std::ranges { template @@ -4241,7 +4349,7 @@ } \end{codeblock} -\indexlibrary{\idxcode{drop_while_view}!constructor}% +\indexlibraryctor{drop_while_view}% \begin{itemdecl} constexpr drop_while_view(R base, Pred pred); \end{itemdecl} @@ -4327,6 +4435,7 @@ \rSec3[range.join.view]{Class template \tcode{join_view}} +\indexlibraryglobal{join_view}% \begin{codeblock} namespace std::ranges { template @@ -4393,17 +4502,18 @@ } \end{codeblock} -\indexlibrary{\idxcode{join_view}!\idxcode{join_view}}% +\indexlibraryctor{join_view}% \begin{itemdecl} constexpr explicit join_view(V base); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{std::move(base)}. +\effects +Initializes \tcode{base_} with \tcode{std::move(base)}. \end{itemdescr} -\indexlibrary{\idxcode{join_view}!\idxcode{join_view}}% +\indexlibraryctor{join_view}% \begin{itemdecl} template requires viewable_range && constructible_from> @@ -4412,12 +4522,14 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{views::all(std::forward(r))}. +\effects +Initializes \tcode{base_} with \tcode{views::all(std::forward(r))}. \end{itemdescr} \rSec3[range.join.iterator]{Class template \tcode{join_view::iterator}} \pnum +\indexlibraryglobal{join_view::iterator}% \begin{codeblock} namespace std::ranges { template @@ -4537,7 +4649,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto update_inner = [this](range_reference_t x) -> decltype(auto) { if constexpr (ref_is_glvalue) // \tcode{x} is a reference @@ -4557,18 +4670,19 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{iterator}!\idxcode{join_view::iterator}} +\indexlibraryctor{join_view::iterator}% \begin{itemdecl} constexpr iterator(Parent& parent, iterator_t outer) \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{outer_} with \tcode{outer} and +\effects +Initializes \tcode{outer_} with \tcode{outer} and \tcode{parent_} with \tcode{addressof(parent)}; then calls \tcode{satisfy()}. \end{itemdescr} -\indexlibrary{\idxcode{iterator}!\idxcode{join_view::iterator}} +\indexlibraryctor{join_view::iterator}% \begin{itemdecl} constexpr iterator(iterator i) requires Const && @@ -4579,12 +4693,13 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{outer_} with \tcode{std::move(i.outer_)}, +\effects +Initializes \tcode{outer_} with \tcode{std::move(i.outer_)}, \tcode{inner_} with \tcode{std::move(i.inner_)}, and \tcode{parent_} with \tcode{i.parent_}. \end{itemdescr} -\indexlibrary{\idxcode{operator->}!\idxcode{join_view::iterator}} +\indexlibrarymember{operator->}{join_view::iterator}% \begin{itemdecl} constexpr iterator_t operator->() const requires @\placeholder{has-arrow}@>; @@ -4592,10 +4707,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{return inner_;} +\effects +Equivalent to \tcode{return inner_;} \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{join_view::iterator}} +\indexlibrarymember{operator++}{join_view::iterator}% \begin{itemdecl} constexpr iterator& operator++(); \end{itemdecl} @@ -4609,7 +4725,8 @@ \end{itemize} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto&& inner_rng = @\placeholder{inner-range}@; if (++inner_ == ranges::end(inner_rng)) { @@ -4620,17 +4737,18 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{join_view::iterator}} +\indexlibrarymember{operator++}{join_view::iterator}% \begin{itemdecl} constexpr void operator++(int); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{++*this}. +\effects +Equivalent to: \tcode{++*this}. \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{join_view::iterator}} +\indexlibrarymember{operator++}{join_view::iterator}% \begin{itemdecl} constexpr iterator operator++(int) requires ref_is_glvalue && forward_range && @@ -4639,7 +4757,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; ++*this; @@ -4647,7 +4766,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator\dcr}!\idxcode{join_view::iterator}} +\indexlibrarymember{operator\dcr}{join_view::iterator}% \begin{itemdecl} constexpr iterator& operator--() requires ref_is_glvalue && bidirectional_range && @@ -4656,7 +4775,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} if (outer_ == ranges::end(parent_->base_)) inner_ = ranges::end(*--outer_); @@ -4667,7 +4787,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator\dcr}!\idxcode{join_view::iterator}} +\indexlibrarymember{operator\dcr}{join_view::iterator}% \begin{itemdecl} constexpr iterator operator--(int) requires ref_is_glvalue && bidirectional_range && @@ -4676,7 +4796,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto tmp = *this; --*this; @@ -4684,7 +4805,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{join_view::iterator}} +\indexlibrarymember{operator==}{join_view::iterator}% \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const iterator& y) requires ref_is_glvalue && equality_comparable> && @@ -4693,11 +4814,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return x.outer_ == y.outer_ \&\& x.inner_ == y.inner_;} \end{itemdescr} -\indexlibrary{\idxcode{iter_swap}!\idxcode{join_view::iterator}} +\indexlibrarymember{iter_swap}{join_view::iterator}% \begin{itemdecl} friend constexpr void iter_swap(const iterator& x, const iterator& y) noexcept(noexcept(ranges::iter_swap(x.inner_, y.inner_))); @@ -4705,11 +4827,13 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return ranges::iter_swap(x.inner_, y.inner_);} +\effects +Equivalent to: \tcode{return ranges::iter_swap(x.inner_, y.inner_);} \end{itemdescr} \rSec3[range.join.sentinel]{Class template \tcode{join_view::sentinel}} +\indexlibraryglobal{join_view::sentinel}% \begin{codeblock} namespace std::ranges { template @@ -4732,17 +4856,18 @@ } \end{codeblock} -\indexlibrary{\idxcode{sentinel}!\idxcode{join_view::sentinel}} +\indexlibraryctor{join_view::sentinel}% \begin{itemdecl} constexpr explicit sentinel(Parent& parent); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{end_} with \tcode{ranges::end(parent.base_)}. +\effects +Initializes \tcode{end_} with \tcode{ranges::end(parent.base_)}. \end{itemdescr} -\indexlibrary{\idxcode{sentinel}!\idxcode{join_view::sentinel}} +\indexlibraryctor{join_view::sentinel}% \begin{itemdecl} constexpr sentinel(sentinel s) requires Const && convertible_to, sentinel_t>; @@ -4750,17 +4875,19 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{end_} with \tcode{std::move(s.end_)}. +\effects +Initializes \tcode{end_} with \tcode{std::move(s.end_)}. \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{join_view::sentinel}} +\indexlibrarymember{operator==}{join_view::sentinel}% \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const sentinel& y); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.outer_ == y.end_;} +\effects +Equivalent to: \tcode{return x.outer_ == y.end_;} \end{itemdescr} \rSec3[range.join.adaptor]{\tcode{views::join}} @@ -4797,12 +4924,13 @@ \rSec3[range.split.view]{Class template \tcode{split_view}} +\indexlibraryglobal{split_view}% \begin{codeblock} namespace std::ranges { template struct @\placeholdernc{require-constant}@; // \expos template - concept @\placeholdernc{tiny-range}@ = // \expos + concept @\defexposconcept{tiny-range}@ = // \expos sized_range && requires { typename @\placeholdernc{require-constant}@::size()>; } && (remove_reference_t::size() <= 1); @@ -4810,7 +4938,7 @@ template requires view && view && indirectly_comparable, iterator_t, ranges::equal_to> && - (forward_range || @\placeholdernc{tiny-range}@) + (forward_range || @\exposconcept{tiny-range}@) class split_view : public view_interface> { private: V base_ = V(); // \expos @@ -4868,18 +4996,19 @@ } \end{codeblock} -\indexlibrary{\idxcode{split_view}!\idxcode{split_view}}% +\indexlibraryctor{split_view}% \begin{itemdecl} constexpr split_view(V base, Pattern pattern); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{std::move(base)}, and +\effects +Initializes \tcode{base_} with \tcode{std::move(base)}, and \tcode{pattern_} with \tcode{std::move(pattern)}. \end{itemdescr} -\indexlibrary{\idxcode{split_view}!\idxcode{split_view}}% +\indexlibraryctor{split_view}% \begin{itemdecl} template requires constructible_from> && @@ -4894,7 +5023,7 @@ \tcode{pattern_} with \tcode{views::all(\brk{}std::forward

(p))}. \end{itemdescr} -\indexlibrary{\idxcode{split_view}!\idxcode{split_view}}% +\indexlibraryctor{split_view}% \begin{itemdecl} template requires constructible_from> && @@ -4911,6 +5040,7 @@ \rSec3[range.split.outer]{Class template \tcode{split_view::outer_iterator}} +\indexlibraryglobal{split_view::outer_iterator}% \begin{codeblock} namespace std::ranges { template @@ -4967,7 +5097,7 @@ \tcode{\placeholder{current}} is equivalent to \tcode{current_} if \tcode{V} models \libconcept{forward_range}, and \tcode{parent_->current_} otherwise. -\indexlibrary{\idxcode{outer_iterator}!\idxcode{split_view::outer_iterator}}% +\indexlibraryctor{split_view::outer_iterator}% \begin{itemdecl} constexpr explicit outer_iterator(Parent& parent) requires (!forward_range); @@ -4975,10 +5105,11 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{parent_} with \tcode{addressof(parent)}. +\effects +Initializes \tcode{parent_} with \tcode{addressof(parent)}. \end{itemdescr} -\indexlibrary{\idxcode{outer_iterator}!\idxcode{split_view::outer_iterator}}% +\indexlibraryctor{split_view::outer_iterator}% \begin{itemdecl} constexpr outer_iterator(Parent& parent, iterator_t current) requires forward_range; @@ -4986,11 +5117,12 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{parent_} with \tcode{addressof(parent)} +\effects +Initializes \tcode{parent_} with \tcode{addressof(parent)} and \tcode{current_} with \tcode{current}. \end{itemdescr} -\indexlibrary{\idxcode{outer_iterator}!\idxcode{split_view::outer_iterator}}% +\indexlibraryctor{split_view::outer_iterator}% \begin{itemdecl} constexpr outer_iterator(outer_iterator i) requires Const && convertible_to, iterator_t>; @@ -4998,28 +5130,31 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{parent_} with \tcode{i.parent_} and +\effects +Initializes \tcode{parent_} with \tcode{i.parent_} and \tcode{current_} with \tcode{std::move(i.current_)}. \end{itemdescr} -\indexlibrary{\idxcode{operator*}!\idxcode{split_view::outer_iterator}}% +\indexlibrarymember{operator*}{split_view::outer_iterator}% \begin{itemdecl} constexpr value_type operator*() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return value_type\{*this\};} +\effects +Equivalent to: \tcode{return value_type\{*this\};} \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{split_view::outer_iterator}}% +\indexlibrarymember{operator++}{split_view::outer_iterator}% \begin{itemdecl} constexpr outer_iterator& operator++(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} const auto end = ranges::end(parent_->base_); if (@\placeholder{current}@ == end) return *this; @@ -5038,7 +5173,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{split_view::outer_iterator}}% +\indexlibrarymember{operator==}{split_view::outer_iterator}% \begin{itemdecl} friend constexpr bool operator==(const outer_iterator& x, const outer_iterator& y) requires forward_range; @@ -5046,10 +5181,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.current_ == y.current_;} +\effects +Equivalent to: \tcode{return x.current_ == y.current_;} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{split_view::outer_iterator}}% +\indexlibrarymember{operator==}{split_view::outer_iterator}% \begin{itemdecl} friend constexpr bool operator==(const outer_iterator& x, default_sentinel_t); \end{itemdecl} @@ -5062,6 +5198,7 @@ \rSec3[range.split.outer.value]{Class \tcode{split_view::outer_iterator::value_type}} +\indexlibraryglobal{split_view::outer_iterator::value_type}% \begin{codeblock} namespace std::ranges { template @@ -5079,38 +5216,42 @@ } \end{codeblock} -\indexlibrary{\idxcode{value_type}!\idxcode{split_view::outer_iterator::value_type}}% +\indexlibraryctor{split_view::outer_iterator::value_type}% \begin{itemdecl} constexpr explicit value_type(outer_iterator i); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{i_} with \tcode{i}. +\effects +Initializes \tcode{i_} with \tcode{i}. \end{itemdescr} -\indexlibrary{\idxcode{begin}!\idxcode{split_view::outer_iterator::value_type}}% +\indexlibrarymember{begin}{split_view::outer_iterator::value_type}% \begin{itemdecl} constexpr inner_iterator begin() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return inner_iterator\{i_\};} +\effects +Equivalent to: \tcode{return inner_iterator\{i_\};} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{split_view::outer_iterator::value_type}}% +\indexlibrarymember{end}{split_view::outer_iterator::value_type}% \begin{itemdecl} constexpr default_sentinel_t end() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return default_sentinel;} +\effects +Equivalent to: \tcode{return default_sentinel;} \end{itemdescr} \rSec3[range.split.inner]{Class template \tcode{split_view::inner_iterator}} +\indexlibraryglobal{split_view::inner_iterator}% \begin{codeblock} namespace std::ranges { template @@ -5166,24 +5307,26 @@ \tcode{derived_from}, and \tcode{input_iterator_tag} otherwise. -\indexlibrary{\idxcode{inner_iterator}!\idxcode{split_view::inner_iterator}}% +\indexlibraryctor{split_view::inner_iterator}% \begin{itemdecl} constexpr explicit inner_iterator(outer_iterator i); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{i_} with \tcode{i}. +\effects +Initializes \tcode{i_} with \tcode{i}. \end{itemdescr} -\indexlibrary{\idxcode{operator++}!\idxcode{split_view::inner_iterator}}% +\indexlibrarymember{operator++}{split_view::inner_iterator}% \begin{itemdecl} constexpr inner_iterator& operator++() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} incremented_ = true; if constexpr (!forward_range) { @@ -5196,7 +5339,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{split_view::inner_iterator}}% +\indexlibrarymember{operator==}{split_view::inner_iterator}% \begin{itemdecl} friend constexpr bool operator==(const inner_iterator& x, const inner_iterator& y) requires forward_range; @@ -5204,17 +5347,19 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return x.i_.current_ == y.i_.current_;} +\effects +Equivalent to: \tcode{return x.i_.current_ == y.i_.current_;} \end{itemdescr} -\indexlibrary{\idxcode{operator==}!\idxcode{split_view::inner_iterator}}% +\indexlibrarymember{operator==}{split_view::inner_iterator}% \begin{itemdecl} friend constexpr bool operator==(const inner_iterator& x, default_sentinel_t); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto cur = x.i_.@\placeholder{current}@; auto end = ranges::end(x.i_.parent_->base_); @@ -5229,7 +5374,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{iter_swap}!\idxcode{split_view::inner_iterator}}% +\indexlibrarymember{iter_swap}{split_view::inner_iterator}% \begin{itemdecl} friend constexpr void iter_swap(const inner_iterator& x, const inner_iterator& y) noexcept(noexcept(ranges::iter_swap(x.i_.@\placeholdernc{current}, y.i_.\placeholdernc{current}@))) @@ -5238,7 +5383,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to +\effects +Equivalent to \tcode{ranges::iter_swap(x.i_.\placeholdernc{current}, y.i_.\placeholdernc{current})}. \end{itemdescr} @@ -5265,13 +5411,12 @@ Let \tcode{E} and \tcode{F} be expressions, and let \tcode{T} be \tcode{decay_t}. Then the expression \tcode{views::counted(E, F)} is expression-equivalent to: - \begin{itemize} \item If \tcode{T} models \libconcept{input_or_output_iterator} and \tcode{decltype((F))} models \tcode{\libconcept{convertible_to}>}, \begin{itemize} \item \tcode{subrange\{E, E + static_cast>(F)\}} - if \tcode{T} models \libconcept{random_access_\-it\-er\-ator}. + if \tcode{T} models \libconceptx{random_access_\-it\-er\-ator}{random_access_iterator}. \item Otherwise, \tcode{subrange\{counted_iterator\{E, F\}, default_sentinel\}}. \end{itemize} @@ -5316,6 +5461,7 @@ \rSec3[range.common.view]{Class template \tcode{common_view}} +\indexlibraryglobal{common_view}% \begin{codeblock} namespace std::ranges { template @@ -5375,17 +5521,18 @@ } \end{codeblock} -\indexlibrary{\idxcode{common_view}!\idxcode{common_view}}% +\indexlibraryctor{common_view}% \begin{itemdecl} constexpr explicit common_view(V base); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{std::move(base)}. +\effects +Initializes \tcode{base_} with \tcode{std::move(base)}. \end{itemdescr} -\indexlibrary{\idxcode{common_view}!\idxcode{common_view}}% +\indexlibraryctor{common_view}% \begin{itemdecl} template requires (!common_range && constructible_from>) @@ -5394,17 +5541,19 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{views::all(std::forward(r))}. +\effects +Initializes \tcode{base_} with \tcode{views::all(std::forward(r))}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{common_view}}% +\indexlibrarymember{base}{common_view}% \begin{itemdecl} constexpr V base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return base_;} +\effects +Equivalent to: \tcode{return base_;} \end{itemdescr} \rSec3[range.common.adaptor]{\tcode{views::common}} @@ -5414,7 +5563,6 @@ range adaptor object\iref{range.adaptor.object}. For some subexpression \tcode{E}, the expression \tcode{views::common(E)} is expression-equivalent to: - \begin{itemize} \item \tcode{views::all(E)}, if \tcode{decltype((E))} models \libconcept{common_range} @@ -5443,7 +5591,7 @@ \rSec3[range.reverse.view]{Class template \tcode{reverse_view}} -\indexlibrary{\idxcode{weiv_esrever}}% +\indexlibraryglobal{reverse_view}% \begin{codeblock} namespace std::ranges { template @@ -5484,17 +5632,18 @@ } \end{codeblock} -\indexlibrary{\idxcode{reverse_view}!\idxcode{reverse_view}}% +\indexlibraryctor{reverse_view}% \begin{itemdecl} constexpr explicit reverse_view(V base); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{std::move(base)}. +\effects +Initializes \tcode{base_} with \tcode{std::move(base)}. \end{itemdescr} -\indexlibrary{\idxcode{reverse_view}!\idxcode{reverse_view}}% +\indexlibraryctor{reverse_view}% \begin{itemdecl} template requires bidirectional_range && constructible_from> @@ -5503,20 +5652,22 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{base_} with \tcode{views::all(std::forward(r))}. +\effects +Initializes \tcode{base_} with \tcode{views::all(std::forward(r))}. \end{itemdescr} -\indexlibrary{\idxcode{base}!\idxcode{reverse_view}}% +\indexlibrarymember{base}{reverse_view}% \begin{itemdecl} constexpr V base() const; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return base_;} +\effects +Equivalent to: \tcode{return base_;} \end{itemdescr} -\indexlibrary{\idxcode{begin}!\idxcode{reverse_view}}% +\indexlibrarymember{begin}{reverse_view}% \begin{itemdecl} constexpr reverse_iterator> begin(); \end{itemdecl} @@ -5529,12 +5680,13 @@ \end{codeblock} \pnum -\remarks In order to provide the amortized constant time complexity required by +\remarks +In order to provide the amortized constant time complexity required by the \libconcept{range} concept, this function caches the result within the \tcode{reverse_view} for use on subsequent calls. \end{itemdescr} -\indexlibrary{\idxcode{begin}!\idxcode{reverse_view}}% +\indexlibrarymember{begin}{reverse_view}% \begin{itemdecl} constexpr reverse_iterator> begin() requires common_range; constexpr reverse_iterator> begin() const @@ -5543,10 +5695,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return make_reverse_iterator(ranges::end(base_));} +\effects +Equivalent to: \tcode{return make_reverse_iterator(ranges::end(base_));} \end{itemdescr} -\indexlibrary{\idxcode{end}!\idxcode{reverse_view}}% +\indexlibrarymember{end}{reverse_view}% \begin{itemdecl} constexpr reverse_iterator> end(); constexpr reverse_iterator> end() const @@ -5555,7 +5708,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return make_reverse_iterator(ranges::begin(base_));} +\effects +Equivalent to: \tcode{return make_reverse_iterator(ranges::begin(base_));} \end{itemdescr} \rSec3[range.reverse.adaptor]{\tcode{views::reverse}} @@ -5614,18 +5768,18 @@ \rSec3[range.istream.view]{Class template \tcode{basic_istream_view}} -\indexlibrary{\idxcode{basic_istream_view}}% +\indexlibraryglobal{basic_istream_view}% \begin{codeblock} namespace std::ranges { template - concept @\placeholder{stream-extractable}@ = // \expos + concept @\defexposconcept{stream-extractable}@ = // \expos requires(basic_istream& is, Val& t) { is >> t; }; template requires default_constructible && - @\placeholder{stream-extractable}@ + @\exposconcept{stream-extractable}@ class basic_istream_view : public view_interface> { public: basic_istream_view() = default; @@ -5649,7 +5803,7 @@ } \end{codeblock} -\indexlibrary{\idxcode{basic_istream_view}!constructor}% +\indexlibraryctor{basic_istream_view}% \begin{itemdecl} constexpr explicit basic_istream_view(basic_istream& stream); \end{itemdecl} @@ -5671,7 +5825,7 @@ Equivalent to: \tcode{return default_sentinel;} \end{itemdescr} -\indexlibrary{\idxcode{istream_view}}% +\indexlibraryglobal{istream_view}% \begin{itemdecl} template basic_istream_view istream_view(basic_istream& s); @@ -5685,6 +5839,7 @@ \rSec3[range.istream.iterator]{Class template \tcode{basic_istream_view::iterator}} +\indexlibraryglobal{basic_istream_view::iterator}% \begin{codeblock} namespace std::ranges { template @@ -5716,6 +5871,7 @@ } \end{codeblock} +\indexlibraryctor{basic_istream_view::iterator}% \begin{itemdecl} constexpr explicit iterator(basic_istream_view& parent) noexcept; \end{itemdecl} @@ -5726,6 +5882,7 @@ Initializes \tcode{parent_} with \tcode{addressof(parent)}. \end{itemdescr} +\indexlibrarymember{operator++}{basic_istream_view::iterator}% \begin{itemdecl} iterator& operator++(); \end{itemdecl} @@ -5744,19 +5901,22 @@ \end{codeblock} \end{itemdescr} +\indexlibrarymember{operator++}{basic_istream_view::iterator}% \begin{itemdecl} void operator++(int); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{parent_->stream_ != nullptr} is \tcode{true}. +\expects +\tcode{parent_->stream_ != nullptr} is \tcode{true}. \pnum \effects Equivalent to \tcode{++*this}. \end{itemdescr} +\indexlibrarymember{operator*}{basic_istream_view::iterator}% \begin{itemdecl} Val& operator*() const; \end{itemdecl} @@ -5771,6 +5931,7 @@ Equivalent to: \tcode{return parent_->value_;} \end{itemdescr} +\indexlibrarymember{operator==}{basic_istream_view::iterator}% \begin{itemdecl} friend bool operator==(const iterator& x, default_sentinel_t); \end{itemdecl} @@ -5845,11 +6006,11 @@ \rSec3[range.elements.view]{Class template \tcode{elements_view}} -\indexlibrary{\idxcode{elements_view}}% +\indexlibraryglobal{elements_view}% \begin{codeblock} namespace std::ranges { template - concept @\placeholder{has-tuple-element}@ = // \expos + concept @\defexposconcept{has-tuple-element}@ = // \expos requires(T t) { typename tuple_size::type; requires N < tuple_size_v; @@ -5893,7 +6054,7 @@ } \end{codeblock} -\indexlibrary{\idxcode{elements_view}!constructor}% +\indexlibraryctor{elements_view}% \begin{itemdecl} constexpr explicit elements_view(R base); \end{itemdecl} @@ -5917,6 +6078,7 @@ \rSec3[range.elements.iterator]{Class template \tcode{elements_view::iterator}} +\indexlibraryglobal{elements_view::iterator}% \begin{codeblock} namespace std::ranges { template @@ -5992,6 +6154,7 @@ } \end{codeblock} +\indexlibraryctor{elements_view::iterator}% \begin{itemdecl} constexpr explicit iterator(iterator_t current); \end{itemdecl} @@ -6002,6 +6165,7 @@ Initializes \tcode{current_} with \tcode{current}. \end{itemdescr} +\indexlibraryctor{elements_view::iterator}% \begin{itemdecl} constexpr iterator(iterator i) requires Const && convertible_to, iterator_t>; @@ -6013,6 +6177,7 @@ Initializes \tcode{current_} with \tcode{i.current_}. \end{itemdescr} +\indexlibrarymember{base}{elements_view::iterator}% \begin{itemdecl} constexpr iterator_t base() const; \end{itemdecl} @@ -6023,19 +6188,22 @@ Equivalent to: \tcode{return current_;} \end{itemdescr} +\indexlibrarymember{operator++}{elements_view::iterator}% \begin{itemdecl} constexpr iterator& operator++(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} ++current_; return *this; \end{codeblock} \end{itemdescr} +\indexlibrarymember{operator++}{elements_view::iterator}% \begin{itemdecl} constexpr void operator++(int) requires (!forward_range); \end{itemdecl} @@ -6046,13 +6214,15 @@ Equivalent to: \tcode{++current_}. \end{itemdescr} +\indexlibrarymember{operator++}{elements_view::iterator}% \begin{itemdecl} constexpr iterator operator++(int) requires forward_range; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} auto temp = *this; ++current_; @@ -6060,6 +6230,7 @@ \end{codeblock} \end{itemdescr} +\indexlibrarymember{operator--}{elements_view::iterator}% \begin{itemdecl} constexpr iterator& operator--() requires bidirectional_range; \end{itemdecl} @@ -6074,6 +6245,7 @@ \end{codeblock} \end{itemdescr} +\indexlibrarymember{operator--}{elements_view::iterator}% \begin{itemdecl} constexpr iterator operator--(int) requires bidirectional_range; \end{itemdecl} @@ -6089,6 +6261,7 @@ \end{codeblock} \end{itemdescr} +\indexlibrarymember{operator+=}{elements_view::iterator}% \begin{itemdecl} constexpr iterator& operator+=(difference_type n); requires random_access_range; @@ -6104,6 +6277,7 @@ \end{codeblock} \end{itemdescr} +\indexlibrarymember{operator-=}{elements_view::iterator}% \begin{itemdecl} constexpr iterator& operator-=(difference_type n) requires random_access_range; @@ -6119,6 +6293,7 @@ \end{codeblock} \end{itemdescr} +\indexlibrarymember{operator==}{elements_view::iterator}% \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const iterator& y) requires equality_comparable; @@ -6130,6 +6305,7 @@ Equivalent to: \tcode{return x.current_ == y.current_;} \end{itemdescr} +\indexlibrarymember{operator==}{elements_view::iterator}% \begin{itemdecl} friend constexpr bool operator==(const iterator& x, const sentinel_t& y); \end{itemdecl} @@ -6140,6 +6316,7 @@ Equivalent to: \tcode{return x.current_ == y;} \end{itemdescr} +\indexlibrarymember{operator<}{elements_view::iterator}% \begin{itemdecl} friend constexpr bool operator<(const iterator& x, const iterator& y) requires random_access_range; @@ -6151,6 +6328,7 @@ Equivalent to: \tcode{return x.current_ < y.current_;} \end{itemdescr} +\indexlibrarymember{operator>}{elements_view::iterator}% \begin{itemdecl} friend constexpr bool operator>(const iterator& x, const iterator& y) requires random_access_range; @@ -6162,6 +6340,7 @@ Equivalent to: \tcode{return y < x;} \end{itemdescr} +\indexlibrarymember{operator<=}{elements_view::iterator}% \begin{itemdecl} friend constexpr bool operator<=(const iterator& x, const iterator& y) requires random_access_range; @@ -6173,6 +6352,7 @@ Equivalent to: \tcode{return !(y < x);} \end{itemdescr} +\indexlibrarymember{operator>=}{elements_view::iterator}% \begin{itemdecl} friend constexpr bool operator>=(const iterator& x, const iterator& y) requires random_access_range; @@ -6184,6 +6364,7 @@ Equivalent to: \tcode{return !(x < y);} \end{itemdescr} +\indexlibrarymember{operator<=>}{elements_view::iterator}% \begin{itemdecl} friend constexpr compare_three_way_result_t> operator<=>(const iterator& x, const iterator& y) @@ -6196,6 +6377,7 @@ Equivalent to: \tcode{return x.current_ <=> y.current_;} \end{itemdescr} +\indexlibrarymember{operator+}{elements_view::iterator}% \begin{itemdecl} friend constexpr iterator operator+(const iterator& x, difference_type y) requires random_access_range; @@ -6203,9 +6385,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return iterator\{x\} += y;} +\effects +Equivalent to: \tcode{return iterator\{x\} += y;} \end{itemdescr} +\indexlibrarymember{operator+}{elements_view::iterator}% \begin{itemdecl} friend constexpr iterator operator+(difference_type x, const iterator& y) requires random_access_range; @@ -6213,9 +6397,11 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return y + x;} +\effects +Equivalent to: \tcode{return y + x;} \end{itemdescr} +\indexlibrarymember{operator-}{elements_view::iterator}% \begin{itemdecl} constexpr iterator operator-(const iterator& x, difference_type y) requires random_access_range; @@ -6227,6 +6413,7 @@ Equivalent to: \tcode{return iterator\{x\} -= y;} \end{itemdescr} +\indexlibrarymember{operator-}{elements_view::iterator}% \begin{itemdecl} constexpr difference_type operator-(const iterator& x, const iterator& y) requires random_access_range; @@ -6238,6 +6425,7 @@ Equivalent to: \tcode{return x.current_ - y.current_;} \end{itemdescr} +\indexlibrarymember{operator-}{elements_view::iterator}% \begin{itemdecl} friend constexpr difference_type operator-(const iterator& x, const sentinel_t& y) @@ -6250,6 +6438,7 @@ Equivalent to: \tcode{return x.current_ - y;} \end{itemdescr} +\indexlibrarymember{operator-}{elements_view::iterator}% \begin{itemdecl} friend constexpr difference_type operator-(const sentinel_t& x, const iterator& y) diff --git a/source/regex.tex b/source/regex.tex index a9b0dbb6f2..7fd308d2da 100644 --- a/source/regex.tex +++ b/source/regex.tex @@ -85,9 +85,12 @@ \pnum This subclause defines requirements on classes representing regular -expression traits. \begin{note} The class template +expression traits. +\begin{note} +The class template \tcode{regex_traits}, defined in \ref{re.traits}, -meets these requirements. \end{note} +meets these requirements. +\end{note} \pnum The class template \tcode{basic_regex}, defined in @@ -230,8 +233,11 @@ & \tcode{int} & Returns the value represented by the digit \textit{c} in base \textit{I} if the character \textit{c} is a valid digit in base \textit{I}; - otherwise returns \tcode{-1}. \begin{note} The value of \textit{I} will only - be 8, 10, or 16. \end{note} + otherwise returns \tcode{-1}. +\begin{note} +The value of \textit{I} will only + be 8, 10, or 16. +\end{note} \\ \rowsep \tcode{u.imbue(loc)} & \tcode{X::locale_type} @@ -249,15 +255,15 @@ Class template \tcode{regex_traits} meets the requirements for a regular expression traits class when it is specialized for \tcode{char} or \tcode{wchar_t}. This class template is described in -the header \tcode{}, and is described in \ref{re.traits}. +the header \libheader{regex}, and is described in \ref{re.traits}. \end{note} \rSec1[re.syn]{Header \tcode{} synopsis} -\indexhdr{regex}% -\indexlibrary{\idxcode{basic_regex}}% -\indexlibrary{\idxcode{regex}}% -\indexlibrary{\idxcode{wregex}}% +\indexheader{regex}% +\indexlibraryglobal{basic_regex}% +\indexlibraryglobal{regex}% +\indexlibraryglobal{wregex}% \begin{codeblock} #include @@ -499,7 +505,7 @@ \rSec1[re.const]{Namespace \tcode{std::regex_constants}} \pnum -\indexlibrary{\idxcode{regex_constants}}% +\indexlibraryglobal{regex_constants}% The namespace \tcode{std::regex_constants} holds symbolic constants used by the regular expression library. This namespace provides three types, \tcode{syntax_option_type}, @@ -507,8 +513,8 @@ constants of these types. \rSec2[re.synopt]{Bitmask type \tcode{syntax_option_type}} -\indexlibrary{\idxcode{syntax_option_type}}% -\indexlibrary{\idxcode{regex_constants}!\idxcode{syntax_option_type}}% +\indexlibraryglobal{syntax_option_type}% +\indexlibrarymember{regex_constants}{syntax_option_type}% \begin{codeblock} namespace std::regex_constants { using syntax_option_type = @\textit{T1}@; @@ -527,17 +533,17 @@ \end{codeblock} \pnum -\indexlibrary{\idxcode{syntax_option_type}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{icase}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{nosubs}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{optimize}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{collate}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{ECMAScript}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{basic}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{extended}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{awk}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{grep}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{egrep}}% +\indexlibraryglobal{syntax_option_type}% +\indexlibrarymember{syntax_option_type}{icase}% +\indexlibrarymember{syntax_option_type}{nosubs}% +\indexlibrarymember{syntax_option_type}{optimize}% +\indexlibrarymember{syntax_option_type}{collate}% +\indexlibrarymember{syntax_option_type}{ECMAScript}% +\indexlibrarymember{syntax_option_type}{basic}% +\indexlibrarymember{syntax_option_type}{extended}% +\indexlibrarymember{syntax_option_type}{awk}% +\indexlibrarymember{syntax_option_type}{grep}% +\indexlibrarymember{syntax_option_type}{egrep}% The type \tcode{syntax_option_type} is an \impldef{type of \tcode{syntax_option_type}} bitmask type\iref{bitmask.types}. Setting its elements has the effects listed in \tref{re.synopt}. A valid value of type @@ -552,7 +558,7 @@ \tcode{icase} & Specifies that matching of regular expressions against a character container sequence shall be performed without regard to case. -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{icase}}% +\indexlibrarymember{syntax_option_type}{icase}% \\ \rowsep % \tcode{nosubs} & @@ -560,7 +566,7 @@ when a regular expression is matched against a character container sequence, no sub-expression matches shall be stored in the supplied \tcode{match_results} object. -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{nosubs}}% +\indexlibrarymember{syntax_option_type}{nosubs}% \\ \rowsep % \tcode{optimize} & @@ -569,13 +575,13 @@ the speed with which regular expression objects are constructed. Otherwise it has no detectable effect on the program output. -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{optimize}}% +\indexlibrarymember{syntax_option_type}{optimize}% \\ \rowsep % \tcode{collate} & Specifies that character ranges of the form \tcode{"[a-b]"} shall be locale sensitive. -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{collate}}% +\indexlibrarymember{syntax_option_type}{collate}% \indextext{locale}% \\ \rowsep % @@ -584,7 +590,7 @@ shall be that used by ECMAScript in ECMA-262, as modified in~\ref{re.grammar}. \newline \xref ECMA-262 15.10 \indextext{ECMAScript}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{ECMAScript}}% +\indexlibrarymember{syntax_option_type}{ECMAScript}% \\ \rowsep % \tcode{basic} & @@ -592,7 +598,7 @@ shall be that used by basic regular expressions in POSIX. \newline \xref POSIX, Base Definitions and Headers, Section 9.3 \indextext{POSIX!regular expressions}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{basic}}% +\indexlibrarymember{syntax_option_type}{basic}% \\ \rowsep % \tcode{extended} & @@ -600,21 +606,21 @@ shall be that used by extended regular expressions in POSIX. \newline \xref POSIX, Base Definitions and Headers, Section 9.4 \indextext{POSIX!extended regular expressions}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{extended}}% +\indexlibrarymember{syntax_option_type}{extended}% \\ \rowsep % \tcode{awk} & Specifies that the grammar recognized by the regular expression engine shall be that used by the utility awk in POSIX. \indextext{\idxcode{awk}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{awk}}% +\indexlibrarymember{syntax_option_type}{awk}% \\ \rowsep % \tcode{grep} & Specifies that the grammar recognized by the regular expression engine shall be that used by the utility grep in POSIX. \indextext{\idxcode{grep}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{grep}}% +\indexlibrarymember{syntax_option_type}{grep}% \\ \rowsep % \tcode{egrep} & @@ -622,7 +628,7 @@ shall be that used by the utility grep when given the -E option in POSIX. \indextext{\idxcode{egrep}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{egrep}}% +\indexlibrarymember{syntax_option_type}{egrep}% \\ \rowsep % \tcode{multiline} & @@ -630,28 +636,28 @@ \tcode{\$} shall match the end of a line, if the \tcode{ECMAScript} engine is selected. \indextext{\idxcode{multiline}}% -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{multiline}}% +\indexlibrarymember{syntax_option_type}{multiline}% \\ % \end{libefftab} \rSec2[re.matchflag]{Bitmask type \tcode{match_flag_type}} -\indexlibrary{\idxcode{match_flag_type}}% -\indexlibrary{\idxcode{regex_constants}!\idxcode{match_flag_type}}% -\indexlibrary{\idxcode{match_default}}% -\indexlibrary{\idxcode{match_not_bol}}% -\indexlibrary{\idxcode{match_not_eol}}% -\indexlibrary{\idxcode{match_not_bow}}% -\indexlibrary{\idxcode{match_not_eow}}% -\indexlibrary{\idxcode{match_any}}% -\indexlibrary{\idxcode{match_not_null}}% -\indexlibrary{\idxcode{match_continuous}}% -\indexlibrary{\idxcode{match_prev_avail}}% -\indexlibrary{\idxcode{format_default}}% -\indexlibrary{\idxcode{format_sed}}% -\indexlibrary{\idxcode{format_no_copy}}% -\indexlibrary{\idxcode{format_first_only}}% +\indexlibraryglobal{match_flag_type}% +\indexlibrarymember{regex_constants}{match_flag_type}% +\indexlibraryglobal{match_default}% +\indexlibraryglobal{match_not_bol}% +\indexlibraryglobal{match_not_eol}% +\indexlibraryglobal{match_not_bow}% +\indexlibraryglobal{match_not_eow}% +\indexlibraryglobal{match_any}% +\indexlibraryglobal{match_not_null}% +\indexlibraryglobal{match_continuous}% +\indexlibraryglobal{match_prev_avail}% +\indexlibraryglobal{format_default}% +\indexlibraryglobal{format_sed}% +\indexlibraryglobal{format_no_copy}% +\indexlibraryglobal{format_first_only}% \begin{codeblock} namespace std::regex_constants { using match_flag_type = @\textit{T2}@; @@ -672,7 +678,7 @@ \end{codeblock} \pnum -\indexlibrary{\idxcode{match_flag_type}}% +\indexlibraryglobal{match_flag_type}% The type \tcode{match_flag_type} is an \impldef{type of \tcode{regex_constants::match_flag_type}} bitmask type\iref{bitmask.types}. The constants of that type, except for \tcode{match_default} and @@ -688,58 +694,58 @@ character container sequence \range{first}{last}.} {re.matchflag} % -\indexlibrary{\idxcode{match_not_bol}}% +\indexlibraryglobal{match_not_bol}% \tcode{match_not_bol} & The first character in the sequence \range{first}{last} shall be treated as though it is not at the beginning of a line, so the character \verb|^| in the regular expression shall not match \range{first}{first}. \\ \rowsep % -\indexlibrary{\idxcode{match_not_eol}}% +\indexlibraryglobal{match_not_eol}% \tcode{match_not_eol} & The last character in the sequence \range{first}{last} shall be treated as though it is not at the end of a line, so the character \verb|"$"| in the regular expression shall not match \range{last}{last}. \\ \rowsep % -\indexlibrary{\idxcode{match_not_bow}}% +\indexlibraryglobal{match_not_bow}% \tcode{match_not_bow} & The expression \verb|"\\b"| shall not match the sub-sequence \range{first}{first}. \\ \rowsep % -\indexlibrary{\idxcode{match_not_eow}}% +\indexlibraryglobal{match_not_eow}% \tcode{match_not_eow} & The expression \verb|"\\b"| shall not match the sub-sequence \range{last}{last}. \\ \rowsep % -\indexlibrary{\idxcode{match_any}}% +\indexlibraryglobal{match_any}% \tcode{match_any} & If more than one match is possible then any match is an acceptable result. \\ \rowsep % -\indexlibrary{\idxcode{match_not_null}}% +\indexlibraryglobal{match_not_null}% \tcode{match_not_null} & The expression shall not match an empty sequence. \\ \rowsep % -\indexlibrary{\idxcode{match_continuous}}% +\indexlibraryglobal{match_continuous}% \tcode{match_continuous} & The expression shall only match a sub-sequence that begins at \tcode{first}. \\ \rowsep % -\indexlibrary{\idxcode{match_prev_avail}}% +\indexlibraryglobal{match_prev_avail}% \tcode{match_prev_avail} & \verb!--first! is a valid iterator position. When this flag is set the flags \tcode{match_not_bol} and \tcode{match_not_bow} shall be ignored by the regular expression algorithms\iref{re.alg} and iterators\iref{re.iter}. \\ \rowsep % -\indexlibrary{\idxcode{format_default}}% +\indexlibraryglobal{format_default}% \tcode{format_default} & When a regular expression match is to be replaced by a new string, the new string shall be constructed using the rules used by @@ -751,20 +757,20 @@ unchanged to the output string. \\ \rowsep % -\indexlibrary{\idxcode{format_sed}}% +\indexlibraryglobal{format_sed}% \tcode{format_sed} & When a regular expression match is to be replaced by a new string, the new string shall be constructed using the rules used by the sed utility in POSIX. \\ \rowsep % -\indexlibrary{\idxcode{format_no_copy}}% +\indexlibraryglobal{format_no_copy}% \tcode{format_no_copy} & During a search and replace operation, sections of the character container sequence being searched that do not match the regular expression shall not be copied to the output string. \\ \rowsep % -\indexlibrary{\idxcode{format_first_only}}% +\indexlibraryglobal{format_first_only}% \tcode{format_first_only} & When specified during a search and replace operation, only the first occurrence of the regular expression shall be replaced. @@ -772,8 +778,8 @@ \end{longlibefftab} \rSec2[re.err]{Implementation-defined \tcode{error_type}} -\indexlibrary{\idxcode{error_type}}% -\indexlibrary{\idxcode{regex_constants}!\idxcode{error_type}}% +\indexlibraryglobal{error_type}% +\indexlibrarymember{regex_constants}{error_type}% \begin{codeblock} namespace std::regex_constants { using error_type = @\textit{T3}@; @@ -794,8 +800,8 @@ \end{codeblock} \pnum -\indexlibrary{\idxcode{error_type}}% -\indexlibrary{\idxcode{regex_constants}!\idxcode{error_type}}% +\indexlibraryglobal{error_type}% +\indexlibrarymember{regex_constants}{error_type}% The type \tcode{error_type} is an \impldef{type of \tcode{regex_constants::error_type}} enumerated type\iref{enumerated.types}. Values of type \tcode{error_type} represent the error @@ -865,7 +871,7 @@ \end{longliberrtab} \rSec1[re.badexp]{Class \tcode{regex_error}} -\indexlibrary{\idxcode{regex_error}}% +\indexlibraryglobal{regex_error}% \begin{codeblock} class regex_error : public runtime_error { public: @@ -878,29 +884,35 @@ The class \tcode{regex_error} defines the type of objects thrown as exceptions to report errors from the regular expression library. -\indexlibrary{\idxcode{regex_error}!constructor}% +\indexlibraryctor{regex_error}% \begin{itemdecl} regex_error(regex_constants::error_type ecode); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs an object of class \tcode{regex_error}. +\pnum +\effects +Constructs an object of class \tcode{regex_error}. -\pnum\ensures \tcode{ecode == code()}. +\pnum +\ensures +\tcode{ecode == code()}. \end{itemdescr} -\indexlibrary{\idxcode{error_type}}% -\indexlibrary{\idxcode{regex_constants}!\idxcode{error_type}}% +\indexlibraryglobal{error_type}% +\indexlibrarymember{regex_constants}{error_type}% \begin{itemdecl} regex_constants::error_type code() const; \end{itemdecl} \begin{itemdescr} -\pnum\returns The error code that was passed to the constructor. +\pnum +\returns +The error code that was passed to the constructor. \end{itemdescr} \rSec1[re.traits]{Class template \tcode{regex_traits}} -\indexlibrary{\idxcode{regex_traits}}% +\indexlibraryglobal{regex_traits}% \begin{codeblock} namespace std { template @@ -959,7 +971,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{char_traits::length(p)}. +\pnum +\returns +\tcode{char_traits::length(p)}. \end{itemdescr} \indexlibrarymember{regex_traits}{translate}% @@ -968,7 +982,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{c}. +\pnum +\returns +\tcode{c}. \end{itemdescr} \indexlibrarymember{regex_traits}{translate_nocase}% @@ -977,7 +993,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{use_facet>(getloc()).tolower(c)}. +\pnum +\returns +\tcode{use_facet>(getloc()).tolower(c)}. \end{itemdescr} \indexlibrarymember{regex_traits}{transform}% @@ -987,7 +1005,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects As if by: \begin{codeblock} string_type str(first, last); @@ -1022,7 +1041,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns A sequence of one or more characters that +\pnum +\returns +A sequence of one or more characters that represents the collating element consisting of the character sequence designated by the iterator range \range{first}{last}. Returns an empty string if the character sequence is not a @@ -1037,7 +1058,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns An unspecified value that represents +\pnum +\returns +An unspecified value that represents the character classification named by the character sequence designated by the iterator range \range{first}{last}. If the parameter \tcode{icase} is \tcode{true} then the returned mask identifies the @@ -1051,7 +1074,8 @@ is not recognized then returns \tcode{char_class_type()}. \pnum -\remarks For \tcode{regex_traits}, at least the narrow character names +\remarks +For \tcode{regex_traits}, at least the narrow character names in \tref{re.traits.classnames} shall be recognized. For \tcode{regex_traits}, at least the wide character names in \tref{re.traits.classnames} shall be recognized. @@ -1064,11 +1088,13 @@ \begin{itemdescr} \pnum -\effects Determines if the character \tcode{c} is a member of the character +\effects +Determines if the character \tcode{c} is a member of the character classification represented by \tcode{f}. \pnum -\returns Given the following function declaration: +\returns +Given the following function declaration: \begin{codeblock} // for exposition only template @@ -1098,7 +1124,7 @@ regex_traits::char_class_type f; f = t.lookup_classname(d.begin(), d.end()); f |= t.lookup_classname(u.begin(), u.end()); -ctype_base::mask m = convert(f); // \tcode{m == ctype_base::digit|ctype_base::upper} +ctype_base::mask m = convert(f); // \tcode{m == ctype_base::digit|ctype_base::upper} \end{codeblock} \end{example} \begin{example} @@ -1107,9 +1133,9 @@ string w("w"); regex_traits::char_class_type f; f = t.lookup_classname(w.begin(), w.end()); -t.isctype('A', f); // returns \tcode{true} -t.isctype('_', f); // returns \tcode{true} -t.isctype(' ', f); // returns \tcode{false} +t.isctype('A', f); // returns \tcode{true} +t.isctype('_', f); // returns \tcode{true} +t.isctype(' ', f); // returns \tcode{false} \end{codeblock} \end{example} @@ -1125,42 +1151,50 @@ \requires The value of \tcode{radix} shall be 8, 10, or 16. \pnum -\returns The value represented by the digit \tcode{ch} in base +\returns +The value represented by the digit \tcode{ch} in base \tcode{radix} if the character \tcode{ch} is a valid digit in base \tcode{radix}; otherwise returns \tcode{-1}. \end{itemdescr} -\indexlibrary{\idxcode{locale}}% -\indexlibrary{\idxcode{imbue}}% +\indexlibraryglobal{locale}% +\indexlibraryglobal{imbue}% \begin{itemdecl} locale_type imbue(locale_type loc); \end{itemdecl} \begin{itemdescr} \pnum -\effects Imbues \tcode{this} with a copy of the -locale \tcode{loc}. \begin{note} Calling \tcode{imbue} with a +\effects +Imbues \tcode{this} with a copy of the +locale \tcode{loc}. +\begin{note} +Calling \tcode{imbue} with a different locale than the one currently in use invalidates all cached -data held by \tcode{*this}. \end{note} +data held by \tcode{*this}. +\end{note} \pnum -\returns If no locale has been previously imbued then a copy of the +\returns +If no locale has been previously imbued then a copy of the global locale in effect at the time of construction of \tcode{*this}, otherwise a copy of the last argument passed to \tcode{imbue}. \pnum -\ensures \tcode{getloc() == loc}. +\ensures +\tcode{getloc() == loc}. \end{itemdescr} -\indexlibrary{\idxcode{locale}}% -\indexlibrary{\idxcode{getloc}}% +\indexlibraryglobal{locale}% +\indexlibraryglobal{getloc}% \begin{itemdecl} locale_type getloc() const; \end{itemdecl} \begin{itemdescr} \pnum -\returns If no locale has been imbued then a copy of the global locale +\returns +If no locale has been imbued then a copy of the global locale in effect at the time of construction of \tcode{*this}, otherwise a copy of the last argument passed to \tcode{imbue}. \end{itemdescr} @@ -1186,7 +1220,7 @@ \end{floattable} \rSec1[re.regex]{Class template \tcode{basic_regex}} -\indexlibrary{\idxcode{basic_regex}}% +\indexlibraryglobal{basic_regex}% \pnum For a char-like type \tcode{charT}, specializations of class @@ -1201,16 +1235,19 @@ converting the sequence of \tcode{charT} objects to an internal representation. It is not specified what form this representation takes, nor how it is accessed by algorithms that operate on regular -expressions. \begin{note} Implementations will typically declare +expressions. +\begin{note} +Implementations will typically declare some function templates as friends of \tcode{basic_regex} to achieve -this \end{note} +this. +\end{note} \pnum -\indexlibrary{\idxcode{regex_error}}% +\indexlibraryglobal{regex_error}% The functions described in this Clause report errors by throwing exceptions of type \tcode{regex_error}. -\indexlibrary{\idxcode{basic_regex}}% +\indexlibraryglobal{basic_regex}% \begin{codeblock} namespace std { template> @@ -1243,35 +1280,35 @@ basic_regex(const basic_regex&); basic_regex(basic_regex&&) noexcept; template - explicit basic_regex(const basic_string& p, + explicit basic_regex(const basic_string& s, flag_type f = regex_constants::ECMAScript); template basic_regex(ForwardIterator first, ForwardIterator last, flag_type f = regex_constants::ECMAScript); - basic_regex(initializer_list, flag_type = regex_constants::ECMAScript); + basic_regex(initializer_list il, flag_type f = regex_constants::ECMAScript); ~basic_regex(); - basic_regex& operator=(const basic_regex&); - basic_regex& operator=(basic_regex&&) noexcept; - basic_regex& operator=(const charT* ptr); + // \ref{re.regex.assign}, assign + basic_regex& operator=(const basic_regex& e); + basic_regex& operator=(basic_regex&& e) noexcept; + basic_regex& operator=(const charT* p); basic_regex& operator=(initializer_list il); template - basic_regex& operator=(const basic_string& p); + basic_regex& operator=(const basic_string& s); - // \ref{re.regex.assign}, assign - basic_regex& assign(const basic_regex& that); - basic_regex& assign(basic_regex&& that) noexcept; - basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript); + basic_regex& assign(const basic_regex& e); + basic_regex& assign(basic_regex&& e) noexcept; + basic_regex& assign(const charT* p, flag_type f = regex_constants::ECMAScript); basic_regex& assign(const charT* p, size_t len, flag_type f); - template - basic_regex& assign(const basic_string& s, + template + basic_regex& assign(const basic_string& s, flag_type f = regex_constants::ECMAScript); template basic_regex& assign(InputIterator first, InputIterator last, flag_type f = regex_constants::ECMAScript); basic_regex& assign(initializer_list, - flag_type = regex_constants::ECMAScript); + flag_type f = regex_constants::ECMAScript); // \ref{re.regex.operations}, const operations unsigned mark_count() const; @@ -1294,18 +1331,19 @@ \rSec2[re.regex.construct]{Constructors} -\indexlibrary{\idxcode{basic_regex}!constructor}% +\indexlibraryctor{basic_regex}% \begin{itemdecl} basic_regex(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an object of class \tcode{basic_regex} that +\effects +Constructs an object of class \tcode{basic_regex} that does not match any character sequence. \end{itemdescr} -\indexlibrary{\idxcode{basic_regex}!constructor}% +\indexlibraryctor{basic_regex}% \begin{itemdecl} explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript); \end{itemdecl} @@ -1315,22 +1353,25 @@ \requires \tcode{p} shall not be a null pointer. \pnum -\throws \tcode{regex_error} if \tcode{p} is not a valid regular expression. +\throws +\tcode{regex_error} if \tcode{p} is not a valid regular expression. \pnum -\effects Constructs an object of class \tcode{basic_regex}; the object's +\effects +Constructs an object of class \tcode{basic_regex}; the object's internal finite state machine is constructed from the regular expression contained in the array of \tcode{charT} of length \tcode{char_traits::\brk{}length(p)} whose first element is designated by \tcode{p}, and interpreted according to the flags \tcode{f}. -\pnum\ensures +\pnum +\ensures \tcode{flags()} returns \tcode{f}. \tcode{mark_count()} returns the number of marked sub-expressions within the expression. \end{itemdescr} -\indexlibrary{\idxcode{basic_regex}!constructor}% +\indexlibraryctor{basic_regex}% \begin{itemdecl} basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript); \end{itemdecl} @@ -1340,51 +1381,58 @@ \requires \tcode{p} shall not be a null pointer. \pnum -\throws \tcode{regex_error} if \tcode{p} is not a valid regular expression. +\throws +\tcode{regex_error} if \tcode{p} is not a valid regular expression. \pnum -\effects Constructs an object of class \tcode{basic_regex}; the object's +\effects +Constructs an object of class \tcode{basic_regex}; the object's internal finite state machine is constructed from the regular expression contained in the sequence of characters \range{p}{p+len}, and interpreted according the flags specified in \tcode{f}. -\pnum\ensures +\pnum +\ensures \tcode{flags()} returns \tcode{f}. \tcode{mark_count()} returns the number of marked sub-expressions within the expression. \end{itemdescr} -\indexlibrary{\idxcode{basic_regex}!constructor}% +\indexlibraryctor{basic_regex}% \begin{itemdecl} basic_regex(const basic_regex& e); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an object of class \tcode{basic_regex} as a copy of +\effects +Constructs an object of class \tcode{basic_regex} as a copy of the object \tcode{e}. -\pnum\ensures +\pnum +\ensures \tcode{flags()} and \tcode{mark_count()} return \tcode{e.flags()} and \tcode{e.mark_count()}, respectively. \end{itemdescr} -\indexlibrary{\idxcode{basic_regex}!constructor}% +\indexlibraryctor{basic_regex}% \begin{itemdecl} basic_regex(basic_regex&& e) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs an object of class \tcode{basic_regex} from \tcode{e}. +\effects +Move constructs an object of class \tcode{basic_regex} from \tcode{e}. \pnum -\ensures \tcode{flags()} and \tcode{mark_count()} return the values that +\ensures +\tcode{flags()} and \tcode{mark_count()} return the values that \tcode{e.flags()} and \tcode{e.mark_count()}, respectively, had before construction. \tcode{e} is in a valid state with unspecified value. \end{itemdescr} -\indexlibrary{\idxcode{basic_regex}!constructor}% +\indexlibraryctor{basic_regex}% \begin{itemdecl} template explicit basic_regex(const basic_string& s, @@ -1393,21 +1441,24 @@ \begin{itemdescr} \pnum -\throws \tcode{regex_error} if \tcode{s} is not a valid regular expression. +\throws +\tcode{regex_error} if \tcode{s} is not a valid regular expression. \pnum -\effects Constructs an object of class \tcode{basic_regex}; the object's +\effects +Constructs an object of class \tcode{basic_regex}; the object's internal finite state machine is constructed from the regular expression contained in the string \tcode{s}, and interpreted according to the flags specified in \tcode{f}. -\pnum\ensures +\pnum +\ensures \tcode{flags()} returns \tcode{f}. \tcode{mark_count()} returns the number of marked sub-expressions within the expression. \end{itemdescr} -\indexlibrary{\idxcode{basic_regex}!constructor}% +\indexlibraryctor{basic_regex}% \begin{itemdecl} template basic_regex(ForwardIterator first, ForwardIterator last, @@ -1416,29 +1467,33 @@ \begin{itemdescr} \pnum -\throws \tcode{regex_error} if the sequence \range{first}{last} is not a +\throws +\tcode{regex_error} if the sequence \range{first}{last} is not a valid regular expression. \pnum -\effects Constructs an object of class \tcode{basic_regex}; the object's +\effects +Constructs an object of class \tcode{basic_regex}; the object's internal finite state machine is constructed from the regular expression contained in the sequence of characters \range{first}{last}, and interpreted according to the flags specified in \tcode{f}. -\pnum\ensures +\pnum +\ensures \tcode{flags()} returns \tcode{f}. \tcode{mark_count()} returns the number of marked sub-expressions within the expression. \end{itemdescr} -\indexlibrary{\idxcode{basic_regex}!constructor}% +\indexlibraryctor{basic_regex}% \begin{itemdecl} basic_regex(initializer_list il, flag_type f = regex_constants::ECMAScript); \end{itemdecl} \begin{itemdescr} \pnum -\effects Same as \tcode{basic_regex(il.begin(), il.end(), f)}. +\effects +Same as \tcode{basic_regex(il.begin(), il.end(), f)}. \end{itemdescr} \rSec2[re.regex.assign]{Assignment} @@ -1450,9 +1505,11 @@ \begin{itemdescr} \pnum -\effects Copies \tcode{e} into \tcode{*this} and returns \tcode{*this}. +\effects +Copies \tcode{e} into \tcode{*this} and returns \tcode{*this}. -\pnum\ensures +\pnum +\ensures \tcode{flags()} and \tcode{mark_count()} return \tcode{e.flags()} and \tcode{e.mark_count()}, respectively. \end{itemdescr} @@ -1464,25 +1521,28 @@ \begin{itemdescr} \pnum -\effects Move assigns from \tcode{e} into \tcode{*this} and returns \tcode{*this}. +\effects +Move assigns from \tcode{e} into \tcode{*this} and returns \tcode{*this}. \pnum -\ensures \tcode{flags()} and \tcode{mark_count()} return the values that +\ensures +\tcode{flags()} and \tcode{mark_count()} return the values that \tcode{e.flags()} and \tcode{e.mark_count()}, respectively, had before assignment. \tcode{e} is in a valid state with unspecified value. \end{itemdescr} \indexlibrarymember{basic_regex}{operator=}% \begin{itemdecl} -basic_regex& operator=(const charT* ptr); +basic_regex& operator=(const charT* p); \end{itemdecl} \begin{itemdescr} \pnum -\requires \tcode{ptr} shall not be a null pointer. +\requires \tcode{p} shall not be a null pointer. \pnum -\effects Returns \tcode{assign(ptr)}. +\effects +Returns \tcode{assign(p)}. \end{itemdescr} \indexlibrarymember{basic_regex}{operator=}% @@ -1492,76 +1552,85 @@ \begin{itemdescr} \pnum -\effects Returns \tcode{assign(il.begin(), il.end())}. +\effects +Returns \tcode{assign(il.begin(), il.end())}. \end{itemdescr} \indexlibrarymember{basic_regex}{operator=}% \begin{itemdecl} template - basic_regex& operator=(const basic_string& p); + basic_regex& operator=(const basic_string& s); \end{itemdecl} \begin{itemdescr} \pnum -\effects Returns \tcode{assign(p)}. +\effects +Returns \tcode{assign(s)}. \end{itemdescr} \indexlibrarymember{basic_regex}{assign}% \begin{itemdecl} -basic_regex& assign(const basic_regex& that); +basic_regex& assign(const basic_regex& e); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return *this = that;} +\effects +Equivalent to: \tcode{return *this = e;} \end{itemdescr} \indexlibrarymember{basic_regex}{assign}% \begin{itemdecl} -basic_regex& assign(basic_regex&& that) noexcept; +basic_regex& assign(basic_regex&& e) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return *this = std::move(that);} +\effects +Equivalent to: \tcode{return *this = std::move(e);} \end{itemdescr} \indexlibrarymember{basic_regex}{assign}% \begin{itemdecl} -basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript); +basic_regex& assign(const charT* p, flag_type f = regex_constants::ECMAScript); \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{assign(string_type(ptr), f)}. +\returns +\tcode{assign(string_type(p), f)}. \end{itemdescr} \indexlibrarymember{basic_regex}{assign}% \begin{itemdecl} -basic_regex& assign(const charT* ptr, size_t len, flag_type f = regex_constants::ECMAScript); +basic_regex& assign(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript); \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{assign(string_type(ptr, len), f)}. +\returns +\tcode{assign(string_type(p, len), f)}. \end{itemdescr} \indexlibrarymember{basic_regex}{assign}% \begin{itemdecl} -template - basic_regex& assign(const basic_string& s, +template + basic_regex& assign(const basic_string& s, flag_type f = regex_constants::ECMAScript); \end{itemdecl} \begin{itemdescr} \pnum -\throws \tcode{regex_error} if \tcode{s} is not a valid regular expression. +\throws +\tcode{regex_error} if \tcode{s} is not a valid regular expression. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \pnum -\effects Assigns the regular expression contained in the string +\effects +Assigns the regular expression contained in the string \tcode{s}, interpreted according the flags specified in \tcode{f}. If an exception is thrown, \tcode{*this} is unchanged. @@ -1586,7 +1655,8 @@ \oldconcept{InputIterator} requirements\iref{input.iterators}. \pnum -\returns \tcode{assign(string_type(first, last), f)}. +\returns +\tcode{assign(string_type(first, last), f)}. \end{itemdescr} \indexlibrarymember{assign}{basic_regex}% @@ -1597,10 +1667,12 @@ \begin{itemdescr} \pnum -\effects Same as \tcode{assign(il.begin(), il.end(), f)}. +\effects +Same as \tcode{assign(il.begin(), il.end(), f)}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} @@ -1613,7 +1685,8 @@ \begin{itemdescr} \pnum -\effects Returns the number of marked sub-expressions within the +\effects +Returns the number of marked sub-expressions within the regular expression. \end{itemdescr} @@ -1624,13 +1697,14 @@ \begin{itemdescr} \pnum -\effects Returns a copy of the regular expression syntax flags that +\effects +Returns a copy of the regular expression syntax flags that were passed to the object's constructor or to the last call to \tcode{assign}. \end{itemdescr} \rSec2[re.regex.locale]{Locale}% -\indexlibrary{\idxcode{locale}} +\indexlibraryglobal{locale} \indexlibrarymember{imbue}{basic_regex}% \begin{itemdecl} @@ -1638,7 +1712,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects Returns the result of \tcode{traits_inst.imbue(loc)} where +\pnum +\effects +Returns the result of \tcode{traits_inst.imbue(loc)} where \tcode{traits_inst} is a (default-initialized) instance of the template type argument \tcode{traits} stored within the object. After a call to \tcode{imbue} the \tcode{basic_regex} object does not match any @@ -1651,7 +1727,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects Returns the result of \tcode{traits_inst.getloc()} where +\pnum +\effects +Returns the result of \tcode{traits_inst.getloc()} where \tcode{traits_inst} is a (default-initialized) instance of the template parameter \tcode{traits} stored within the object. \end{itemdescr} @@ -1665,13 +1743,19 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects Swaps the contents of the two regular expressions. +\pnum +\effects +Swaps the contents of the two regular expressions. -\pnum\ensures \tcode{*this} contains the regular expression +\pnum +\ensures +\tcode{*this} contains the regular expression that was in \tcode{e}, \tcode{e} contains the regular expression that was in \tcode{*this}. -\pnum\complexity Constant time. +\pnum +\complexity +Constant time. \end{itemdescr} \rSec2[re.regex.nonmemb]{Non-member functions} @@ -1683,12 +1767,14 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects Calls \tcode{lhs.swap(rhs)}. +\pnum +\effects +Calls \tcode{lhs.swap(rhs)}. \end{itemdescr} \rSec1[re.submatch]{Class template \tcode{sub_match}} \pnum -\indexlibrary{\idxcode{sub_match}}% +\indexlibraryglobal{sub_match}% Class template \tcode{sub_match} denotes the sequence of characters matched by a particular marked sub-expression. @@ -1722,14 +1808,15 @@ \rSec2[re.submatch.members]{Members} -\indexlibrary{\idxcode{sub_match}!constructor}% +\indexlibraryctor{sub_match}% \begin{itemdecl} constexpr sub_match(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Value-initializes the \tcode{pair} base class subobject and the member +\effects +Value-initializes the \tcode{pair} base class subobject and the member \tcode{matched}. \end{itemdescr} @@ -1739,7 +1826,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{matched ?\ distance(first, second) :\ 0}. +\pnum +\returns +\tcode{matched ?\ distance(first, second) :\ 0}. \end{itemdescr} \indexlibrarymember{operator basic_string}{sub_match}% @@ -1748,7 +1837,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{matched ?\ string_type(first, second) :\ string_type()}. +\pnum +\returns +\tcode{matched ?\ string_type(first, second) :\ string_type()}. \end{itemdescr} \indexlibrarymember{sub_match}{str}% @@ -1757,7 +1848,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{matched ?\ string_type(first, second) :\ string_type()}. +\pnum +\returns +\tcode{matched ?\ string_type(first, second) :\ string_type()}. \end{itemdescr} \indexlibrarymember{sub_match}{compare}% @@ -1766,7 +1859,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{str().compare(s.str())}. +\pnum +\returns +\tcode{str().compare(s.str())}. \end{itemdescr} \indexlibrarymember{sub_match}{compare}% @@ -1775,7 +1870,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{str().compare(s)}. +\pnum +\returns +\tcode{str().compare(s)}. \end{itemdescr} \indexlibrarymember{sub_match}{compare}% @@ -1784,7 +1881,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{str().compare(s)}. +\pnum +\returns +\tcode{str().compare(s)}. \end{itemdescr} \rSec2[re.submatch.op]{Non-member operators} @@ -1802,7 +1901,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{lhs.compare(rhs) == 0}. +\pnum +\returns +\tcode{lhs.compare(rhs) == 0}. \end{itemdescr} \indexlibrarymember{sub_match}{operator<=>}% @@ -1812,7 +1913,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{static_cast<\placeholdernc{SM-CAT}(BiIter)>(lhs.compare(rhs) <=> 0)}. +\pnum +\returns +\tcode{static_cast<\placeholdernc{SM-CAT}(BiIter)>(lhs.compare(rhs) <=> 0)}. \end{itemdescr} \indexlibrarymember{operator==}{sub_match}% @@ -1840,7 +1943,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns +\pnum +\returns \begin{codeblock} static_cast<@\placeholdernc{SM-CAT}@(BiIter)>(lhs.compare( typename sub_match::string_type(rhs.data(), rhs.size())) @@ -1857,7 +1961,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{lhs.compare(rhs) == 0}. +\pnum +\returns +\tcode{lhs.compare(rhs) == 0}. \end{itemdescr} \indexlibrarymember{sub_match}{operator<=>}% @@ -1868,7 +1974,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns +\pnum +\returns \tcode{static_cast<\placeholdernc{SM-CAT}(BiIter)>(lhs.compare(rhs) <=> 0)}. \end{itemdescr} @@ -1881,7 +1988,8 @@ \begin{itemdescr} \pnum -\returns \tcode{lhs.compare(typename sub_match::string_type(1, rhs)) == 0}. +\returns +\tcode{lhs.compare(typename sub_match::string_type(1, rhs)) == 0}. \end{itemdescr} \indexlibrarymember{sub_match}{operator<=>}% @@ -1902,7 +2010,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{basic_ostream}}% +\indexlibraryglobal{basic_ostream}% \indexlibrarymember{sub_match}{operator<<}% \begin{itemdecl} template @@ -1911,12 +2019,14 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{os << m.str()}. +\pnum +\returns +\tcode{os << m.str()}. \end{itemdescr} \rSec1[re.results]{Class template \tcode{match_results}} \pnum -\indexlibrary{\idxcode{match_results}}% +\indexlibraryglobal{match_results}% Class template \tcode{match_results} denotes a collection of character sequences representing the result of a regular expression match. Storage for the collection is allocated and freed as necessary @@ -1944,7 +2054,7 @@ most member functions from a \tcode{match_results} object that is not ready are undefined. \pnum -\indexlibrary{\idxcode{match_results}!\idxcode{matched}}% +\indexlibrarymember{match_results}{matched}% The \tcode{sub_match} object stored at index 0 represents sub-expression 0, i.e., the whole match. In this case the \tcode{sub_match} member \tcode{matched} is always \tcode{true}. The \tcode{sub_match} @@ -1956,9 +2066,12 @@ \range{first}{second} which formed that match. Otherwise \tcode{matched} is \tcode{false}, and members \tcode{first} and \tcode{second} point to the end of the sequence -that was searched. \begin{note} The \tcode{sub_match} objects representing +that was searched. +\begin{note} +The \tcode{sub_match} objects representing different sub-expressions that did not participate in a regular expression -match need not be distinct.\end{note} +match need not be distinct. +\end{note} \begin{codeblock} namespace std { @@ -2039,14 +2152,15 @@ \rSec2[re.results.const]{Constructors} -\indexlibrary{\idxcode{match_results}!constructor}% +\indexlibraryctor{match_results}% \begin{itemdecl} explicit match_results(const Allocator& a); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an object of class \tcode{match_results}. +\effects +Constructs an object of class \tcode{match_results}. \pnum \ensures @@ -2054,30 +2168,33 @@ \tcode{size()} returns \tcode{0}. \end{itemdescr} -\indexlibrary{\idxcode{match_results}!constructor}% +\indexlibraryctor{match_results}% \begin{itemdecl} match_results(const match_results& m); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs an object of class \tcode{match_results}, as a +\effects +Constructs an object of class \tcode{match_results}, as a copy of \tcode{m}. \end{itemdescr} -\indexlibrary{\idxcode{match_results}!constructor}% +\indexlibraryctor{match_results}% \begin{itemdecl} match_results(match_results&& m) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects\ Move constructs an object of class \tcode{match_results} from \tcode{m} +\effects +Move constructs an object of class \tcode{match_results} from \tcode{m} satisfying the same postconditions as \tref{re.results.const}. Additionally, the stored \tcode{Allocator} value is move constructed from \tcode{m.get_allocator()}. \pnum -\throws Nothing. +\throws +Nothing. \end{itemdescr} \indexlibrarymember{match_results}{operator=}% @@ -2087,7 +2204,8 @@ \begin{itemdescr} \pnum -\effects Assigns \tcode{m} to \tcode{*this}. The postconditions of this +\effects +Assigns \tcode{m} to \tcode{*this}. The postconditions of this function are indicated in \tref{re.results.const}. \end{itemdescr} @@ -2098,7 +2216,8 @@ \begin{itemdescr} \pnum -\effects\ Move-assigns \tcode{m} to \tcode{*this}. The postconditions of this function +\effects +Move-assigns \tcode{m} to \tcode{*this}. The postconditions of this function are indicated in \tref{re.results.const}. \end{itemdescr} @@ -2124,7 +2243,8 @@ \begin{itemdescr} \pnum -\returns \tcode{true} if \tcode{*this} has a fully established result state, otherwise +\returns +\tcode{true} if \tcode{*this} has a fully established result state, otherwise \tcode{false}. \end{itemdescr} @@ -2136,10 +2256,13 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns One plus the number of marked sub-expressions in the +\pnum +\returns +One plus the number of marked sub-expressions in the regular expression that was matched if \tcode{*this} represents the result of a successful match. Otherwise returns \tcode{0}. -\begin{note} The state of a \tcode{match_results} object can be modified +\begin{note} +The state of a \tcode{match_results} object can be modified only by passing that object to \tcode{regex_match} or \tcode{regex_search}. Subclauses~\ref{re.alg.match} and~\ref{re.alg.search} specify the effects of those algorithms on their \tcode{match_results} arguments. @@ -2152,7 +2275,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns The maximum number of \tcode{sub_match} elements that can be +\pnum +\returns +The maximum number of \tcode{sub_match} elements that can be stored in \tcode{*this}. \end{itemdescr} @@ -2162,7 +2287,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{size() == 0}. +\pnum +\returns +\tcode{size() == 0}. \end{itemdescr} \rSec2[re.results.acc]{Element access} @@ -2177,7 +2304,8 @@ \requires \tcode{ready() == true}. \pnum -\returns \tcode{(*this)[sub].length()}. +\returns +\tcode{(*this)[sub].length()}. \end{itemdescr} \indexlibrarymember{position}{match_results}% @@ -2190,7 +2318,8 @@ \requires \tcode{ready() == true}. \pnum -\returns The distance from the start of the target sequence +\returns +The distance from the start of the target sequence to \tcode{(*this)[sub].first}. \end{itemdescr} @@ -2204,7 +2333,8 @@ \requires \tcode{ready() == true}. \pnum -\returns \tcode{string_type((*this)[sub])}. +\returns +\tcode{string_type((*this)[sub])}. \end{itemdescr} \indexlibrarymember{match_results}{operator[]}% @@ -2217,7 +2347,8 @@ \requires \tcode{ready() == true}. \pnum -\returns A reference to the \tcode{sub_match} object representing the +\returns +A reference to the \tcode{sub_match} object representing the character sequence that matched marked sub-expression \tcode{n}. If \tcode{n == 0} then returns a reference to a \tcode{sub_match} object representing the character sequence that matched the whole regular expression. If @@ -2235,7 +2366,8 @@ \requires \tcode{ready() == true}. \pnum -\returns A reference to the \tcode{sub_match} object representing the +\returns +A reference to the \tcode{sub_match} object representing the character sequence from the start of the string being matched/searched to the start of the match found. \end{itemdescr} @@ -2250,7 +2382,8 @@ \requires \tcode{ready() == true}. \pnum -\returns A reference to the \tcode{sub_match} object representing the +\returns +A reference to the \tcode{sub_match} object representing the character sequence from the end of the match found to the end of the string being matched/searched. \end{itemdescr} @@ -2262,7 +2395,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns A starting iterator that enumerates over all the +\pnum +\returns +A starting iterator that enumerates over all the sub-expressions stored in \tcode{*this}. \end{itemdescr} @@ -2273,7 +2408,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns A terminating iterator that enumerates over all the +\pnum +\returns +A terminating iterator that enumerates over all the sub-expressions stored in \tcode{*this}. \end{itemdescr} @@ -2294,7 +2431,8 @@ \oldconcept{OutputIterator}\iref{output.iterators}. \pnum -\effects Copies the character sequence \range{fmt_first}{fmt_last} to +\effects +Copies the character sequence \range{fmt_first}{fmt_last} to OutputIter \tcode{out}. Replaces each format specifier or escape sequence in the copied range with either the character(s) it represents or the sequence of characters within \tcode{*this} to which it refers. @@ -2302,7 +2440,8 @@ specifiers and escape sequences are recognized. \pnum -\returns \tcode{out}. +\returns +\tcode{out}. \end{itemdescr} \indexlibrarymember{match_results}{format}% @@ -2316,7 +2455,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return format(out, fmt.data(), fmt.data() + fmt.size(), flags); \end{codeblock} @@ -2338,13 +2478,13 @@ \effects Constructs an empty string \tcode{result} of type \tcode{basic_string} and calls: - \begin{codeblock} format(back_inserter(result), fmt, flags); \end{codeblock} \pnum -\returns \tcode{result}. +\returns +\tcode{result}. \end{itemdescr} \indexlibrarymember{match_results}{format}% @@ -2359,14 +2499,16 @@ \requires \tcode{ready() == true}. \pnum -\effects Constructs an empty string \tcode{result} of type \tcode{string_type} and +\effects +Constructs an empty string \tcode{result} of type \tcode{string_type} and calls: \begin{codeblock} format(back_inserter(result), fmt, fmt + char_traits::length(fmt), flags); \end{codeblock} \pnum -\returns \tcode{result}. +\returns +\tcode{result}. \end{itemdescr} \rSec2[re.results.all]{Allocator}% @@ -2378,7 +2520,8 @@ \begin{itemdescr} \pnum -\returns A copy of the Allocator that was passed to the object's constructor or, if that +\returns +A copy of the Allocator that was passed to the object's constructor or, if that allocator has been replaced, a copy of the most recent replacement. \end{itemdescr} @@ -2390,13 +2533,19 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects Swaps the contents of the two sequences. +\pnum +\effects +Swaps the contents of the two sequences. -\pnum\ensures \tcode{*this} contains the sequence of matched +\pnum +\ensures +\tcode{*this} contains the sequence of matched sub-expressions that were in \tcode{that}, \tcode{that} contains the sequence of matched sub-expressions that were in \tcode{*this}. -\pnum\complexity Constant time. +\pnum +\complexity +Constant time. \end{itemdescr} \indexlibrarymember{match_results}{swap}% @@ -2406,7 +2555,9 @@ match_results& m2); \end{itemdecl} -\pnum\effects As if by \tcode{m1.swap(m2)}. +\pnum +\effects +As if by \tcode{m1.swap(m2)}. \rSec2[re.results.nonmember]{Non-member functions} @@ -2422,14 +2573,12 @@ \returns \tcode{true} if neither match result is ready, \tcode{false} if one match result is ready and the other is not. If both match results are ready, returns \tcode{true} only if: - \begin{itemize} \item \tcode{m1.empty() \&\& m2.empty()}, or \item \tcode{!m1.empty() \&\& !m2.empty()}, and the following conditions are satisfied: - \begin{itemize} \item \tcode{m1.prefix() == m2.prefix()}, @@ -2441,7 +2590,9 @@ \tcode{m1.suffix() == m2.suffix()}. \end{itemize} \end{itemize} -\begin{note} The algorithm \tcode{equal} is defined in \ref{algorithms}. \end{note} +\begin{note} +The algorithm \tcode{equal} is defined in \ref{algorithms}. +\end{note} \end{itemdescr} \rSec1[re.alg]{Regular expression algorithms} @@ -2454,7 +2605,7 @@ or \tcode{regex_constants::error_stack}. \rSec2[re.alg.match]{\tcode{regex_match}} -\indexlibrary{\idxcode{regex_match}}% +\indexlibraryglobal{regex_match}% \begin{itemdecl} template bool regex_match(BidirectionalIterator first, BidirectionalIterator last, @@ -2470,7 +2621,8 @@ \oldconcept{BidirectionalIterator} requirements\iref{bidirectional.iterators}. \pnum -\effects Determines whether there is a match between the +\effects +Determines whether there is a match between the regular expression \tcode{e}, and all of the character sequence \range{first}{last}. The parameter \tcode{flags} is used to control how the expression is matched against the character @@ -2482,10 +2634,10 @@ \begin{codeblock} std::regex re("Get|GetValue"); std::cmatch m; -regex_search("GetValue", m, re); // returns \tcode{true}, and \tcode{m[0]} contains \tcode{"Get"} -regex_match ("GetValue", m, re); // returns \tcode{true}, and \tcode{m[0]} contains \tcode{"GetValue"} -regex_search("GetValues", m, re); // returns \tcode{true}, and \tcode{m[0]} contains \tcode{"Get"} -regex_match ("GetValues", m, re); // returns \tcode{false} +regex_search("GetValue", m, re); // returns \tcode{true}, and \tcode{m[0]} contains \tcode{"Get"} +regex_match ("GetValue", m, re); // returns \tcode{true}, and \tcode{m[0]} contains \tcode{"GetValue"} +regex_search("GetValues", m, re); // returns \tcode{true}, and \tcode{m[0]} contains \tcode{"Get"} +regex_match ("GetValues", m, re); // returns \tcode{false} \end{codeblock} \end{example} @@ -2565,7 +2717,7 @@ \\ \end{longlibefftabvalue} -\indexlibrary{\idxcode{regex_match}}% +\indexlibraryglobal{regex_match}% \begin{itemdecl} template bool regex_match(BidirectionalIterator first, BidirectionalIterator last, @@ -2575,13 +2727,14 @@ \begin{itemdescr} \pnum -\effects Behaves ``as if'' by constructing an instance of +\effects +Behaves ``as if'' by constructing an instance of \tcode{match_results what}, and then returning the result of \tcode{regex_match(first, last, what, e, flags)}. \end{itemdescr} -\indexlibrary{\idxcode{regex_match}}% +\indexlibraryglobal{regex_match}% \begin{itemdecl} template bool regex_match(const charT* str, @@ -2592,10 +2745,11 @@ \begin{itemdescr} \pnum -\returns \tcode{regex_match(str, str + char_traits::length(str), m, e, flags)}. +\returns +\tcode{regex_match(str, str + char_traits::length(str), m, e, flags)}. \end{itemdescr} -\indexlibrary{\idxcode{regex_match}}% +\indexlibraryglobal{regex_match}% \begin{itemdecl} template bool regex_match(const basic_string& s, @@ -2607,10 +2761,11 @@ \begin{itemdescr} \pnum -\returns \tcode{regex_match(s.begin(), s.end(), m, e, flags)}. +\returns +\tcode{regex_match(s.begin(), s.end(), m, e, flags)}. \end{itemdescr} -\indexlibrary{\idxcode{regex_match}}% +\indexlibraryglobal{regex_match}% \begin{itemdecl} template bool regex_match(const charT* str, @@ -2620,10 +2775,11 @@ \begin{itemdescr} \pnum -\returns \tcode{regex_match(str, str + char_traits::length(str), e, flags)} +\returns +\tcode{regex_match(str, str + char_traits::length(str), e, flags)} \end{itemdescr} -\indexlibrary{\idxcode{regex_match}}% +\indexlibraryglobal{regex_match}% \begin{itemdecl} template bool regex_match(const basic_string& s, @@ -2633,12 +2789,13 @@ \begin{itemdescr} \pnum -\returns \tcode{regex_match(s.begin(), s.end(), e, flags)}. +\returns +\tcode{regex_match(s.begin(), s.end(), e, flags)}. \end{itemdescr} \rSec2[re.alg.search]{\tcode{regex_search}} -\indexlibrary{\idxcode{regex_search}}% +\indexlibraryglobal{regex_search}% \begin{itemdecl} template bool regex_search(BidirectionalIterator first, BidirectionalIterator last, @@ -2654,7 +2811,8 @@ \oldconcept{BidirectionalIterator} requirements\iref{bidirectional.iterators}. \pnum -\effects Determines whether there is some sub-sequence within \range{first}{last} that matches +\effects +Determines whether there is some sub-sequence within \range{first}{last} that matches the regular expression \tcode{e}. The parameter \tcode{flags} is used to control how the expression is matched against the character sequence. Returns \tcode{true} if such a sequence exists, \tcode{false} otherwise. @@ -2734,7 +2892,7 @@ \\ \end{longlibefftabvalue} -\indexlibrary{\idxcode{regex_search}}% +\indexlibraryglobal{regex_search}% \begin{itemdecl} template bool regex_search(const charT* str, match_results& m, @@ -2744,10 +2902,11 @@ \begin{itemdescr} \pnum -\returns \tcode{regex_search(str, str + char_traits::length(str), m, e, flags)}. +\returns +\tcode{regex_search(str, str + char_traits::length(str), m, e, flags)}. \end{itemdescr} -\indexlibrary{\idxcode{regex_search}}% +\indexlibraryglobal{regex_search}% \begin{itemdecl} template bool regex_search(const basic_string& s, @@ -2759,10 +2918,11 @@ \begin{itemdescr} \pnum -\returns \tcode{regex_search(s.begin(), s.end(), m, e, flags)}. +\returns +\tcode{regex_search(s.begin(), s.end(), m, e, flags)}. \end{itemdescr} -\indexlibrary{\idxcode{regex_search}}% +\indexlibraryglobal{regex_search}% \begin{itemdecl} template bool regex_search(BidirectionalIterator first, BidirectionalIterator last, @@ -2772,12 +2932,13 @@ \begin{itemdescr} \pnum -\effects Behaves ``as if'' by constructing an object \tcode{what} +\effects +Behaves ``as if'' by constructing an object \tcode{what} of type \tcode{match_results} and returning \tcode{regex_search(first, last, what, e, flags)}. \end{itemdescr} -\indexlibrary{\idxcode{regex_search}}% +\indexlibraryglobal{regex_search}% \begin{itemdecl} template bool regex_search(const charT* str, @@ -2787,10 +2948,11 @@ \begin{itemdescr} \pnum -\returns \tcode{regex_search(str, str + char_traits::length(str), e, flags)}. +\returns +\tcode{regex_search(str, str + char_traits::length(str), e, flags)}. \end{itemdescr} -\indexlibrary{\idxcode{regex_search}}% +\indexlibraryglobal{regex_search}% \begin{itemdecl} template bool regex_search(const basic_string& s, @@ -2799,12 +2961,14 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{regex_search(s.begin(), s.end(), e, flags)}. +\pnum +\returns +\tcode{regex_search(s.begin(), s.end(), e, flags)}. \end{itemdescr} \rSec2[re.alg.replace]{\tcode{regex_replace}} -\indexlibrary{\idxcode{regex_replace}}% +\indexlibraryglobal{regex_replace}% \begin{itemdecl} template @@ -2825,8 +2989,8 @@ \begin{itemdescr} \pnum -\indexlibrary{\idxcode{format_no_copy}}% -\indexlibrary{\idxcode{format_first_only}}% +\indexlibraryglobal{format_no_copy}% +\indexlibraryglobal{format_first_only}% \effects Constructs a \tcode{regex_iterator} object \tcode{i} as if by @@ -2870,10 +3034,12 @@ found. If \tcode{flags \& regex_constants::format_first_only} is nonzero, then only the first match found is replaced. -\pnum\returns \tcode{out}. +\pnum +\returns +\tcode{out}. \end{itemdescr} -\indexlibrary{\idxcode{regex_replace}}% +\indexlibraryglobal{regex_replace}% \begin{itemdecl} template basic_string @@ -2890,17 +3056,20 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs an empty string \tcode{result} of +\pnum +\effects +Constructs an empty string \tcode{result} of type \tcode{basic_string} and calls: \begin{codeblock} regex_replace(back_inserter(result), s.begin(), s.end(), e, fmt, flags); \end{codeblock} \pnum -\returns \tcode{result}. +\returns +\tcode{result}. \end{itemdescr} -\indexlibrary{\idxcode{regex_replace}}% +\indexlibraryglobal{regex_replace}% \begin{itemdecl} template basic_string @@ -2918,22 +3087,24 @@ \begin{itemdescr} \pnum -\effects Constructs an empty string \tcode{result} of +\effects +Constructs an empty string \tcode{result} of type \tcode{basic_string} and calls: \begin{codeblock} regex_replace(back_inserter(result), s, s + char_traits::length(s), e, fmt, flags); \end{codeblock} \pnum -\returns \tcode{result}. +\returns +\tcode{result}. \end{itemdescr} \rSec1[re.iter]{Regular expression iterators} \rSec2[re.regiter]{Class template \tcode{regex_iterator}} \pnum -\indexlibrary{\idxcode{regex_iterator}}% -\indexlibrary{\idxcode{match_results}}% +\indexlibraryglobal{regex_iterator}% +\indexlibraryglobal{match_results}% The class template \tcode{regex_iterator} is an iterator adaptor. It represents a new view of an existing iterator sequence, by enumerating all the occurrences of a regular expression within that @@ -2987,11 +3158,11 @@ regex_iterator operator++(int); private: - BidirectionalIterator begin; // \expos - BidirectionalIterator end; // \expos - const regex_type* pregex; // \expos - regex_constants::match_flag_type flags; // \expos - match_results match; // \expos + BidirectionalIterator begin; // \expos + BidirectionalIterator end; // \expos + const regex_type* pregex; // \expos + regex_constants::match_flag_type flags; // \expos + match_results match; // \expos }; } \end{codeblock} @@ -3000,23 +3171,28 @@ \indextext{\idxcode{regex_iterator}!end-of-sequence}% An object of type \tcode{regex_iterator} that is not an end-of-sequence iterator holds a \textit{zero-length match} if \tcode{match[0].matched == true} and -\tcode{match[0].first == match[0].second}. \begin{note} For +\tcode{match[0].first == match[0].second}. +\begin{note} +For example, this can occur when the part of the regular expression that matched consists only of an assertion (such as \verb|'^'|, \verb|'$'|, -\tcode{'$\backslash$b'}, \tcode{'$\backslash$B'}). \end{note} +\tcode{'$\backslash$b'}, \tcode{'$\backslash$B'}). +\end{note} \rSec3[re.regiter.cnstr]{Constructors} -\indexlibrary{\idxcode{regex_iterator}!constructor}% +\indexlibraryctor{regex_iterator}% \begin{itemdecl} regex_iterator(); \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs an end-of-sequence iterator. +\pnum +\effects +Constructs an end-of-sequence iterator. \end{itemdescr} -\indexlibrary{\idxcode{regex_iterator}!constructor}% +\indexlibraryctor{regex_iterator}% \begin{itemdecl} regex_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, @@ -3024,7 +3200,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects Initializes \tcode{begin} and \tcode{end} to +\pnum +\effects +Initializes \tcode{begin} and \tcode{end} to \tcode{a} and \tcode{b}, respectively, sets \tcode{pregex} to \tcode{addressof(re)}, sets \tcode{flags} to \tcode{m}, then calls \tcode{regex_search(begin, end, match, *pregex, flags)}. If this @@ -3041,7 +3219,8 @@ \begin{itemdescr} \pnum -\returns \tcode{true} if \tcode{*this} and \tcode{right} are both end-of-sequence +\returns +\tcode{true} if \tcode{*this} and \tcode{right} are both end-of-sequence iterators or if the following conditions all hold: \begin{itemize} \item \tcode{begin == right.begin}, @@ -3061,7 +3240,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{match}. +\pnum +\returns +\tcode{match}. \end{itemdescr} \indexlibrarymember{operator->}{regex_iterator}% @@ -3070,7 +3251,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{addressof(match)}. +\pnum +\returns +\tcode{addressof(match)}. \end{itemdescr} \rSec3[re.regiter.incr]{Increment} @@ -3083,7 +3266,8 @@ \begin{itemdescr} \pnum -\effects Constructs a local variable \tcode{start} of type \tcode{BidirectionalIterator} and +\effects +Constructs a local variable \tcode{start} of type \tcode{BidirectionalIterator} and initializes it with the value of \tcode{match[0].second}. \pnum @@ -3091,8 +3275,8 @@ sets \tcode{*this} to the end-of-sequence iterator and returns \tcode{*this}. \pnum -\indexlibrary{\idxcode{match_not_null}}% -\indexlibrary{\idxcode{match_continuous}}% +\indexlibraryglobal{match_not_null}% +\indexlibraryglobal{match_continuous}% Otherwise, if the iterator holds a zero-length match, the operator calls: \begin{codeblock} regex_search(start, end, match, *pregex, @@ -3103,7 +3287,7 @@ the most recent match was not a zero-length match. \pnum -\indexlibrary{\idxcode{match_prev_avail}}% +\indexlibraryglobal{match_prev_avail}% If the most recent match was not a zero-length match, the operator sets \tcode{flags} to \tcode{flags | regex_constants::match_prev_avail} and calls \tcode{regex_search(start, end, match, *pregex, flags)}. If the call returns @@ -3119,19 +3303,23 @@ shall return \tcode{distance(begin, match[i].\brk{}first)}. \pnum -\begin{note} This means that \tcode{match.position(i)} gives the +\begin{note} +This means that \tcode{match.position(i)} gives the offset from the beginning of the target sequence, which is often not the same as the offset from the sequence passed in the call -to \tcode{regex_search}. \end{note} +to \tcode{regex_search}. +\end{note} \pnum It is unspecified how the implementation makes these adjustments. \pnum -\begin{note} This means that a compiler may call an +\begin{note} +This means that a compiler may call an implementation-specific search function, in which case a program-defined specialization of \tcode{regex_search} will not be -called. \end{note} +called. +\end{note} \end{itemdescr} \indexlibrarymember{regex_iterator}{operator++}% @@ -3140,7 +3328,8 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects +\pnum +\effects As if by: \begin{codeblock} regex_iterator tmp = *this; @@ -3152,7 +3341,7 @@ \rSec2[re.tokiter]{Class template \tcode{regex_token_iterator}} \pnum -\indexlibrary{\idxcode{regex_token_iterator}}% +\indexlibraryglobal{regex_token_iterator}% The class template \tcode{regex_token_iterator} is an iterator adaptor; that is to say it represents a new view of an existing iterator sequence, by enumerating all the occurrences of a regular expression within that @@ -3169,7 +3358,7 @@ expression specified. \pnum -\indexlibrary{\idxcode{match_results}}% +\indexlibraryglobal{match_results}% After it is constructed, the iterator finds and stores a value \tcode{regex_iterator position} and sets the internal count \tcode{N} to zero. It also maintains a sequence @@ -3275,12 +3464,12 @@ private: using position_iterator = - regex_iterator; // \expos - position_iterator position; // \expos - const value_type* result; // \expos - value_type suffix; // \expos - size_t N; // \expos - vector subs; // \expos + regex_iterator; // \expos + position_iterator position; // \expos + const value_type* result; // \expos + value_type suffix; // \expos + size_t N; // \expos + vector subs; // \expos }; } \end{codeblock} @@ -3296,10 +3485,12 @@ final sequence. \pnum -\begin{note} For a suffix iterator, data +\begin{note} +For a suffix iterator, data member \tcode{suffix.first} is the same as the end of the last match found, and \tcode{suffix\brk.second} is the same as the end of the target -sequence \end{note} +sequence. +\end{note} \pnum The \textit{current match} is \tcode{(*position).prefix()} if \tcode{subs[N] == -1}, or @@ -3307,17 +3498,18 @@ \rSec3[re.tokiter.cnstr]{Constructors} -\indexlibrary{\idxcode{regex_token_iterator}!constructor}% +\indexlibraryctor{regex_token_iterator}% \begin{itemdecl} regex_token_iterator(); \end{itemdecl} \begin{itemdescr} \pnum -\effects Constructs the end-of-sequence iterator. +\effects +Constructs the end-of-sequence iterator. \end{itemdescr} -\indexlibrary{\idxcode{regex_token_iterator}!constructor}% +\indexlibraryctor{regex_token_iterator}% \begin{itemdecl} regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, @@ -3347,7 +3539,8 @@ \tcode{>= -1}. \pnum -\effects The first constructor initializes the member \tcode{subs} to hold the single +\effects +The first constructor initializes the member \tcode{subs} to hold the single value \tcode{submatch}. The second, third, and fourth constructors initialize the member \tcode{subs} to hold a copy of the sequence of integer values @@ -3373,7 +3566,8 @@ \begin{itemdescr} \pnum -\returns \tcode{true} if \tcode{*this} and \tcode{right} are both end-of-sequence iterators, +\returns +\tcode{true} if \tcode{*this} and \tcode{right} are both end-of-sequence iterators, or if \tcode{*this} and \tcode{right} are both suffix iterators and \tcode{suffix == right.suffix}; otherwise returns \tcode{false} if \tcode{*this} or \tcode{right} is an end-of-sequence iterator or a suffix iterator. Otherwise returns \tcode{true} if \tcode{position == right.position}, @@ -3388,7 +3582,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{*result}. +\pnum +\returns +\tcode{*result}. \end{itemdescr} @@ -3398,7 +3594,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum\returns \tcode{result}. +\pnum +\returns +\tcode{result}. \end{itemdescr} @@ -3411,7 +3609,8 @@ \begin{itemdescr} \pnum -\effects Constructs a local variable \tcode{prev} of +\effects +Constructs a local variable \tcode{prev} of type \tcode{position_iterator}, initialized with the value of \tcode{position}. @@ -3437,7 +3636,9 @@ \pnum Otherwise, sets \tcode{*this} to an end-of-sequence iterator. -\pnum\returns \tcode{*this} +\pnum +\returns +\tcode{*this} \end{itemdescr} \indexlibrarymember{regex_token_iterator}{operator++}% @@ -3446,9 +3647,13 @@ \end{itemdecl} \begin{itemdescr} -\pnum\effects Constructs a copy \tcode{tmp} of \tcode{*this}, then calls \tcode{++(*this)}. +\pnum +\effects +Constructs a copy \tcode{tmp} of \tcode{*this}, then calls \tcode{++(*this)}. -\pnum\returns \tcode{tmp}. +\pnum +\returns +\tcode{tmp}. \end{itemdescr} \rSec1[re.grammar]{Modified ECMAScript regular expression grammar} @@ -3456,14 +3661,14 @@ \indextext{grammar!regular expression}% \pnum -\indexlibrary{\idxcode{basic_regex}}% +\indexlibraryglobal{basic_regex}% \indextext{ECMAScript}% The regular expression grammar recognized by \tcode{basic_regex} objects constructed with the ECMAScript flag is that specified by ECMA-262, except as specified below. \pnum -\indexlibrary{\idxcode{locale}}% +\indexlibraryglobal{locale}% \indextext{regular expression traits}% Objects of type specialization of \tcode{basic_regex} store within themselves a default-constructed instance of their \tcode{traits} template parameter, henceforth @@ -3475,42 +3680,42 @@ \pnum The following productions within the ECMAScript grammar are modified as follows: -\begin{codeblock} -ClassAtom :: - - - ClassAtomNoDash - ClassAtomExClass - ClassAtomCollatingElement +\begin{ncbnf} +\renontermdef{ClassAtom}\br + \terminal{-}\br + ClassAtomNoDash\br + ClassAtomExClass\br + ClassAtomCollatingElement\br ClassAtomEquivalence -IdentityEscape :: - SourceCharacter but not c -\end{codeblock} +\renontermdef{IdentityEscape}\br + SourceCharacter \textnormal{\textbf{but not}} \terminal{c} +\end{ncbnf} \pnum The following new productions are then added: -\begin{codeblock} -ClassAtomExClass :: - [: ClassName :] +\begin{ncbnf} +\renontermdef{ClassAtomExClass}\br + \terminal{[:} ClassName \terminal{:]} -ClassAtomCollatingElement :: - [. ClassName .] +\renontermdef{ClassAtomCollatingElement}\br + \terminal{[.} ClassName \terminal{.]} -ClassAtomEquivalence :: - [= ClassName =] +\renontermdef{ClassAtomEquivalence}\br + \terminal{[=} ClassName \terminal{=]} -ClassName :: - ClassNameCharacter +\renontermdef{ClassName}\br + ClassNameCharacter\br ClassNameCharacter ClassName -ClassNameCharacter :: - SourceCharacter but not one of "." "=" ":" -\end{codeblock} +\renontermdef{ClassNameCharacter}\br + SourceCharacter \textnormal{\textbf{but not one of}} \terminal{.} \textnormal{\textbf{or}} \terminal{=} \textnormal{\textbf{or}} \terminal{:} +\end{ncbnf} \pnum -The productions \tcode{ClassAtomExClass}, \tcode{ClassAtomCollatingElement} -and \tcode{ClassAtomEquivalence} provide functionality +The productions \regrammarterm{ClassAtomExClass}, \regrammarterm{ClassAtomCollatingElement} +and \regrammarterm{ClassAtomEquivalence} provide functionality equivalent to that of the same features in regular expressions in POSIX. \pnum @@ -3520,9 +3725,9 @@ according to the rules in \tref{re.synopt}. \pnum -A \tcode{ClassName} production, when used in \tcode{ClassAtomExClass}, +A \regrammarterm{ClassName} production, when used in \regrammarterm{ClassAtomExClass}, is not valid if \tcode{traits_inst.lookup_classname} returns zero for -that name. The names recognized as valid \tcode{ClassName}s are +that name. The names recognized as valid \regrammarterm{ClassName}s are determined by the type of the traits class, but at least the following names shall be recognized: \tcode{alnum}, \tcode{alpha}, \tcode{blank}, \tcode{cntrl}, \tcode{digit}, @@ -3547,8 +3752,8 @@ \pnum \indexlibrary{regular expression traits!\idxcode{lookup_collatename}}% \indexlibrary{\idxcode{lookup_collatename}!regular expression traits}% -A \tcode{ClassName} production when used in -a \tcode{ClassAtomCollatingElement} production is not valid +A \regrammarterm{ClassName} production when used in +a \regrammarterm{ClassAtomCollatingElement} production is not valid if the value returned by \tcode{traits_inst.lookup_collatename} for that name is an empty string. @@ -3564,33 +3769,35 @@ \pnum \indexlibrary{regular expression traits!\idxcode{transform_primary}}% \indextext{\idxcode{transform_primary}!regular expression traits}% -A \tcode{ClassName} production when used in -a \tcode{ClassAtomEquivalence} production is not valid if the value +A \regrammarterm{ClassName} production when used in +a \regrammarterm{ClassAtomEquivalence} production is not valid if the value returned by \tcode{traits_inst.lookup_collatename} for that name is an empty string or if the value returned by \tcode{traits_inst\brk.transform_primary} for the result of the call to \tcode{traits_inst.lookup_collatename} is an empty string. \pnum -\indexlibrary{\idxcode{regex_error}}% +\indexlibraryglobal{regex_error}% When the sequence of characters being transformed to a finite state machine contains an invalid class name the translator shall throw an exception object of type \tcode{regex_error}. \pnum -\indexlibrary{\idxcode{regex_error}}% +\indexlibraryglobal{regex_error}% If the \textit{CV} of a \textit{UnicodeEscapeSequence} is greater than the largest value that can be held in an object of type \tcode{charT} the translator shall -throw an exception object of type \tcode{regex_error}. \begin{note} +throw an exception object of type \tcode{regex_error}. +\begin{note} This means that values of the form \tcode{"uxxxx"} that do not fit in -a character are invalid. \end{note} +a character are invalid. +\end{note} \pnum Where the regular expression grammar requires the conversion of a sequence of characters to an integral value, this is accomplished by calling \tcode{traits_inst.value}. \pnum -\indexlibrary{\idxcode{match_flag_type}}% +\indexlibraryglobal{match_flag_type}% The behavior of the internal finite state machine representation when used to match a sequence of characters is as described in ECMA-262. The behavior is modified according @@ -3609,7 +3816,7 @@ \item otherwise, if \tcode{flags() \& regex_constants::collate} the two characters are equal if \tcode{traits_inst\brk.translate(c) == traits_inst\brk.translate(d)}; -\indexlibrary{\idxcode{syntax_option_type}!\idxcode{collate}}% +\indexlibrarymember{syntax_option_type}{collate}% \indextext{regular expression traits!\idxcode{translate}}% \indextext{\idxcode{translate}!regular expression traits}% \item otherwise, the two characters are equal if \tcode{c == d}. diff --git a/source/statements.tex b/source/statements.tex index f958ecf175..67de6a7ce3 100644 --- a/source/statements.tex +++ b/source/statements.tex @@ -6,6 +6,8 @@ \indextext{block statement|see{statement, compound}} +\rSec1[stmt.pre]{Preamble} + \pnum Except as indicated, statements are executed in sequence. @@ -166,7 +168,6 @@ \pnum Expression statements have the form - \begin{bnf} \nontermdef{expression-statement}\br \opt{expression} \terminal{;} @@ -245,14 +246,11 @@ \grammarterm{compound-statement}, it is as if it was rewritten to be a \grammarterm{compound-statement} containing the original substatement. \begin{example} - \begin{codeblock} if (x) int i; \end{codeblock} - can be equivalently rewritten as - \begin{codeblock} if (x) { int i; @@ -365,12 +363,10 @@ Any statement within the \tcode{switch} statement can be labeled with one or more case labels as follows: - \begin{ncbnf} \indextext{label!\idxcode{case}}% \keyword{case} constant-expression \terminal{:} \end{ncbnf} - where the \grammarterm{constant-expression} shall be a converted constant expression\iref{expr.const} of the adjusted type of the switch condition. No two of the case constants in @@ -379,11 +375,9 @@ \pnum \indextext{label!\idxcode{default}}% There shall be at most one label of the form - \begin{codeblock} default : \end{codeblock} - within a \tcode{switch} statement. \pnum @@ -478,14 +472,11 @@ it is as if it was rewritten to be a \grammarterm{compound-statement} containing the original statement. \begin{example} - \begin{codeblock} while (--x >= 0) int i; \end{codeblock} - can be equivalently rewritten as - \begin{codeblock} while (--x >= 0) { int i; @@ -615,7 +606,6 @@ If the \grammarterm{init-statement} is a declaration, the scope of the name(s) declared extends to the end of the \tcode{for} statement. \begin{example} - \begin{codeblock} int i = 42; int a[10]; @@ -681,8 +671,10 @@ \tcode{begin(\exposid{range})} and \tcode{end(\exposid{range})}, respectively, where \tcode{begin} and \tcode{end} are looked up in the associated namespaces\iref{basic.lookup.argdep}. -\begin{note} Ordinary unqualified lookup\iref{basic.lookup.unqual} is not -performed. \end{note} +\begin{note} +Ordinary unqualified lookup\iref{basic.lookup.unqual} is not +performed. +\end{note} \end{itemize} \end{itemize} @@ -716,8 +708,8 @@ % \begin{bnf} \nontermdef{jump-statement}\br - \keyword{break ;}\br - \keyword{continue ;}\br + \keyword{break} \terminal{;}\br + \keyword{continue} \terminal{;}\br \keyword{return} \opt{expr-or-braced-init-list} \terminal{;}\br coroutine-return-statement\br \keyword{goto} identifier \terminal{;} @@ -728,8 +720,12 @@ \indextext{scope!destructor and exit from}% On exit from a scope (however accomplished), objects with automatic storage duration\iref{basic.stc.auto} that have been constructed in that scope are destroyed -in the reverse order of their construction. \begin{note} For temporaries, -see~\ref{class.temporary}. \end{note} Transfer out of a loop, out of a block, or back +in the reverse order of their construction. +\begin{note} +For temporaries, +see~\ref{class.temporary}. +\end{note} +Transfer out of a loop, out of a block, or back past an initialized variable with automatic storage duration involves the destruction of objects with automatic storage duration that are in @@ -738,10 +734,10 @@ \begin{note} However, the program can be terminated (by calling \indextext{\idxcode{exit}}% -\indexlibrary{\idxcode{exit}}% +\indexlibraryglobal{exit}% \tcode{std::exit()} or \indextext{\idxcode{abort}}% -\indexlibrary{\idxcode{abort}}% +\indexlibraryglobal{abort}% \tcode{std::abort()}\iref{support.start.term}, for example) without destroying objects with automatic storage duration. \end{note} @@ -773,7 +769,6 @@ and causes control to pass to the loop-continuation portion of the smallest enclosing \grammarterm{iteration-statement}, that is, to the end of the loop. More precisely, in each of the statements - \begin{minipage}{.30\hsize} \begin{codeblock} while (foo) { @@ -885,11 +880,9 @@ \begin{ncsimplebnf} \terminal{\{} S\terminal{;} \terminal{goto} \exposid{final-suspend}\terminal{;} \terminal{\}} \end{ncsimplebnf} - where \exposid{final-suspend} is the exposition-only label defined in \ref{dcl.fct.def.coroutine} and \placeholder{S} is defined as follows: - \begin{itemize} \item \placeholder{S} is \placeholder{p}\tcode{.return_value(}\grammarterm{expr-or-braced-init-list}{}\tcode{)}, @@ -921,7 +914,6 @@ \pnum A declaration statement introduces one or more new identifiers into a block; it has the form - \begin{bnf} \nontermdef{declaration-statement}\br block-declaration @@ -958,7 +950,6 @@ In such a case, the variables with vacuous initialization are constructed in the order of their declaration. \begin{example} - \begin{codeblock} void f() { // ... @@ -996,7 +987,6 @@ re-enters the declaration recursively while the variable is being initialized, the behavior is undefined. \begin{example} - \begin{codeblock} int foo(int i) { static int s = foo(2*i); // recursive call - undefined @@ -1056,7 +1046,6 @@ The remaining cases are \grammarterm{declaration}{s}. \begin{example} - \begin{codeblock} class T { // ... @@ -1090,7 +1079,6 @@ declaration. \end{note} \begin{example} - \begin{codeblock} struct T1 { T1 operator()(int x) { return T1(x); } @@ -1108,5 +1096,5 @@ // since it depends on \tcode{T2} being a type-name } \end{codeblock} -\end{example}% +\end{example} \indextext{statement|)} diff --git a/source/std.tex b/source/std.tex index 1d9c01fb5a..f8da262ef6 100644 --- a/source/std.tex +++ b/source/std.tex @@ -59,9 +59,10 @@ \input{tables} \makeindex[generalindex] +\makeindex[grammarindex] \makeindex[headerindex] \makeindex[libraryindex] -\makeindex[grammarindex] +\makeindex[conceptindex] \makeindex[impldefindex] \makeglossary[xrefindex] \makeglossary[xrefdelta] diff --git a/source/strings.tex b/source/strings.tex index 612d8236df..374c5974f0 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -130,25 +130,32 @@ \tcode{X::state_type} & & (described in~\ref{char.traits.typedefs}) & compile-time \\ \rowsep \tcode{X::eq(c,d)} & \tcode{bool} & -\returns whether \tcode{c} is to be treated as equal to \tcode{d}. & constant \\ \rowsep +\returns +whether \tcode{c} is to be treated as equal to \tcode{d}. & constant \\ \rowsep \tcode{X::lt(c,d)} & \tcode{bool} & -\returns whether \tcode{c} is to be treated as less than \tcode{d}. & constant \\ \rowsep +\returns +whether \tcode{c} is to be treated as less than \tcode{d}. & constant \\ \rowsep \tcode{X::compare(p,q,n)} & \tcode{int} & -\returns \tcode{0} if for each \tcode{i} in \tcode{[0,n)}, \tcode{X::eq(p[i],q[i])} +\returns +\tcode{0} if for each \tcode{i} in \tcode{[0,n)}, \tcode{X::eq(p[i],q[i])} is \tcode{true}; else, a negative value if, for some \tcode{j} in \tcode{[0,n)}, \tcode{X::lt(p[j],q[j])} is \tcode{true} and for each \tcode{i} in \tcode{[0,j)} \tcode{X::eq(p[i],q[i])} is \tcode{true}; else a positive value. & linear \\ \rowsep \tcode{X::length(p)} & \tcode{size_t} & -\returns the smallest \tcode{i} such that \tcode{X::eq(p[i],charT())} is \tcode{true}. & linear \\ \rowsep +\returns +the smallest \tcode{i} such that \tcode{X::eq(p[i],charT())} is \tcode{true}. & linear \\ \rowsep \tcode{X::find(p,n,c)} & \tcode{const X::char_type*} & -\returns the smallest \tcode{q} in \tcode{[p,p+n)} such that +\returns +the smallest \tcode{q} in \tcode{[p,p+n)} such that \tcode{X::eq(*q,c)} is \tcode{true}, zero otherwise. & linear \\ \rowsep \tcode{X::move(s,p,n)} & \tcode{X::char_type*} & for each \tcode{i} in \tcode{[0,n)}, performs \tcode{X::assign(s[i],p[i])}. Copies correctly even where the ranges \tcode{[p,p+n)} and \tcode{[s,s+n)} overlap.\br \returns \tcode{s}. & linear \\ \rowsep \tcode{X::copy(s,p,n)} & \tcode{X::char_type*} & -\expects \tcode{p} not in \tcode{[s,s+n)}. \br -\returns \tcode{s}.\br +\expects +\tcode{p} not in \tcode{[s,s+n)}. \br +\returns +\tcode{s}.\br for each \tcode{i} in \tcode{[0,n)}, performs \tcode{X::assign(s[i],p[i])}. & linear \\ \rowsep \tcode{X::assign(r,d)} & (not used) & @@ -156,38 +163,41 @@ \tcode{X::assign\-(s,n,c)} & \tcode{X::char_type*} & for each \tcode{i} in \tcode{[0,n)}, performs \tcode{X::assign(s[i],c)}.\br -\returns \tcode{s}. & linear \\ \rowsep +\returns +\tcode{s}. & linear \\ \rowsep \tcode{X::not_eof(e)} & \tcode{int_type} & -\returns \tcode{e} if \tcode{X::eq_int_type(e,X::eof())} is \tcode{false}, +\returns +\tcode{e} if \tcode{X::eq_int_type(e,X::eof())} is \tcode{false}, otherwise a value \tcode{f} such that \tcode{X::eq_int_type(f,X::eof())} is \tcode{false}. & constant \\ \rowsep \tcode{X::to_char_type\-(e)} & \tcode{X::char_type} & -\returns if for some \tcode{c}, \tcode{X::eq_int_type(e,X::to_int_type(c))} +\returns +if for some \tcode{c}, \tcode{X::eq_int_type(e,X::to_int_type(c))} is \tcode{true}, \tcode{c}; else some unspecified value. & constant \\ \rowsep \tcode{X::to_int_type\-(c)} & \tcode{X::int_type} & -\returns some value \tcode{e}, constrained by the definitions of +\returns +some value \tcode{e}, constrained by the definitions of \tcode{to_char_type} and \tcode{eq_int_type}. & constant \\ \rowsep \tcode{X::eq_int_type\-(e,f)} & \tcode{bool} & -\returns for all \tcode{c} and \tcode{d}, \tcode{X::eq(c,d)} is equal to +\returns +for all \tcode{c} and \tcode{d}, \tcode{X::eq(c,d)} is equal to \tcode{X::eq_int_type(X::to_int_type(c), X::to_int_type(d))}; otherwise, yields \tcode{true} if \tcode{e} and \tcode{f} are both copies of \tcode{X::eof()}; otherwise, yields \tcode{false} if one of \tcode{e} and \tcode{f} is a copy of \tcode{X::eof()} and the other is not; otherwise the value is unspecified. & constant \\ \rowsep \tcode{X::eof()} & \tcode{X::int_type} & -\returns a value \tcode{e} such that \tcode{X::eq_int_type(e,X::to_int_type(c))} +\returns +a value \tcode{e} such that \tcode{X::eq_int_type(e,X::to_int_type(c))} is \tcode{false} for all values \tcode{c}. & constant \\ \end{libreqtab4d} \pnum The class template - -\indexlibrary{\idxcode{char_traits}}% +\indexlibraryglobal{char_traits}% \begin{codeblock} template struct char_traits; \end{codeblock} - -is provided in the header -\tcode{} +is provided in the header \libheader{string} as a basis for explicit specializations. \rSec2[char.traits.typedefs]{Traits typedefs} @@ -231,7 +241,7 @@ \rSec2[char.traits.specializations]{\tcode{char_traits} specializations} -\indexlibrary{\idxcode{char_traits}}% +\indexlibraryglobal{char_traits}% \begin{codeblock} namespace std { template<> struct char_traits; @@ -243,10 +253,8 @@ \end{codeblock} \pnum -The header -\tcode{} -defines five -specializations of the class template +The header \libheader{string} +defines five specializations of the class template \tcode{char_traits}: \tcode{char_traits<\brk{}char>}, \tcode{char_traits}, @@ -258,7 +266,7 @@ \rSec3[char.traits.specializations.char]{\tcode{struct char_traits}} -\indexlibrary{\idxcode{char_traits}}% +\indexlibraryglobal{char_traits}% \begin{codeblock} namespace std { template<> struct char_traits { @@ -291,10 +299,7 @@ \end{codeblock} \pnum -The type -\tcode{mbstate_t} -is defined in -\tcode{} +The type \tcode{mbstate_t} is defined in \libheader{cwchar} and can represent any of the conversion states that can occur in an \impldef{supported multibyte character encoding rules} set of supported multibyte character encoding rules. @@ -313,7 +318,7 @@ \rSec3[char.traits.specializations.char8.t]{\tcode{struct char_traits}} -\indexlibrary{\idxcode{char_traits}}% +\indexlibraryglobal{char_traits}% \begin{codeblock} namespace std { template<> struct char_traits { @@ -355,7 +360,7 @@ \rSec3[char.traits.specializations.char16.t]{\tcode{struct char_traits}} -\indexlibrary{\idxcode{char_traits}}% +\indexlibraryglobal{char_traits}% \begin{codeblock} namespace std { template<> struct char_traits { @@ -401,7 +406,7 @@ \rSec3[char.traits.specializations.char32.t]{\tcode{struct char_traits}} -\indexlibrary{\idxcode{char_traits}}% +\indexlibraryglobal{char_traits}% \begin{codeblock} namespace std { template<> struct char_traits { @@ -447,7 +452,7 @@ \rSec3[char.traits.specializations.wchar.t]{\tcode{struct char_traits}} -\indexlibrary{\idxcode{char_traits}}% +\indexlibraryglobal{char_traits}% \begin{codeblock} namespace std { template<> struct char_traits { @@ -520,7 +525,7 @@ \tcode{basic_string<\brk{}wchar_t>}, respectively. \rSec2[string.syn]{Header \tcode{} synopsis} -\indexhdr{string}% +\indexheader{string}% \begin{codeblock} #include @@ -727,7 +732,7 @@ \rSec2[basic.string]{Class template \tcode{basic_string}} \pnum -\indexlibrary{\idxcode{basic_string}}% +\indexlibraryglobal{basic_string}% The class template \tcode{basic_string} @@ -751,7 +756,7 @@ and \tcode{size() <= capacity()} is \tcode{true}. -\indexlibrary{\idxcode{basic_string}}% +\indexlibraryglobal{basic_string}% \indexlibrarymember{traits_type}{basic_string}% \indexlibrarymember{value_type}{basic_string}% \indexlibrarymember{allocator_type}{basic_string}% @@ -1113,7 +1118,7 @@ \rSec3[string.cons]{Constructors and assignment operators} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} constexpr explicit basic_string(const Allocator& a) noexcept; \end{itemdecl} @@ -1125,7 +1130,7 @@ \tcode{size()} is equal to \tcode{0}. \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} constexpr basic_string(const basic_string& str); constexpr basic_string(basic_string&& str) noexcept; @@ -1142,7 +1147,7 @@ In the second form, \tcode{str} is left in a valid but unspecified state. \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} constexpr basic_string(const basic_string& str, size_type pos, const Allocator& a = Allocator()); @@ -1159,7 +1164,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} template constexpr basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); @@ -1172,7 +1177,8 @@ is \tcode{true}. \pnum -\effects Creates a variable, \tcode{sv}, +\effects +Creates a variable, \tcode{sv}, as if by \tcode{basic_string_view sv = t;} and then behaves the same as: \begin{codeblock} @@ -1180,7 +1186,7 @@ \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} template constexpr explicit basic_string(const T& t, const Allocator& a = Allocator()); @@ -1199,19 +1205,21 @@ \end{itemize} \pnum -\effects Creates a variable, \tcode{sv}, as if by +\effects +Creates a variable, \tcode{sv}, as if by \tcode{basic_string_view sv = t;} and then behaves the same as \tcode{basic_string(sv.data(), sv.size(), a)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} constexpr basic_string(const charT* s, size_type n, const Allocator& a = Allocator()); \end{itemdecl} \begin{itemdescr} \pnum -\expects \range{s}{s + n} is a valid range. +\expects +\range{s}{s + n} is a valid range. \pnum \effects @@ -1223,7 +1231,7 @@ \tcode{traits::compare(data(), s, n)} is equal to \tcode{0}. \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} constexpr basic_string(const charT* s, const Allocator& a = Allocator()); \end{itemdecl} @@ -1238,10 +1246,11 @@ \end{note} \pnum -\effects Equivalent to: \tcode{basic_string(s, traits::length(s), a)}. +\effects +Equivalent to: \tcode{basic_string(s, traits::length(s), a)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} constexpr basic_string(size_type n, charT c, const Allocator& a = Allocator()); \end{itemdecl} @@ -1260,7 +1269,7 @@ Constructs an object whose value consists of \tcode{n} copies of \tcode{c}. \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} template constexpr basic_string(InputIterator begin, InputIterator end, const Allocator& a = Allocator()); @@ -1278,17 +1287,18 @@ as indicated in \tref{container.seq.req}. \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} constexpr basic_string(initializer_list il, const Allocator& a = Allocator()); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_string(il.begin(), il.end(), a)}. +\effects +Equivalent to \tcode{basic_string(il.begin(), il.end(), a)}. \end{itemdescr} -\indexlibrary{\idxcode{basic_string}!constructor}% +\indexlibraryctor{basic_string}% \begin{itemdecl} constexpr basic_string(const basic_string& str, const Allocator& alloc); constexpr basic_string(basic_string&& str, const Allocator& alloc); @@ -1296,13 +1306,15 @@ \begin{itemdescr} \pnum -\effects Constructs an object whose value is +\effects +Constructs an object whose value is that of \tcode{str} prior to this call. The stored allocator is constructed from \tcode{alloc}. In the second form, \tcode{str} is left in a valid but unspecified state. \pnum -\throws The second form throws nothing if \tcode{alloc == str.get_allocator()}. +\throws +The second form throws nothing if \tcode{alloc == str.get_allocator()}. \end{itemdescr} \begin{itemdecl} @@ -1395,7 +1407,8 @@ \end{itemize} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} basic_string_view sv = t; return assign(sv); @@ -1409,7 +1422,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return *this = basic_string_view(s);} \end{itemdescr} @@ -1420,7 +1434,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return *this = basic_string_view(addressof(c), 1); \end{codeblock} @@ -1433,7 +1448,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return *this = basic_string_view(il.begin(), il.size()); \end{codeblock} @@ -1514,7 +1530,8 @@ A count of the number of char-like objects currently in the string. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} \indexlibrarymember{max_size}{basic_string}% @@ -1529,7 +1546,8 @@ \tcode{basic_string}. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} \indexlibrarymember{resize}{basic_string}% @@ -1543,7 +1561,6 @@ Alters the value of \tcode{*this} as follows: - \begin{itemize} \item If @@ -1578,7 +1595,8 @@ The size of the allocated storage in the string. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} \indexlibrarymember{reserve}{basic_string}% @@ -1618,21 +1636,29 @@ \begin{itemdescr} \pnum -\effects \tcode{shrink_to_fit} is a non-binding request to reduce -\tcode{capacity()} to \tcode{size()}. \begin{note} The request is non-binding to -allow latitude for implementation-specific optimizations. \end{note} +\effects +\tcode{shrink_to_fit} is a non-binding request to reduce +\tcode{capacity()} to \tcode{size()}. +\begin{note} +The request is non-binding to +allow latitude for implementation-specific optimizations. +\end{note} It does not increase \tcode{capacity()}, but may reduce \tcode{capacity()} by causing reallocation. \pnum -\complexity If the size is not equal to the old capacity, +\complexity +If the size is not equal to the old capacity, linear in the size of the sequence; otherwise constant. \pnum -\remarks Reallocation invalidates all the references, pointers, and iterators +\remarks +Reallocation invalidates all the references, pointers, and iterators referring to the elements in the sequence, as well as the past-the-end iterator. -\begin{note} If no reallocation happens, they remain valid. \end{note} +\begin{note} +If no reallocation happens, they remain valid. +\end{note} \end{itemdescr} \indexlibrarymember{clear}{basic_string}% @@ -1653,7 +1679,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return size() == 0;} \end{itemdescr} @@ -1667,19 +1694,23 @@ \begin{itemdescr} \pnum -\expects \tcode{pos <= size()}. +\expects +\tcode{pos <= size()}. \pnum -\returns \tcode{*(begin() + pos)} if \tcode{pos < size()}. Otherwise, +\returns +\tcode{*(begin() + pos)} if \tcode{pos < size()}. Otherwise, returns a reference to an object of type \tcode{charT} with value \tcode{charT()}, where modifying the object to any value other than \tcode{charT()} leads to undefined behavior. \pnum -\throws Nothing. +\throws +Nothing. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} \indexlibrarymember{at}{basic_string}% @@ -1743,7 +1774,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return append(str);} +\effects +Equivalent to: \tcode{return append(str);} \end{itemdescr} @@ -1782,7 +1814,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return append(s);} +\effects +Equivalent to: \tcode{return append(s);} \end{itemdescr} \indexlibrarymember{operator+=}{basic_string}% @@ -1792,7 +1825,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return append(size_type\{1\}, c);} +\effects +Equivalent to: \tcode{return append(size_type\{1\}, c);} \end{itemdescr} \indexlibrarymember{operator+=}{basic_string}% @@ -1802,7 +1836,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return append(il);} +\effects +Equivalent to: \tcode{return append(il);} \end{itemdescr} @@ -1815,7 +1850,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return append(str.data(), str.size());} +\effects +Equivalent to: \tcode{return append(str.data(), str.size());} \end{itemdescr} \indexlibrarymember{append}{basic_string}% @@ -1893,10 +1929,12 @@ \begin{itemdescr} \pnum -\expects \range{s}{s + n} is a valid range. +\expects +\range{s}{s + n} is a valid range. \pnum -\effects Appends a copy of the range \range{s}{s + n} to the string. +\effects +Appends a copy of the range \range{s}{s + n} to the string. \pnum \returns @@ -1910,7 +1948,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return append(s, traits::length(s));} +\effects +Equivalent to: \tcode{return append(s, traits::length(s));} \end{itemdescr} \indexlibrarymember{append}{basic_string}% @@ -1920,10 +1959,12 @@ \begin{itemdescr} \pnum -\effects Appends \tcode{n} copies of \tcode{c} to the string. +\effects +Appends \tcode{n} copies of \tcode{c} to the string. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{append}{basic_string}% @@ -1939,7 +1980,8 @@ iterator\iref{container.requirements.general}. \pnum -\effects Equivalent to: \tcode{return append(basic_string(first, last, get_allocator()));} +\effects +Equivalent to: \tcode{return append(basic_string(first, last, get_allocator()));} \end{itemdescr} \indexlibrarymember{append}{basic_string}% @@ -1949,7 +1991,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return append(il.begin(), il.size());} +\effects +Equivalent to: \tcode{return append(il.begin(), il.size());} \end{itemdescr} \indexlibrarymember{push_back}{basic_string}% @@ -1973,7 +2016,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return *this = str;} +\effects +Equivalent to: \tcode{return *this = str;} \end{itemdescr} \indexlibrarymember{assign}{basic_string}% @@ -1985,7 +2029,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return *this = std::move(str);} +\effects +Equivalent to: \tcode{return *this = std::move(str);} \end{itemdescr} @@ -2049,7 +2094,8 @@ \end{itemize} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} basic_string_view sv = t; return assign(sv.substr(pos, n)); @@ -2063,7 +2109,8 @@ \begin{itemdescr} \pnum -\expects \range{s}{s + n} is a valid range. +\expects +\range{s}{s + n} is a valid range. \pnum \effects @@ -2082,7 +2129,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return assign(s, traits::length(s));} +\effects +Equivalent to: \tcode{return assign(s, traits::length(s));} \end{itemdescr} \indexlibrarymember{assign}{basic_string}% @@ -2092,7 +2140,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return assign(il.begin(), il.size());} +\effects +Equivalent to: \tcode{return assign(il.begin(), il.size());} \end{itemdescr} \indexlibrarymember{assign}{basic_string}% @@ -2102,7 +2151,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} clear(); resize(n, c); @@ -2123,7 +2173,8 @@ iterator\iref{container.requirements.general}. \pnum -\effects Equivalent to: \tcode{return assign(basic_string(first, last, get_allocator()));} +\effects +Equivalent to: \tcode{return assign(basic_string(first, last, get_allocator()));} \end{itemdescr} \rSec4[string.insert]{\tcode{basic_string::insert}} @@ -2135,7 +2186,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return insert(pos, str.data(), str.size());} +\effects +Equivalent to: \tcode{return insert(pos, str.data(), str.size());} \end{itemdescr} \indexlibrarymember{insert}{basic_string}% @@ -2200,7 +2252,8 @@ \end{itemize} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} basic_string_view sv = t; return insert(pos1, sv.substr(pos2, n)); @@ -2214,7 +2267,8 @@ \begin{itemdescr} \pnum -\expects \range{s}{s + n} is a valid range. +\expects +\range{s}{s + n} is a valid range. \pnum \throws @@ -2225,7 +2279,8 @@ \end{itemize} \pnum -\effects Inserts a copy of the range \range{s}{s + n} +\effects +Inserts a copy of the range \range{s}{s + n} immediately before the character at position \tcode{pos} if \tcode{pos < size()}, or otherwise at the end of the string. @@ -2241,7 +2296,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return insert(pos, s, traits::length(s));} +\effects +Equivalent to: \tcode{return insert(pos, s, traits::length(s));} \end{itemdescr} \indexlibrarymember{insert}{basic_string}% @@ -2305,7 +2361,8 @@ Inserts \tcode{n} copies of \tcode{c} at the position \tcode{p}. \pnum -\returns An iterator which refers to the first inserted character, or +\returns +An iterator which refers to the first inserted character, or \tcode{p} if \tcode{n == 0}. \end{itemdescr} @@ -2332,7 +2389,8 @@ \tcode{insert(p - begin(), basic_string(first, last, get_allocator()))}. \pnum -\returns An iterator which refers to the first inserted character, or +\returns +An iterator which refers to the first inserted character, or \tcode{p} if \tcode{first == last}. \end{itemdescr} @@ -2343,7 +2401,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return insert(p, il.begin(), il.end());} +\effects +Equivalent to: \tcode{return insert(p, il.begin(), il.end());} \end{itemdescr} \rSec4[string.erase]{\tcode{basic_string::erase}} @@ -2383,7 +2442,8 @@ \tcode{p} is a valid dereferenceable iterator on \tcode{*this}. \pnum -\throws Nothing. +\throws +Nothing. \pnum \effects @@ -2410,7 +2470,8 @@ \tcode{*this}. \range{first}{last} is a valid range. \pnum -\throws Nothing. +\throws +Nothing. \pnum \effects @@ -2437,7 +2498,8 @@ \tcode{!empty()}. \pnum -\throws Nothing. +\throws +Nothing. \pnum \effects @@ -2453,7 +2515,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return replace(pos1, n1, str.data(), str.size());} +\effects +Equivalent to: \tcode{return replace(pos1, n1, str.data(), str.size());} \end{itemdescr} \indexlibrarymember{replace}{basic_string}% @@ -2533,7 +2596,8 @@ \begin{itemdescr} \pnum -\expects \range{s}{s + n2} is a valid range. +\expects +\range{s}{s + n2} is a valid range. \pnum \throws @@ -2545,7 +2609,8 @@ \end{itemize} \pnum -\effects Determines the effective length \tcode{xlen} of the string to be +\effects +Determines the effective length \tcode{xlen} of the string to be removed as the smaller of \tcode{n1} and \tcode{size() - pos1}. If \tcode{size() - xlen >= max_size() - n2} throws \tcode{length_error}. Otherwise, the function replaces the characters in the range @@ -2564,7 +2629,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: \tcode{return replace(pos, n, s, traits::length(s));} +\effects +Equivalent to: \tcode{return replace(pos, n, s, traits::length(s));} \end{itemdescr} \indexlibrarymember{replace}{basic_string}% @@ -2583,7 +2649,8 @@ \end{itemize} \pnum -\effects Determines the effective length \tcode{xlen} of the string to be +\effects +Determines the effective length \tcode{xlen} of the string to be removed as the smaller of \tcode{n1} and \tcode{size() - pos1}. If \tcode{size() - xlen >=} \tcode{max_size() - n2} throws \tcode{length_error}. Otherwise, the function replaces the characters in the range @@ -2591,7 +2658,8 @@ with \tcode{n2} copies of \tcode{c}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \indexlibrarymember{replace}{basic_string}% @@ -2665,7 +2733,8 @@ \begin{itemdescr} \pnum -\expects \range{begin()}{i1} and \range{i1}{i2} are valid ranges. +\expects +\range{begin()}{i1} and \range{i1}{i2} are valid ranges. \pnum \effects @@ -2713,7 +2782,9 @@ \effects Equivalent to: \tcode{return basic_string_view(*this).copy(s, n, pos);} -\begin{note} This does not terminate \tcode{s} with a null object. \end{note} +\begin{note} +This does not terminate \tcode{s} with a null object. +\end{note} \end{itemdescr} \rSec4[string.swap]{\tcode{basic_string::swap}} @@ -2740,10 +2811,12 @@ \tcode{*this}. \pnum -\throws Nothing. +\throws +Nothing. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} \rSec3[string.ops]{String operations} @@ -2759,11 +2832,13 @@ \begin{itemdescr} \pnum -\returns A pointer \tcode{p} such that \tcode{p + i == addressof(operator[](i))} for each +\returns +A pointer \tcode{p} such that \tcode{p + i == addressof(operator[](i))} for each \tcode{i} in \crange{0}{size()}. \pnum -\complexity Constant time. +\complexity +Constant time. \pnum \remarks @@ -2777,11 +2852,13 @@ \begin{itemdescr} \pnum -\returns A pointer \tcode{p} such that \tcode{p + i == addressof(operator[](i))} for each +\returns +A pointer \tcode{p} such that \tcode{p + i == addressof(operator[](i))} for each \tcode{i} in \crange{0}{size()}. \pnum -\complexity Constant time. +\complexity +Constant time. \pnum \remarks @@ -2796,7 +2873,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return basic_string_view(data(), size());} \end{itemdescr} @@ -3051,7 +3129,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \begin{codeblock} return compare(pos1, n1, basic_string_view(str), pos2, n2); \end{codeblock} @@ -3064,7 +3143,8 @@ \begin{itemdescr} \pnum -\effects Equivalent to: +\effects +Equivalent to: \tcode{return compare(basic_string_view(s));} \end{itemdescr} @@ -3128,7 +3208,7 @@ \rSec2[string.nonmembers]{Non-member functions} -\indexlibrary{\idxcode{basic_string}} +\indexlibraryglobal{basic_string} \rSec3[string.op.plus]{\tcode{operator+}} @@ -3327,7 +3407,8 @@ \end{itemdecl} \begin{itemdescr} \pnum -\effects Let \tcode{\placeholder{op}} be the operator. +\effects +Let \tcode{\placeholder{op}} be the operator. Equivalent to: \begin{codeblock} return basic_string_view(lhs) @\placeholder{op}@ basic_string_view(rhs); @@ -3380,7 +3461,6 @@ \tcode{str.max_size()}. Characters are extracted and appended until any of the following occurs: - \begin{itemize} \item \textit{n} @@ -3453,7 +3533,6 @@ to \tcode{str} as if by calling \tcode{str.append(1, c)} until any of the following occurs: - \begin{itemize} \item end-of-file occurs on the input sequence @@ -3514,7 +3593,7 @@ \rSec3[string.erasure]{Erasure} -\indexlibrary{\idxcode{erase}!\idxcode{basic_string}}% +\indexlibrarymember{erase}{basic_string}% \begin{itemdecl} template constexpr void erase(basic_string& c, const U& value); @@ -3526,7 +3605,7 @@ Equivalent to: \tcode{c.erase(remove(c.begin(), c.end(), value), c.end());} \end{itemdescr} -\indexlibrary{\idxcode{erase_if}!\idxcode{basic_string}}% +\indexlibrarymember{erase_if}{basic_string}% \begin{itemdecl} template constexpr void erase_if(basic_string& c, Predicate pred); @@ -3540,11 +3619,11 @@ \rSec2[string.conversions]{Numeric conversions} -\indexlibrary{\idxcode{stoi}}% -\indexlibrary{\idxcode{stol}}% -\indexlibrary{\idxcode{stoul}}% -\indexlibrary{\idxcode{stoll}}% -\indexlibrary{\idxcode{stoull}}% +\indexlibraryglobal{stoi}% +\indexlibraryglobal{stol}% +\indexlibraryglobal{stoul}% +\indexlibraryglobal{stoll}% +\indexlibraryglobal{stoull}% \begin{itemdecl} int stoi(const string& str, size_t* idx = nullptr, int base = 10); long stol(const string& str, size_t* idx = nullptr, int base = 10); @@ -3555,7 +3634,8 @@ \begin{itemdescr} \pnum -\effects The first two functions call \tcode{strtol(str.c_str(), ptr, base)}, +\effects +The first two functions call \tcode{strtol(str.c_str(), ptr, base)}, and the last three functions call \tcode{strtoul(str.c_str(), ptr, base)}, \tcode{strtoll(str.c_str(), ptr, base)}, and \tcode{strtoull(\brk{}str.c_str(), ptr, base)}, respectively. Each function returns the converted result, if any. The @@ -3565,10 +3645,12 @@ the index of the first unconverted element of \tcode{str}. \pnum -\returns The converted result. +\returns +The converted result. \pnum -\throws \tcode{invalid_argument} if \tcode{strtol}, \tcode{strtoul}, +\throws +\tcode{invalid_argument} if \tcode{strtol}, \tcode{strtoul}, \tcode{strtoll}, or \tcode{strtoull} reports that no conversion could be performed. Throws \tcode{out_of_range} if \tcode{strtol}, \tcode{strtoul}, \tcode{strtoll} or \tcode{strtoull} sets \tcode{errno} to \tcode{ERANGE}, @@ -3576,9 +3658,9 @@ for the return type. \end{itemdescr} -\indexlibrary{\idxcode{stof}}% -\indexlibrary{\idxcode{stod}}% -\indexlibrary{\idxcode{stold}}% +\indexlibraryglobal{stof}% +\indexlibraryglobal{stod}% +\indexlibraryglobal{stold}% \begin{itemdecl} float stof(const string& str, size_t* idx = nullptr); double stod(const string& str, size_t* idx = nullptr); @@ -3587,7 +3669,8 @@ \begin{itemdescr} \pnum -\effects These functions call +\effects +These functions call \tcode{strtof(str.c_str(), ptr)}, \tcode{strtod(str.c_str(), ptr)}, and \tcode{strtold(\brk{}str.c_str(), ptr)}, respectively. Each function returns the converted result, if any. The argument \tcode{ptr} designates a pointer to @@ -3597,10 +3680,12 @@ of \tcode{str}. \pnum -\returns The converted result. +\returns +The converted result. \pnum -\throws \tcode{invalid_argument} if \tcode{strtof}, \tcode{strtod}, or +\throws +\tcode{invalid_argument} if \tcode{strtof}, \tcode{strtod}, or \tcode{strtold} reports that no conversion could be performed. Throws \tcode{out_of_range} if \tcode{strtof}, \tcode{strtod}, or \tcode{strtold} sets \tcode{errno} to \tcode{ERANGE} @@ -3608,7 +3693,7 @@ values for the return type. \end{itemdescr} -\indexlibrary{\idxcode{to_string}}% +\indexlibraryglobal{to_string}% \begin{itemdecl} string to_string(int val); string to_string(unsigned val); @@ -3623,7 +3708,8 @@ \begin{itemdescr} \pnum -\returns Each function returns a \tcode{string} object holding the character +\returns +Each function returns a \tcode{string} object holding the character representation of the value of its argument that would be generated by calling \tcode{sprintf(buf, fmt, val)} with a format specifier of \tcode{"\%d"}, @@ -3637,11 +3723,11 @@ character buffer of sufficient size. \end{itemdescr} -\indexlibrary{\idxcode{stoi}}% -\indexlibrary{\idxcode{stol}}% -\indexlibrary{\idxcode{stoul}}% -\indexlibrary{\idxcode{stoll}}% -\indexlibrary{\idxcode{stoull}}% +\indexlibraryglobal{stoi}% +\indexlibraryglobal{stol}% +\indexlibraryglobal{stoul}% +\indexlibraryglobal{stoll}% +\indexlibraryglobal{stoull}% \begin{itemdecl} int stoi(const wstring& str, size_t* idx = nullptr, int base = 10); long stol(const wstring& str, size_t* idx = nullptr, int base = 10); @@ -3652,7 +3738,8 @@ \begin{itemdescr} \pnum -\effects The first two functions call \tcode{wcstol(str.c_str(), ptr, base)}, +\effects +The first two functions call \tcode{wcstol(str.c_str(), ptr, base)}, and the last three functions call \tcode{wcstoul(str.c_str(), ptr, base)}, \tcode{wcstoll(str.c_str(), ptr, base)}, and \tcode{wcstoull(\brk{}str.c_str(), ptr, base)}, respectively. Each function returns the converted result, if any. The @@ -3662,18 +3749,20 @@ the index of the first unconverted element of \tcode{str}. \pnum -\returns The converted result. +\returns +The converted result. \pnum -\throws \tcode{invalid_argument} if \tcode{wcstol}, \tcode{wcstoul}, \tcode{wcstoll}, or +\throws +\tcode{invalid_argument} if \tcode{wcstol}, \tcode{wcstoul}, \tcode{wcstoll}, or \tcode{wcstoull} reports that no conversion could be performed. Throws \tcode{out_of_range} if the converted value is outside the range of representable values for the return type. \end{itemdescr} -\indexlibrary{\idxcode{stof}}% -\indexlibrary{\idxcode{stod}}% -\indexlibrary{\idxcode{stold}}% +\indexlibraryglobal{stof}% +\indexlibraryglobal{stod}% +\indexlibraryglobal{stold}% \begin{itemdecl} float stof(const wstring& str, size_t* idx = nullptr); double stod(const wstring& str, size_t* idx = nullptr); @@ -3682,7 +3771,8 @@ \begin{itemdescr} \pnum -\effects These functions call \tcode{wcstof(str.c_str(), ptr)}, +\effects +These functions call \tcode{wcstof(str.c_str(), ptr)}, \tcode{wcstod(str.c_str(), ptr)}, and \tcode{wcstold(\brk{}str.c_str(), ptr)}, respectively. Each function returns the converted result, if any. The argument \tcode{ptr} designates a pointer to an object internal to @@ -3691,15 +3781,17 @@ the index of the first unconverted element of \tcode{str}. \pnum -\returns The converted result. +\returns +The converted result. \pnum -\throws \tcode{invalid_argument} if \tcode{wcstof}, \tcode{wcstod}, or \tcode{wcstold} reports that no +\throws +\tcode{invalid_argument} if \tcode{wcstof}, \tcode{wcstod}, or \tcode{wcstold} reports that no conversion could be performed. Throws \tcode{out_of_range} if \tcode{wcstof}, \tcode{wcstod}, or \tcode{wcstold} sets \tcode{errno} to \tcode{ERANGE}. \end{itemdescr} -\indexlibrary{\idxcode{to_wstring}}% +\indexlibraryglobal{to_wstring}% \begin{itemdecl} wstring to_wstring(int val); wstring to_wstring(unsigned val); @@ -3714,7 +3806,8 @@ \begin{itemdescr} \pnum -\returns Each function returns a \tcode{wstring} object holding the character +\returns +Each function returns a \tcode{wstring} object holding the character representation of the value of its argument that would be generated by calling \tcode{swprintf(buf, buffsz, fmt, val)} with a format specifier of \tcode{L"\%d"}, @@ -3731,14 +3824,14 @@ \rSec2[basic.string.hash]{Hash support} -\indexlibrary{\idxcode{hash}!\idxcode{string}}% -\indexlibrary{\idxcode{hash}!\idxcode{u16string}}% -\indexlibrary{\idxcode{hash}!\idxcode{u32string}}% -\indexlibrary{\idxcode{hash}!\idxcode{wstring}}% -\indexlibrary{\idxcode{hash}!\idxcode{pmr::string}}% -\indexlibrary{\idxcode{hash}!\idxcode{pmr::u16string}}% -\indexlibrary{\idxcode{hash}!\idxcode{pmr::u32string}}% -\indexlibrary{\idxcode{hash}!\idxcode{pmr::wstring}}% +\indexlibrarymember{hash}{string}% +\indexlibrarymember{hash}{u16string}% +\indexlibrarymember{hash}{u32string}% +\indexlibrarymember{hash}{wstring}% +\indexlibrarymember{hash}{pmr::string}% +\indexlibrarymember{hash}{pmr::u16string}% +\indexlibrarymember{hash}{pmr::u32string}% +\indexlibrarymember{hash}{pmr::wstring}% \begin{itemdecl} template<> struct hash; template<> struct hash; @@ -3813,7 +3906,8 @@ \tcode{wstring\{str, len\}}. \end{itemdescr} -\pnum \begin{note} +\pnum +\begin{note} The same suffix \tcode{s} is used for \tcode{chrono::duration} literals denoting seconds but there is no conflict, since duration suffixes apply to numbers and string literal suffixes apply to character array literals. \end{note} @@ -3831,7 +3925,7 @@ \rSec2[string.view.synop]{Header \tcode{} synopsis} -\indexhdr{string_view}% +\indexheader{string_view}% \begin{codeblock} namespace std { // \ref{string.view.template}, class template \tcode{basic_string_view} @@ -3888,7 +3982,7 @@ \rSec2[string.view.template]{Class template \tcode{basic_string_view}} -\indexlibrary{\idxcode{basic_string_view}}% +\indexlibraryglobal{basic_string_view}% \indexlibrarymember{traits_type}{basic_string_view}% \indexlibrarymember{value_type}{basic_string_view}% \indexlibrarymember{pointer}{basic_string_view}% @@ -4009,8 +4103,8 @@ constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const; private: - const_pointer data_; // \expos - size_type size_; // \expos + const_pointer data_; // \expos + size_type size_; // \expos }; \end{codeblock} @@ -4033,7 +4127,7 @@ \rSec3[string.view.cons]{Construction and assignment} -\indexlibrary{\idxcode{basic_string_view}!constructor}% +\indexlibraryctor{basic_string_view}% \begin{itemdecl} constexpr basic_string_view() noexcept; \end{itemdecl} @@ -4044,7 +4138,7 @@ \tcode{size_ == 0} and \tcode{data_ == nullptr}. \end{itemdescr} -\indexlibrary{\idxcode{basic_string_view}!constructor}% +\indexlibraryctor{basic_string_view}% \begin{itemdecl} constexpr basic_string_view(const charT* str); \end{itemdecl} @@ -4064,7 +4158,7 @@ \bigoh{\tcode{traits::length(str)}}. \end{itemdescr} -\indexlibrary{\idxcode{basic_string_view}!constructor}% +\indexlibraryctor{basic_string_view}% \begin{itemdecl} constexpr basic_string_view(const charT* str, size_type len); \end{itemdecl} @@ -4839,11 +4933,11 @@ \rSec2[string.view.hash]{Hash support} -\indexlibrary{\idxcode{hash}!\idxcode{string_view}}% -\indexlibrary{\idxcode{hash}!\idxcode{u8string_view}}% -\indexlibrary{\idxcode{hash}!\idxcode{u16string_view}}% -\indexlibrary{\idxcode{hash}!\idxcode{u32string_view}}% -\indexlibrary{\idxcode{hash}!\idxcode{wstring_view}}% +\indexlibrarymember{hash}{string_view}% +\indexlibrarymember{hash}{u8string_view}% +\indexlibrarymember{hash}{u16string_view}% +\indexlibrarymember{hash}{u32string_view}% +\indexlibrarymember{hash}{wstring_view}% \begin{itemdecl} template<> struct hash; template<> struct hash; @@ -4919,21 +5013,20 @@ \rSec2[cctype.syn]{Header \tcode{} synopsis} -\indexhdr{cctype}% -\indexlibrary{\idxcode{isalnum}}% -\indexlibrary{\idxcode{isalpha}}% -\indexlibrary{\idxcode{isblank}}% -\indexlibrary{\idxcode{iscntrl}}% -\indexlibrary{\idxcode{isdigit}}% -\indexlibrary{\idxcode{isgraph}}% -\indexlibrary{\idxcode{islower}}% -\indexlibrary{\idxcode{isprint}}% -\indexlibrary{\idxcode{ispunct}}% -\indexlibrary{\idxcode{isspace}}% -\indexlibrary{\idxcode{isupper}}% -\indexlibrary{\idxcode{isxdigit}}% -\indexlibrary{\idxcode{tolower}}% -\indexlibrary{\idxcode{toupper}}% +\indexlibraryglobal{isalnum}% +\indexlibraryglobal{isalpha}% +\indexlibraryglobal{isblank}% +\indexlibraryglobal{iscntrl}% +\indexlibraryglobal{isdigit}% +\indexlibraryglobal{isgraph}% +\indexlibraryglobal{islower}% +\indexlibraryglobal{isprint}% +\indexlibraryglobal{ispunct}% +\indexlibraryglobal{isspace}% +\indexlibraryglobal{isupper}% +\indexlibraryglobal{isxdigit}% +\indexlibraryglobal{tolower}% +\indexlibraryglobal{toupper}% \begin{codeblock} namespace std { int isalnum(int c); @@ -4954,37 +5047,35 @@ \end{codeblock} \pnum -\indexhdr{ctype.h}% -The contents and meaning of the header \tcode{} -are the same as the C standard library header \tcode{}. +The contents and meaning of the header \libheaderdef{cctype} +are the same as the C standard library header \libheader{ctype.h}. \xrefc{7.4} \rSec2[cwctype.syn]{Header \tcode{} synopsis} -\indexhdr{cwctype}% -\indexlibrary{\idxcode{wint_t}}% -\indexlibrary{\idxcode{wctrans_t}}% -\indexlibrary{\idxcode{wctype_t}}% -\indexlibrary{\idxcode{iswalnum}}% -\indexlibrary{\idxcode{iswalpha}}% -\indexlibrary{\idxcode{iswblank}}% -\indexlibrary{\idxcode{iswcntrl}}% -\indexlibrary{\idxcode{iswdigit}}% -\indexlibrary{\idxcode{iswgraph}}% -\indexlibrary{\idxcode{iswlower}}% -\indexlibrary{\idxcode{iswprint}}% -\indexlibrary{\idxcode{iswpunct}}% -\indexlibrary{\idxcode{iswspace}}% -\indexlibrary{\idxcode{iswupper}}% -\indexlibrary{\idxcode{iswxdigit}}% -\indexlibrary{\idxcode{iswctype}}% -\indexlibrary{\idxcode{wctype}}% -\indexlibrary{\idxcode{towlower}}% -\indexlibrary{\idxcode{towupper}}% -\indexlibrary{\idxcode{towctrans}}% -\indexlibrary{\idxcode{wctrans}}% -\indexlibrary{\idxcode{WEOF}}% +\indexlibraryglobal{wint_t}% +\indexlibraryglobal{wctrans_t}% +\indexlibraryglobal{wctype_t}% +\indexlibraryglobal{iswalnum}% +\indexlibraryglobal{iswalpha}% +\indexlibraryglobal{iswblank}% +\indexlibraryglobal{iswcntrl}% +\indexlibraryglobal{iswdigit}% +\indexlibraryglobal{iswgraph}% +\indexlibraryglobal{iswlower}% +\indexlibraryglobal{iswprint}% +\indexlibraryglobal{iswpunct}% +\indexlibraryglobal{iswspace}% +\indexlibraryglobal{iswupper}% +\indexlibraryglobal{iswxdigit}% +\indexlibraryglobal{iswctype}% +\indexlibraryglobal{wctype}% +\indexlibraryglobal{towlower}% +\indexlibraryglobal{towupper}% +\indexlibraryglobal{towctrans}% +\indexlibraryglobal{wctrans}% +\indexlibraryglobal{WEOF}% \begin{codeblock} namespace std { using wint_t = @\seebelow@; @@ -5015,38 +5106,36 @@ \end{codeblock} \pnum -\indexhdr{wctype.h}% -The contents and meaning of the header \tcode{} -are the same as the C standard library header \tcode{}. +The contents and meaning of the header \libheaderdef{cwctype} +are the same as the C standard library header \libheader{wctype.h}. \xrefc{7.30} \rSec2[cstring.syn]{Header \tcode{} synopsis} -\indexhdr{cstring}% -\indexlibrary{\idxcode{memchr}}% -\indexlibrary{\idxcode{memcmp}}% -\indexlibrary{\idxcode{memcpy}}% -\indexlibrary{\idxcode{memmove}}% -\indexlibrary{\idxcode{memset}}% -\indexlibrary{\idxcode{size_t}}% -\indexlibrary{\idxcode{strcat}}% -\indexlibrary{\idxcode{strchr}}% -\indexlibrary{\idxcode{strcmp}}% -\indexlibrary{\idxcode{strcoll}}% -\indexlibrary{\idxcode{strcpy}}% -\indexlibrary{\idxcode{strcspn}}% -\indexlibrary{\idxcode{strerror}}% -\indexlibrary{\idxcode{strlen}}% -\indexlibrary{\idxcode{strncat}}% -\indexlibrary{\idxcode{strncmp}}% -\indexlibrary{\idxcode{strncpy}}% -\indexlibrary{\idxcode{strpbrk}}% -\indexlibrary{\idxcode{strrchr}}% -\indexlibrary{\idxcode{strspn}}% -\indexlibrary{\idxcode{strstr}}% -\indexlibrary{\idxcode{strtok}}% -\indexlibrary{\idxcode{strxfrm}}% +\indexlibraryglobal{memchr}% +\indexlibraryglobal{memcmp}% +\indexlibraryglobal{memcpy}% +\indexlibraryglobal{memmove}% +\indexlibraryglobal{memset}% +\indexlibraryglobal{size_t}% +\indexlibraryglobal{strcat}% +\indexlibraryglobal{strchr}% +\indexlibraryglobal{strcmp}% +\indexlibraryglobal{strcoll}% +\indexlibraryglobal{strcpy}% +\indexlibraryglobal{strcspn}% +\indexlibraryglobal{strerror}% +\indexlibraryglobal{strlen}% +\indexlibraryglobal{strncat}% +\indexlibraryglobal{strncmp}% +\indexlibraryglobal{strncpy}% +\indexlibraryglobal{strpbrk}% +\indexlibraryglobal{strrchr}% +\indexlibraryglobal{strspn}% +\indexlibraryglobal{strstr}% +\indexlibraryglobal{strtok}% +\indexlibraryglobal{strxfrm}% \begin{codeblock} namespace std { using size_t = @\textit{see \ref{support.types.layout}}@; @@ -5062,18 +5151,18 @@ int strcoll(const char* s1, const char* s2); int strncmp(const char* s1, const char* s2, size_t n); size_t strxfrm(char* s1, const char* s2, size_t n); - const void* memchr(const void* s, int c, size_t n); // see \ref{library.c} - void* memchr(void* s, int c, size_t n); // see \ref{library.c} - const char* strchr(const char* s, int c); // see \ref{library.c} - char* strchr(char* s, int c); // see \ref{library.c} + const void* memchr(const void* s, int c, size_t n); // see \ref{library.c} + void* memchr(void* s, int c, size_t n); // see \ref{library.c} + const char* strchr(const char* s, int c); // see \ref{library.c} + char* strchr(char* s, int c); // see \ref{library.c} size_t strcspn(const char* s1, const char* s2); - const char* strpbrk(const char* s1, const char* s2); // see \ref{library.c} - char* strpbrk(char* s1, const char* s2); // see \ref{library.c} - const char* strrchr(const char* s, int c); // see \ref{library.c} - char* strrchr(char* s, int c); // see \ref{library.c} + const char* strpbrk(const char* s1, const char* s2); // see \ref{library.c} + char* strpbrk(char* s1, const char* s2); // see \ref{library.c} + const char* strrchr(const char* s, int c); // see \ref{library.c} + char* strrchr(char* s, int c); // see \ref{library.c} size_t strspn(const char* s1, const char* s2); - const char* strstr(const char* s1, const char* s2); // see \ref{library.c} - char* strstr(char* s1, const char* s2); // see \ref{library.c} + const char* strstr(const char* s1, const char* s2); // see \ref{library.c} + char* strstr(char* s1, const char* s2); // see \ref{library.c} char* strtok(char* s1, const char* s2); void* memset(void* s, int c, size_t n); char* strerror(int errnum); @@ -5084,9 +5173,8 @@ \end{codeblock} \pnum -\indexhdr{string.h}% -The contents and meaning of the header \tcode{} -are the same as the C standard library header \tcode{}. +The contents and meaning of the header \libheaderdef{cstring} +are the same as the C standard library header \libheader{string.h}. \pnum The functions \tcode{strerror} and \tcode{strtok} are not required to avoid data @@ -5109,74 +5197,74 @@ \rSec2[cwchar.syn]{Header \tcode{} synopsis} -\indexhdr{cwchar}% -\indexlibrary{\idxcode{NULL}}% -\indexlibrary{\idxcode{WCHAR_MAX}}% -\indexlibrary{\idxcode{WCHAR_MIN}}% -\indexlibrary{\idxcode{WEOF}}% -\indexlibrary{\idxcode{btowc}}% -\indexlibrary{\idxcode{fgetwc}}% -\indexlibrary{\idxcode{fgetws}}% -\indexlibrary{\idxcode{fputwc}}% -\indexlibrary{\idxcode{fputws}}% -\indexlibrary{\idxcode{fwide}}% -\indexlibrary{\idxcode{fwprintf}}% -\indexlibrary{\idxcode{fwscanf}}% -\indexlibrary{\idxcode{getwchar}}% -\indexlibrary{\idxcode{getwc}}% -\indexlibrary{\idxcode{mbrlen}}% -\indexlibrary{\idxcode{mbrtowc}}% -\indexlibrary{\idxcode{mbsinit}}% -\indexlibrary{\idxcode{mbsrtowcs}}% -\indexlibrary{\idxcode{mbstate_t}}% -\indexlibrary{\idxcode{putwchar}}% -\indexlibrary{\idxcode{putwc}}% -\indexlibrary{\idxcode{size_t}}% -\indexlibrary{\idxcode{swprintf}}% -\indexlibrary{\idxcode{swscanf}}% -\indexlibrary{\idxcode{tm}}% -\indexlibrary{\idxcode{ungetwc}}% -\indexlibrary{\idxcode{vfwprintf}}% -\indexlibrary{\idxcode{vfwscanf}}% -\indexlibrary{\idxcode{vswprintf}}% -\indexlibrary{\idxcode{vswscanf}}% -\indexlibrary{\idxcode{vwprintf}}% -\indexlibrary{\idxcode{vwscanf}}% -\indexlibrary{\idxcode{wcrtomb}}% -\indexlibrary{\idxcode{wcscat}}% -\indexlibrary{\idxcode{wcschr}}% -\indexlibrary{\idxcode{wcscmp}}% -\indexlibrary{\idxcode{wcscoll}}% -\indexlibrary{\idxcode{wcscpy}}% -\indexlibrary{\idxcode{wcscspn}}% -\indexlibrary{\idxcode{wcsftime}}% -\indexlibrary{\idxcode{wcslen}}% -\indexlibrary{\idxcode{wcsncat}}% -\indexlibrary{\idxcode{wcsncmp}}% -\indexlibrary{\idxcode{wcsncpy}}% -\indexlibrary{\idxcode{wcspbrk}}% -\indexlibrary{\idxcode{wcsrchr}}% -\indexlibrary{\idxcode{wcsrtombs}}% -\indexlibrary{\idxcode{wcsspn}}% -\indexlibrary{\idxcode{wcsstr}}% -\indexlibrary{\idxcode{wcstod}}% -\indexlibrary{\idxcode{wcstof}}% -\indexlibrary{\idxcode{wcstok}}% -\indexlibrary{\idxcode{wcstold}}% -\indexlibrary{\idxcode{wcstoll}}% -\indexlibrary{\idxcode{wcstol}}% -\indexlibrary{\idxcode{wcstoull}}% -\indexlibrary{\idxcode{wcstoul}}% -\indexlibrary{\idxcode{wcsxfrm}}% -\indexlibrary{\idxcode{wctob}}% -\indexlibrary{\idxcode{wint_t}}% -\indexlibrary{\idxcode{wmemchr}}% -\indexlibrary{\idxcode{wmemcmp}}% -\indexlibrary{\idxcode{wmemcpy}}% -\indexlibrary{\idxcode{wmemmove}}% -\indexlibrary{\idxcode{wmemset}}% -\indexlibrary{\idxcode{wprintf}}% -\indexlibrary{\idxcode{wscanf}}% +\indexheader{cwchar}% +\indexlibraryglobal{NULL}% +\indexlibraryglobal{WCHAR_MAX}% +\indexlibraryglobal{WCHAR_MIN}% +\indexlibraryglobal{WEOF}% +\indexlibraryglobal{btowc}% +\indexlibraryglobal{fgetwc}% +\indexlibraryglobal{fgetws}% +\indexlibraryglobal{fputwc}% +\indexlibraryglobal{fputws}% +\indexlibraryglobal{fwide}% +\indexlibraryglobal{fwprintf}% +\indexlibraryglobal{fwscanf}% +\indexlibraryglobal{getwchar}% +\indexlibraryglobal{getwc}% +\indexlibraryglobal{mbrlen}% +\indexlibraryglobal{mbrtowc}% +\indexlibraryglobal{mbsinit}% +\indexlibraryglobal{mbsrtowcs}% +\indexlibraryglobal{mbstate_t}% +\indexlibraryglobal{putwchar}% +\indexlibraryglobal{putwc}% +\indexlibraryglobal{size_t}% +\indexlibraryglobal{swprintf}% +\indexlibraryglobal{swscanf}% +\indexlibraryglobal{tm}% +\indexlibraryglobal{ungetwc}% +\indexlibraryglobal{vfwprintf}% +\indexlibraryglobal{vfwscanf}% +\indexlibraryglobal{vswprintf}% +\indexlibraryglobal{vswscanf}% +\indexlibraryglobal{vwprintf}% +\indexlibraryglobal{vwscanf}% +\indexlibraryglobal{wcrtomb}% +\indexlibraryglobal{wcscat}% +\indexlibraryglobal{wcschr}% +\indexlibraryglobal{wcscmp}% +\indexlibraryglobal{wcscoll}% +\indexlibraryglobal{wcscpy}% +\indexlibraryglobal{wcscspn}% +\indexlibraryglobal{wcsftime}% +\indexlibraryglobal{wcslen}% +\indexlibraryglobal{wcsncat}% +\indexlibraryglobal{wcsncmp}% +\indexlibraryglobal{wcsncpy}% +\indexlibraryglobal{wcspbrk}% +\indexlibraryglobal{wcsrchr}% +\indexlibraryglobal{wcsrtombs}% +\indexlibraryglobal{wcsspn}% +\indexlibraryglobal{wcsstr}% +\indexlibraryglobal{wcstod}% +\indexlibraryglobal{wcstof}% +\indexlibraryglobal{wcstok}% +\indexlibraryglobal{wcstold}% +\indexlibraryglobal{wcstoll}% +\indexlibraryglobal{wcstol}% +\indexlibraryglobal{wcstoull}% +\indexlibraryglobal{wcstoul}% +\indexlibraryglobal{wcsxfrm}% +\indexlibraryglobal{wctob}% +\indexlibraryglobal{wint_t}% +\indexlibraryglobal{wmemchr}% +\indexlibraryglobal{wmemcmp}% +\indexlibraryglobal{wmemcpy}% +\indexlibraryglobal{wmemmove}% +\indexlibraryglobal{wmemset}% +\indexlibraryglobal{wprintf}% +\indexlibraryglobal{wscanf}% \begin{codeblock} namespace std { using size_t = @\textit{see \ref{support.types.layout}}@; @@ -5225,19 +5313,19 @@ int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n); size_t wcsxfrm(wchar_t* s1, const wchar_t* s2, size_t n); int wmemcmp(const wchar_t* s1, const wchar_t* s2, size_t n); - const wchar_t* wcschr(const wchar_t* s, wchar_t c); // see \ref{library.c} - wchar_t* wcschr(wchar_t* s, wchar_t c); // see \ref{library.c} + const wchar_t* wcschr(const wchar_t* s, wchar_t c); // see \ref{library.c} + wchar_t* wcschr(wchar_t* s, wchar_t c); // see \ref{library.c} size_t wcscspn(const wchar_t* s1, const wchar_t* s2); - const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2); // see \ref{library.c} - wchar_t* wcspbrk(wchar_t* s1, const wchar_t* s2); // see \ref{library.c} - const wchar_t* wcsrchr(const wchar_t* s, wchar_t c); // see \ref{library.c} - wchar_t* wcsrchr(wchar_t* s, wchar_t c); // see \ref{library.c} + const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2); // see \ref{library.c} + wchar_t* wcspbrk(wchar_t* s1, const wchar_t* s2); // see \ref{library.c} + const wchar_t* wcsrchr(const wchar_t* s, wchar_t c); // see \ref{library.c} + wchar_t* wcsrchr(wchar_t* s, wchar_t c); // see \ref{library.c} size_t wcsspn(const wchar_t* s1, const wchar_t* s2); const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2); // see \ref{library.c} - wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2); // see \ref{library.c} + wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2); // see \ref{library.c} wchar_t* wcstok(wchar_t* s1, const wchar_t* s2, wchar_t** ptr); - const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n); // see \ref{library.c} - wchar_t* wmemchr(wchar_t* s, wchar_t c, size_t n); // see \ref{library.c} + const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n); // see \ref{library.c} + wchar_t* wmemchr(wchar_t* s, wchar_t c, size_t n); // see \ref{library.c} size_t wcslen(const wchar_t* s); wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n); size_t wcsftime(wchar_t* s, size_t maxsize, const wchar_t* format, const struct tm* timeptr); @@ -5260,10 +5348,9 @@ \end{codeblock} \pnum -\indexhdr{wchar.h}% -The contents and meaning of the header \tcode{} +The contents and meaning of the header \libheader{cwchar} are the same as the C standard library header -\tcode{}, except that it does not declare a type \tcode{wchar_t}. +\libheader{wchar.h}, except that it does not declare a type \tcode{wchar_t}. \pnum \begin{note} @@ -5277,15 +5364,14 @@ \rSec2[cuchar.syn]{Header \tcode{} synopsis} -\indexhdr{cuchar}% -\indexlibrary{\idxcode{mbstate_t}}% -\indexlibrary{\idxcode{size_t}}% -\indexlibrary{\idxcode{mbrtoc8}}% -\indexlibrary{\idxcode{c8rtomb}}% -\indexlibrary{\idxcode{mbrtoc16}}% -\indexlibrary{\idxcode{c16rtomb}}% -\indexlibrary{\idxcode{mbrtoc32}}% -\indexlibrary{\idxcode{c32rtomb}}% +\indexlibraryglobal{mbstate_t}% +\indexlibraryglobal{size_t}% +\indexlibraryglobal{mbrtoc8}% +\indexlibraryglobal{c8rtomb}% +\indexlibraryglobal{mbrtoc16}% +\indexlibraryglobal{c16rtomb}% +\indexlibraryglobal{mbrtoc32}% +\indexlibraryglobal{c32rtomb}% \begin{codeblock} namespace std { using mbstate_t = @\seebelow@; @@ -5301,10 +5387,9 @@ \end{codeblock} \pnum -\indexhdr{uchar.h}% -The contents and meaning of the header \tcode{} +The contents and meaning of the header \libheaderdef{cuchar} are the same as the C standard library header -\tcode{}, except that it +\libheader{uchar.h}, except that it declares the additional \tcode{mbrtoc8} and \tcode{c8rtomb} functions and does not declare types \tcode{char16_t} nor \tcode{char32_t}. @@ -5313,19 +5398,17 @@ \rSec2[c.mb.wcs]{Multibyte / wide string and character conversion functions} \pnum -\indexhdr{cstdlib}% -\indexhdr{cwchar}% \begin{note} -The headers \tcode{}\iref{cstdlib.syn}, -\tcode{}\iref{cuchar.syn}, -and \tcode{}\iref{cwchar.syn} +The headers \libheaderref{cstdlib}, +\libheaderref{cuchar}, +and \libheaderref{cwchar} declare the functions described in this subclause. \end{note} -\indexlibrary{\idxcode{mbsinit}}% -\indexlibrary{\idxcode{mblen}}% -\indexlibrary{\idxcode{mbstowcs}}% -\indexlibrary{\idxcode{wcstombs}}% +\indexlibraryglobal{mbsinit}% +\indexlibraryglobal{mblen}% +\indexlibraryglobal{mbstowcs}% +\indexlibraryglobal{wcstombs}% \begin{itemdecl} int mbsinit(const mbstate_t* ps); int mblen(const char* s, size_t n); @@ -5341,8 +5424,8 @@ \xrefc{7.22.7.1, 7.22.8, 7.29.6.2.1} -\indexlibrary{\idxcode{mbtowc}}% -\indexlibrary{\idxcode{wctomb}}% +\indexlibraryglobal{mbtowc}% +\indexlibraryglobal{wctomb}% \begin{itemdecl} int mbtowc(wchar_t* pwc, const char* s, size_t n); int wctomb(char* s, wchar_t wchar); @@ -5362,11 +5445,11 @@ \xrefc{7.22.7} -\indexlibrary{\idxcode{mbrlen}}% -\indexlibrary{\idxcode{mbrstowcs}}% -\indexlibrary{\idxcode{wcrstombs}}% -\indexlibrary{\idxcode{mbrtowc}}% -\indexlibrary{\idxcode{wcrtomb}}% +\indexlibraryglobal{mbrlen}% +\indexlibraryglobal{mbrstowcs}% +\indexlibraryglobal{wcrstombs}% +\indexlibraryglobal{mbrtowc}% +\indexlibraryglobal{wcrtomb}% \begin{itemdecl} size_t mbrlen(const char* s, size_t n, mbstate_t* ps); size_t mbrtowc(wchar_t* pwc, const char* s, size_t n, mbstate_t* ps); @@ -5391,7 +5474,7 @@ \xrefc{7.29.6.3} -\indexlibrary{\idxcode{mbrtoc8}}% +\indexlibraryglobal{mbrtoc8}% \begin{itemdecl} size_t mbrtoc8(char8_t* pc8, const char* s, size_t n, mbstate_t* ps); \end{itemdecl} @@ -5443,7 +5526,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{c8rtomb}}% +\indexlibraryglobal{c8rtomb}% \begin{itemdecl} size_t c8rtomb(char* s, char8_t c8, mbstate_t* ps); \end{itemdecl} diff --git a/source/support.tex b/source/support.tex index dcd1a4129d..e06d42ec8d 100644 --- a/source/support.tex +++ b/source/support.tex @@ -43,13 +43,13 @@ \rSec2[cstddef.syn]{Header \tcode{} synopsis} -\indexlibrary{\idxcode{NULL}}% -\indexlibrary{\idxcode{offsetof}}% -\indexlibrary{\idxcode{ptrdiff_t}}% -\indexlibrary{\idxcode{size_t}}% -\indexlibrary{\idxcode{max_align_t}}% -\indexlibrary{\idxcode{nullptr_t}}% -\indexlibrary{\idxcode{byte}}% +\indexlibraryglobal{NULL}% +\indexlibraryglobal{offsetof}% +\indexlibraryglobal{ptrdiff_t}% +\indexlibraryglobal{size_t}% +\indexlibraryglobal{max_align_t}% +\indexlibraryglobal{nullptr_t}% +\indexlibraryglobal{byte}% \begin{codeblock} namespace std { using ptrdiff_t = @\seebelow@; @@ -84,8 +84,8 @@ \end{codeblock} \pnum -The contents and meaning of the header \tcode{} are the same as -the C standard library header \tcode{}, +The contents and meaning of the header \libheaderdef{cstddef} are the same as +the C standard library header \libheader{stddef.h}, except that it does not declare the type \tcode{wchar_t}, that it also declares the type \tcode{byte} and its associated operations\iref{support.types.byteops}, @@ -97,55 +97,55 @@ \rSec2[cstdlib.syn]{Header \tcode{} synopsis} -\indexhdr{cstdlib}% -\indexlibrary{\idxcode{EXIT_FAILURE}}% -\indexlibrary{\idxcode{EXIT_SUCCESS}}% -\indexlibrary{\idxcode{MB_CUR_MAX}}% -\indexlibrary{\idxcode{NULL}}% -\indexlibrary{\idxcode{RAND_MAX}}% -\indexlibrary{\idxcode{_Exit}}% -\indexlibrary{\idxcode{abort}}% -\indexlibrary{\idxcode{abs}}% -\indexlibrary{\idxcode{aligned_alloc}}% -\indexlibrary{\idxcode{at_quick_exit}}% -\indexlibrary{\idxcode{atexit}}% -\indexlibrary{\idxcode{atof}}% -\indexlibrary{\idxcode{atoi}}% -\indexlibrary{\idxcode{atol}}% -\indexlibrary{\idxcode{atoll}}% -\indexlibrary{\idxcode{bsearch}}% -\indexlibrary{\idxcode{calloc}}% -\indexlibrary{\idxcode{div}}% -\indexlibrary{\idxcode{div_t}}% -\indexlibrary{\idxcode{exit}}% -\indexlibrary{\idxcode{free}}% -\indexlibrary{\idxcode{getenv}}% -\indexlibrary{\idxcode{labs}}% -\indexlibrary{\idxcode{ldiv}}% -\indexlibrary{\idxcode{ldiv_t}}% -\indexlibrary{\idxcode{llabs}}% -\indexlibrary{\idxcode{lldiv}}% -\indexlibrary{\idxcode{lldiv_t}}% -\indexlibrary{\idxcode{malloc}}% -\indexlibrary{\idxcode{mblen}}% -\indexlibrary{\idxcode{mbstowcs}}% -\indexlibrary{\idxcode{mbtowc}}% -\indexlibrary{\idxcode{qsort}}% -\indexlibrary{\idxcode{quick_exit}}% -\indexlibrary{\idxcode{rand}}% -\indexlibrary{\idxcode{realloc}}% -\indexlibrary{\idxcode{size_t}}% -\indexlibrary{\idxcode{srand}}% -\indexlibrary{\idxcode{strtod}}% -\indexlibrary{\idxcode{strtof}}% -\indexlibrary{\idxcode{strtol}}% -\indexlibrary{\idxcode{strtold}}% -\indexlibrary{\idxcode{strtoll}}% -\indexlibrary{\idxcode{strtoul}}% -\indexlibrary{\idxcode{strtoull}}% -\indexlibrary{\idxcode{system}}% -\indexlibrary{\idxcode{wcstombs}}% -\indexlibrary{\idxcode{wctomb}}% +\indexheader{cstdlib}% +\indexlibraryglobal{EXIT_FAILURE}% +\indexlibraryglobal{EXIT_SUCCESS}% +\indexlibraryglobal{MB_CUR_MAX}% +\indexlibraryglobal{NULL}% +\indexlibraryglobal{RAND_MAX}% +\indexlibraryglobal{_Exit}% +\indexlibraryglobal{abort}% +\indexlibraryglobal{abs}% +\indexlibraryglobal{aligned_alloc}% +\indexlibraryglobal{at_quick_exit}% +\indexlibraryglobal{atexit}% +\indexlibraryglobal{atof}% +\indexlibraryglobal{atoi}% +\indexlibraryglobal{atol}% +\indexlibraryglobal{atoll}% +\indexlibraryglobal{bsearch}% +\indexlibraryglobal{calloc}% +\indexlibraryglobal{div}% +\indexlibraryglobal{div_t}% +\indexlibraryglobal{exit}% +\indexlibraryglobal{free}% +\indexlibraryglobal{getenv}% +\indexlibraryglobal{labs}% +\indexlibraryglobal{ldiv}% +\indexlibraryglobal{ldiv_t}% +\indexlibraryglobal{llabs}% +\indexlibraryglobal{lldiv}% +\indexlibraryglobal{lldiv_t}% +\indexlibraryglobal{malloc}% +\indexlibraryglobal{mblen}% +\indexlibraryglobal{mbstowcs}% +\indexlibraryglobal{mbtowc}% +\indexlibraryglobal{qsort}% +\indexlibraryglobal{quick_exit}% +\indexlibraryglobal{rand}% +\indexlibraryglobal{realloc}% +\indexlibraryglobal{size_t}% +\indexlibraryglobal{srand}% +\indexlibraryglobal{strtod}% +\indexlibraryglobal{strtof}% +\indexlibraryglobal{strtol}% +\indexlibraryglobal{strtold}% +\indexlibraryglobal{strtoll}% +\indexlibraryglobal{strtoul}% +\indexlibraryglobal{strtoull}% +\indexlibraryglobal{system}% +\indexlibraryglobal{wcstombs}% +\indexlibraryglobal{wctomb}% \begin{codeblock} namespace std { using size_t = @\seebelow@; @@ -230,16 +230,16 @@ long long int llabs(long long int j); div_t div(int numer, int denom); - ldiv_t div(long int numer, long int denom); // see \ref{library.c} - lldiv_t div(long long int numer, long long int denom); // see \ref{library.c} + ldiv_t div(long int numer, long int denom); // see \ref{library.c} + lldiv_t div(long long int numer, long long int denom); // see \ref{library.c} ldiv_t ldiv(long int numer, long int denom); lldiv_t lldiv(long long int numer, long long int denom); } \end{codeblock} \pnum -The contents and meaning of the header \tcode{} are the same as -the C standard library header \tcode{}, +The contents and meaning of the header \libheader{cstdlib} are the same as +the C standard library header \libheader{stdlib.h}, except that it does not declare the type \tcode{wchar_t}, and except as noted in \ref{support.types.nullptr}, @@ -260,7 +260,7 @@ \rSec2[support.types.nullptr]{Null pointers} \pnum -\indexlibrary{\idxcode{nullptr_t}}% +\indexlibraryglobal{nullptr_t}% The type \tcode{nullptr_t} is a synonym for the type of a \tcode{nullptr} expression, and it has the characteristics @@ -272,7 +272,7 @@ \pnum The macro -\indexlibrary{\idxcode{NULL}}% +\indexlibraryglobal{NULL}% \tcode{NULL} is an \impldef{definition of \tcode{NULL}} null pointer constant.% \footnote{Possible definitions include @@ -288,10 +288,10 @@ \pnum The macro -\indexlibrary{\idxcode{offsetof}}% +\indexlibraryglobal{offsetof}% \tcode{offsetof(\placeholder{type}, \placeholder{member-designator})} has the same semantics as the corresponding macro in -the C standard library header \tcode{}, but +the C standard library header \libheader{stddef.h}, but accepts a restricted set of \tcode{\placeholder{type}} arguments in this document. Use of the \tcode{offsetof} macro with a \tcode{\placeholder{type}} @@ -329,7 +329,7 @@ \pnum The type -\indexlibrary{\idxcode{max_align_t}}% +\indexlibraryglobal{max_align_t}% \tcode{max_align_t} is a trivial standard-layout type whose alignment requirement is at least as great as that of every scalar type, and whose alignment requirement is supported in every context\iref{basic.align}. @@ -345,9 +345,12 @@ \end{itemdecl} \begin{itemdescr} -\pnum \constraints \tcode{is_integral_v} is \tcode{true}. +\pnum +\constraints \tcode{is_integral_v} is \tcode{true}. -\pnum \effects Equivalent to: +\pnum +\effects +Equivalent to: \tcode{return b = b << shift;} \end{itemdescr} @@ -358,9 +361,12 @@ \end{itemdecl} \begin{itemdescr} -\pnum \constraints \tcode{is_integral_v} is \tcode{true}. +\pnum +\constraints \tcode{is_integral_v} is \tcode{true}. -\pnum \effects Equivalent to: +\pnum +\effects +Equivalent to: \begin{codeblock} return static_cast(static_cast( static_cast(b) << shift)); @@ -374,9 +380,12 @@ \end{itemdecl} \begin{itemdescr} -\pnum \constraints \tcode{is_integral_v} is \tcode{true}. +\pnum +\constraints \tcode{is_integral_v} is \tcode{true}. -\pnum \effects Equivalent to: +\pnum +\effects +Equivalent to: \tcode{return b >> shift;} \end{itemdescr} @@ -387,9 +396,12 @@ \end{itemdecl} \begin{itemdescr} -\pnum \constraints \tcode{is_integral_v} is \tcode{true}. +\pnum +\constraints \tcode{is_integral_v} is \tcode{true}. -\pnum \effects Equivalent to: +\pnum +\effects +Equivalent to: \begin{codeblock} return static_cast(static_cast( static_cast(b) >> shift)); @@ -402,7 +414,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \effects Equivalent to: \tcode{return l = l | r;} +\pnum +\effects +Equivalent to: \tcode{return l = l | r;} \end{itemdescr} \indexlibrarymember{operator"|}{byte}% @@ -411,7 +425,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \effects Equivalent to: +\pnum +\effects +Equivalent to: \begin{codeblock} return static_cast(static_cast(static_cast(l) | static_cast(r))); @@ -424,7 +440,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \effects Equivalent to: \tcode{return l = l \& r;} +\pnum +\effects +Equivalent to: \tcode{return l = l \& r;} \end{itemdescr} \indexlibrarymember{operator\&}{byte}% @@ -433,7 +451,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \effects Equivalent to: +\pnum +\effects +Equivalent to: \begin{codeblock} return static_cast(static_cast(static_cast(l) & static_cast(r))); @@ -446,7 +466,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \effects Equivalent to: \tcode{return l = l \caret{} r;} +\pnum +\effects +Equivalent to: \tcode{return l = l \caret{} r;} \end{itemdescr} \indexlibrarymember{operator\caret}{byte}% @@ -455,7 +477,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \effects Equivalent to: +\pnum +\effects +Equivalent to: \begin{codeblock} return static_cast(static_cast(static_cast(l) ^ static_cast(r))); @@ -468,7 +492,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \effects Equivalent to: +\pnum +\effects +Equivalent to: \begin{codeblock} return static_cast(static_cast( ~static_cast(b))); @@ -482,9 +508,12 @@ \end{itemdecl} \begin{itemdescr} -\pnum \constraints \tcode{is_integral_v} is \tcode{true}. +\pnum +\constraints \tcode{is_integral_v} is \tcode{true}. -\pnum \effects Equivalent to: \tcode{return static_cast(b);} +\pnum +\effects +Equivalent to: \tcode{return static_cast(b);} \end{itemdescr} \rSec1[support.limits]{Implementation properties} @@ -493,266 +522,157 @@ \pnum The headers -\tcode{}\iref{limits.syn}, -\tcode{}\iref{climits.syn}, and -\tcode{}\iref{cfloat.syn} +\libheaderref{limits}, +\libheaderref{climits}, and +\libheaderref{cfloat} supply characteristics of \indextext{implementation-dependent}% imple\-mentation-dependent arithmetic types\iref{basic.fundamental}. +\rSec2[version.syn]{Header \tcode{} synopsis} + \pnum -The header \tcode{} +The header \libheaderdef{version} supplies implementation-dependent information about the C++ standard library (e.g., version number and release date). \pnum -The macros in \tref{support.ft} are defined -after inclusion of the header \tcode{} or -one of the corresponding headers specified in the table. +Each of the macros defined in \libheader{version} is also defined +after inclusion of any member of the set of library headers +indicated in the corresponding comment in this synopsis. \begin{note} Future versions of this International Standard might replace the values of these macros with greater values. \end{note} -\begin{LongTable}{Standard library feature-test macros} -{support.ft}{llx{.3\hsize}} -\\ \topline -\lhdr{Macro name} & \chdr{Value} & \rhdr{Header(s)} \\ \capsep -\endfirsthead -\continuedcaption \\ -\hline -\lhdr{Macro name} & \chdr{Value} & \rhdr{Header(s)} \\ \capsep -\endhead -\defnlibxname{cpp_lib_addressof_constexpr} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_allocator_traits_is_always_equal} & \tcode{201411L} & - \tcode{} \tcode{} \tcode{} - \tcode{} \tcode{} \tcode{} \tcode{} - \tcode{} \tcode{} \tcode{} - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_any} & \tcode{201606L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_apply} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_array_constexpr} & \tcode{201603L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_as_const} & \tcode{201510L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_atomic_flag_test} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_atomic_is_always_lock_free} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_atomic_lock_free_type_aliases} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_atomic_ref} & \tcode{201806L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_atomic_wait} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_barrier} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_bit_cast} & \tcode{201806L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_bind_front} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_bitops} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_bool_constant} & \tcode{201505L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_bounded_array_traits} & \tcode{201902L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_boyer_moore_searcher} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_byte} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_char8_t} & \tcode{201907L} & - \tcode{} \tcode{} \tcode{} \tcode{} - \tcode{} \tcode{} \tcode{} \tcode{} - \\ \rowsep -\defnlibxname{cpp_lib_chrono} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_chrono_udls} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_clamp} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_complex_udls} & \tcode{201309L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_concepts} & \tcode{201806L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_constexpr} & \tcode{201811L} & - any C++ library header from \tref{headers.cpp} or - any C++ header for C library facilities from \tref{headers.cpp.c} \\ \rowsep -\defnlibxname{cpp_lib_constexpr_dynamic_alloc} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_constexpr_invoke} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_constexpr_string} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_constexpr_swap_algorithms} & \tcode{201806L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_constexpr_vector} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_destroying_delete} & \tcode{201806L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_enable_shared_from_this} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_endian} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_erase_if} & \tcode{201811L} & - \tcode{} \tcode{} \tcode{} \tcode{} - \tcode{} \tcode{} \tcode{} \tcode{} - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_exchange_function} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_execution} & \tcode{201902L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_filesystem} & \tcode{201703L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_format} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_gcd_lcm} & \tcode{201606L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_generic_associative_lookup} & \tcode{201304L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_generic_unordered_lookup} & \tcode{201811L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_hardware_interference_size} & \tcode{201703L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_has_unique_object_representations} & \tcode{201606L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_hypot} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_incomplete_container_elements} & \tcode{201505L} & - \tcode{} \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_integer_sequence} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_integral_constant_callable} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_interpolate} & \tcode{201902L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_invoke} & \tcode{201411L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_is_aggregate} & \tcode{201703L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_is_constant_evaluated} & \tcode{201811L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_is_final} & \tcode{201402L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_is_invocable} & \tcode{201703L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_is_layout_compatible} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_is_null_pointer} & \tcode{201309L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_is_pointer_interconvertible} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_is_swappable} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_jthread} & \tcode{201907L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_latch} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_launder} & \tcode{201606L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_list_remove_return_type} & \tcode{201806L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_logical_traits} & \tcode{201510L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_make_from_tuple} & \tcode{201606L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_make_reverse_iterator} & \tcode{201402L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_make_unique} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_map_try_emplace} & \tcode{201411L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_math_constants} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_math_special_functions} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_memory_resource} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_node_extract} & \tcode{201606L} & - \tcode{} \tcode{} \tcode{} - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_nonmember_container_access} & \tcode{201411L} & - \tcode{} \tcode{} \tcode{} \tcode{} - \tcode{} \tcode{} \tcode{} \tcode{} \tcode{} - \tcode{} \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_not_fn} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_null_iterators} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_optional} & \tcode{201606L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_parallel_algorithm} & \tcode{201603L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_quoted_string_io} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_ranges} & \tcode{201811L} & - \tcode{} \tcode{} \tcode{} - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_raw_memory_algorithms} & \tcode{201606L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_result_of_sfinae} & \tcode{201210L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_robust_nonmodifying_seq_ops} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_sample} & \tcode{201603L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_scoped_lock} & \tcode{201703L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_semaphore} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_shared_mutex} & \tcode{201505L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_shared_ptr_arrays} & \tcode{201611L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_shared_ptr_weak_type} & \tcode{201606L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_shared_timed_mutex} & \tcode{201402L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_source_location} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_spaceship} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_string_udls} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_string_view} & \tcode{201606L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_three_way_comparison} & \tcode{201711L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_to_array} & \tcode{201907L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_to_chars} & \tcode{201611L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_transformation_trait_aliases} & \tcode{201304L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_transparent_operators} & \tcode{201510L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_tuple_element_t} & \tcode{201402L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_tuples_by_type} & \tcode{201304L} & - \tcode{} \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_type_trait_variable_templates} & \tcode{201510L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_uncaught_exceptions} & \tcode{201411L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_unordered_map_try_emplace} & \tcode{201411L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_variant} & \tcode{201606L} & - \tcode{} \\ \rowsep -\defnlibxname{cpp_lib_void_t} & \tcode{201411L} & - \tcode{} \\ \rowsep -\end{LongTable} +\begin{codeblock} +#define @\defnlibxname{cpp_lib_addressof_constexpr}@ 201603L // also in \libheader{memory} +#define @\defnlibxname{cpp_lib_allocator_traits_is_always_equal}@ 201411L + // also in \libheader{memory}, \libheader{scoped_allocator}, \libheader{string}, \libheader{deque}, \libheader{forward_list}, \libheader{list}, \libheader{vector}, + // \libheader{map}, \libheader{set}, \libheader{unordered_map}, \libheader{unordered_set} +#define @\defnlibxname{cpp_lib_any}@ 201606L // also in \libheader{any} +#define @\defnlibxname{cpp_lib_apply}@ 201603L // also in \libheader{tuple} +#define @\defnlibxname{cpp_lib_array_constexpr}@ 201603L // also in \libheader{iterator}, \libheader{array} +#define @\defnlibxname{cpp_lib_as_const}@ 201510L // also in \libheader{utility} +#define @\defnlibxname{cpp_lib_atomic_flag_test}@ 201907L // also in \libheader{atomic} +#define @\defnlibxname{cpp_lib_atomic_is_always_lock_free}@ 201603L // also in \libheader{atomic} +#define @\defnlibxname{cpp_lib_atomic_lock_free_type_aliases}@ 201907L // also in \libheader{atomic} +#define @\defnlibxname{cpp_lib_atomic_ref}@ 201806L // also in \libheader{atomic} +#define @\defnlibxname{cpp_lib_atomic_wait}@ 201907L // also in \libheader{atomic} +#define @\defnlibxname{cpp_lib_barrier}@ 201907L // also in \libheader{barrier} +#define @\defnlibxname{cpp_lib_bit_cast}@ 201806L // also in \libheader{bit} +#define @\defnlibxname{cpp_lib_bind_front}@ 201907L // also in \libheader{functional} +#define @\defnlibxname{cpp_lib_bitops}@ 201907L // also in \libheader{bit} +#define @\defnlibxname{cpp_lib_bool_constant}@ 201505L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_bounded_array_traits}@ 201902L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_boyer_moore_searcher}@ 201603L // also in \libheader{functional} +#define @\defnlibxname{cpp_lib_byte}@ 201603L // also in \libheader{cstddef} +#define @\defnlibxname{cpp_lib_char8_t}@ 201907L + // also in \libheader{atomic}, \libheader{filesystem}, \libheader{istream}, \libheader{limits}, \libheader{locale}, \libheader{ostream}, \libheader{string}, \libheader{string_view} +#define @\defnlibxname{cpp_lib_chrono}@ 201907L // also in \libheader{chrono} +#define @\defnlibxname{cpp_lib_chrono_udls}@ 201304L // also in \libheader{chrono} +#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}@ 201806L // also in \libheader{concepts} +#define @\defnlibxname{cpp_lib_constexpr}@ 201811L + // also in any C++ library header from \tref{headers.cpp} or any C++ header for C library facilities from \tref{headers.cpp.c} +#define @\defnlibxname{cpp_lib_constexpr_dynamic_alloc}@ 201907L // also in \libheader{memory} +#define @\defnlibxname{cpp_lib_constexpr_invoke}@ 201907L // also in \libheader{functional} +#define @\defnlibxname{cpp_lib_constexpr_string}@ 201907L // also in \libheader{string} +#define @\defnlibxname{cpp_lib_constexpr_swap_algorithms}@ 201806L // also in \libheader{algorithm} +#define @\defnlibxname{cpp_lib_constexpr_vector}@ 201907L // also in \libheader{vector} +#define @\defnlibxname{cpp_lib_destroying_delete}@ 201806L // also in \libheader{new} +#define @\defnlibxname{cpp_lib_enable_shared_from_this}@ 201603L // also in \libheader{memory} +#define @\defnlibxname{cpp_lib_endian}@ 201907L // also in \libheader{bit} +#define @\defnlibxname{cpp_lib_erase_if}@ 201811L + // also in \libheader{string}, \libheader{deque}, \libheader{forward_list}, \libheader{list}, \libheader{vector}, \libheader{map}, \libheader{set}, \libheader{unordered_map}, + // \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_filesystem}@ 201703L // also in \libheader{filesystem} +#define @\defnlibxname{cpp_lib_format}@ 201907L // also in \libheader{format} +#define @\defnlibxname{cpp_lib_gcd_lcm}@ 201606L // also in \libheader{numeric} +#define @\defnlibxname{cpp_lib_generic_associative_lookup}@ 201304L // also in \libheader{map}, \libheader{set} +#define @\defnlibxname{cpp_lib_generic_unordered_lookup}@ 201811L + // also in \libheader{unordered_map}, \libheader{unordered_set} +#define @\defnlibxname{cpp_lib_hardware_interference_size}@ 201703L // also in \libheader{new} +#define @\defnlibxname{cpp_lib_has_unique_object_representations}@ 201606L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_hypot}@ 201603L // also in \libheader{cmath} +#define @\defnlibxname{cpp_lib_incomplete_container_elements}@ 201505L + // also in \libheader{forward_list}, \libheader{list}, \libheader{vector} +#define @\defnlibxname{cpp_lib_integer_sequence}@ 201304L // also in \libheader{utility} +#define @\defnlibxname{cpp_lib_integral_constant_callable}@ 201304L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_interpolate}@ 201902L // also in \libheader{cmath}, \libheader{numeric} +#define @\defnlibxname{cpp_lib_invoke}@ 201411L // also in \libheader{functional} +#define @\defnlibxname{cpp_lib_is_aggregate}@ 201703L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_is_constant_evaluated}@ 201811L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_is_final}@ 201402L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_is_invocable}@ 201703L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_is_layout_compatible}@ 201907L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_is_null_pointer}@ 201309L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_is_pointer_interconvertible}@ 201907L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_is_swappable}@ 201603L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_jthread}@ 201907L // also in \libheader{stop_token}, \libheader{thread} +#define @\defnlibxname{cpp_lib_latch}@ 201907L // also in \libheader{latch} +#define @\defnlibxname{cpp_lib_launder}@ 201606L // also in \libheader{new} +#define @\defnlibxname{cpp_lib_list_remove_return_type}@ 201806L // also in \libheader{forward_list}, \libheader{list} +#define @\defnlibxname{cpp_lib_logical_traits}@ 201510L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_make_from_tuple}@ 201606L // also in \libheader{tuple} +#define @\defnlibxname{cpp_lib_make_reverse_iterator}@ 201402L // also in \libheader{iterator} +#define @\defnlibxname{cpp_lib_make_unique}@ 201304L // also in \libheader{memory} +#define @\defnlibxname{cpp_lib_map_try_emplace}@ 201411L // also in \libheader{map} +#define @\defnlibxname{cpp_lib_math_constants}@ 201907L // also in \libheader{numbers} +#define @\defnlibxname{cpp_lib_math_special_functions}@ 201603L // also in \libheader{cmath} +#define @\defnlibxname{cpp_lib_memory_resource}@ 201603L // also in \libheader{memory_resource} +#define @\defnlibxname{cpp_lib_node_extract}@ 201606L + // also in \libheader{map}, \libheader{set}, \libheader{unordered_map}, \libheader{unordered_set} +#define @\defnlibxname{cpp_lib_nonmember_container_access}@ 201411L + // also in \libheader{array}, \libheader{deque}, \libheader{forward_list}, \libheader{iterator}, \libheader{list}, \libheader{map}, \libheader{regex}, \libheader{set}, \libheader{string}, + // \libheader{unordered_map}, \libheader{unordered_set}, \libheader{vector} +#define @\defnlibxname{cpp_lib_not_fn}@ 201603L // also in \libheader{functional} +#define @\defnlibxname{cpp_lib_null_iterators}@ 201304L // also in \libheader{iterator} +#define @\defnlibxname{cpp_lib_optional}@ 201606L // also in \libheader{optional} +#define @\defnlibxname{cpp_lib_parallel_algorithm}@ 201603L // also in \libheader{algorithm}, \libheader{numeric} +#define @\defnlibxname{cpp_lib_quoted_string_io}@ 201304L // also in \libheader{iomanip} +#define @\defnlibxname{cpp_lib_ranges}@ 201811L + // also in \libheader{algorithm}, \libheader{functional}, \libheader{iterator}, \libheader{memory}, \libheader{ranges} +#define @\defnlibxname{cpp_lib_raw_memory_algorithms}@ 201606L // also in \libheader{memory} +#define @\defnlibxname{cpp_lib_result_of_sfinae}@ 201210L // also in \libheader{functional}, \libheader{type_traits} +#define @\defnlibxname{cpp_lib_robust_nonmodifying_seq_ops}@ 201304L // also in \libheader{algorithm} +#define @\defnlibxname{cpp_lib_sample}@ 201603L // also in \libheader{algorithm} +#define @\defnlibxname{cpp_lib_scoped_lock}@ 201703L // also in \libheader{mutex} +#define @\defnlibxname{cpp_lib_semaphore}@ 201907L // also in \libheader{semaphore} +#define @\defnlibxname{cpp_lib_shared_mutex}@ 201505L // also in \libheader{shared_mutex} +#define @\defnlibxname{cpp_lib_shared_ptr_arrays}@ 201611L // also in \libheader{memory} +#define @\defnlibxname{cpp_lib_shared_ptr_weak_type}@ 201606L // also in \libheader{memory} +#define @\defnlibxname{cpp_lib_shared_timed_mutex}@ 201402L // also in \libheader{shared_mutex} +#define @\defnlibxname{cpp_lib_source_location}@ 201907L // also in \libheader{source_location} +#define @\defnlibxname{cpp_lib_spaceship}@ 201907L // also in \libheader{compare} +#define @\defnlibxname{cpp_lib_string_udls}@ 201304L // also in \libheader{string} +#define @\defnlibxname{cpp_lib_string_view}@ 201606L // also in \libheader{string}, \libheader{string_view} +#define @\defnlibxname{cpp_lib_three_way_comparison}@ 201711L // also in \libheader{compare} +#define @\defnlibxname{cpp_lib_to_array}@ 201907L // also in \libheader{array} +#define @\defnlibxname{cpp_lib_to_chars}@ 201611L // also in \libheader{charconv} +#define @\defnlibxname{cpp_lib_transformation_trait_aliases}@ 201304L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_transparent_operators}@ 201510L // also in \libheader{memory}, \libheader{functional} +#define @\defnlibxname{cpp_lib_tuple_element_t}@ 201402L // also in \libheader{tuple} +#define @\defnlibxname{cpp_lib_tuples_by_type}@ 201304L // also in \libheader{utility}, \libheader{tuple} +#define @\defnlibxname{cpp_lib_type_trait_variable_templates}@ 201510L // also in \libheader{type_traits} +#define @\defnlibxname{cpp_lib_uncaught_exceptions}@ 201411L // also in \libheader{exception} +#define @\defnlibxname{cpp_lib_unordered_map_try_emplace}@ 201411L // also in \libheader{unordered_map} +#define @\defnlibxname{cpp_lib_variant}@ 201606L // also in \libheader{variant} +#define @\defnlibxname{cpp_lib_void_t}@ 201411L // also in \libheader{type_traits} +\end{codeblock} \rSec2[limits.syn]{Header \tcode{} synopsis} -\indexhdr{limits}% + +\indexheader{limits}% \indextext{\idxcode{numeric_limits}}% -\indexlibrary{\idxcode{numeric_limits}}% -\indexlibrary{\idxcode{float_round_style}}% -\indexlibrary{\idxcode{float_denorm_style}}% +\indexlibraryglobal{numeric_limits}% +\indexlibraryglobal{float_round_style}% +\indexlibraryglobal{float_denorm_style}% \begin{codeblock} namespace std { @@ -796,7 +716,7 @@ \rSec3[round.style]{Type \tcode{float_round_style}} -\indexlibrary{\idxcode{float_round_style}}% +\indexlibraryglobal{float_round_style}% \begin{codeblock} namespace std { enum float_round_style { @@ -812,33 +732,32 @@ \pnum The rounding mode for floating-point arithmetic is characterized by the values: - \begin{itemize} \item -\indexlibrary{\idxcode{round_indeterminate}}% +\indexlibraryglobal{round_indeterminate}% \tcode{round_indeterminate} if the rounding style is indeterminable \item -\indexlibrary{\idxcode{round_toward_zero}}% +\indexlibraryglobal{round_toward_zero}% \tcode{round_toward_zero} if the rounding style is toward zero \item -\indexlibrary{\idxcode{round_to_nearest}}% +\indexlibraryglobal{round_to_nearest}% \tcode{round_to_nearest} if the rounding style is to the nearest representable value \item -\indexlibrary{\idxcode{round_toward_infinity}}% +\indexlibraryglobal{round_toward_infinity}% \tcode{round_toward_infinity} if the rounding style is toward infinity \item -\indexlibrary{\idxcode{round_toward_neg_infinity}}% +\indexlibraryglobal{round_toward_neg_infinity}% \tcode{round_toward_neg_infinity} if the rounding style is toward negative infinity \end{itemize} \rSec3[denorm.style]{Type \tcode{float_denorm_style}} -\indexlibrary{\idxcode{float_denorm_style}}% +\indexlibraryglobal{float_denorm_style}% \begin{codeblock} namespace std { enum float_denorm_style { @@ -856,18 +775,17 @@ \pnum The presence or absence of subnormal numbers (variable number of exponent bits) is characterized by the values: - \begin{itemize} \item -\indexlibrary{\idxcode{denorm_indeterminate}}% +\indexlibraryglobal{denorm_indeterminate}% \tcode{denorm_indeterminate} if it cannot be determined whether or not the type allows subnormal values \item -\indexlibrary{\idxcode{denorm_absent}}% +\indexlibraryglobal{denorm_absent}% \tcode{denorm_absent} if the type does not allow subnormal values \item -\indexlibrary{\idxcode{denorm_present}}% +\indexlibraryglobal{denorm_present}% \tcode{denorm_present} if the type does allow subnormal values \end{itemize} @@ -876,13 +794,13 @@ \pnum The -\indexlibrary{\idxcode{numeric_limits}}% +\indexlibraryglobal{numeric_limits}% \tcode{numeric_limits} class template provides a \Cpp{} program with information about various properties of the implementation's representation of the arithmetic types. -\indexlibrary{\idxcode{numeric_limits}}% +\indexlibraryglobal{numeric_limits}% \begin{codeblock} namespace std { template class numeric_limits { @@ -1039,7 +957,8 @@ \pnum For integer types, the number of non-sign bits in the representation. -\pnum For floating-point types, the number of \tcode{radix} digits in the +\pnum +For floating-point types, the number of \tcode{radix} digits in the mantissa.\footnote{Equivalent to \tcode{FLT_MANT_DIG}, \tcode{DBL_MANT_DIG}, \tcode{LDBL_MANT_DIG}.} \end{itemdescr} @@ -1405,8 +1324,10 @@ \begin{itemdescr} \pnum \tcode{true} if the set of values representable by the type is finite.\footnote{Required by LIA-1.} -\begin{note} All fundamental types\iref{basic.fundamental} are bounded. This member would be \tcode{false} for arbitrary -precision types.\end{note} +\begin{note} +All fundamental types\iref{basic.fundamental} are bounded. This member would be \tcode{false} for arbitrary +precision types. +\end{note} \pnum Meaningful for all specializations. @@ -1554,7 +1475,7 @@ The specialization for \tcode{bool} shall be provided as follows: -\indexlibrary{\idxcode{numeric_limits}}% +\indexlibraryglobal{numeric_limits}% \begin{codeblock} namespace std { template<> class numeric_limits { @@ -1603,25 +1524,26 @@ \rSec2[climits.syn]{Header \tcode{} synopsis} -\indexlibrary{\idxcode{CHAR_BIT}}% -\indexlibrary{\idxcode{SCHAR_MIN}}% -\indexlibrary{\idxcode{SCHAR_MAX}}% -\indexlibrary{\idxcode{UCHAR_MAX}}% -\indexlibrary{\idxcode{CHAR_MIN}}% -\indexlibrary{\idxcode{CHAR_MAX}}% -\indexlibrary{\idxcode{MB_LEN_MAX}}% -\indexlibrary{\idxcode{SHRT_MIN}}% -\indexlibrary{\idxcode{SHRT_MAX}}% -\indexlibrary{\idxcode{USHRT_MAX}}% -\indexlibrary{\idxcode{INT_MIN}}% -\indexlibrary{\idxcode{INT_MAX}}% -\indexlibrary{\idxcode{UINT_MAX}}% -\indexlibrary{\idxcode{LONG_MIN}}% -\indexlibrary{\idxcode{LONG_MAX}}% -\indexlibrary{\idxcode{ULONG_MAX}}% -\indexlibrary{\idxcode{LLONG_MIN}}% -\indexlibrary{\idxcode{LLONG_MAX}}% -\indexlibrary{\idxcode{ULLONG_MAX}}% +\indexheader{climits}% +\indexlibraryglobal{CHAR_BIT}% +\indexlibraryglobal{SCHAR_MIN}% +\indexlibraryglobal{SCHAR_MAX}% +\indexlibraryglobal{UCHAR_MAX}% +\indexlibraryglobal{CHAR_MIN}% +\indexlibraryglobal{CHAR_MAX}% +\indexlibraryglobal{MB_LEN_MAX}% +\indexlibraryglobal{SHRT_MIN}% +\indexlibraryglobal{SHRT_MAX}% +\indexlibraryglobal{USHRT_MAX}% +\indexlibraryglobal{INT_MIN}% +\indexlibraryglobal{INT_MAX}% +\indexlibraryglobal{UINT_MAX}% +\indexlibraryglobal{LONG_MIN}% +\indexlibraryglobal{LONG_MAX}% +\indexlibraryglobal{ULONG_MAX}% +\indexlibraryglobal{LLONG_MIN}% +\indexlibraryglobal{LLONG_MAX}% +\indexlibraryglobal{ULLONG_MAX}% \begin{codeblock} #define CHAR_BIT @\seebelow@ #define SCHAR_MIN @\seebelow@ @@ -1645,10 +1567,10 @@ \end{codeblock} \pnum -The header \tcode{} defines all macros the same as -the C standard library header \tcode{}. +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 \tcode{} are not +The types of the constants defined by macros in \libheader{climits} are not required to match the types to which the macros refer. \end{note} @@ -1656,46 +1578,47 @@ \rSec2[cfloat.syn]{Header \tcode{} synopsis} -\indexlibrary{\idxcode{DBL_DECIMAL_DIG}}% -\indexlibrary{\idxcode{DBL_DIG}}% -\indexlibrary{\idxcode{DBL_EPSILON}}% -\indexlibrary{\idxcode{DBL_HAS_SUBNORM}}% -\indexlibrary{\idxcode{DBL_MANT_DIG}}% -\indexlibrary{\idxcode{DBL_MAX}}% -\indexlibrary{\idxcode{DBL_MAX_10_EXP}}% -\indexlibrary{\idxcode{DBL_MAX_EXP}}% -\indexlibrary{\idxcode{DBL_MIN}}% -\indexlibrary{\idxcode{DBL_MIN_10_EXP}}% -\indexlibrary{\idxcode{DBL_MIN_EXP}}% -\indexlibrary{\idxcode{DBL_TRUE_MIN}}% -\indexlibrary{\idxcode{DECIMAL_DIG}}% -\indexlibrary{\idxcode{FLT_DECIMAL_DIG}}% -\indexlibrary{\idxcode{FLT_DIG}}% -\indexlibrary{\idxcode{FLT_EPSILON}}% -\indexlibrary{\idxcode{FLT_EVAL_METHOD}}% -\indexlibrary{\idxcode{FLT_HAS_SUBNORM}}% -\indexlibrary{\idxcode{FLT_MANT_DIG}}% -\indexlibrary{\idxcode{FLT_MAX}}% -\indexlibrary{\idxcode{FLT_MAX_10_EXP}}% -\indexlibrary{\idxcode{FLT_MAX_EXP}}% -\indexlibrary{\idxcode{FLT_MIN}}% -\indexlibrary{\idxcode{FLT_MIN_10_EXP}}% -\indexlibrary{\idxcode{FLT_MIN_EXP}}% -\indexlibrary{\idxcode{FLT_RADIX}}% -\indexlibrary{\idxcode{FLT_ROUNDS}}% -\indexlibrary{\idxcode{FLT_TRUE_MIN}}% -\indexlibrary{\idxcode{LDBL_DECIMAL_DIG}}% -\indexlibrary{\idxcode{LDBL_DIG}}% -\indexlibrary{\idxcode{LDBL_EPSILON}}% -\indexlibrary{\idxcode{LDBL_HAS_SUBNORM}}% -\indexlibrary{\idxcode{LDBL_MANT_DIG}}% -\indexlibrary{\idxcode{LDBL_MAX}}% -\indexlibrary{\idxcode{LDBL_MAX_10_EXP}}% -\indexlibrary{\idxcode{LDBL_MAX_EXP}}% -\indexlibrary{\idxcode{LDBL_MIN}}% -\indexlibrary{\idxcode{LDBL_MIN_10_EXP}}% -\indexlibrary{\idxcode{LDBL_MIN_EXP}}% -\indexlibrary{\idxcode{LDBL_TRUE_MIN}}% +\indexheader{cfloat}% +\indexlibraryglobal{DBL_DECIMAL_DIG}% +\indexlibraryglobal{DBL_DIG}% +\indexlibraryglobal{DBL_EPSILON}% +\indexlibraryglobal{DBL_HAS_SUBNORM}% +\indexlibraryglobal{DBL_MANT_DIG}% +\indexlibraryglobal{DBL_MAX}% +\indexlibraryglobal{DBL_MAX_10_EXP}% +\indexlibraryglobal{DBL_MAX_EXP}% +\indexlibraryglobal{DBL_MIN}% +\indexlibraryglobal{DBL_MIN_10_EXP}% +\indexlibraryglobal{DBL_MIN_EXP}% +\indexlibraryglobal{DBL_TRUE_MIN}% +\indexlibraryglobal{DECIMAL_DIG}% +\indexlibraryglobal{FLT_DECIMAL_DIG}% +\indexlibraryglobal{FLT_DIG}% +\indexlibraryglobal{FLT_EPSILON}% +\indexlibraryglobal{FLT_EVAL_METHOD}% +\indexlibraryglobal{FLT_HAS_SUBNORM}% +\indexlibraryglobal{FLT_MANT_DIG}% +\indexlibraryglobal{FLT_MAX}% +\indexlibraryglobal{FLT_MAX_10_EXP}% +\indexlibraryglobal{FLT_MAX_EXP}% +\indexlibraryglobal{FLT_MIN}% +\indexlibraryglobal{FLT_MIN_10_EXP}% +\indexlibraryglobal{FLT_MIN_EXP}% +\indexlibraryglobal{FLT_RADIX}% +\indexlibraryglobal{FLT_ROUNDS}% +\indexlibraryglobal{FLT_TRUE_MIN}% +\indexlibraryglobal{LDBL_DECIMAL_DIG}% +\indexlibraryglobal{LDBL_DIG}% +\indexlibraryglobal{LDBL_EPSILON}% +\indexlibraryglobal{LDBL_HAS_SUBNORM}% +\indexlibraryglobal{LDBL_MANT_DIG}% +\indexlibraryglobal{LDBL_MAX}% +\indexlibraryglobal{LDBL_MAX_10_EXP}% +\indexlibraryglobal{LDBL_MAX_EXP}% +\indexlibraryglobal{LDBL_MIN}% +\indexlibraryglobal{LDBL_MIN_10_EXP}% +\indexlibraryglobal{LDBL_MIN_EXP}% +\indexlibraryglobal{LDBL_TRUE_MIN}% \begin{codeblock} #define FLT_ROUNDS @\seebelow@ #define FLT_EVAL_METHOD @\seebelow@ @@ -1740,44 +1663,44 @@ \end{codeblock} \pnum -The header \tcode{} defines all macros the same as -the C standard library header \tcode{}. +The header \libheader{cfloat} defines all macros the same as +the C standard library header \libheader{float.h}. \xrefc{5.2.4.2.2} \rSec1[cstdint]{Integer types} \rSec2[cstdint.syn]{Header \tcode{} synopsis} -\indexhdr{cstdint}% -\indexlibrary{\idxcode{int8_t}}% -\indexlibrary{\idxcode{int16_t}}% -\indexlibrary{\idxcode{int32_t}}% -\indexlibrary{\idxcode{int64_t}}% -\indexlibrary{\idxcode{int_fast8_t}}% -\indexlibrary{\idxcode{int_fast16_t}}% -\indexlibrary{\idxcode{int_fast32_t}}% -\indexlibrary{\idxcode{int_fast64_t}}% -\indexlibrary{\idxcode{int_least8_t}}% -\indexlibrary{\idxcode{int_least16_t}}% -\indexlibrary{\idxcode{int_least32_t}}% -\indexlibrary{\idxcode{int_least64_t}}% -\indexlibrary{\idxcode{intmax_t}}% -\indexlibrary{\idxcode{intptr_t}}% -\indexlibrary{\idxcode{uint8_t}}% -\indexlibrary{\idxcode{uint16_t}}% -\indexlibrary{\idxcode{uint32_t}}% -\indexlibrary{\idxcode{uint64_t}}% -\indexlibrary{\idxcode{uint_fast8_t}}% -\indexlibrary{\idxcode{uint_fast16_t}}% -\indexlibrary{\idxcode{uint_fast32_t}}% -\indexlibrary{\idxcode{uint_fast64_t}}% -\indexlibrary{\idxcode{uint_least8_t}}% -\indexlibrary{\idxcode{uint_least16_t}}% -\indexlibrary{\idxcode{uint_least32_t}}% -\indexlibrary{\idxcode{uint_least64_t}}% -\indexlibrary{\idxcode{uintmax_t}}% -\indexlibrary{\idxcode{uintptr_t}}% +\indexheader{cstdint}% +\indexlibraryglobal{int8_t}% +\indexlibraryglobal{int16_t}% +\indexlibraryglobal{int32_t}% +\indexlibraryglobal{int64_t}% +\indexlibraryglobal{int_fast8_t}% +\indexlibraryglobal{int_fast16_t}% +\indexlibraryglobal{int_fast32_t}% +\indexlibraryglobal{int_fast64_t}% +\indexlibraryglobal{int_least8_t}% +\indexlibraryglobal{int_least16_t}% +\indexlibraryglobal{int_least32_t}% +\indexlibraryglobal{int_least64_t}% +\indexlibraryglobal{intmax_t}% +\indexlibraryglobal{intptr_t}% +\indexlibraryglobal{uint8_t}% +\indexlibraryglobal{uint16_t}% +\indexlibraryglobal{uint32_t}% +\indexlibraryglobal{uint64_t}% +\indexlibraryglobal{uint_fast8_t}% +\indexlibraryglobal{uint_fast16_t}% +\indexlibraryglobal{uint_fast32_t}% +\indexlibraryglobal{uint_fast64_t}% +\indexlibraryglobal{uint_least8_t}% +\indexlibraryglobal{uint_least16_t}% +\indexlibraryglobal{uint_least32_t}% +\indexlibraryglobal{uint_least64_t}% +\indexlibraryglobal{uintmax_t}% +\indexlibraryglobal{uintptr_t}% \begin{codeblock} namespace std { using int8_t = @\textit{signed integer type}@; // optional @@ -1820,7 +1743,6 @@ \pnum The header also defines numerous macros of the form: - \begin{codeblock} INT_[FAST LEAST]{8 16 32 64}_MIN [U]INT_[FAST LEAST]{8 16 32 64}_MAX @@ -1829,29 +1751,26 @@ {PTRDIFF SIG_ATOMIC WCHAR WINT}{_MAX _MIN} SIZE_MAX \end{codeblock} - plus function macros of the form: - \begin{codeblock} [U]INT{8 16 32 64 MAX}_C \end{codeblock} \pnum The header defines all types and macros the same as -the C standard library header \tcode{}. +the C standard library header \libheader{stdint.h}. \xrefc{7.20} \rSec1[support.start.term]{Start and termination} \pnum -\indexhdr{cstdlib}% \begin{note} -The header \tcode{}\iref{cstdlib.syn} +The header \libheaderref{cstdlib} declares the functions described in this subclause. \end{note} -\indexlibrary{\idxcode{_Exit}}% +\indexlibraryglobal{_Exit}% \begin{itemdecl} [[noreturn]] void _Exit(int status) noexcept; \end{itemdecl} @@ -1870,7 +1789,7 @@ The function \tcode{_Exit} is signal-safe\iref{support.signal}. \end{itemdescr} -\indexlibrary{\idxcode{abort}}% +\indexlibraryglobal{abort}% \begin{itemdecl} [[noreturn]] void abort() noexcept; \end{itemdecl} @@ -1890,7 +1809,7 @@ The function \tcode{abort} is signal-safe\iref{support.signal}. \end{itemdescr} -\indexlibrary{\idxcode{atexit}}% +\indexlibraryglobal{atexit}% \begin{itemdecl} int atexit(@\placeholder{c-atexit-handler}@* f) noexcept; int atexit(@\placeholder{atexit-handler}@* f) noexcept; @@ -1905,8 +1824,10 @@ to be called without arguments at normal program termination. It is unspecified whether a call to \tcode{atexit()} that does not happen before\iref{intro.multithread} a call to \tcode{exit()} will succeed. -\begin{note} The \tcode{atexit()} functions do not introduce a data -race\iref{res.on.data.races}. \end{note} +\begin{note} +The \tcode{atexit()} functions do not introduce a data +race\iref{res.on.data.races}. +\end{note} \pnum \implimits @@ -1920,7 +1841,7 @@ nonzero if it fails. \end{itemdescr} -\indexlibrary{\idxcode{exit}}% +\indexlibraryglobal{exit}% \begin{itemdecl} [[noreturn]] void exit(int status); \end{itemdecl} @@ -1948,16 +1869,14 @@ If control leaves a registered function called by \tcode{exit} because the function does not provide a handler for a thrown exception, the function \tcode{std::terminate} shall be called\iref{except.terminate}.% -\indexlibrary{\idxcode{terminate}}% +\indexlibraryglobal{terminate}% \item Next, all open C streams (as mediated by the function -signatures declared in -\tcode{}) +signatures declared in \libheaderref{cstdio}) with unwritten buffered data are flushed, all open C streams are closed, and all files created by calling -\tcode{tmpfile()} -are removed. +\tcode{tmpfile()} are removed. \item Finally, control is returned to the host environment. @@ -1972,16 +1891,13 @@ an \impldef{exit status} form of the status \term{unsuccessful termination} is returned. -Otherwise the status returned is \impldef{exit status}.\footnote{The macros -\tcode{EXIT_FAILURE} -and -\tcode{EXIT_SUCCESS} -are defined in -\tcode{}.} +Otherwise the status returned is \impldef{exit status}.% +\footnote{The macros \tcode{EXIT_FAILURE} and \tcode{EXIT_SUCCESS} +are defined in \libheaderref{cstdlib}.} \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{at_quick_exit}}% +\indexlibraryglobal{at_quick_exit}% \begin{itemdecl} int at_quick_exit(@\placeholder{c-atexit-handler}@* f) noexcept; int at_quick_exit(@\placeholder{atexit-handler}@* f) noexcept; @@ -1989,17 +1905,22 @@ \begin{itemdescr} \pnum -\effects The \tcode{at_quick_exit()} functions register the function pointed to by \tcode{f} +\effects +The \tcode{at_quick_exit()} functions register the function pointed to by \tcode{f} to be called without arguments when \tcode{quick_exit} is called. It is unspecified whether a call to \tcode{at_quick_exit()} that does not -happen before\iref{intro.multithread} all calls to \tcode{quick_exit} will succeed. \begin{note} The +happen before\iref{intro.multithread} all calls to \tcode{quick_exit} will succeed. +\begin{note} +The \tcode{at_quick_exit()} functions do not introduce a -data race\iref{res.on.data.races}. \end{note} +data race\iref{res.on.data.races}. +\end{note} \begin{note} The order of registration may be indeterminate if \tcode{at_quick_exit} was called from more than one thread. \end{note} -\begin{note} The +\begin{note} +The \tcode{at_quick_exit} registrations are distinct from the \tcode{atexit} registrations, and applications may need to call both registration functions with the same argument. \end{note} @@ -2009,23 +1930,25 @@ The implementation shall support the registration of at least 32 functions. \pnum -\returns Zero if the registration succeeds, nonzero if it fails. +\returns +Zero if the registration succeeds, nonzero if it fails. \end{itemdescr} -\indexlibrary{\idxcode{quick_exit}}% +\indexlibraryglobal{quick_exit}% \begin{itemdecl} [[noreturn]] void quick_exit(int status) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Functions registered by calls to \tcode{at_quick_exit} are called in the +\effects +Functions registered by calls to \tcode{at_quick_exit} are called in the reverse order of their registration, except that a function shall be called after any previously registered functions that had already been called at the time it was registered. Objects shall not be destroyed as a result of calling \tcode{quick_exit}. If control leaves a registered function called by \tcode{quick_exit} because the function does not provide a handler for a thrown exception, the function \tcode{std::terminate} shall -be called.\indexlibrary{\idxcode{terminate}} +be called.\indexlibraryglobal{terminate} \begin{note} A function registered via \tcode{at_quick_exit} is invoked by the thread that calls \tcode{quick_exit}, @@ -2047,19 +1970,17 @@ \rSec1[support.dynamic]{Dynamic memory management} \pnum -The header -\tcode{} -defines several +The header \libheaderdef{new} defines several functions that manage the allocation of dynamic storage in a program. It also defines components for reporting storage management errors. \rSec2[new.syn]{Header \tcode{} synopsis} -\indexhdr{new}% -\indexlibrary{\idxcode{align_val_t}}% -\indexlibrary{\idxcode{destroying_delete_t}}% -\indexlibrary{\idxcode{destroying_delete}}% -\indexlibrary{\idxcode{nothrow_t}}% -\indexlibrary{\idxcode{nothrow}}% + +\indexlibraryglobal{align_val_t}% +\indexlibraryglobal{destroying_delete_t}% +\indexlibraryglobal{destroying_delete}% +\indexlibraryglobal{nothrow_t}% +\indexlibraryglobal{nothrow}% \begin{codeblock} namespace std { class bad_alloc; @@ -2138,7 +2059,7 @@ \rSec3[new.delete.single]{Single-object forms} -\indexlibrary{\idxcode{new}!\idxcode{operator}}% +\indexlibrarymember{new}{operator}% \begin{itemdecl} [[nodiscard]] void* operator new(std::size_t size); [[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment); @@ -2165,7 +2086,7 @@ Return a non-null pointer to suitably aligned storage\iref{basic.stc.dynamic}, or else throw a \tcode{bad_alloc} -\indexlibrary{\idxcode{bad_alloc}}% +\indexlibraryglobal{bad_alloc}% exception. This requirement is binding on any replacement versions of these functions. @@ -2198,7 +2119,7 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{new}!\idxcode{operator}}% +\indexlibrarymember{new}{operator}% \begin{itemdecl} [[nodiscard]] void* operator new(std::size_t size, const std::nothrow_t&) noexcept; [[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment, @@ -2248,7 +2169,7 @@ \end{example} \end{itemdescr} -\indexlibrary{\idxcode{delete}!\idxcode{operator}}% +\indexlibrarymember{delete}{operator}% \begin{itemdecl} void operator delete(void* ptr) noexcept; void operator delete(void* ptr, std::size_t size) noexcept; @@ -2316,16 +2237,20 @@ a call to the corresponding \tcode{operator delete} without a \tcode{size} parameter, without affecting memory allocation. -\begin{note} A conforming implementation is for +\begin{note} +A conforming implementation is for \tcode{operator delete(void* ptr, std::size_t size)} to simply call -\tcode{operator delete(ptr)}. \end{note} +\tcode{operator delete(ptr)}. +\end{note} \pnum \default The functions that have a \tcode{size} parameter forward their other parameters to the corresponding function without a \tcode{size} parameter. -\begin{note} See the note in the above \replaceable paragraph. \end{note} +\begin{note} +See the note in the above \replaceable paragraph. +\end{note} \pnum \default @@ -2345,11 +2270,10 @@ \tcode{malloc}, or \tcode{realloc}, -declared in -\tcode{}. +declared in \libheaderref{cstdlib}. \end{itemdescr} -\indexlibrary{\idxcode{delete}!\idxcode{operator}}% +\indexlibrarymember{delete}{operator}% \begin{itemdecl} 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; @@ -2404,7 +2328,7 @@ \rSec3[new.delete.array]{Array forms} -\indexlibrary{\idxcode{new}!\idxcode{operator}}% +\indexlibrarymember{new}{operator}% \begin{itemdecl} [[nodiscard]] void* operator new[](std::size_t size); [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment); @@ -2456,7 +2380,7 @@ respectively. \end{itemdescr} -\indexlibrary{\idxcode{new}!\idxcode{operator}}% +\indexlibrarymember{new}{operator}% \begin{itemdecl} [[nodiscard]] void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment, @@ -2498,7 +2422,7 @@ Otherwise, returns a null pointer. \end{itemdescr} -\indexlibrary{\idxcode{delete}!\idxcode{operator}}% +\indexlibrarymember{delete}{operator}% \begin{itemdecl} void operator delete[](void* ptr) noexcept; void operator delete[](void* ptr, std::size_t size) noexcept; @@ -2566,9 +2490,11 @@ a call to the corresponding \tcode{operator delete[]} without a \tcode{size} parameter, without affecting memory allocation. -\begin{note} A conforming implementation is for +\begin{note} +A conforming implementation is for \tcode{operator delete[](void* ptr, std::size_t size)} to simply call -\tcode{operator delete[](ptr)}. \end{note} +\tcode{operator delete[](ptr)}. +\end{note} \pnum \default @@ -2580,7 +2506,7 @@ to the corresponding \tcode{operator delete} (single-object) function. \end{itemdescr} -\indexlibrary{\idxcode{delete}!\idxcode{operator}}% +\indexlibrarymember{delete}{operator}% \begin{itemdecl} 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; @@ -2641,7 +2567,7 @@ The provisions of~\ref{basic.stc.dynamic} do not apply to these reserved placement forms of \tcode{operator new} and \tcode{operator delete}. -\indexlibrary{\idxcode{new}!\idxcode{operator}}% +\indexlibrarymember{new}{operator}% \begin{itemdecl} [[nodiscard]] void* operator new(std::size_t size, void* ptr) noexcept; \end{itemdecl} @@ -2666,7 +2592,7 @@ \end{example} \end{itemdescr} -\indexlibrary{\idxcode{new}!\idxcode{operator}}% +\indexlibrarymember{new}{operator}% \begin{itemdecl} [[nodiscard]] void* operator new[](std::size_t size, void* ptr) noexcept; \end{itemdecl} @@ -2681,7 +2607,7 @@ Intentionally performs no other action. \end{itemdescr} -\indexlibrary{\idxcode{delete}!\idxcode{operator}}% +\indexlibrarymember{delete}{operator}% \begin{itemdecl} void operator delete(void* ptr, void*) noexcept; \end{itemdecl} @@ -2704,7 +2630,7 @@ terminates by throwing an exception\iref{expr.new}. \end{itemdescr} -\indexlibrary{\idxcode{delete}!\idxcode{operator}}% +\indexlibrarymember{delete}{operator}% \begin{itemdecl} void operator delete[](void* ptr, void*) noexcept; \end{itemdecl} @@ -2746,10 +2672,10 @@ \rSec2[alloc.errors]{Storage allocation errors} -\indexlibrary{\idxcode{bad_alloc}}% +\indexlibraryglobal{bad_alloc}% \rSec3[bad.alloc]{Class \tcode{bad_alloc}} -\indexlibrary{\idxcode{bad_alloc}!constructor}% +\indexlibraryctor{bad_alloc}% \begin{codeblock} namespace std { class bad_alloc : public exception { @@ -2777,8 +2703,8 @@ An \impldef{return value of \tcode{bad_alloc::what}} \ntbs{}. \end{itemdescr} -\indexlibrary{\idxcode{bad_array_new_length}}% -\indexlibrary{\idxcode{bad_array_new_length}!constructor}% +\indexlibraryglobal{bad_array_new_length}% +\indexlibraryctor{bad_array_new_length}% \rSec3[new.badlength]{Class \tcode{bad_array_new_length}} \begin{codeblock} @@ -2810,7 +2736,7 @@ \rSec3[new.handler]{Type \tcode{new_handler}} -\indexlibrary{\idxcode{new_handler}}% +\indexlibraryglobal{new_handler}% \begin{itemdecl} using new_handler = void (*)(); \end{itemdecl} @@ -2827,7 +2753,6 @@ \pnum \required A \tcode{new_handler} shall perform one of the following: - \begin{itemize} \item make more storage available for allocation and then return; @@ -2835,18 +2760,18 @@ throw an exception of type \tcode{bad_alloc} or a class derived from -\indexlibrary{\idxcode{bad_alloc}}% +\indexlibraryglobal{bad_alloc}% \tcode{bad_alloc}; \item terminate execution of the program without returning to the caller. -\indexlibrary{\idxcode{abort}}% -\indexlibrary{\idxcode{exit}}% +\indexlibraryglobal{abort}% +\indexlibraryglobal{exit}% \end{itemize} \end{itemdescr} \rSec3[set.new.handler]{\tcode{set_new_handler}} -\indexlibrary{\idxcode{set_new_handler}}% +\indexlibraryglobal{set_new_handler}% \begin{itemdecl} new_handler set_new_handler(new_handler new_p) noexcept; \end{itemdecl} @@ -2868,20 +2793,23 @@ \rSec3[get.new.handler]{\tcode{get_new_handler}} -\indexlibrary{\idxcode{get_new_handler}}% +\indexlibraryglobal{get_new_handler}% \begin{itemdecl} new_handler get_new_handler() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns The current \tcode{new_handler}. -\begin{note} This may be a null pointer value. \end{note} +\returns +The current \tcode{new_handler}. +\begin{note} +This may be a null pointer value. +\end{note} \end{itemdescr} \rSec2[ptr.launder]{Pointer optimization barrier} -\indexlibrary{\idxcode{launder}}% +\indexlibraryglobal{launder}% \begin{itemdecl} template [[nodiscard]] constexpr T* launder(T* p) noexcept; \end{itemdecl} @@ -2945,7 +2873,7 @@ \rSec2[hardware.interference]{Hardware interference size} -\indexlibrary{\idxcode{hardware_destructive_interference_size}}% +\indexlibraryglobal{hardware_destructive_interference_size}% \begin{itemdecl} inline constexpr size_t hardware_destructive_interference_size = @\impdef{}@; \end{itemdecl} @@ -2967,7 +2895,7 @@ \end{codeblock} \end{example} -\indexlibrary{\idxcode{hardware_constructive_interference_size}}% +\indexlibraryglobal{hardware_constructive_interference_size}% \begin{itemdecl} inline constexpr size_t hardware_constructive_interference_size = @\impdef{}@; \end{itemdecl} @@ -2996,18 +2924,15 @@ \rSec1[support.rtti]{Type identification} \pnum -The header -\tcode{} -defines a +The header \libheaderdef{typeinfo} defines a type associated with type information generated by the implementation. It also defines two types for reporting dynamic type identification errors. \rSec2[typeinfo.syn]{Header \tcode{} synopsis} -\indexhdr{typeinfo}% -\indexlibrary{\idxcode{type_info}}% -\indexlibrary{\idxcode{bad_cast}}% -\indexlibrary{\idxcode{bad_typeid}}% +\indexlibraryglobal{type_info}% +\indexlibraryglobal{bad_cast}% +\indexlibraryglobal{bad_typeid}% \begin{codeblock} namespace std { class type_info; @@ -3018,7 +2943,7 @@ \rSec2[type.info]{Class \tcode{type_info}} -\indexlibrary{\idxcode{type_info}}% +\indexlibraryglobal{type_info}% \begin{codeblock} namespace std { class type_info { @@ -3029,8 +2954,8 @@ size_t hash_code() const noexcept; const char* name() const noexcept; - type_info(const type_info& rhs) = delete; // cannot be copied - type_info& operator=(const type_info& rhs) = delete; // cannot be copied + type_info(const type_info&) = delete; // cannot be copied + type_info& operator=(const type_info&) = delete; // cannot be copied }; } \end{codeblock} @@ -3086,12 +3011,14 @@ \begin{itemdescr} \pnum -\returns An unspecified value, except that within a single execution of the +\returns +An unspecified value, except that within a single execution of the program, it shall return the same value for any two \tcode{type_info} objects which compare equal. \pnum -\remarks An implementation should return different values for two +\remarks +An implementation should return different values for two \tcode{type_info} objects which do not compare equal. \end{itemdescr} @@ -3110,13 +3037,13 @@ \remarks The message may be a null-terminated multibyte string\iref{multibyte.strings}, suitable for conversion and display as a -\tcode{wstring}~(\ref{string.classes}, \ref{locale.codecvt}) +\tcode{wstring}~(\ref{string.classes}, \ref{locale.codecvt}). \end{itemdescr} \rSec2[bad.cast]{Class \tcode{bad_cast}} -\indexlibrary{\idxcode{bad_cast}}% -\indexlibrary{\idxcode{bad_cast}!constructor}% +\indexlibraryglobal{bad_cast}% +\indexlibraryctor{bad_cast}% \begin{codeblock} namespace std { class bad_cast : public exception { @@ -3149,8 +3076,8 @@ \rSec2[bad.typeid]{Class \tcode{bad_typeid}} -\indexlibrary{\idxcode{bad_typeid}}% -\indexlibrary{\idxcode{bad_typeid}!constructor}% +\indexlibraryglobal{bad_typeid}% +\indexlibraryctor{bad_typeid}% \begin{codeblock} namespace std { class bad_typeid : public exception { @@ -3181,14 +3108,23 @@ An \impldef{return value of \tcode{bad_typeid::what}} \ntbs{}. \end{itemdescr} -\rSec1[support.srcloc]{Class \tcode{source_location}} +\rSec1[support.srcloc]{Source location} + +\rSec2[source.location.syn]{Header \tcode{} synopsis} + +The header \libheaderdef{source_location} defines +the class \tcode{source_location} +that provides a means to obtain source location information. -The header \tcode{} defines the class \tcode{source_location} that provides a means to obtain source location information. +\begin{codeblock} +namespace std { + struct source_location; +} +\end{codeblock} -\rSec2[source_location.syn]{Header \tcode{} synopsis} -\indexhdr{source_location}% -\indexlibrary{\idxcode{source_location}}% +\rSec2[support.srcloc.class]{Class \tcode{source_location}} +\indexlibraryglobal{source_location}% \begin{codeblock} namespace std { struct source_location { @@ -3250,7 +3186,7 @@ \item \tcode{lhs.column() == rhs_p.column()} \end{itemize} -\rSec2[support.srcloc.cons]{Creation} +\rSec3[support.srcloc.cons]{Creation} \begin{itemdecl} static consteval source_location current() noexcept; @@ -3352,14 +3288,15 @@ The data members are initialized with valid but unspecified values. \end{itemdescr} -\rSec2[support.srcloc.access]{Field access} +\rSec3[support.srcloc.obs]{Observers} \begin{itemdecl} constexpr uint_least32_t line() const noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{line_}. +\returns +\tcode{line_}. \end{itemdescr} \begin{itemdecl} @@ -3392,12 +3329,10 @@ \rSec1[support.exception]{Exception handling} \pnum -The header -\tcode{} +The header \libheaderdef{exception} defines several types and functions related to the handling of exceptions in a \Cpp{} program. \rSec2[exception.syn]{Header \tcode{} synopsis} -\indexhdr{exception}% \begin{codeblock} namespace std { @@ -3425,8 +3360,8 @@ \rSec2[exception]{Class \tcode{exception}} -\indexlibrary{\idxcode{exception}}% -\indexlibrary{\idxcode{exception}!constructor}% +\indexlibraryglobal{exception}% +\indexlibraryctor{exception}% \begin{codeblock} namespace std { class exception { @@ -3464,7 +3399,7 @@ The \tcode{what()} member function of each such \tcode{T} satisfies the constraints specified for \tcode{exception::what()} (see below). -\indexlibrary{\idxcode{exception}!constructor}% +\indexlibraryctor{exception}% \indexlibrarymember{operator=}{exception}% \begin{itemdecl} exception(const exception& rhs) noexcept; @@ -3473,11 +3408,12 @@ \begin{itemdescr} \pnum -\ensures If \tcode{*this} and \tcode{rhs} both have dynamic type \tcode{exception} +\ensures +If \tcode{*this} and \tcode{rhs} both have dynamic type \tcode{exception} then the value of the expression \tcode{strcmp(what(), rhs.what())} shall equal 0. \end{itemdescr} -\indexlibrary{\idxcode{exception}!destructor}% +\indexlibrarydtor{exception}% \begin{itemdecl} virtual ~exception(); \end{itemdecl} @@ -3511,8 +3447,8 @@ \rSec2[bad.exception]{Class \tcode{bad_exception}} -\indexlibrary{\idxcode{bad_exception}}% -\indexlibrary{\idxcode{bad_exception}!constructor}% +\indexlibraryglobal{bad_exception}% +\indexlibraryctor{bad_exception}% \begin{codeblock} namespace std { class bad_exception : public exception { @@ -3546,7 +3482,7 @@ \rSec3[terminate.handler]{Type \tcode{terminate_handler}} -\indexlibrary{\idxcode{terminate_handler}}% +\indexlibraryglobal{terminate_handler}% \begin{itemdecl} using terminate_handler = void (*)(); \end{itemdecl} @@ -3557,7 +3493,7 @@ \term{handler function} to be called by \tcode{std::terminate()} -\indexlibrary{\idxcode{terminate}}% +\indexlibraryglobal{terminate}% when terminating exception processing. \pnum @@ -3569,12 +3505,12 @@ \default The implementation's default \tcode{terminate_handler} calls \tcode{abort()}.% -\indexlibrary{\idxcode{abort}}% +\indexlibraryglobal{abort}% \end{itemdescr} \rSec3[set.terminate]{\tcode{set_terminate}} -\indexlibrary{\idxcode{set_terminate}}% +\indexlibraryglobal{set_terminate}% \begin{itemdecl} terminate_handler set_terminate(terminate_handler f) noexcept; \end{itemdecl} @@ -3586,7 +3522,8 @@ handler function for terminating exception processing. \pnum -\remarks It is unspecified whether a null pointer value designates the default +\remarks +It is unspecified whether a null pointer value designates the default \tcode{terminate_handler}. \pnum @@ -3596,20 +3533,23 @@ \rSec3[get.terminate]{\tcode{get_terminate}} -\indexlibrary{\idxcode{get_terminate}}% +\indexlibraryglobal{get_terminate}% \begin{itemdecl} terminate_handler get_terminate() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns The current \tcode{terminate_handler}. -\begin{note} This may be a null pointer value. \end{note} +\returns +The current \tcode{terminate_handler}. +\begin{note} +This may be a null pointer value. +\end{note} \end{itemdescr} \rSec3[terminate]{\tcode{terminate}} -\indexlibrary{\idxcode{terminate}}% +\indexlibraryglobal{terminate}% \begin{itemdecl} [[noreturn]] void terminate() noexcept; \end{itemdecl} @@ -3626,14 +3566,17 @@ Calls a \tcode{terminate_handler} function. It is unspecified which \tcode{terminate_handler} function will be called if an exception is active during a call to \tcode{set_terminate}. -Otherwise calls the current \tcode{terminate_handler} function. \begin{note} A +Otherwise calls the current \tcode{terminate_handler} function. +\begin{note} +A default \tcode{terminate_handler} is always considered a callable handler in -this context. \end{note} +this context. +\end{note} \end{itemdescr} \rSec2[uncaught.exceptions]{\tcode{uncaught_exceptions}} -\indexlibrary{\idxcode{uncaught_exceptions}}% +\indexlibraryglobal{uncaught_exceptions}% \begin{itemdecl} int uncaught_exceptions() noexcept; \end{itemdecl} @@ -3652,7 +3595,7 @@ \rSec2[propagation]{Exception propagation} -\indexlibrary{\idxcode{exception_ptr}}% +\indexlibraryglobal{exception_ptr}% \begin{itemdecl} using exception_ptr = @\unspec@; \end{itemdecl} @@ -3678,29 +3621,35 @@ enumeration, or pointer type. \pnum -\begin{note} An implementation might use a reference-counted smart -pointer as \tcode{exception_ptr}. \end{note} +\begin{note} +An implementation might use a reference-counted smart +pointer as \tcode{exception_ptr}. +\end{note} \pnum For purposes of determining the presence of a data race, operations on \tcode{exception_ptr} objects shall access and modify only the \tcode{exception_ptr} objects themselves and not the exceptions they refer to. Use of \tcode{rethrow_exception} on \tcode{exception_ptr} objects that refer to -the same exception object shall not introduce a data race. \begin{note} If +the same exception object shall not introduce a data race. +\begin{note} +If \tcode{rethrow_exception} rethrows the same exception object (rather than a copy), concurrent access to that rethrown exception object may introduce a data race. Changes in the number of \tcode{exception_ptr} objects that refer to a -particular exception do not introduce a data race. \end{note} +particular exception do not introduce a data race. +\end{note} \end{itemdescr} -\indexlibrary{\idxcode{current_exception}}% +\indexlibraryglobal{current_exception}% \begin{itemdecl} exception_ptr current_exception() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\returns An \tcode{exception_ptr} object that refers to +\returns +An \tcode{exception_ptr} object that refers to the currently handled exception\iref{except.handle} or a copy of the currently handled exception, or a null \tcode{exception_ptr} object if no exception is being handled. The referenced object shall remain valid at least as long as there is an @@ -3709,37 +3658,45 @@ \tcode{exception_ptr} object that refers to an instance of \tcode{bad_alloc}. It is unspecified whether the return values of two successive calls to \tcode{current_exception} refer to the same exception object. -\begin{note} That is, it is unspecified whether \tcode{current_exception} -creates a new copy each time it is called. \end{note} +\begin{note} +That is, it is unspecified whether \tcode{current_exception} +creates a new copy each time it is called. +\end{note} If the attempt to copy the current exception object throws an exception, the function returns an \tcode{exception_ptr} object that refers to the thrown exception or, -if this is not possible, to an instance of \tcode{bad_exception}. \begin{note} The +if this is not possible, to an instance of \tcode{bad_exception}. +\begin{note} +The copy constructor of the thrown exception may also fail, so the implementation is allowed to substitute a \tcode{bad_exception} object to avoid infinite -recursion.\end{note} +recursion. +\end{note} \end{itemdescr} -\indexlibrary{\idxcode{rethrow_exception}}% +\indexlibraryglobal{rethrow_exception}% \begin{itemdecl} [[noreturn]] void rethrow_exception(exception_ptr p); \end{itemdecl} \begin{itemdescr} \pnum -\expects \tcode{p} is not a null pointer. +\expects +\tcode{p} is not a null pointer. \pnum -\throws The exception object to which \tcode{p} refers. +\throws +The exception object to which \tcode{p} refers. \end{itemdescr} -\indexlibrary{\idxcode{make_exception_ptr}}% +\indexlibraryglobal{make_exception_ptr}% \begin{itemdecl} template exception_ptr make_exception_ptr(E e) noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects Creates an \tcode{exception_ptr} object that refers to a copy of \tcode{e}, as if: +\effects +Creates an \tcode{exception_ptr} object that refers to a copy of \tcode{e}, as if: \begin{codeblock} try { throw e; @@ -3749,13 +3706,15 @@ \end{codeblock} \pnum -\begin{note} This function is provided for convenience and -efficiency reasons. \end{note} +\begin{note} +This function is provided for convenience and +efficiency reasons. +\end{note} \end{itemdescr} \rSec2[except.nested]{\tcode{nested_exception}} -\indexlibrary{\idxcode{nested_exception}}% +\indexlibraryglobal{nested_exception}% \begin{codeblock} namespace std { class nested_exception { @@ -3781,18 +3740,20 @@ for later use. \pnum -\begin{note} \tcode{nested_exception} has a virtual destructor to make it a +\begin{note} +\tcode{nested_exception} has a virtual destructor to make it a polymorphic class. Its presence can be tested for with \tcode{dynamic_cast}. \end{note} -\indexlibrary{\idxcode{nested_exception}!constructor}% +\indexlibraryctor{nested_exception}% \begin{itemdecl} nested_exception() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\effects The constructor calls \tcode{current_exception()} and stores the returned value. +\effects +The constructor calls \tcode{current_exception()} and stores the returned value. \end{itemdescr} \indexlibrarymember{rethrow_nested}{nested_exception}% @@ -3802,7 +3763,8 @@ \begin{itemdescr} \pnum -\effects If \tcode{nested_ptr()} returns a null pointer, the function calls the function \tcode{std::terminate}. +\effects +If \tcode{nested_ptr()} returns a null pointer, the function calls the function \tcode{std::terminate}. Otherwise, it throws the stored exception captured by \tcode{*this}. \end{itemdescr} @@ -3813,7 +3775,8 @@ \begin{itemdescr} \pnum -\returns The stored exception captured by this \tcode{nested_exception} object. +\returns +The stored exception captured by this \tcode{nested_exception} object. \end{itemdescr} \indexlibrarymember{throw_with_nested}{nested_exception}% @@ -3826,7 +3789,8 @@ Let \tcode{U} be \tcode{decay_t}. \pnum -\expects \tcode{U} meets the \oldconcept{CopyConstructible} requirements. +\expects +\tcode{U} meets the \oldconcept{CopyConstructible} requirements. \pnum \throws @@ -3858,17 +3822,16 @@ \rSec1[support.initlist]{Initializer lists} -\indexhdr{initializer_list}% \pnum -The header \tcode{} defines a class template and several +The header \libheaderdef{initializer_list} defines a class template and several support functions related to list-initialization~(see \ref{dcl.init.list}). \indextext{signal-safe!\idxcode{initializer_list} functions}% All functions specified in this subclause are signal-safe\iref{support.signal}. \rSec2[initializer.list.syn]{Header \tcode{} synopsis} -\indexlibrary{\idxcode{initializer_list}}% -\indexlibrary{\idxcode{begin}}% -\indexlibrary{\idxcode{end}}% +\indexlibraryglobal{initializer_list}% +\indexlibraryglobal{begin}% +\indexlibraryglobal{end}% \begin{codeblock} namespace std { @@ -3897,11 +3860,14 @@ \pnum An object of type \tcode{initializer_list} provides access to an array of -objects of type \tcode{const E}. \begin{note} A pair of pointers or a pointer plus +objects of type \tcode{const E}. +\begin{note} +A pair of pointers or a pointer plus a length would be obvious representations for \tcode{initializer_list}. \tcode{initializer_list} is used to implement initializer lists as specified in~\ref{dcl.init.list}. Copying an initializer list does not copy the underlying -elements. \end{note} +elements. +\end{note} \pnum If an explicit specialization or partial specialization of @@ -3909,14 +3875,15 @@ \rSec2[support.initlist.cons]{Initializer list constructors} -\indexlibrary{\idxcode{initializer_list}!constructor}% +\indexlibraryctor{initializer_list}% \begin{itemdecl} constexpr initializer_list() noexcept; \end{itemdecl} \begin{itemdescr} \pnum -\ensures \tcode{size() == 0}. +\ensures +\tcode{size() == 0}. \end{itemdescr} \rSec2[support.initlist.access]{Initializer list access} @@ -3928,7 +3895,8 @@ \begin{itemdescr} \pnum -\returns A pointer to the beginning of the array. If \tcode{size() == 0} the +\returns +A pointer to the beginning of the array. If \tcode{size() == 0} the values of \tcode{begin()} and \tcode{end()} are unspecified but they shall be identical. \end{itemdescr} @@ -3940,7 +3908,8 @@ \begin{itemdescr} \pnum -\returns \tcode{begin() + size()}. +\returns +\tcode{begin() + size()}. \end{itemdescr} \indexlibrarymember{size}{initializer_list}% @@ -3950,10 +3919,12 @@ \begin{itemdescr} \pnum -\returns The number of elements in the array. +\returns +The number of elements in the array. \pnum -\complexity Constant time. +\complexity +Constant time. \end{itemdescr} \rSec2[support.initlist.range]{Initializer list range access} @@ -3965,7 +3936,8 @@ \begin{itemdescr} \pnum -\returns \tcode{il.begin()}. +\returns +\tcode{il.begin()}. \end{itemdescr} \indexlibrary{\idxcode{end(initializer_list)}}% @@ -3975,7 +3947,8 @@ \begin{itemdescr} \pnum -\returns \tcode{il.end()}. +\returns +\tcode{il.end()}. \end{itemdescr} \rSec1[cmp]{Comparisons} @@ -3983,19 +3956,18 @@ \rSec2[compare.syn]{Header \tcode{} synopsis} \pnum -The header \tcode{} specifies types, objects, and functions +The header \libheaderdef{compare} specifies types, objects, and functions for use primarily in connection with the three-way comparison operator\iref{expr.spaceship}. -\indexhdr{compare}% -\indexlibrary{\idxcode{is_eq}}% -\indexlibrary{\idxcode{is_neq}}% -\indexlibrary{\idxcode{is_lt}}% -\indexlibrary{\idxcode{is_lteq}}% -\indexlibrary{\idxcode{is_gt}}% -\indexlibrary{\idxcode{is_geq}}% -\indexlibrary{\idxcode{is_gteq}}% -\indexlibrary{\idxcode{common_comparison_category_t}}% +\indexlibraryglobal{is_eq}% +\indexlibraryglobal{is_neq}% +\indexlibraryglobal{is_lt}% +\indexlibraryglobal{is_lteq}% +\indexlibraryglobal{is_gt}% +\indexlibraryglobal{is_geq}% +\indexlibraryglobal{is_gteq}% +\indexlibraryglobal{common_comparison_category_t}% \begin{codeblock} namespace std { // \ref{cmp.categories}, comparison category types @@ -4105,7 +4077,7 @@ that (a) admits only equality and inequality comparisons, and (b) does not imply substitutability. -\indexlibrary{\idxcode{weak_equality}}% +\indexlibraryglobal{weak_equality}% \indexlibrarymember{equivalent}{weak_equality}% \indexlibrarymember{nonequivalent}{weak_equality}% \begin{codeblock} @@ -4165,7 +4137,7 @@ that (a) admits only equality and inequality comparisons, and (b) does imply substitutability. -\indexlibrary{\idxcode{strong_equality}}% +\indexlibraryglobal{strong_equality}% \indexlibrarymember{equal}{strong_equality}% \indexlibrarymember{nonequal}{strong_equality}% \indexlibrarymember{equivalent}{strong_equality}% @@ -4247,7 +4219,7 @@ and (c) permits two values to be incomparable.% \footnote{That is, \tcode{a < b}, \tcode{a == b}, and \tcode{a > b} might all be \tcode{false}.} -\indexlibrary{\idxcode{partial_ordering}}% +\indexlibraryglobal{partial_ordering}% \indexlibrarymember{less}{partial_ordering}% \indexlibrarymember{equivalent}{partial_ordering}% \indexlibrarymember{greater}{partial_ordering}% @@ -4379,7 +4351,7 @@ that (a) admits all of the six two-way comparison operators (\ref{expr.rel}, \ref{expr.eq}), and (b) does not imply substitutability. -\indexlibrary{\idxcode{weak_ordering}}% +\indexlibraryglobal{weak_ordering}% \indexlibrarymember{less}{weak_ordering}% \indexlibrarymember{equivalent}{weak_ordering}% \indexlibrarymember{greater}{weak_ordering}% @@ -4516,7 +4488,7 @@ that (a) admits all of the six two-way comparison operators (\ref{expr.rel}, \ref{expr.eq}), and (b) does imply substitutability. -\indexlibrary{\idxcode{strong_ordering}}% +\indexlibraryglobal{strong_ordering}% \indexlibrarymember{less}{strong_ordering}% \indexlibrarymember{equal}{strong_ordering}% \indexlibrarymember{equivalent}{strong_ordering}% @@ -4688,7 +4660,7 @@ can be converted to an instance of the latter. \end{note} -\indexlibrary{\idxcode{common_comparison_category}}% +\indexlibraryglobal{common_comparison_category}% \begin{itemdecl} template struct common_comparison_category { @@ -4713,11 +4685,11 @@ \begin{codeblock} template - concept @\placeholder{compares-as}@ = // \expos + concept @\defexposconcept{compares-as}@ = // \expos same_as, Cat>; template - concept @\placeholder{partially-ordered-with}@ = // \expos + concept @\defexposconcept{partially-ordered-with}@ = // \expos requires(const remove_reference_t& t, const remove_reference_t& u) { { t < u } -> boolean; { t > u } -> boolean; @@ -4735,7 +4707,7 @@ lvalues of types \tcode{const remove_reference_t} and \tcode{const remove_reference_t}, respectively. \tcode{T} and \tcode{U} model -\tcode{\placeholder{partially-ordered-with}} only if: +\tcode{\exposconcept{partially-ordered-with}} only if: \begin{itemize} \item \tcode{t < u}, @@ -4757,14 +4729,14 @@ \tcode{bool(u <= t) == bool(t >= u)} is \tcode{true}. \end{itemize} -\indexlibrary{\idxcode{three_way_comparable}}% +\indexlibraryglobal{three_way_comparable}% \begin{codeblock} template - concept three_way_comparable = - @\placeholder{weakly-equality-comparable-with}@ && - (!convertible_to || @\placeholder{partially-ordered-with}@) && + concept @\deflibconcept{three_way_comparable}@ = + @\exposconcept{weakly-equality-comparable-with}@ && + (!convertible_to || @\exposconcept{partially-ordered-with}@) && requires(const remove_reference_t& a, const remove_reference_t& b) { - { a <=> b } -> @\placeholder{compares-as}@; + { a <=> b } -> @\exposconcept{compares-as}@; }; \end{codeblock} @@ -4800,20 +4772,20 @@ \libconcept{totally_ordered}\iref{concept.totallyordered}. \end{itemize} -\indexlibrary{\idxcode{three_way_comparable_with}}% +\indexlibraryglobal{three_way_comparable_with}% \begin{codeblock} template - concept three_way_comparable_with = - @\placeholder{weakly-equality-comparable-with}@ && - (!convertible_to || @\placeholder{partially-ordered-with}@) && + concept @\deflibconcept{three_way_comparable_with}@ = + @\exposconcept{weakly-equality-comparable-with}@ && + (!convertible_to || @\exposconcept{partially-ordered-with}@) && three_way_comparable && three_way_comparable && common_reference_with&, const remove_reference_t&> && three_way_comparable< common_reference_t&, const remove_reference_t&>, Cat> && requires(const remove_reference_t& t, const remove_reference_t& u) { - { t <=> u } -> @\placeholder{compares-as}@; - { u <=> t } -> @\placeholder{compares-as}@; + { t <=> u } -> @\exposconcept{compares-as}@; + { u <=> t } -> @\exposconcept{compares-as}@; }; \end{codeblock} @@ -4889,7 +4861,7 @@ \end{codeblock} resolves to a built-in operator comparing pointers. -\indexlibrary{\idxcode{compare_three_way}}% +\indexlibraryglobal{compare_three_way}% \begin{codeblock} struct compare_three_way { template @@ -4901,9 +4873,9 @@ \end{codeblock} \pnum -In addition to being available via inclusion of the \tcode{} header, +In addition to being available via inclusion of the \libheader{compare} header, the class \tcode{compare_three_way} is available -when the header \tcode{} is included. +when the header \libheaderref{functional} is included. \begin{itemdecl} template @@ -4939,7 +4911,7 @@ \rSec2[cmp.alg]{Comparison algorithms} -\indexlibrary{\idxcode{strong_order}}% +\indexlibraryglobal{strong_order}% \pnum The name \tcode{strong_order} denotes a customization point object\iref{customization.point.object}. @@ -4975,7 +4947,7 @@ \end{note} \end{itemize} -\indexlibrary{\idxcode{weak_order}}% +\indexlibraryglobal{weak_order}% \pnum The name \tcode{weak_order} denotes a customization point object\iref{customization.point.object}. @@ -5025,7 +4997,7 @@ \end{note} \end{itemize} -\indexlibrary{\idxcode{partial_order}}% +\indexlibraryglobal{partial_order}% \pnum The name \tcode{partial_order} denotes a customization point object\iref{customization.point.object}. @@ -5056,7 +5028,7 @@ \end{note} \end{itemize} -\indexlibrary{\idxcode{compare_strong_order_fallback}}% +\indexlibraryglobal{compare_strong_order_fallback}% \pnum The name \tcode{compare_strong_order_fallback} denotes a customization point object\iref{customization.point.object}. @@ -5082,7 +5054,7 @@ Otherwise, \tcode{compare_strong_order_fallback(E, F)} is ill-formed. \end{itemize} -\indexlibrary{\idxcode{compare_weak_order_fallback}}% +\indexlibraryglobal{compare_weak_order_fallback}% \pnum The name \tcode{compare_weak_order_fallback} denotes a customization point object\iref{customization.point.object}. @@ -5108,7 +5080,7 @@ Otherwise, \tcode{compare_weak_order_fallback(E, F)} is ill-formed. \end{itemize} -\indexlibrary{\idxcode{compare_partial_order_fallback}}% +\indexlibraryglobal{compare_partial_order_fallback}% \pnum The name \tcode{compare_partial_order_fallback} denotes a customization point object\iref{customization.point.object}. @@ -5138,17 +5110,15 @@ \rSec1[support.coroutine]{Coroutines} \pnum -The header -\tcode{} +The header \libheaderdef{coroutine} defines several types providing compile and run-time support for coroutines in a \Cpp{} program. \rSec2[coroutine.syn]{Header \tcode{} synopsis} -\indextext{\idxhdr{coroutine}}% -\indexlibrary{\idxhdr{coroutine}}% -\indexlibrary{\idxcode{noop_coroutine_handle}}% +\indexheader{coroutine}% +\indexlibraryglobal{noop_coroutine_handle}% \begin{codeblock} namespace std { // \ref{coroutine.traits}, coroutine traits @@ -5193,7 +5163,7 @@ \rSec3[coroutine.traits.primary]{Class template \tcode{coroutine_traits}} \pnum -The header \tcode{} defines the primary template +The header \libheader{coroutine} defines the primary template \tcode{coroutine_traits} such that if \tcode{ArgTypes} is a parameter pack of types and if the \grammarterm{qualified-id} \tcode{R::promise_type} is valid and @@ -5202,7 +5172,7 @@ accessible member: \begin{codeblock} - using promise_type = typename R::promise_type; +using promise_type = typename R::promise_type; \end{codeblock} Otherwise, \tcode{coroutine_traits} has no members. @@ -5213,7 +5183,7 @@ \rSec2[coroutine.handle]{Class template \tcode{coroutine_handle}} -\indexlibrary{\idxcode{coroutine_handle}}% +\indexlibraryglobal{coroutine_handle}% \begin{codeblock} namespace std { template<> @@ -5271,7 +5241,7 @@ \rSec3[coroutine.handle.con]{Construct/reset} -\indexlibrary{\idxcode{coroutine_handle}!constructor}% +\indexlibraryctor{coroutine_handle}% \begin{itemdecl} constexpr coroutine_handle() noexcept; constexpr coroutine_handle(nullptr_t) noexcept; @@ -5279,7 +5249,8 @@ \begin{itemdescr} \pnum -\ensures \tcode{address() == nullptr}. +\ensures +\tcode{address() == nullptr}. \end{itemdescr} \indexlibrarymember{from_promise}{coroutine_handle}% @@ -5292,10 +5263,12 @@ \requires \tcode{p} is a reference to a promise object of a coroutine. \pnum -\returns A coroutine handle \tcode{h} referring to the coroutine. +\returns +A coroutine handle \tcode{h} referring to the coroutine. \pnum -\ensures \tcode{addressof(h.promise()) == addressof(p)}. +\ensures +\tcode{addressof(h.promise()) == addressof(p)}. \end{itemdescr} \indexlibrarymember{operator=}{coroutine_handle}% @@ -5305,10 +5278,12 @@ \begin{itemdescr} \pnum -\ensures \tcode{address() == nullptr}. +\ensures +\tcode{address() == nullptr}. \pnum -\returns \tcode{*this}. +\returns +\tcode{*this}. \end{itemdescr} \rSec3[coroutine.handle.export.import]{Export/import} @@ -5320,7 +5295,8 @@ \begin{itemdescr} \pnum -\returns \tcode{ptr}. +\returns +\tcode{ptr}. \end{itemdescr} \indexlibrarymember{from_address}{coroutine_handle}% @@ -5334,7 +5310,8 @@ \requires \tcode{addr} was obtained via a prior call to \tcode{address}. \pnum -\ensures \tcode{from_address(address()) == *this}. +\ensures +\tcode{from_address(address()) == *this}. \end{itemdescr} \rSec3[coroutine.handle.observers]{Observers} @@ -5346,7 +5323,8 @@ \begin{itemdescr} \pnum -\returns \tcode{address() != nullptr}. +\returns +\tcode{address() != nullptr}. \end{itemdescr} \indexlibrarymember{done}{coroutine_handle}% @@ -5359,7 +5337,8 @@ \requires \tcode{*this} refers to a suspended coroutine. \pnum -\returns \tcode{true} if the coroutine is suspended at its +\returns +\tcode{true} if the coroutine is suspended at its final suspend point, otherwise \tcode{false}. \end{itemdescr} @@ -5393,7 +5372,8 @@ \requires \tcode{*this} refers to a suspended coroutine. \pnum -\effects Resumes the execution of the coroutine. If the coroutine +\effects +Resumes the execution of the coroutine. If the coroutine was suspended at its final suspend point, behavior is undefined. \end{itemdescr} @@ -5407,7 +5387,8 @@ \requires \tcode{*this} refers to a suspended coroutine. \pnum -\effects Destroys the coroutine\iref{dcl.fct.def.coroutine}. +\effects +Destroys the coroutine\iref{dcl.fct.def.coroutine}. \end{itemdescr} \rSec3[coroutine.handle.promise]{Promise access} @@ -5422,7 +5403,8 @@ \requires \tcode{*this} refers to a coroutine. \pnum -\returns A reference to the promise of the coroutine. +\returns +A reference to the promise of the coroutine. \end{itemdescr} \rSec3[coroutine.handle.compare]{Comparison operators} @@ -5434,7 +5416,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{x.address() == y.address()}. +\pnum +\returns +\tcode{x.address() == y.address()}. \end{itemdescr} \indexlibrarymember{operator<=>}{coroutine_handle}% @@ -5443,38 +5427,42 @@ \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{compare_three_way()(x.address(), y.address())}. +\pnum +\returns +\tcode{compare_three_way()(x.address(), y.address())}. \end{itemdescr} \rSec3[coroutine.handle.hash]{Hash support} -\indexlibrary{\idxcode{hash}!\idxcode{coroutine_handle}}% +\indexlibrarymember{hash}{coroutine_handle}% \begin{itemdecl} template struct hash>; \end{itemdecl} \begin{itemdescr} -\pnum The specialization is enabled\iref{unord.hash}. +\pnum +The specialization is enabled\iref{unord.hash}. \end{itemdescr} \rSec2[coroutine.noop]{No-op coroutines} \rSec3[coroutine.promise.noop]{Class \tcode{noop_coroutine_promise}} -\indexlibrary{\idxcode{noop_coroutine_promise}}% +\indexlibraryglobal{noop_coroutine_promise}% \begin{itemdecl} struct noop_coroutine_promise {}; \end{itemdecl} \begin{itemdescr} -\pnum The class \tcode{noop_coroutine_promise} defines the promise type for +\pnum +The class \tcode{noop_coroutine_promise} defines the promise type for the coroutine referred to by \tcode{noop_coroutine_handle}\iref{coroutine.syn}. \end{itemdescr} \rSec3[coroutine.handle.noop]{Class \tcode{coroutine_handle}} -\indexlibrary{\idxcode{coroutine_handle}}% +\indexlibraryglobal{coroutine_handle}% \begin{codeblock} namespace std { template<> @@ -5508,7 +5496,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{true}. +\pnum +\returns +\tcode{true}. \end{itemdescr} \indexlibrarymember{done}{coroutine_handle}% @@ -5517,7 +5507,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{false}. +\pnum +\returns +\tcode{false}. \end{itemdescr} \rSec4[coroutine.handle.noop.resumption]{Resumption} @@ -5532,7 +5524,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \effects None. +\pnum +\effects +None. \pnum \remarks @@ -5549,7 +5543,9 @@ \end{itemdecl} \begin{itemdescr} -\pnum \returns A reference to the promise object associated with this +\pnum +\returns +A reference to the promise object associated with this coroutine handle. \end{itemdescr} @@ -5561,9 +5557,13 @@ \end{itemdecl} \begin{itemdescr} -\pnum \returns \tcode{ptr}. +\pnum +\returns +\tcode{ptr}. -\pnum \remarks A \tcode{noop_coroutine_handle}'s \tcode{ptr} is always a +\pnum +\remarks +A \tcode{noop_coroutine_handle}'s \tcode{ptr} is always a non-null pointer value. \end{itemdescr} @@ -5575,21 +5575,25 @@ \end{itemdecl} \begin{itemdescr} -\pnum \returns A handle to a coroutine that has no observable effects +\pnum +\returns +A handle to a coroutine that has no observable effects when resumed or destroyed. -\pnum \remarks A handle returned from \tcode{noop_coroutine} may or may not +\pnum +\remarks +A handle returned from \tcode{noop_coroutine} may or may not compare equal to a handle returned from another invocation of \tcode{noop_coroutine}. \end{itemdescr} \rSec2[coroutine.trivial.awaitables]{Trivial awaitables} -\indexlibrary{\idxcode{suspend_never}}% +\indexlibraryglobal{suspend_never}% \indexlibrarymember{await_ready}{suspend_never}% \indexlibrarymember{await_suspend}{suspend_never}% \indexlibrarymember{await_resume}{suspend_never}% -\indexlibrary{\idxcode{suspend_always}}% +\indexlibraryglobal{suspend_always}% \indexlibrarymember{await_ready}{suspend_always}% \indexlibrarymember{await_suspend}{suspend_always}% \indexlibrarymember{await_resume}{suspend_always}% @@ -5618,32 +5622,29 @@ \rSec1[support.runtime]{Other runtime support} \pnum -\indexhdr{cstdarg}% -\indexhdr{csetjmp}% -\indexhdr{ctime}% -\indexhdr{csignal}% -\indexhdr{cstdlib}% -\indexlibrary{\idxcode{getenv}}% -\indexlibrary{\idxcode{system}}% +\indexlibraryglobal{getenv}% +\indexlibraryglobal{system}% Headers -\tcode{} (nonlocal jumps), -\tcode{} (signal handling), -\tcode{} (variable arguments), +\libheader{csetjmp} (nonlocal jumps), +\libheader{csignal} (signal handling), +\libheader{cstdarg} (variable arguments), and -\tcode{} (runtime environment \tcode{getenv}, \tcode{system}), +\libheader{cstdlib} (runtime environment \tcode{getenv}, \tcode{system}), provide further compatibility with C code. \pnum Calls to the function -\indexlibrary{\idxcode{getenv}}% +\indexlibraryglobal{getenv}% \tcode{getenv}\iref{cstdlib.syn} shall not introduce a data race\iref{res.on.data.races} provided that nothing modifies the environment. -\begin{note} Calls to the POSIX functions -\indexlibrary{\idxcode{setenv}}% +\begin{note} +Calls to the POSIX functions +\indexlibraryglobal{setenv}% \tcode{setenv} and -\indexlibrary{\idxcode{putenv}}% +\indexlibraryglobal{putenv}% \tcode{putenv} modify the -environment. \end{note} +environment. +\end{note} \pnum A call to the \tcode{setlocale} function\iref{c.locales} @@ -5655,12 +5656,12 @@ \rSec2[cstdarg.syn]{Header \tcode{} synopsis} -\indexhdr{cstdarg}% -\indexlibrary{\idxcode{va_list}}% -\indexlibrary{\idxcode{va_start}}% -\indexlibrary{\idxcode{va_copy}}% -\indexlibrary{\idxcode{va_end}}% -\indexlibrary{\idxcode{va_arg}}% +\indexheader{cstdarg}% +\indexlibraryglobal{va_list}% +\indexlibraryglobal{va_start}% +\indexlibraryglobal{va_copy}% +\indexlibraryglobal{va_end}% +\indexlibraryglobal{va_arg}% \begin{codeblock} namespace std { using va_list = @\seebelow@; @@ -5673,15 +5674,11 @@ \end{codeblock} \pnum -\indexhdr{stdarg.h}% -The contents of the header \tcode{} are the same as the C -standard library header \tcode{}, with the following changes: +The contents of the header \libheaderdef{cstdarg} are the same as the C +standard library header \libheader{stdarg.h}, with the following changes: The restrictions that ISO C places on the second parameter to the -\indexlibrary{\idxcode{va_start}}% -\tcode{va_start} -macro in header -\indexhdr{stdarg.h}% -\tcode{} +\indexlibraryglobal{va_start}% +\tcode{va_start} macro in header \libheader{stdarg.h} are different in this document. The parameter \tcode{parmN} @@ -5706,10 +5703,9 @@ \rSec2[csetjmp.syn]{Header \tcode{} synopsis} -\indexhdr{csetjmp}% -\indexlibrary{\idxcode{jmp_buf}}% -\indexlibrary{\idxcode{longjmp}}% -\indexlibrary{\idxcode{setjmp}}% +\indexlibraryglobal{jmp_buf}% +\indexlibraryglobal{longjmp}% +\indexlibraryglobal{setjmp}% \begin{codeblock} namespace std { using jmp_buf = @\seebelow@; @@ -5720,13 +5716,12 @@ \end{codeblock} \pnum -\indexhdr{setjmp.h}% -The contents of the header \tcode{} are the same as the C -standard library header \tcode{}. +The contents of the header \libheaderdef{csetjmp} are the same as the C +standard library header \libheader{setjmp.h}. \pnum The function signature -\indexlibrary{\idxcode{longjmp}}% +\indexlibraryglobal{longjmp}% \tcode{longjmp(jmp_buf jbuf, int val)} has more restricted behavior in this document. A \tcode{setjmp}/\tcode{longjmp} call pair has undefined @@ -5740,19 +5735,18 @@ \rSec2[csignal.syn]{Header \tcode{} synopsis} -\indexhdr{csignal}% -\indexlibrary{\idxcode{sig_atomic_t}}% -\indexlibrary{\idxcode{signal}}% -\indexlibrary{\idxcode{raise}}% -\indexlibrary{\idxcode{SIG_IGN}}% -\indexlibrary{\idxcode{SIGABRT}}% -\indexlibrary{\idxcode{SIGFPE}}% -\indexlibrary{\idxcode{SIGILL}}% -\indexlibrary{\idxcode{SIGINT}}% -\indexlibrary{\idxcode{SIGSEGV}}% -\indexlibrary{\idxcode{SIGTERM}}% -\indexlibrary{\idxcode{SIG_DFL}}% -\indexlibrary{\idxcode{SIG_ERR}}% +\indexlibraryglobal{sig_atomic_t}% +\indexlibraryglobal{signal}% +\indexlibraryglobal{raise}% +\indexlibraryglobal{SIG_IGN}% +\indexlibraryglobal{SIGABRT}% +\indexlibraryglobal{SIGFPE}% +\indexlibraryglobal{SIGILL}% +\indexlibraryglobal{SIGINT}% +\indexlibraryglobal{SIGSEGV}% +\indexlibraryglobal{SIGTERM}% +\indexlibraryglobal{SIG_DFL}% +\indexlibraryglobal{SIG_ERR}% \begin{codeblock} namespace std { using sig_atomic_t = @\seebelow@; @@ -5776,9 +5770,8 @@ \end{codeblock} \pnum -\indexhdr{signal.h}% -The contents of the header \tcode{} are the same as the C -standard library header \tcode{}. +The contents of the header \libheaderdef{csignal} are the same as the C +standard library header \libheader{signal.h}. \rSec2[support.signal]{Signal handlers} @@ -5790,7 +5783,6 @@ A \defn{plain lock-free atomic operation} is an invocation of a function \tcode{f} from \ref{atomics}, such that: - \begin{itemize} \item \tcode{f} is the function \tcode{atomic_is_lock_free()}, or @@ -5811,12 +5803,11 @@ \pnum \indextext{signal-safe!evaluation|see{evaluation, signal-safe}}% An evaluation is \defnx{signal-safe}{evaluation!signal-safe} unless it includes one of the following: - \begin{itemize} \item a call to any standard library function, except for plain lock-free atomic operations and -functions explicitly identified as signal-safe. +functions explicitly identified as signal-safe; \begin{note} This implicitly excludes the use of \tcode{new} and \tcode{delete} expressions that rely on a library-provided memory allocator. diff --git a/source/templates.tex b/source/templates.tex index 1682ce7b19..fba77ad5f4 100644 --- a/source/templates.tex +++ b/source/templates.tex @@ -7,6 +7,8 @@ \indextext{parameterized type|see{template}}% \indextext{type generator|see{template}} +\rSec1[temp.pre]{Preamble} + \pnum A \defn{template} defines a family of classes, functions, or variables, an alias for a family of types, or a concept. @@ -63,12 +65,14 @@ \opt{nested-name-specifier} concept-name \terminal{<} \opt{template-argument-list} \terminal{>} \end{bnf} -\begin{note} The \tcode{>} token following the +\begin{note} +The \tcode{>} token following the \grammarterm{template-parameter-list} of a \grammarterm{template-declaration} may be the product of replacing a \tcode{>{>}} token by two consecutive \tcode{>} -tokens\iref{temp.names}.\end{note} +tokens\iref{temp.names}. +\end{note} \pnum The @@ -77,7 +81,6 @@ \grammarterm{template-declaration} (if any) shall - \begin{itemize} \item declare or define a function, a class, or a variable, or @@ -93,14 +96,7 @@ \pnum A \grammarterm{template-declaration} is a \grammarterm{declaration}. -\indextext{template!definition of}% -A \grammarterm{template-declaration} is also a definition -if its -\grammarterm{template-head} is followed by -either a \grammarterm{concept-definition} or -a \grammarterm{declaration} that -defines a function, a class, a variable, or a -static data member. A declaration introduced by a template declaration of a +A declaration introduced by a template declaration of a \indextext{variable template!definition of}% variable is a \defnx{variable template}{template!variable}. A variable template at class scope is a \defnx{static data member template}{template!static data member}. @@ -168,7 +164,7 @@ otherwise \tcode{E} is \tcode{(E$'$ \&\& ...)}. This \grammarterm{constraint-expression} \tcode{E} is called the \defnx{immediately-declared constraint}{constraint!immediately-declared} -of \tcode{T}. +of \tcode{Q} for \tcode{T}. The concept designated by a \grammarterm{type-constraint} shall be a type concept\iref{temp.concept}. @@ -204,7 +200,6 @@ \pnum \indextext{entity!templated}% A \defn{templated entity} is - \begin{itemize} \item a template, \item an entity defined\iref{basic.def} or created\iref{class.temporary} @@ -282,12 +277,14 @@ \keyword{typename} \end{bnf} -\begin{note} The \tcode{>} token following the +\begin{note} +The \tcode{>} token following the \grammarterm{template-parameter-list} of a \grammarterm{type-parameter} may be the product of replacing a \tcode{>{>}} token by two consecutive \tcode{>} -tokens\iref{temp.names}.\end{note} +tokens\iref{temp.names}. +\end{note} \pnum There is no semantic difference between @@ -369,7 +366,6 @@ \pnum A non-type \grammarterm{template-parameter} shall have one of the following (optionally cv-qualified) types: - \begin{itemize} \item a literal type that has strong structural equality\iref{class.compare.default}, @@ -415,6 +411,7 @@ \end{note} \begin{example} \begin{codeblock} +using X = int; struct A { friend bool operator==(const A&, const A&) = default; }; template void f() { i++; // error: change of template-parameter value @@ -434,7 +431,6 @@ \grammarterm{template-parameter} shall not be declared to have floating-point or void type. \begin{example} - \begin{codeblock} template class X; // error template class Y; // OK @@ -451,7 +447,6 @@ of function type \tcode{T} is adjusted to be of type ``pointer to \tcode{T}''. \begin{example} - \begin{codeblock} template struct R { @\commentellip@ }; template struct S { @\commentellip@ }; @@ -466,26 +461,28 @@ \pnum A \grammarterm{type-parameter} that starts with a \grammarterm{type-constraint} -introduces the immediately-declared constraint\iref{temp} of the parameter. +introduces the immediately-declared constraint\iref{temp} +of the \grammarterm{type-constraint} for the parameter. \begin{example} \begin{codeblock} template concept C1 = true; template concept C2 = true; template concept C3 = true; -template struct s1; // associates \tcode{C1} -template struct s2; // associates \tcode{(C1 \&\& ...)} -template struct s3; // associates \tcode{(C2 \&\& ...)} -template T> struct s4; // associates \tcode{C3} -template... T> struct s5; // associates \tcode{(C3 \&\& ...)} +template struct s1; // associates \tcode{C1} +template struct s2; // associates \tcode{(C1 \&\& ...)} +template struct s3; // associates \tcode{(C2 \&\& ...)} +template T> struct s4; // associates \tcode{C3} +template... T> struct s5; // associates \tcode{(C3 \&\& ...)} \end{codeblock} \end{example} \pnum A non-type template parameter declared with a type that contains a placeholder type with a \grammarterm{type-constraint} -introduces the immediately-declared constraint of -the invented type corresponding to the placeholder\iref{dcl.fct}. +introduces the immediately-declared constraint +of the \grammarterm{type-constraint} +for the invented type corresponding to the placeholder\iref{dcl.fct}. \pnum A @@ -526,14 +523,11 @@ from all prior declarations of the template in the same way default function arguments are\iref{dcl.fct.default}. \begin{example} - \begin{codeblock} template class A; template class A; \end{codeblock} - is equivalent to - \begin{codeblock} template class A; \end{codeblock} @@ -564,7 +558,6 @@ from the parameter-type-list of the deduction guide template. \begin{example} - \begin{codeblock} template class B; // error @@ -580,7 +573,6 @@ shall not be given default arguments by two different declarations in the same scope. \begin{example} - \begin{codeblock} template class X; template class X { @\commentellip@ }; // error @@ -600,7 +592,6 @@ \grammarterm{template-parameter-list} rather than a greater-than operator. \begin{example} - \begin{codeblock} template 4 > // syntax error class X { @\commentellip@ }; @@ -623,7 +614,6 @@ \grammarterm{template-parameter}. \begin{example} \begin{codeblock} -template struct B {}; template