`_ instead,
then run the following command to install the other packages that the draft requires:
- sudo tlmgr install latexmk isodate substr relsize ulem fixme rsfs extract layouts enumitem
+ sudo tlmgr install latexmk isodate substr relsize ulem fixme rsfs extract layouts enumitem l3packages l3kernel
---------------------------------------
Getting Started on Debian-based Systems
@@ -40,7 +40,7 @@ Getting Started on Fedora
Install the following packages:
- dnf install latexmk texlive texlive-isodate texlive-relsize texlive-ulem texlive-fixme texlive-extract
+ dnf install latexmk texlive texlive-isodate texlive-relsize texlive-ulem texlive-fixme texlive-extract texlive-l3kernel texlive-l3packages
-----------------------------
Getting Started on Arch Linux
diff --git a/papers/n4799.html b/papers/n4799.html
new file mode 100644
index 0000000000..25dc644168
--- /dev/null
+++ b/papers/n4799.html
@@ -0,0 +1,572 @@
+N4799
+N4799 Editors' Report -- Programming Languages -- C++
+
+2019-01-21
+Richard Smith (editor) (Google Inc)
+Dawn Perchik (co-editor) (Bright Side Computing, LLC)
+Jens Maurer (co-editor)
+Thomas Köppe (co-editor) (Google DeepMind)
+<cxxeditor@gmail.com>
+
+Acknowledgements
+
+Thanks to all those who have submitted editorial
+issues
+and to those who have provided pull requests with fixes.
+
+New papers
+
+
+- N4800 is the current C++ working draft. It replaces N4791.
+- N4799 is this Editors' Report.
+
+
+Motions incorporated into working draft
+
+This revision contains only editorial changes relative to N4791.
+
+Notable editorial changes
+
+DECAY_COPY
+
+DECAY_COPY
has been renamed to decay-copy
+for consistency with other exposition-only entities,
+and moved from
+[thread.decaycopy] to [expos.only.func].
+
+Other changes to section labels
+
+[iterator.container] has been merged into [iterator.range], and
+[range.prim] has been merged into [range.access].
+
+The parts of [range.adaptors] that create new ranges rather than adapting
+existing ranges have been split into a separate [range.factories].
+
+The parts of [dcl.init] relating to indeterminate values have been moved to a
+new [basic.indet].
+
+Minor editorial fixes
+
+A log of editorial fixes made to the working draft since N4791 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 2831ba3b8e1862a8a0e52d540b61062e72e89d6d
+Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
+Date: Mon Jan 14 11:15:11 2019 -0500
+
+ [depr.strstreambuf.virtuals] Hyphenate "implementation-defined"
+
+commit d333390f0dd56dc9143731c1be00f66bc3752479
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Sat Dec 29 12:54:56 2018 +0100
+
+ [range.prim] merge into [range.access]
+
+commit dc3be11dd06a5edfa81061dce4b79fec2a8024df
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Sat Dec 29 12:54:26 2018 +0100
+
+ [iterator.container] merge into [iterator.range]
+
+commit 75dde78fd9ac709ff4843d1d5572d5cbfe4ac6d2
+Author: S. B. Tam <cpplearner@outlook.com>
+Date: Mon Jan 21 23:24:52 2019 +0800
+
+ [meta.const.eval] Fix typo in function name (#2650)
+
+commit 55577a76181134d1dd442af3f4eb36c4d861c7c9
+Author: kiroma <krzysio.kurek@wp.pl>
+Date: Tue Jan 15 00:56:07 2019 +0100
+
+ [thread.condition] Improve description of efficiency of condition_variable.
+
+commit 281a8bd29f97b5249eae68fe0280e2dfda5ac714
+Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
+Date: Mon Jan 7 18:37:20 2019 -0500
+
+ [ranges.syn] Fix a typo: "fowarding"
+
+commit 099022dbf1642541ab0d1c380ed26e8fb1244d86
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Wed Jan 2 22:29:51 2019 +0100
+
+ [unreachable.sentinel] 'open interval' -> 'unbounded interval'
+
+commit a9fdd8589a51617d5d60bf59263d1567076718ba
+Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
+Date: Tue Jan 1 21:40:09 2019 -0500
+
+ Fix some `operator<=>` declarations with the wrong number of parameters.
+
+ Also one `operator<` that should at least have been a const member function.
+
+commit d42648926f4131586943b7dccb7df41bfbd8df5b
+Author: Eelis van der Weegen <eelis@eelis.net>
+Date: Tue Jan 1 14:56:43 2019 +0100
+
+ [expr.prim.id.dtor] Fix comment in example.
+
+ In translation phase 3, the "0.T" in the line of code is parsed as a (single) preprocessing-token.
+
+ In phase 7, this preprocessing token is converted into a user-defined-floating-literal whose ud-suffix component is "T".
+
+ At no point is the "0." partial token a floating-point literal. At most, it is the fractional-constant component in a bigger user-defined-floating-literal token.
+
+ Fixes #2630.
+
+commit bac5e8438a9238730ae76e7ecf0899a52ef20fe0
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Mon Dec 31 09:19:20 2018 +0100
+
+ [range.cmp] Deconfuse subclause heading.
+
+commit ede68b76f56ebb5bdf0692ab0ac2e5bcb68de96a
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Sun Dec 30 10:45:33 2018 +0100
+
+ [description] Drop 'informative' from the heading.
+
+ This subclause contains many normative definitions
+ (e.g. [operators]); marking it as 'informative' is
+ misleading.
+
+commit 5884d91293055be8b1ab494ef2ee5e675caad00c
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Sun Dec 30 10:41:21 2018 +0100
+
+ [expos.only.types] Exposition-only types apply more generally,
+
+ not just to capture language linkage. For example,
+ 'node-handle' is an entire exposition-only class.
+
+commit ce10ce47647e61ef8a308ad0aefcb2ff1094017a
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Sun Dec 30 10:28:16 2018 +0100
+
+ [expos.only.func] New home for global exposition-only functions.
+
+ Also introduce the descriptive mechanism of an
+ exposition-only function.
+ Remove [thread.decaycopy] by moving its contents here.
+ Use the spelling 'decay-copy' (italics code font) instead of
+ introducing an intermediate meta-macro DECAY_COPY.
+
+commit 6833990f6e090644df012c11ebc55b26c7580565
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Sat Dec 29 21:33:54 2018 +0100
+
+ [range.refinements] Rephrase heading to not use 'common range'
+
+ 'Common range' means iterator and end marker have the same type;
+ see [range.req.general]. This is not what this subclause is about.
+
+commit 5874ecd6f82612873d4a40e14a3e93947b2ebab6
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Sat Dec 29 13:27:54 2018 +0100
+
+ [special.mem.concepts] Use 'models ... only if' phrasing for semantic constraints.
+
+commit 1c3b991fac1b6668f42bde6824435f8ece037a10
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Sat Dec 29 12:43:27 2018 +0100
+
+ [range.factories] New subclause, split off from [range.adaptors]
+
+ Range adaptors take a range and produce a new range;
+ range factories take something else (or nothing) and produce a range.
+
+commit 3afb777a04ddb2e31292c4cf011475db5b65a9fc
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Fri Dec 28 00:25:45 2018 +0100
+
+ [dcl.typedef] Use 'redeclare', not 'redefine'
+
+commit e88e605f3561546ab47d327d1865a576c415bc7b
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Fri Dec 28 00:12:18 2018 +0100
+
+ [basic.life] Adjust subclause heading
+
+ and clarify that references are treated as-if requiring storage.
+
+commit 5d35f0c24e0724aee7993cef6085108fdfcd4590
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Fri Dec 21 20:44:23 2018 +0100
+
+ [iterators] Qualify declarator-id with sub-namespace.
+
+commit 4beab059b54b2fb859cc404b79682cbb71d76364
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Fri Dec 21 00:42:42 2018 +0100
+
+ [expr.new] A new-expression might not invoke a constructor
+
+commit 90467df5ce5b0dd92058dd13b082f6ed3bc16efc
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Fri Dec 21 00:37:06 2018 +0100
+
+ [over.ics.user,over.ics.rank] Reference binding is part of the second SCS
+
+commit 8909a8f20249435788fa4f43e5199f2595a1e623
+Author: Eelis van der Weegen <eelis@eelis.net>
+Date: Mon Dec 17 18:54:04 2018 +0100
+
+ [diff.dcl] Capitalize sentence.
+
+commit 64f01ee78bfac1450c6ffefbfe345a65ce951da1
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sun Dec 9 18:59:21 2018 -0400
+
+ [counted.iter.cmp] Add missing colon to specification element
+
+commit 3ff583af0448540f40e9db7cd07c30489696ecd7
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Mon Dec 10 15:14:50 2018 -0400
+
+ [istreambuf.iterator] Remove duplicated declarations
+
+commit 64d61459522873003f4af52d4abab65cac2f48c5
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Mon Dec 10 15:13:34 2018 -0400
+
+ [istream.iterator] Remove duplicated declarations
+
+commit 48acf476dedcb443407cadc189a79eb89f623097
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 8 15:26:39 2018 -0400
+
+ [insert.iterators] Remove duplicated declarations
+
+commit 45f889a3fe071cadc80f97d58e1f905e8213455b
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 8 14:14:55 2018 -0400
+
+ [iterator.synopsis] Drive-by add semantic breaks
+
+commit b72a3447c2a602aa6362fd0073c6683cedee2098
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 8 14:13:36 2018 -0400
+
+ [move.iterator] Remove duplicated declarations
+
+commit 0fd872506cf6d30101eacd654b2133a5e090b654
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 8 14:09:08 2018 -0400
+
+ [reverse.iterator] Remove duplicated declarations
+
+commit a1c3e9c0319f96e549fae711e616e41ff571cb6d
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 8 14:08:20 2018 -0400
+
+ [iterators] Move specialization to synopsis
+
+commit eb1067835df26c6eef46d006420be2129758d7d0
+Author: Nicolas Lesser <blitzrakete@gmail.com>
+Date: Sat Dec 8 19:32:21 2018 +0100
+
+ [expr.and,expr.or,expr.xor] Add grouping sentence to the binary and/or/xor operators.
+
+commit 27d19661fbb0a5424f72330724d9809618efbb8b
+Author: Géry Ogam <gery.ogam@gmail.com>
+Date: Sat Jan 19 00:59:08 2019 +0100
+
+ [basic.lval] clarify the contexts where void expressions can appear and their value category
+
+commit 9c3b921635b041895d44f378ea3f534145e05006
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Thu Oct 25 19:16:06 2018 +0200
+
+ [basic.lookup,over.call.func] Clarify lookup rules for function calls.
+
+ Also add cross-references to [class.member.lookup] when
+ talking about 'looked up in the class of the object expression'
+ in [basic.lookup.classref].
+
+commit 0cd2126ddab16740d38a302f0da7fee5658f5fbb
+Author: Jonathan Caves <joncaves@microsoft.com>
+Date: Mon Dec 17 14:16:45 2018 -0800
+
+ [expr.prim.lambda.capture] Add missing semicolons after statements ending in lambda expressions
+
+commit 1111bf9d422ebd3765730d95155860aeda07234a
+Author: Casey Carter <Casey@Carter.net>
+Date: Sun Jan 6 04:16:39 2019 -0800
+
+ [allocator.requirements] relocate example to end of subclause
+
+ and add paragraph number.
+
+ Fixes #2639.
+
+commit b4f5a7e426c8b55c08e414aee434fe85c41e2a48
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 29 21:01:42 2018 -0400
+
+ [ostreambuf.iterator] Remove tutorial-like sentence
+
+commit d902c5bfe137dc303fb5c7c54b6409cddac61cdc
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sun Dec 9 23:13:07 2018 -0400
+
+ [ostreambuf.iterator] Move description before the synopsis
+
+commit 486e7a2f8308a5f4d8aca20a74dd7a1ed2974a84
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 29 20:59:51 2018 -0400
+
+ [istreambuf.iterator.proxy] Move description before class synopsis
+
+commit ca07d4deb68ffb9630d3f73a33f552d5040bab17
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sun Dec 9 21:54:51 2018 -0400
+
+ [istreambuf.iterator] Use nullptr instead of 0
+
+commit f9995862feaf47b85aabf7ec63ead2d5b00d5573
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sun Dec 9 21:49:56 2018 -0400
+
+ [ostream.iterator.ops] Check for non nullptr value implicitly
+
+commit b2cfef81694aa61a7c197ad58c96ee44f20f18ca
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sun Dec 9 21:28:50 2018 -0400
+
+ [ostream.iterator.cons.des] Use nullptr instead of null
+
+commit a97f9c18edcbcfb3cf10149116f4126a422ce1fe
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 29 20:11:38 2018 -0400
+
+ [ostream.iterator] Remove redundant paragraph
+
+commit 8098533eabd9361b7798de7a44dea0277fc767e3
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 29 20:11:03 2018 -0400
+
+ [ostream.iterator] Remove tutorial-like description
+
+commit c3a5aa19594a534f8bb9adc9b83f0eb703870699
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sun Dec 9 20:31:29 2018 -0400
+
+ [istream.iterator.ops] Unparenthesize return object name
+
+commit c84872ba9679e322ee2cded0b1a129d7b8faf2d0
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sun Dec 9 19:43:59 2018 -0400
+
+ [istream.iterator] Use nullptr instead of 0
+
+commit 169f0c41b51ba081e2c3e662276e9a4061567eaa
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Wed Dec 19 22:01:18 2018 +0100
+
+ [iterator.primitives] Rescue introductory sentence.
+
+commit 98f1e9f668cbe109511fd8cee1afc03c4bb9f007
+Author: JF Bastien <github@jfbastien.com>
+Date: Thu Dec 20 11:27:51 2018 -0800
+
+ [optional.assign] use injected class name consistently
+
+commit 597b6900151f810acd776e452f08c1e2941857b9
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Wed Dec 19 21:41:46 2018 +0100
+
+ [reverse.iterators] Use the public accessor function,
+
+ not the exposition-only member 'current', from non-member functions.
+
+commit 3d9f80e990daf459a85cff539bd2ce64c0986886
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Tue Dec 11 15:50:03 2018 -0400
+
+ [ranges.syn] Complete requires clause of view_interface
+
+commit a61eb25d048b96fd23b7544d12f43299ccf51026
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Tue Dec 11 20:23:37 2018 -0400
+
+ [ranges.syn] Complete requires clause of filter_view
+
+commit 687b718c431c67a80888552c5055b0903fb197ba
+Author: Casey Carter <Casey@Carter.net>
+Date: Wed Dec 19 13:39:05 2018 -0800
+
+ [alg.min.max] Fix typo in returns element of ranges::minmax (#2600)
+
+ Also add linebreaks as appropriate after template-heads in declarations of `min`, `max`, and `minmax`.
+
+commit e7c5655a9a4746b895937aee4fdadfad30f02cfa
+Author: Alberto Barbati <2210776+iaanus@users.noreply.github.com>
+Date: Tue Dec 18 16:02:35 2018 +0100
+
+ [dcl.constexpr] Add "consteval" to subclause heading (#2597)
+
+commit a88d02d8d77e730bbf2730b6988a8b63319496c3
+Author: Eelis van der Weegen <eelis@eelis.net>
+Date: Wed Dec 12 16:43:21 2018 +0100
+
+ [temp.mem.func] Remove inappropriate parentheses in 'Array<T>::operator[]()'.
+
+commit 4d9447fb590bf7fdc302706eb1560e6a402eca95
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Sat Dec 8 10:09:29 2018 -0400
+
+ [reverse.iterator] Remove stray backslashes
+
+commit 54ddae362645af5028e622f92b795cd6d198c8a0
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Fri Dec 7 21:09:52 2018 -0400
+
+ [indirectcallable.general] Fix reference
+
+ Just 6 lines below, it is correct.
+
+commit 5aaec13ef8f29527e762f8e4bf8e2362c8b1419c
+Author: Jens Maurer <Jens.Maurer@gmx.net>
+Date: Fri Dec 7 23:03:51 2018 +0100
+
+ [basic.indet] Indeterminate values
+
+ Create a new section, moved from parts of [dcl.init].
+
+commit 9cf2dd2247af79721f4961c96dd9c57003556c94
+Author: Richard Smith <richard@metafoo.co.uk>
+Date: Fri Dec 7 16:06:05 2018 -0800
+
+ [lex.key] Fix relative order of 'do' and 'double' in keywords table.
+
+commit 607ec0d6d6ce7c6e72c1cae63d22bbdf40eebd2c
+Author: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
+Date: Fri Dec 7 19:28:30 2018 -0400
+
+ [iterator.concept.bidir] Add comma for clarity
+
diff --git a/papers/n4799.md b/papers/n4799.md
new file mode 100644
index 0000000000..2d7736db33
--- /dev/null
+++ b/papers/n4799.md
@@ -0,0 +1,446 @@
+# N4799 Editors' Report -- Programming Languages -- C++
+
+2019-01-21
+Richard Smith (editor) (Google Inc)
+Dawn Perchik (co-editor) (Bright Side Computing, LLC)
+Jens Maurer (co-editor)
+Thomas Köppe (co-editor) (Google DeepMind)
+``
+
+## Acknowledgements
+
+Thanks to all those who have [submitted editorial
+issues](https://github.com/cplusplus/draft/wiki/How-to-submit-an-editorial-issue)
+and to those who have provided pull requests with fixes.
+
+## New papers
+
+ * [N4800](http://wg21.link/n4800) is the current C++ working draft. It replaces [N4791](http://wg21.link/n4791).
+ * N4799 is this Editors' Report.
+
+## Motions incorporated into working draft
+
+This revision contains only editorial changes relative to N4791.
+
+## Notable editorial changes
+
+### `DECAY_COPY`
+
+`DECAY_COPY` has been renamed to *decay-copy*
+for consistency with other exposition-only entities,
+and moved from
+[thread.decaycopy] to [expos.only.func].
+
+### Other changes to section labels
+
+[iterator.container] has been merged into [iterator.range], and
+[range.prim] has been merged into [range.access].
+
+The parts of [range.adaptors] that create new ranges rather than adapting
+existing ranges have been split into a separate [range.factories].
+
+The parts of [dcl.init] relating to indeterminate values have been moved to a
+new [basic.indet].
+
+## Minor editorial fixes
+
+A log of editorial fixes made to the working draft since N4791 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/n4791...n4800).
+
+ commit 2831ba3b8e1862a8a0e52d540b61062e72e89d6d
+ Author: Arthur O'Dwyer
+ Date: Mon Jan 14 11:15:11 2019 -0500
+
+ [depr.strstreambuf.virtuals] Hyphenate "implementation-defined"
+
+ commit d333390f0dd56dc9143731c1be00f66bc3752479
+ Author: Jens Maurer
+ Date: Sat Dec 29 12:54:56 2018 +0100
+
+ [range.prim] merge into [range.access]
+
+ commit dc3be11dd06a5edfa81061dce4b79fec2a8024df
+ Author: Jens Maurer
+ Date: Sat Dec 29 12:54:26 2018 +0100
+
+ [iterator.container] merge into [iterator.range]
+
+ commit 75dde78fd9ac709ff4843d1d5572d5cbfe4ac6d2
+ Author: S. B. Tam
+ Date: Mon Jan 21 23:24:52 2019 +0800
+
+ [meta.const.eval] Fix typo in function name (#2650)
+
+ commit 55577a76181134d1dd442af3f4eb36c4d861c7c9
+ Author: kiroma
+ Date: Tue Jan 15 00:56:07 2019 +0100
+
+ [thread.condition] Improve description of efficiency of condition_variable.
+
+ commit 281a8bd29f97b5249eae68fe0280e2dfda5ac714
+ Author: Arthur O'Dwyer
+ Date: Mon Jan 7 18:37:20 2019 -0500
+
+ [ranges.syn] Fix a typo: "fowarding"
+
+ commit 099022dbf1642541ab0d1c380ed26e8fb1244d86
+ Author: Jens Maurer
+ Date: Wed Jan 2 22:29:51 2019 +0100
+
+ [unreachable.sentinel] 'open interval' -> 'unbounded interval'
+
+ commit a9fdd8589a51617d5d60bf59263d1567076718ba
+ Author: Arthur O'Dwyer
+ Date: Tue Jan 1 21:40:09 2019 -0500
+
+ Fix some `operator<=>` declarations with the wrong number of parameters.
+
+ Also one `operator<` that should at least have been a const member function.
+
+ commit d42648926f4131586943b7dccb7df41bfbd8df5b
+ Author: Eelis van der Weegen
+ Date: Tue Jan 1 14:56:43 2019 +0100
+
+ [expr.prim.id.dtor] Fix comment in example.
+
+ In translation phase 3, the "0.T" in the line of code is parsed as a (single) preprocessing-token.
+
+ In phase 7, this preprocessing token is converted into a user-defined-floating-literal whose ud-suffix component is "T".
+
+ At no point is the "0." partial token a floating-point literal. At most, it is the fractional-constant component in a bigger user-defined-floating-literal token.
+
+ Fixes #2630.
+
+ commit bac5e8438a9238730ae76e7ecf0899a52ef20fe0
+ Author: Jens Maurer
+ Date: Mon Dec 31 09:19:20 2018 +0100
+
+ [range.cmp] Deconfuse subclause heading.
+
+ commit ede68b76f56ebb5bdf0692ab0ac2e5bcb68de96a
+ Author: Jens Maurer
+ Date: Sun Dec 30 10:45:33 2018 +0100
+
+ [description] Drop 'informative' from the heading.
+
+ This subclause contains many normative definitions
+ (e.g. [operators]); marking it as 'informative' is
+ misleading.
+
+ commit 5884d91293055be8b1ab494ef2ee5e675caad00c
+ Author: Jens Maurer
+ Date: Sun Dec 30 10:41:21 2018 +0100
+
+ [expos.only.types] Exposition-only types apply more generally,
+
+ not just to capture language linkage. For example,
+ 'node-handle' is an entire exposition-only class.
+
+ commit ce10ce47647e61ef8a308ad0aefcb2ff1094017a
+ Author: Jens Maurer
+ Date: Sun Dec 30 10:28:16 2018 +0100
+
+ [expos.only.func] New home for global exposition-only functions.
+
+ Also introduce the descriptive mechanism of an
+ exposition-only function.
+ Remove [thread.decaycopy] by moving its contents here.
+ Use the spelling 'decay-copy' (italics code font) instead of
+ introducing an intermediate meta-macro DECAY_COPY.
+
+ commit 6833990f6e090644df012c11ebc55b26c7580565
+ Author: Jens Maurer
+ Date: Sat Dec 29 21:33:54 2018 +0100
+
+ [range.refinements] Rephrase heading to not use 'common range'
+
+ 'Common range' means iterator and end marker have the same type;
+ see [range.req.general]. This is not what this subclause is about.
+
+ commit 5874ecd6f82612873d4a40e14a3e93947b2ebab6
+ Author: Jens Maurer
+ Date: Sat Dec 29 13:27:54 2018 +0100
+
+ [special.mem.concepts] Use 'models ... only if' phrasing for semantic constraints.
+
+ commit 1c3b991fac1b6668f42bde6824435f8ece037a10
+ Author: Jens Maurer
+ Date: Sat Dec 29 12:43:27 2018 +0100
+
+ [range.factories] New subclause, split off from [range.adaptors]
+
+ Range adaptors take a range and produce a new range;
+ range factories take something else (or nothing) and produce a range.
+
+ commit 3afb777a04ddb2e31292c4cf011475db5b65a9fc
+ Author: Jens Maurer
+ Date: Fri Dec 28 00:25:45 2018 +0100
+
+ [dcl.typedef] Use 'redeclare', not 'redefine'
+
+ commit e88e605f3561546ab47d327d1865a576c415bc7b
+ Author: Jens Maurer
+ Date: Fri Dec 28 00:12:18 2018 +0100
+
+ [basic.life] Adjust subclause heading
+
+ and clarify that references are treated as-if requiring storage.
+
+ commit 5d35f0c24e0724aee7993cef6085108fdfcd4590
+ Author: Jens Maurer
+ Date: Fri Dec 21 20:44:23 2018 +0100
+
+ [iterators] Qualify declarator-id with sub-namespace.
+
+ commit 4beab059b54b2fb859cc404b79682cbb71d76364
+ Author: Jens Maurer
+ Date: Fri Dec 21 00:42:42 2018 +0100
+
+ [expr.new] A new-expression might not invoke a constructor
+
+ commit 90467df5ce5b0dd92058dd13b082f6ed3bc16efc
+ Author: Jens Maurer
+ Date: Fri Dec 21 00:37:06 2018 +0100
+
+ [over.ics.user,over.ics.rank] Reference binding is part of the second SCS
+
+ commit 8909a8f20249435788fa4f43e5199f2595a1e623
+ Author: Eelis van der Weegen
+ Date: Mon Dec 17 18:54:04 2018 +0100
+
+ [diff.dcl] Capitalize sentence.
+
+ commit 64f01ee78bfac1450c6ffefbfe345a65ce951da1
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sun Dec 9 18:59:21 2018 -0400
+
+ [counted.iter.cmp] Add missing colon to specification element
+
+ commit 3ff583af0448540f40e9db7cd07c30489696ecd7
+ Author: Johel Ernesto Guerrero Peña
+ Date: Mon Dec 10 15:14:50 2018 -0400
+
+ [istreambuf.iterator] Remove duplicated declarations
+
+ commit 64d61459522873003f4af52d4abab65cac2f48c5
+ Author: Johel Ernesto Guerrero Peña
+ Date: Mon Dec 10 15:13:34 2018 -0400
+
+ [istream.iterator] Remove duplicated declarations
+
+ commit 48acf476dedcb443407cadc189a79eb89f623097
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 8 15:26:39 2018 -0400
+
+ [insert.iterators] Remove duplicated declarations
+
+ commit 45f889a3fe071cadc80f97d58e1f905e8213455b
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 8 14:14:55 2018 -0400
+
+ [iterator.synopsis] Drive-by add semantic breaks
+
+ commit b72a3447c2a602aa6362fd0073c6683cedee2098
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 8 14:13:36 2018 -0400
+
+ [move.iterator] Remove duplicated declarations
+
+ commit 0fd872506cf6d30101eacd654b2133a5e090b654
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 8 14:09:08 2018 -0400
+
+ [reverse.iterator] Remove duplicated declarations
+
+ commit a1c3e9c0319f96e549fae711e616e41ff571cb6d
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 8 14:08:20 2018 -0400
+
+ [iterators] Move specialization to synopsis
+
+ commit eb1067835df26c6eef46d006420be2129758d7d0
+ Author: Nicolas Lesser
+ Date: Sat Dec 8 19:32:21 2018 +0100
+
+ [expr.and,expr.or,expr.xor] Add grouping sentence to the binary and/or/xor operators.
+
+ commit 27d19661fbb0a5424f72330724d9809618efbb8b
+ Author: Géry Ogam
+ Date: Sat Jan 19 00:59:08 2019 +0100
+
+ [basic.lval] clarify the contexts where void expressions can appear and their value category
+
+ commit 9c3b921635b041895d44f378ea3f534145e05006
+ Author: Jens Maurer
+ Date: Thu Oct 25 19:16:06 2018 +0200
+
+ [basic.lookup,over.call.func] Clarify lookup rules for function calls.
+
+ Also add cross-references to [class.member.lookup] when
+ talking about 'looked up in the class of the object expression'
+ in [basic.lookup.classref].
+
+ commit 0cd2126ddab16740d38a302f0da7fee5658f5fbb
+ Author: Jonathan Caves
+ Date: Mon Dec 17 14:16:45 2018 -0800
+
+ [expr.prim.lambda.capture] Add missing semicolons after statements ending in lambda expressions
+
+ commit 1111bf9d422ebd3765730d95155860aeda07234a
+ Author: Casey Carter
+ Date: Sun Jan 6 04:16:39 2019 -0800
+
+ [allocator.requirements] relocate example to end of subclause
+
+ and add paragraph number.
+
+ Fixes #2639.
+
+ commit b4f5a7e426c8b55c08e414aee434fe85c41e2a48
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 29 21:01:42 2018 -0400
+
+ [ostreambuf.iterator] Remove tutorial-like sentence
+
+ commit d902c5bfe137dc303fb5c7c54b6409cddac61cdc
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sun Dec 9 23:13:07 2018 -0400
+
+ [ostreambuf.iterator] Move description before the synopsis
+
+ commit 486e7a2f8308a5f4d8aca20a74dd7a1ed2974a84
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 29 20:59:51 2018 -0400
+
+ [istreambuf.iterator.proxy] Move description before class synopsis
+
+ commit ca07d4deb68ffb9630d3f73a33f552d5040bab17
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sun Dec 9 21:54:51 2018 -0400
+
+ [istreambuf.iterator] Use nullptr instead of 0
+
+ commit f9995862feaf47b85aabf7ec63ead2d5b00d5573
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sun Dec 9 21:49:56 2018 -0400
+
+ [ostream.iterator.ops] Check for non nullptr value implicitly
+
+ commit b2cfef81694aa61a7c197ad58c96ee44f20f18ca
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sun Dec 9 21:28:50 2018 -0400
+
+ [ostream.iterator.cons.des] Use nullptr instead of null
+
+ commit a97f9c18edcbcfb3cf10149116f4126a422ce1fe
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 29 20:11:38 2018 -0400
+
+ [ostream.iterator] Remove redundant paragraph
+
+ commit 8098533eabd9361b7798de7a44dea0277fc767e3
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 29 20:11:03 2018 -0400
+
+ [ostream.iterator] Remove tutorial-like description
+
+ commit c3a5aa19594a534f8bb9adc9b83f0eb703870699
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sun Dec 9 20:31:29 2018 -0400
+
+ [istream.iterator.ops] Unparenthesize return object name
+
+ commit c84872ba9679e322ee2cded0b1a129d7b8faf2d0
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sun Dec 9 19:43:59 2018 -0400
+
+ [istream.iterator] Use nullptr instead of 0
+
+ commit 169f0c41b51ba081e2c3e662276e9a4061567eaa
+ Author: Jens Maurer
+ Date: Wed Dec 19 22:01:18 2018 +0100
+
+ [iterator.primitives] Rescue introductory sentence.
+
+ commit 98f1e9f668cbe109511fd8cee1afc03c4bb9f007
+ Author: JF Bastien
+ Date: Thu Dec 20 11:27:51 2018 -0800
+
+ [optional.assign] use injected class name consistently
+
+ commit 597b6900151f810acd776e452f08c1e2941857b9
+ Author: Jens Maurer
+ Date: Wed Dec 19 21:41:46 2018 +0100
+
+ [reverse.iterators] Use the public accessor function,
+
+ not the exposition-only member 'current', from non-member functions.
+
+ commit 3d9f80e990daf459a85cff539bd2ce64c0986886
+ Author: Johel Ernesto Guerrero Peña
+ Date: Tue Dec 11 15:50:03 2018 -0400
+
+ [ranges.syn] Complete requires clause of view_interface
+
+ commit a61eb25d048b96fd23b7544d12f43299ccf51026
+ Author: Johel Ernesto Guerrero Peña
+ Date: Tue Dec 11 20:23:37 2018 -0400
+
+ [ranges.syn] Complete requires clause of filter_view
+
+ commit 687b718c431c67a80888552c5055b0903fb197ba
+ Author: Casey Carter
+ Date: Wed Dec 19 13:39:05 2018 -0800
+
+ [alg.min.max] Fix typo in returns element of ranges::minmax (#2600)
+
+ Also add linebreaks as appropriate after template-heads in declarations of `min`, `max`, and `minmax`.
+
+ commit e7c5655a9a4746b895937aee4fdadfad30f02cfa
+ Author: Alberto Barbati <2210776+iaanus@users.noreply.github.com>
+ Date: Tue Dec 18 16:02:35 2018 +0100
+
+ [dcl.constexpr] Add "consteval" to subclause heading (#2597)
+
+ commit a88d02d8d77e730bbf2730b6988a8b63319496c3
+ Author: Eelis van der Weegen
+ Date: Wed Dec 12 16:43:21 2018 +0100
+
+ [temp.mem.func] Remove inappropriate parentheses in 'Array::operator[]()'.
+
+ commit 4d9447fb590bf7fdc302706eb1560e6a402eca95
+ Author: Johel Ernesto Guerrero Peña
+ Date: Sat Dec 8 10:09:29 2018 -0400
+
+ [reverse.iterator] Remove stray backslashes
+
+ commit 54ddae362645af5028e622f92b795cd6d198c8a0
+ Author: Johel Ernesto Guerrero Peña
+ Date: Fri Dec 7 21:09:52 2018 -0400
+
+ [indirectcallable.general] Fix reference
+
+ Just 6 lines below, it is correct.
+
+ commit 5aaec13ef8f29527e762f8e4bf8e2362c8b1419c
+ Author: Jens Maurer
+ Date: Fri Dec 7 23:03:51 2018 +0100
+
+ [basic.indet] Indeterminate values
+
+ Create a new section, moved from parts of [dcl.init].
+
+ commit 9cf2dd2247af79721f4961c96dd9c57003556c94
+ Author: Richard Smith
+ Date: Fri Dec 7 16:06:05 2018 -0800
+
+ [lex.key] Fix relative order of 'do' and 'double' in keywords table.
+
+ commit 607ec0d6d6ce7c6e72c1cae63d22bbdf40eebd2c
+ Author: Johel Ernesto Guerrero Peña
+ Date: Fri Dec 7 19:28:30 2018 -0400
+
+ [iterator.concept.bidir] Add comma for clarity
diff --git a/papers/n4800.pdf b/papers/n4800.pdf
new file mode 100644
index 0000000000..39de74ca82
Binary files /dev/null and b/papers/n4800.pdf differ
diff --git a/source/Makefile b/source/Makefile
index aefaf3ed98..8215ae9d77 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -1,16 +1,5 @@
### -*- mode: makefile-gmake -*-
-# Note: If building on Mac OS X, and if you use MacPorts, the following ports
-# should be installed:
-#
-# texlive-latex
-# texlive-plain-extra
-# texlive-latex-recommended
-# texlive-latex-extra
-# texlive-fonts-recommended
-# texlive-fonts-extra
-# texlive-generic-recommended
-
FIGURES = $(patsubst %.dot,%.pdf,$(wildcard *.dot))
STDPDF = pdflatex std | grep -v "^Overfull"
diff --git a/source/algorithms.tex b/source/algorithms.tex
index db62bcc009..4b61488ff1 100644
--- a/source/algorithms.tex
+++ b/source/algorithms.tex
@@ -25,18 +25,19 @@
\rSec1[algorithms.requirements]{Algorithms requirements}
\pnum
-All of the algorithms are separated from the particular implementations of data structures and are
-parameterized by iterator types.
-Because of this, they can work with program-defined data structures, as long
-as these data structures have iterator types satisfying the assumptions on the algorithms.
+All of the algorithms
+are separated from the particular implementations of data structures and
+are parameterized by iterator types.
+Because of this, they can work with program-defined data structures,
+as long as these data structures have iterator types
+satisfying the assumptions on the algorithms.
\pnum
-The entities defined in the \tcode{std::ranges} namespace
-in this Clause are not found by argument-dependent
-name lookup\iref{basic.lookup.argdep}. When found by
-unqualified\iref{basic.lookup.unqual} name lookup for the
-\grammarterm{postfix-expression} in a function call\iref{expr.call}, they
-inhibit argument-dependent name lookup.
+The entities defined in the \tcode{std::ranges} namespace in this Clause
+are not found by argument-dependent name lookup\iref{basic.lookup.argdep}.
+When found by unqualified\iref{basic.lookup.unqual} name lookup
+for the \grammarterm{postfix-expression} in a function call\iref{expr.call},
+they inhibit argument-dependent name lookup.
\begin{example}
\begin{codeblock}
@@ -47,151 +48,129 @@
}
\end{codeblock}
The function call expression at \tcode{\#1} invokes \tcode{std::ranges::find},
-not \tcode{std::find}, despite that (a) the iterator type returned from \tcode{begin(vec)}
-and \tcode{end(vec)} may be associated with namespace \tcode{std} and (b)
-\tcode{std::find} is more specialized~(\ref{temp.func.order}) than
-\tcode{std::ranges::find} since the former requires its first two parameters to
-have the same type.
+not \tcode{std::find}, despite that
+(a) the iterator type returned from \tcode{begin(vec)} and \tcode{end(vec)}
+may be associated with namespace \tcode{std} and
+(b) \tcode{std::find} is more specialized\iref{temp.func.order} than
+\tcode{std::ranges::find} since the former requires
+its first two parameters to have the same type.
\end{example}
\pnum
-For purposes of determining the existence of data races, algorithms shall
-not modify objects referenced through an iterator argument unless the
-specification requires such modification.
+For purposes of determining the existence of data races,
+algorithms shall not modify objects referenced through an iterator argument
+unless the specification requires such modification.
\pnum
Throughout this Clause, where the template parameters are not constrained,
-the names of template parameters
-are used to express type requirements.
+the names of template parameters are used to express type requirements.
\begin{itemize}
\item
-If an algorithm's template parameter is named
-\tcode{InputIterator},
-\tcode{InputIterator1},
-or
-\tcode{Input\-Iterator2},
-the template argument shall satisfy the
-\oldconcept{InputIterator} requirements\iref{input.iterators}.
-\item
-If an algorithm's template parameter is named
-\tcode{OutputIterator},
-\tcode{OutputIterator1},
-or
-\tcode{Output\-Iterator2},
-the template argument shall satisfy the
-\oldconcept{OutputIterator} requirements\iref{output.iterators}.
-\item
-If an algorithm's template parameter is named
-\tcode{ForwardIterator},
-\tcode{ForwardIterator1},
-or
-\tcode{Forward\-Iterator2},
-the template argument shall satisfy the
-\oldconcept{ForwardIterator} requirements\iref{forward.iterators}.
-\item
-If an algorithm's template parameter is named
-\tcode{BidirectionalIterator},
-\tcode{Bidirectional\-Iterator1},
-or
-\tcode{BidirectionalIterator2},
-the template argument shall satisfy the
-\oldconcept{BidirectionalIterator} requirements\iref{bidirectional.iterators}.
-\item
-If an algorithm's template parameter is named
-\tcode{RandomAccessIterator},
-\tcode{Random\-AccessIterator1},
-or
-\tcode{RandomAccessIterator2},
-the template argument shall satisfy the
-\oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators}.
+ If an algorithm's template parameter is named
+ \tcode{InputIterator},
+ \tcode{InputIterator1}, or
+ \tcode{Input\-Iterator2},
+ the template argument shall satisfy the
+ \oldconcept{InputIterator} requirements\iref{input.iterators}.
+\item
+ If an algorithm's template parameter is named
+ \tcode{OutputIterator},
+ \tcode{OutputIterator1}, or
+ \tcode{Output\-Iterator2},
+ the template argument shall satisfy the
+ \oldconcept{OutputIterator} requirements\iref{output.iterators}.
+\item
+ If an algorithm's template parameter is named
+ \tcode{ForwardIterator},
+ \tcode{ForwardIterator1}, or
+ \tcode{Forward\-Iterator2},
+ the template argument shall satisfy the
+ \oldconcept{ForwardIterator} requirements\iref{forward.iterators}.
+\item
+ If an algorithm's template parameter is named
+ \tcode{BidirectionalIterator},
+ \tcode{Bidirectional\-Iterator1}, or
+ \tcode{BidirectionalIterator2},
+ the template argument shall satisfy the
+ \oldconcept{BidirectionalIterator} requirements\iref{bidirectional.iterators}.
+\item
+ If an algorithm's template parameter is named
+ \tcode{RandomAccessIterator},
+ \tcode{Random\-AccessIterator1}, or
+ \tcode{RandomAccessIterator2},
+ the template argument shall satisfy the
+ \oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators}.
\end{itemize}
\pnum
-If an algorithm's
-\effects
-element specifies that a value pointed to by any iterator passed
-as an argument is modified, then that algorithm has an additional
-type requirement:
-The type of that argument shall satisfy the requirements
-of a mutable iterator\iref{iterator.requirements}.
+If an algorithm's \effects element specifies
+that a value pointed to by any iterator passed as an argument is modified,
+then that algorithm has an additional type requirement:
+The type of that argument shall satisfy
+the requirements of a mutable iterator\iref{iterator.requirements}.
\begin{note}
This requirement does not affect arguments that are named
-\tcode{OutputIterator},
-\tcode{OutputIterator1},
-or
-\tcode{OutputIterator2},
-because output iterators must always be mutable, nor does it affect
-arguments that are constrained, for which mutability requirements are expressed
-explicitly.
+\tcode{OutputIterator}, \tcode{OutputIterator1}, or \tcode{OutputIterator2},
+because output iterators must always be mutable, nor
+does it affect arguments that are constrained,
+for which mutability requirements are expressed explicitly.
\end{note}
\pnum
-Both in-place and copying versions are provided for certain
-algorithms.\footnote{The decision whether to include a copying version was
-usually based on complexity considerations. When the cost of doing the operation
-dominates the cost of copy, the copying version is not included. For example,
-\tcode{sort_copy} is not included because the cost of sorting is much more
-significant, and users might as well do \tcode{copy} followed by \tcode{sort}.}
+Both in-place and copying versions are provided for certain algorithms.%
+\footnote{The decision whether to include a copying version was
+usually based on complexity considerations.
+When the cost of doing the operation dominates the cost of copy,
+the copying version is not included.
+For example, \tcode{sort_copy} is not included
+because the cost of sorting is much more significant,
+and users might as well do \tcode{copy} followed by \tcode{sort}.}
When such a version is provided for \textit{algorithm} it is called
-\textit{algorithm\tcode{_copy}}. Algorithms that take predicates end with the
-suffix \tcode{_if} (which follows the suffix \tcode{_copy}).
-
-\pnum
-When not otherwise constrained, the
-\tcode{Predicate}
-parameter is used whenever an algorithm expects a function object\iref{function.objects}
-that, when applied to the result
-of dereferencing the corresponding iterator, returns a value testable as
-\tcode{true}.
-In other words, if an algorithm
-takes
-\tcode{Predicate pred}
-as its argument and \tcode{first}
-as its iterator argument with value type \tcode{T},
+\textit{algorithm\tcode{_copy}}.
+Algorithms that take predicates end with the suffix \tcode{_if}
+(which follows the suffix \tcode{_copy}).
+
+\pnum
+When not otherwise constrained, the \tcode{Predicate} parameter is used
+whenever an algorithm expects a function object\iref{function.objects} that,
+when applied to the result of dereferencing the corresponding iterator,
+returns a value testable as \tcode{true}.
+In other words,
+if an algorithm takes \tcode{Predicate pred} as its argument and
+\tcode{first} as its iterator argument with value type \tcode{T},
it should work correctly in the construct
\tcode{pred(*first)} contextually converted to \tcode{bool}\iref{conv}.
-The function object
-\tcode{pred}
-shall not apply any non-constant
-function through the dereferenced iterator.
-Given a glvalue \tcode{u} of type (possibly \tcode{const}) \tcode{T} that
-designates the same object as \tcode{*first},
+The function object \tcode{pred} shall not apply any non-constant function
+through the dereferenced iterator.
+Given a glvalue \tcode{u} of type (possibly \tcode{const}) \tcode{T}
+that designates the same object as \tcode{*first},
\tcode{pred(u)} shall be a valid expression
that is equal to \tcode{pred(*first)}.
\pnum
-When not otherwise constrained, the
-\tcode{BinaryPredicate}
-parameter is used whenever an algorithm expects a function object that when applied to
-the result of dereferencing two corresponding iterators or to dereferencing an
-iterator and type
-\tcode{T}
-when
-\tcode{T}
-is part of the signature returns a value testable as
-\tcode{true}.
-In other words, if an algorithm takes
-\tcode{BinaryPredicate binary_pred}
-as its argument and \tcode{first1} and \tcode{first2} as
-its iterator arguments with respective value types \tcode{T1} and \tcode{T2},
+When not otherwise constrained, the \tcode{BinaryPredicate} parameter is used
+whenever an algorithm expects a function object that when applied
+to the result of dereferencing two corresponding iterators or
+to dereferencing an iterator and type \tcode{T}
+when \tcode{T} is part of the signature
+returns a value testable as \tcode{true}.
+In other words,
+if an algorithm takes \tcode{BinaryPredicate binary_pred} as its argument and
+\tcode{first1} and \tcode{first2} as its iterator arguments
+with respective value types \tcode{T1} and \tcode{T2},
it should work correctly in the construct
\tcode{binary_pred(*first1, *first2)} contextually converted to \tcode{bool}\iref{conv}.
Unless otherwise specified,
-\tcode{BinaryPredicate}
-always takes the first
-iterator's \tcode{value_type}
-as its first argument, that is, in those cases when
-\tcode{T value}
-is part of the signature, it should work
-correctly in the
-construct \tcode{binary_pred(*first1, value)} contextually converted to \tcode{bool}\iref{conv}.
-\tcode{binary_pred} shall not
-apply any non-constant function through the dereferenced iterators.
-Given a glvalue \tcode{u} of type (possibly \tcode{const}) \tcode{T1} that
-designates the same object as \tcode{*first1}, and
-a glvalue \tcode{v} of type (possibly \tcode{const}) \tcode{T2} that
-designates the same object as
-\tcode{*first2},
+\tcode{BinaryPredicate} always takes the first iterator's \tcode{value_type}
+as its first argument, that is, in those cases when \tcode{T value}
+is part of the signature, it should work correctly in the construct
+\tcode{binary_pred(*first1, value)} contextually converted to \tcode{bool}\iref{conv}.
+\tcode{binary_pred} shall not apply any non-constant function
+through the dereferenced iterators.
+Given a glvalue \tcode{u} of type (possibly \tcode{const}) \tcode{T1}
+that designates the same object as \tcode{*first1}, and
+a glvalue \tcode{v} of type (possibly \tcode{const}) \tcode{T2}
+that designates the same object as \tcode{*first2},
\tcode{binary_pred(u, *first2)},
\tcode{binary_pred(*first1, v)}, and
\tcode{binary_pred(u, v)}
@@ -213,33 +192,32 @@
\pnum
\begin{note}
Unless otherwise specified, algorithms that take function objects as arguments
-are permitted to copy those function objects freely. Programmers for whom object
-identity is important should consider using a wrapper class that points to a
-noncopied implementation object such as \tcode{reference_wrapper}\iref{refwrap}, or some equivalent solution.
+are permitted to copy those function objects freely.
+Programmers for whom object identity is important should consider
+using a wrapper class that points to a noncopied implementation object
+such as \tcode{reference_wrapper}\iref{refwrap}, or some equivalent solution.
\end{note}
\pnum
When the description of an algorithm gives an expression such as
-\tcode{*first == value}
-for a condition, the expression shall evaluate to
-either \tcode{true} or \tcode{false} in boolean contexts.
+\tcode{*first == value} for a condition, the expression
+shall evaluate to either \tcode{true} or \tcode{false} in boolean contexts.
\pnum
In the description of the algorithms, operator \tcode{+}
-is used for some of the iterator categories for which
-it does not have to be defined.
-In these cases the semantics of
-\tcode{a + n}
-are the same as those of
+is used for some of the iterator categories
+for which it does not have to be defined.
+In these cases the semantics of \tcode{a + n} are the same as those of
\begin{codeblock}
auto tmp = a;
for (; n < 0; ++n) --tmp;
for (; n > 0; --n) ++tmp;
return tmp;
\end{codeblock}
-Similarly, operator \tcode{-} is used for some
-combinations of iterators and sentinel types for which
-it does not have to be defined. If \range{a}{b} denotes a range,
+Similarly, operator \tcode{-} is used
+for some combinations of iterators and sentinel types
+for which it does not have to be defined.
+If \range{a}{b} denotes a range,
the semantics of \tcode{b - a} in these cases are the same as those of
\begin{codeblock}
iter_difference_t> n = 0;
@@ -254,103 +232,108 @@
\end{codeblock}
\pnum
-In the description of algorithm return values, a sentinel value \tcode{s}
-denoting the end of a range \range{i}{s} is sometimes
-returned where an iterator is expected. In these cases, the semantics are as
-if the sentinel is converted into an iterator using
+In the description of algorithm return values,
+a sentinel value \tcode{s} denoting the end of a range \range{i}{s}
+is sometimes returned where an iterator is expected.
+In these cases,
+the semantics are as if the sentinel is converted into an iterator using
\tcode{ranges::next(i, s)}.
\pnum
Overloads of algorithms that take \libconcept{Range} arguments\iref{range.range}
behave as if they are implemented by calling \tcode{ranges::begin} and
-\tcode{ranges::end} on the \libconcept{Range}(s) and dispatching
-to the overload in namespace \tcode{ranges} that takes
-separate iterator and sentinel arguments.
+\tcode{ranges::end} on the \libconcept{Range}(s) and
+dispatching to the overload in namespace \tcode{ranges}
+that takes separate iterator and sentinel arguments.
\pnum
The number and order of deducible template parameters for algorithm declarations
are unspecified, except where explicitly stated otherwise.
\begin{note}
-Consequently, the algorithms may not be called with
-explicitly-specified template argument lists.
+Consequently, the algorithms may not
+be called with explicitly-specified template argument lists.
\end{note}
\pnum
-The class templates \tcode{binary_transform_result},
-\tcode{for_each_result}, \tcode{minmax_result}, \tcode{mismatch_result},
+The class templates
+\tcode{binary_transform_result},
+\tcode{for_each_result},
+\tcode{minmax_result},
+\tcode{mismatch_result},
\tcode{copy_result}, and
-\tcode{partition_copy_result} have the template parameters, data members, and
-special members specified above. They have no base classes or members other than
-those specified.
+\tcode{partition_copy_result}
+have the template parameters, data members, and special members specified above.
+They have no base classes or members other than those specified.
\rSec1[algorithms.parallel]{Parallel algorithms}
\pnum
-This subclause describes components that \Cpp{} programs may use to perform
-operations on containers and other sequences in parallel.
+This subclause describes components that \Cpp{} programs may use
+to perform operations on containers and other sequences in parallel.
\rSec2[algorithms.parallel.defns]{Terms and definitions}
\pnum
-A \defn{parallel algorithm} is a function template listed in this document with
-a template parameter named \tcode{ExecutionPolicy}.
+A \defn{parallel algorithm} is a function template listed in this document
+with a template parameter named \tcode{ExecutionPolicy}.
\pnum
-Parallel algorithms access objects indirectly accessible via their arguments by
-invoking the following functions:
-
+Parallel algorithms access objects indirectly accessible via their arguments
+by invoking the following functions:
\begin{itemize}
\item
-All operations of the categories of the iterators that the algorithm is
-instantiated with.
-
+ All operations of the categories of the iterators
+ that the algorithm is instantiated with.
\item
-Operations on those sequence elements that are required by its specification.
-
+ Operations on those sequence elements that are required by its specification.
\item
-User-provided function objects to be applied during the execution of the
-algorithm, if required by the specification.
-
+ User-provided function objects
+ to be applied during the execution of the algorithm,
+ if required by the specification.
\item
-Operations on those function objects required by the specification.
-\begin{note} See~\ref{algorithms.requirements}.\end{note}
+ Operations on those function objects required by the specification.
+\begin{note}
+See~\ref{algorithms.requirements}.
+\end{note}
\end{itemize}
-
These functions are herein called \defn{element access functions}.
\begin{example}
The \tcode{sort} function may invoke the following element access functions:
-
\begin{itemize}
\item
-Operations of the random-access iterator of the actual template argument
-(as per \ref{random.access.iterators}),
-as implied by the name of the template parameter \tcode{RandomAccessIterator}.
-
+ Operations of the random-access iterator of the actual template argument
+ (as per \ref{random.access.iterators}),
+ as implied by the name of the template parameter \tcode{RandomAccessIterator}.
\item
-The \tcode{swap} function on the elements of the sequence (as per the
-preconditions specified in \ref{sort}).
-
+ The \tcode{swap} function on the elements of the sequence
+ (as per the preconditions specified in \ref{sort}).
\item
-The user-provided \tcode{Compare} function object.
+ The user-provided \tcode{Compare} function object.
\end{itemize}
\end{example}
\rSec2[algorithms.parallel.user]{Requirements on user-provided function objects}
\pnum
-Unless otherwise specified, function objects passed into parallel algorithms as
-objects of type \tcode{Predicate}, \tcode{BinaryPredicate}, \tcode{Compare},
-\tcode{UnaryOperation}, \tcode{BinaryOperation}, \tcode{BinaryOperation1},
-\tcode{BinaryOperation2}, and the operators used by the analogous overloads to
-these parallel algorithms that could be formed by the invocation with the
-specified default predicate or operation (where applicable) shall not directly
-or indirectly modify objects via their arguments, nor shall they rely on the
-identity of the provided objects.
+Unless otherwise specified,
+function objects passed into parallel algorithms as objects of type
+\tcode{Predicate},
+\tcode{BinaryPredicate},
+\tcode{Compare},
+\tcode{UnaryOperation},
+\tcode{BinaryOperation},
+\tcode{BinaryOperation1},
+\tcode{BinaryOperation2}, and
+the operators used by the analogous overloads to these parallel algorithms
+that could be formed by the invocation
+with the specified default predicate or operation (where applicable)
+shall not directly or indirectly modify objects via their arguments,
+nor shall they rely on the identity of the provided objects.
\rSec2[algorithms.parallel.exec]{Effect of execution policies on algorithm execution}
\pnum
-Parallel algorithms have template parameters
-named \tcode{ExecutionPolicy}\iref{execpol}
+Parallel algorithms have
+template parameters named \tcode{ExecutionPolicy}\iref{execpol}
which describe the manner in which the execution of these algorithms may be
parallelized and the manner in which they apply the element access functions.
@@ -361,23 +344,28 @@
which are specified as modifying the object.
\begin{note}
For example,
-\tcode{swap()}, \tcode{++}, \tcode{--}, \tcode{@=}, and assignments
+\tcode{swap()},
+\tcode{++},
+\tcode{--},
+\tcode{@=}, and
+assignments
modify the object.
-For the assignment and \tcode{@=} operators,
-only the left argument is modified.
+For the assignment and \tcode{@=} operators, only the left argument is modified.
\end{note}
\pnum
Unless otherwise stated, implementations may make arbitrary copies of elements
-(with type \tcode{T}) from sequences where \tcode{is_trivially_copy_constructible_v}
+(with type \tcode{T}) from sequences
+where \tcode{is_trivially_copy_constructible_v}
and \tcode{is_trivially_destructible_v} are \tcode{true}.
\begin{note}
-This implies that user-supplied function objects should not rely on object
-identity of arguments for such input sequences. Users for whom the object
-identity of the arguments to these function objects is important should
-consider using a wrapping iterator that returns a non-copied implementation
-object such as \tcode{reference_wrapper}\iref{refwrap} or some equivalent
-solution.
+This implies that user-supplied function objects should not rely on
+object identity of arguments for such input sequences.
+Users for whom the object identity of the arguments to these function objects
+is important should consider using a wrapping iterator
+that returns a non-copied implementation object
+such as \tcode{reference_wrapper}\iref{refwrap}
+or some equivalent solution.
\end{note}
\pnum
@@ -390,28 +378,30 @@
\pnum
The invocations of element access functions in parallel algorithms invoked with
-an execution policy object of type \tcode{execution::parallel_policy} are
-permitted to execute in either the invoking thread of execution or in a
-thread of execution implicitly
-created by the library to support parallel algorithm execution.
-If the threads of execution created by \tcode{thread}\iref{thread.thread.class} provide concurrent
-forward progress guarantees\iref{intro.progress}, then a thread of execution
-implicitly created by the library will provide parallel forward progress guarantees;
+an execution policy object of type \tcode{execution::parallel_policy}
+are permitted to execute
+in either the invoking thread of execution or
+in a thread of execution implicitly created by the library
+to support parallel algorithm execution.
+If the threads of execution created by \tcode{thread}\iref{thread.thread.class}
+provide concurrent forward progress guarantees\iref{intro.progress},
+then a thread of execution implicitly created by the library will provide
+parallel forward progress guarantees;
otherwise, the provided forward progress guarantee is
-\impldef{forward progress guarantees for implicit threads of parallel algorithms (if not defined for \tcode{thread})}.
-Any such
-invocations executing in the same thread of execution are indeterminately sequenced with
-respect to each other.
+\impldef{forward progress guarantees for
+implicit threads of parallel algorithms (if not defined for \tcode{thread})}.
+Any such invocations executing in the same thread of execution
+are indeterminately sequenced with respect to each other.
\begin{note}
-It is the caller's responsibility to ensure that the
-invocation does not introduce data races or deadlocks.
+It is the caller's responsibility to ensure
+that the invocation does not introduce data races or deadlocks.
\end{note}
\begin{example}
\begin{codeblock}
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
@@ -428,8 +418,8 @@
});
\end{codeblock}
The above example depends on the order of execution of the iterations, and
-will not terminate if both iterations are executed sequentially on the same
-thread of execution.
+will not terminate if both iterations are executed sequentially
+on the same thread of execution.
\end{example}
\begin{example}
\begin{codeblock}
@@ -441,38 +431,44 @@
++x;
});
\end{codeblock}
-The above example synchronizes access to object \tcode{x} ensuring that it is
-incremented correctly.
+The above example synchronizes access to object \tcode{x}
+ensuring that it is incremented correctly.
\end{example}
\pnum
The invocations of element access functions in parallel algorithms invoked with
an execution policy of type \tcode{execution::parallel_unsequenced_policy} are
-permitted to execute in an unordered fashion in unspecified threads of execution, and
+permitted to execute
+in an unordered fashion in unspecified threads of execution, and
unsequenced with respect to one another within each thread of execution.
-These threads of execution are either the invoking thread of execution or threads of
-execution implicitly created by the library; the latter will provide weakly parallel
-forward progress guarantees.
+These threads of execution are
+either the invoking thread of execution
+or threads of execution implicitly created by the library;
+the latter will provide weakly parallel forward progress guarantees.
\begin{note}
-This means that multiple function object invocations may be interleaved on a
-single thread of execution, which overrides the usual guarantee from \ref{intro.execution}
+This means that multiple function object invocations may be interleaved
+on a single thread of execution,
+which overrides the usual guarantee from \ref{intro.execution}
that function executions do not interleave with one another.
\end{note}
-Since \tcode{execution::parallel_unsequenced_policy} allows the execution of element
-access functions to be interleaved on a single thread of execution, blocking synchronization,
-including the use of mutexes, risks deadlock. Thus, the synchronization with
-\tcode{execution::parallel_unsequenced_policy} is restricted as
-follows:
-A standard library function is \defn{vectorization-unsafe} if it is specified
-to synchronize with another function invocation, or another function invocation
-is specified to synchronize with it, and if it is not a memory allocation or
-deallocation function. Vectorization-unsafe standard library functions may not
-be invoked by user code called from \tcode{execution::parallel_unsequenced_policy}
-algorithms.
+Since \tcode{execution::parallel_unsequenced_policy} allows
+the execution of element access functions
+to be interleaved on a single thread of execution,
+blocking synchronization, including the use of mutexes, risks deadlock.
+Thus, the synchronization with \tcode{execution::parallel_unsequenced_policy}
+is restricted as follows:
+A standard library function is \defn{vectorization-unsafe}
+if it is specified to synchronize with another function invocation, or
+another function invocation is specified to synchronize with it, and
+if it is not a memory allocation or deallocation function.
+Vectorization-unsafe standard library functions may not be invoked by user code
+called from \tcode{execution::parallel_unsequenced_policy} algorithms.
\begin{note}
-Implementations must ensure that internal synchronization inside standard
-library functions does not prevent forward progress when those functions are
-executed by threads of execution with weakly parallel forward progress guarantees.
+Implementations must ensure
+that internal synchronization inside standard library functions
+does not prevent forward progress
+when those functions are executed
+by threads of execution with weakly parallel forward progress guarantees.
\end{note}
\begin{example}
\begin{codeblock}
@@ -484,77 +480,88 @@
++x;
});
\end{codeblock}
-The above program may result in two consecutive calls to \tcode{m.lock()} on
-the same thread of execution (which may deadlock), because the applications of the function
-object are not guaranteed to run on different threads of execution.
+The above program may result in two consecutive calls to \tcode{m.lock()}
+on the same thread of execution (which may deadlock),
+because the applications of the function object are not guaranteed
+to run on different threads of execution.
\end{example}
\begin{note}
-The semantics of the \tcode{execution::parallel_policy} or the
-\tcode{execution::parallel_unsequenced_policy} invocation allow the implementation to
-fall back to sequential execution if the system cannot parallelize an algorithm
-invocation due to lack of resources.
+The semantics of the \tcode{execution::parallel_policy} or
+the \tcode{execution::parallel_unsequenced_policy} invocation
+allow the implementation to fall back to sequential execution
+if the system cannot parallelize an algorithm invocation
+due to lack of resources.
\end{note}
\pnum
-If an invocation of a parallel algorithm uses threads of execution implicitly
-created by the library, then the invoking thread of execution will either
-
+If an invocation of a parallel algorithm uses threads of execution
+implicitly created by the library,
+then the invoking thread of execution will either
\begin{itemize}
-\item temporarily block with forward progress guarantee delegation\iref{intro.progress}
- on the completion of these library-managed threads of execution, or
-\item eventually execute an element access function;
+\item
+ temporarily block
+ with forward progress guarantee delegation\iref{intro.progress}
+ on the completion of these library-managed threads of execution, or
+\item
+ eventually execute an element access function;
\end{itemize}
-
the thread of execution will continue to do so until the algorithm is finished.
\begin{note}
In blocking with forward progress guarantee delegation in this context,
-a thread of execution created by the library is considered to have
-finished execution as soon as it has finished the execution of the
-particular element access function that the invoking thread of execution
-logically depends on.
+a thread of execution created by the library
+is considered to have finished execution
+as soon as it has finished the execution
+of the particular element access function
+that the invoking thread of execution logically depends on.
\end{note}
\pnum
The semantics of parallel algorithms invoked with an execution policy object of
-\impldef{additional execution policies supported by parallel algorithms} type are
-\impldef{semantics of parallel algorithms invoked with
+\impldef{additional execution policies supported by parallel algorithms} type
+are \impldef{semantics of parallel algorithms invoked with
imple\-men\-tation-defined execution policies}.
\rSec2[algorithms.parallel.exceptions]{Parallel algorithm exceptions}
\pnum
-During the execution of a parallel algorithm, if temporary memory resources are
-required for parallelization and none are available, the algorithm throws a
-\tcode{bad_alloc} exception.
+During the execution of a parallel algorithm,
+if temporary memory resources are required for parallelization
+and none are available, the algorithm throws a \tcode{bad_alloc} exception.
\pnum
-During the execution of a parallel algorithm, if the invocation of an element
-access function exits via an uncaught exception,
+During the execution of a parallel algorithm,
+if the invocation of an element access function exits via an uncaught exception,
the behavior is determined by the \tcode{ExecutionPolicy}.
\rSec2[algorithms.parallel.overloads]{\tcode{ExecutionPolicy} algorithm overloads}
\pnum
-Parallel algorithms are algorithm overloads. Each parallel algorithm overload
-has an additional template type parameter named \tcode{ExecutionPolicy}, which
-is the first template parameter.
-Additionally, each parallel algorithm overload has an additional function
-parameter of type \tcode{ExecutionPolicy\&\&}, which is the first
-function parameter.
-\begin{note} Not all algorithms have parallel algorithm overloads.\end{note}
+Parallel algorithms are algorithm overloads.
+Each parallel algorithm overload
+has an additional template type parameter named \tcode{ExecutionPolicy},
+which is the first template parameter.
+Additionally, each parallel algorithm overload
+has an additional function parameter of type \tcode{ExecutionPolicy\&\&},
+which is the first function parameter.
+\begin{note}
+Not all algorithms have parallel algorithm overloads.
+\end{note}
\pnum
-Unless otherwise specified, the semantics of \tcode{ExecutionPolicy} algorithm
-overloads are identical to their overloads without.
+Unless otherwise specified,
+the semantics of \tcode{ExecutionPolicy} algorithm overloads
+are identical to their overloads without.
\pnum
-Unless otherwise specified, the complexity requirements of \tcode{ExecutionPolicy}
-algorithm overloads are relaxed from the complexity requirements of the overloads
-without as follows:
-when the guarantee says ``at most \placeholder{expr}'' or ``exactly \placeholder{expr}''
-and does not specify the number of assignments or swaps, and \placeholder{expr}
-is not already expressed with \bigoh{} notation, the complexity of the algorithm
-shall be \bigoh{\placeholder{expr}}.
+Unless otherwise specified,
+the complexity requirements of \tcode{ExecutionPolicy} algorithm overloads
+are relaxed from the complexity requirements of the overloads without
+as follows:
+when the guarantee says ``at most \placeholder{expr}'' or
+``exactly \placeholder{expr}''
+and does not specify the number of assignments or swaps, and
+\placeholder{expr} is not already expressed with \bigoh{} notation,
+the complexity of the algorithm shall be \bigoh{\placeholder{expr}}.
\pnum
Parallel algorithms shall not participate in overload resolution unless
@@ -2795,12 +2802,13 @@
\pnum
\returns
-\tcode{false} if $E$ is \tcode{false} for some iterator \tcode{i} in the
-range \range{first}{last}, and \tcode{true} otherwise.
+\tcode{false} if $E$ is \tcode{false}
+for some iterator \tcode{i} in the range \range{first}{last}, and
+\tcode{true} otherwise.
\pnum
-\complexity At most \tcode{last - first} applications of the predicate
-and any projection.
+\complexity
+At most \tcode{last - first} applications of the predicate and any projection.
\end{itemdescr}
\rSec2[alg.any_of]{Any of}
@@ -2827,6 +2835,7 @@
\pnum
Let $E$ be \tcode{pred(*i)} and \tcode{invoke(pred, invoke(proj, *i))}
for the overloads in namespace \tcode{std} and \tcode{std::ranges}, respectively.
+
\pnum
\returns
\tcode{true} if $E$ is \tcode{true} for some iterator \tcode{i}
@@ -2864,12 +2873,13 @@
\pnum
\returns
-\tcode{false} if $E$ is \tcode{true} for some iterator \tcode{i}
-in the range \range{first}{last}, and \tcode{true} otherwise.
+\tcode{false} if $E$ is \tcode{true}
+for some iterator \tcode{i} in the range \range{first}{last}, and
+\tcode{true} otherwise.
\pnum
-\complexity At most \tcode{last - first} applications of the predicate
-and any projection.
+\complexity
+At most \tcode{last - first} applications of the predicate and any projection.
\end{itemdescr}
\rSec2[alg.foreach]{For each}
@@ -2882,23 +2892,23 @@
\begin{itemdescr}
\pnum
-\requires \tcode{Function} shall satisfy the
-\oldconcept{MoveConstructible} requirements (\tref{moveconstructible}).
-\begin{note} \tcode{Function} need not meet the requirements of
-\oldconcept{CopyConstructible} (\tref{copyconstructible}). \end{note}
+\requires
+\tcode{Function} shall satisfy
+the \oldconcept{MoveConstructible} requirements (\tref{moveconstructible}).
+\begin{note}
+\tcode{Function} need not meet the requirements of
+\oldconcept{CopyConstructible} (\tref{copyconstructible}).
+\end{note}
\pnum
\effects
-Applies
-\tcode{f} to the result of dereferencing every iterator in the range
-\range{first}{last},
-starting from
-\tcode{first}
-and proceeding to
-\tcode{last - 1}.
-\begin{note} If the type of \tcode{first} satisfies the
-requirements of a mutable iterator, \tcode{f} may apply non-constant
-functions through the dereferenced iterator.\end{note}
+Applies \tcode{f} to the result of dereferencing
+every iterator in the range \range{first}{last},
+starting from \tcode{first} and proceeding to \tcode{last - 1}.
+\begin{note}
+If the type of \tcode{first} satisfies the requirements of a mutable iterator,
+\tcode{f} may apply non-constant functions through the dereferenced iterator.
+\end{note}
\pnum
\returns
@@ -2906,10 +2916,7 @@
\pnum
\complexity
-Applies \tcode{f}
-exactly
-\tcode{last - first}
-times.
+Applies \tcode{f} exactly \tcode{last - first} times.
\pnum
\remarks
@@ -2931,8 +2938,8 @@
\pnum
\effects
-Applies \tcode{f} to the result of dereferencing every iterator in the range
-\range{first}{last}.
+Applies \tcode{f} to the result of dereferencing
+every iterator in the range \range{first}{last}.
\begin{note}
If the type of \tcode{first} satisfies the requirements of a mutable iterator,
\tcode{f} may apply non-constant functions through the dereferenced iterator.
@@ -2945,14 +2952,14 @@
\pnum
\remarks
If \tcode{f} returns a result, the result is ignored.
-Implementations do not
-have the freedom granted under \ref{algorithms.parallel.exec} to make arbitrary
-copies of elements from the input sequence.
+Implementations do not have
+the freedom granted under \ref{algorithms.parallel.exec}
+to make arbitrary copies of elements from the input sequence.
\pnum
\begin{note}
-Does not return a copy of its \tcode{Function} parameter, since
-parallelization may not permit efficient state accumulation.
+Does not return a copy of its \tcode{Function} parameter,
+since parallelization may not permit efficient state accumulation.
\end{note}
\end{itemdescr}
@@ -2973,18 +2980,12 @@
\begin{itemdescr}
\pnum
\effects
-Calls
-\tcode{invoke(f, invoke(proj, *i))} for every iterator
-\tcode{i} in the range
-\range{first}{last},
-starting from
-\tcode{first}
-and proceeding to
-\tcode{last - 1}.
+Calls \tcode{invoke(f, invoke(proj, *i))}
+for every iterator \tcode{i} in the range \range{first}{last},
+starting from \tcode{first} and proceeding to \tcode{last - 1}.
\begin{note}
-If the result of
-\tcode{invoke(proj, *i)} is a mutable reference, \tcode{f} may apply
-non-constant functions.
+If the result of \tcode{invoke(proj, *i)} is a mutable reference,
+\tcode{f} may apply non-constant functions.
\end{note}
\pnum
@@ -2993,10 +2994,7 @@
\pnum
\complexity
-Applies \tcode{f} and \tcode{proj}
-exactly
-\tcode{last - first}
-times.
+Applies \tcode{f} and \tcode{proj} exactly \tcode{last - first} times.
\pnum
\remarks
@@ -3004,8 +3002,8 @@
\pnum
\begin{note}
-The overloads in namespace \tcode{ranges} require \tcode{Fun} to model
-\libconcept{CopyConstructible}.
+The overloads in namespace \tcode{ranges} require
+\tcode{Fun} to model \libconcept{CopyConstructible}.
\end{note}
\end{itemdescr}
@@ -3019,8 +3017,10 @@
\pnum
\requires
\tcode{Function} shall satisfy the \oldconcept{MoveConstructible} requirements
-\begin{note} \tcode{Function} need not meet the requirements of
-\oldconcept{CopyConstructible}. \end{note}
+\begin{note}
+\tcode{Function} need not meet
+the requirements of \oldconcept{CopyConstructible}.
+\end{note}
\pnum
\requires
@@ -3028,8 +3028,8 @@
\pnum
\effects
-Applies \tcode{f} to the result of dereferencing every iterator in the range
-\range{first}{first + n} in order.
+Applies \tcode{f} to the result of dereferencing
+every iterator in the range \range{first}{first + n} in order.
\begin{note}
If the type of \tcode{first} satisfies the requirements of a mutable iterator,
\tcode{f} may apply non-constant functions through the dereferenced iterator.
@@ -3062,8 +3062,8 @@
\pnum
\effects
-Applies \tcode{f} to the result of dereferencing every iterator in the range
-\range{first}{first + n}.
+Applies \tcode{f} to the result of dereferencing
+every iterator in the range \range{first}{first + n}.
\begin{note}
If the type of \tcode{first} satisfies the requirements of a mutable iterator,
\tcode{f} may apply non-constant functions through the dereferenced iterator.
@@ -3075,12 +3075,12 @@
\pnum
\remarks
-If \tcode{f} returns a result, the result is ignored. Implementations do not
-have the freedom granted under \ref{algorithms.parallel.exec} to make arbitrary
-copies of elements from the input sequence.
+If \tcode{f} returns a result, the result is ignored.
+Implementations do not have
+the freedom granted under \ref{algorithms.parallel.exec}
+to make arbitrary copies of elements from the input sequence.
\end{itemdescr}
-
\rSec2[alg.find]{Find}
\indexlibrary{\idxcode{find}}%
@@ -3148,19 +3148,14 @@
\pnum
\returns
-The first iterator
-\tcode{i}
-in the range
-\range{first}{last}
-for which
-$E$ is \tcode{true}.
+The first iterator \tcode{i} in the range \range{first}{last}
+for which $E$ is \tcode{true}.
Returns \tcode{last} if no such iterator is found.
\pnum
\complexity
-At most
-\tcode{last - first}
-applications of the corresponding predicate and any projection.
+At most \tcode{last - first} applications
+of the corresponding predicate and any projection.
\end{itemdescr}
\rSec2[alg.find.end]{Find end}
@@ -3211,26 +3206,28 @@
\pnum
Let:
\begin{itemize}
-\item \tcode{pred} be \tcode{equal_to\{\}} for the overloads with no parameter
-\tcode{pred}.
-
-\item $E$ be:
-\begin{itemize}
-\item \tcode{pred(*(i + n), *(first2 + n))}
-for the overloads in namespace \tcode{std},
-
-\item \tcode{invoke(pred, invoke(proj1, *(i + n)), invoke(proj2, *(first2 + n)))}
-for the overloads in namespace \tcode{ranges}.
-\end{itemize}
-
-\item \tcode{i} be \tcode{last1} if \range{first2}{last2} is empty,
-or if \tcode{(last2 - first2) > (last1 - first1)} is \tcode{true},
-or if there is no iterator
-in the range \range{first1}{last1 - (last2 - first2)}
-such that for every non-negative integer
-\tcode{n < (last2 - first2)}, $E$ is \tcode{true}.
-Otherwise \tcode{i} is the last such iterator
-in \range{first1}{last1 - (last2 - first2)}.
+\item
+ \tcode{pred} be \tcode{equal_to\{\}}
+ for the overloads with no parameter \tcode{pred}.
+\item
+ $E$ be:
+ \begin{itemize}
+ \item
+ \tcode{pred(*(i + n), *(first2 + n))}
+ for the overloads in namespace \tcode{std},
+ \item
+ \tcode{invoke(pred, invoke(proj1, *(i + n)), invoke(proj2, *(first2 + n)))}
+ for the overloads in namespace \tcode{ranges}.
+ \end{itemize}
+\item
+ \tcode{i} be \tcode{last1} if \range{first2}{last2} is empty,
+ or if \tcode{(last2 - first2) > (last1 - first1)} is \tcode{true},
+ or if there is no iterator
+ in the range \range{first1}{last1 - (last2 - first2)}
+ such that for every non-negative integer
+ \tcode{n < (last2 - first2)}, $E$ is \tcode{true}.
+ Otherwise \tcode{i} is the last such iterator
+ in \range{first1}{last1 - (last2 - first2)}.
\end{itemize}
\pnum
@@ -3310,22 +3307,17 @@
\pnum
\returns
-The first iterator
-\tcode{i}
-in the range \range{first1}{last1}
-such that for some
-iterator
-\tcode{j}
-in the range \range{first2}{last2} $E$ holds.
+The first iterator \tcode{i} in the range \range{first1}{last1}
+such that for some iterator \tcode{j} in the range \range{first2}{last2}
+$E$ holds.
Returns \tcode{last1}
if \range{first2}{last2} is empty or
if no such iterator is found.
\pnum
\complexity
-At most
-\tcode{(last1-first1) * (last2-first2)}
-applications of the corresponding predicate and any projections.
+At most \tcode{(last1-first1) * (last2-first2)} applications
+of the corresponding predicate and any projections.
\end{itemdescr}
\rSec2[alg.adjacent.find]{Adjacent find}
@@ -3374,26 +3366,18 @@
\pnum
\returns
-The first iterator
-\tcode{i}
-such that both
-\tcode{i}
-and
-\tcode{i + 1}
-are in
-the range
-\range{first}{last}
+The first iterator \tcode{i}
+such that both \tcode{i} and \tcode{i + 1} are in the range \range{first}{last}
for which $E$ holds.
-Returns \tcode{last}
-if no such iterator is found.
+Returns \tcode{last} if no such iterator is found.
\pnum
\complexity
-For the overloads with no \tcode{ExecutionPolicy}, exactly
-\[ \min(\tcode{(i - first) + 1}, \ \tcode{(last - first) - 1}) \]
-applications of the corresponding predicate, where \tcode{i} is
-\tcode{adjacent_find}'s
-return value. For the overloads with an \tcode{ExecutionPolicy},
+For the overloads with no \tcode{ExecutionPolicy},
+exactly \[ \min(\tcode{(i - first) + 1}, \ \tcode{(last - first) - 1}) \]
+applications of the corresponding predicate,
+where \tcode{i} is \tcode{adjacent_find}'s return value.
+For the overloads with an \tcode{ExecutionPolicy},
\bigoh{\tcode{last - first}} applications of the corresponding predicate,
and no more than twice as many applications of any projection.
\end{itemdescr}
@@ -3443,28 +3427,29 @@
\pnum
Let $E$ be:
\begin{itemize}
-\item \tcode{*i == value} for the overloads
+\item
+ \tcode{*i == value} for the overloads
with no parameter \tcode{pred} or \tcode{proj},
-\item \tcode{pred(*i) != false} for the overloads
+\item
+ \tcode{pred(*i) != false} for the overloads
with a parameter \tcode{pred} but no parameter \tcode{proj},
-\item \tcode{invoke(proj, *i) == value} for the overloads
+\item
+ \tcode{invoke(proj, *i) == value} for the overloads
with a parameter \tcode{proj} but no parameter \tcode{pred},
-\item \tcode{invoke(pred, invoke(proj, *i)) != false} for the overloads
+\item
+ \tcode{invoke(pred, invoke(proj, *i)) != false} for the overloads
with both parameters \tcode{proj} and \tcode{pred}.
\end{itemize}
\pnum
\effects
-Returns the number of iterators
-\tcode{i}
-in the range \range{first}{last}
+Returns the number of iterators \tcode{i} in the range \range{first}{last}
for which $E$ holds.
\pnum
\complexity
-Exactly
-\tcode{last - first}
-applications of the corresponding predicate and any projection.
+Exactly \tcode{last - first} applications
+of the corresponding predicate and any projection.
\end{itemdescr}
\rSec2[mismatch]{Mismatch}
@@ -3537,27 +3522,35 @@
\begin{itemdescr}
\pnum
-Let \tcode{last2} be \tcode{first2 + (last1 - first1)} for the overloads with no parameter \tcode{last2} or \tcode{r2}.
+Let \tcode{last2} be \tcode{first2 + (last1 - first1)}
+for the overloads with no parameter \tcode{last2} or \tcode{r2}.
\pnum
Let $E$ be:
\begin{itemize}
\setlength{\emergencystretch}{1em}
-\item \tcode{!(*(first1 + n) == *(first2 + n))} for the overloads with no parameter \tcode{pred},
-\item \tcode{pred(*(first1 + n), *(first2 + n)) == false} for the overloads with a parameter \tcode{pred} and no parameter \tcode{proj1},
-\item \tcode{!invoke(pred, invoke(proj1, *(first1 + n)), invoke(proj2, *(first2 + n)))} for the overloads with both parameters \tcode{pred} and \tcode{proj1}.
+\item
+ \tcode{!(*(first1 + n) == *(first2 + n))}
+ for the overloads with no parameter \tcode{pred},
+\item
+ \tcode{pred(*(first1 + n), *(first2 + n)) == false}
+ for the overloads with a parameter \tcode{pred} and
+ no parameter \tcode{proj1},
+\item
+ \tcode{!invoke(pred, invoke(proj1, *(first1 + n)), invoke(proj2, *(first2 + n)))}
+ for the overloads with both parameters \tcode{pred} and \tcode{proj1}.
\end{itemize}
\pnum
\returns
-\tcode{\{ first1 + n, first2 + n \}}, where \tcode{n} is the smallest integer
-such that $E$ holds,
-or $\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$ if no such integer exists.
+\tcode{\{ first1 + n, first2 + n \}},
+where \tcode{n} is the smallest integer such that $E$ holds,
+or $\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$
+if no such integer exists.
\pnum
\complexity
-At most
-$\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$
+At most $\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$
applications of the corresponding predicate and any projections.
\end{itemdescr}
@@ -3622,57 +3615,56 @@
\pnum
Let:
\begin{itemize}
-\item \tcode{last2} be \tcode{first2 + (last1 - first1)} for the overloads with no parameter \tcode{last2} or \tcode{r2},
-
-\item \tcode{pred} be \tcode{equal_to\{\}} for the overloads with no parameter \tcode{pred},
-
-\item $E$ be:
-\begin{itemize}
-\setlength{\emergencystretch}{1em}
-\item \tcode{pred(*i, *(first2 + (i - first1)))} for the overloads with no parameter \tcode{proj1},
-\item \tcode{invoke(pred, invoke(proj1, *i), invoke(proj2, *(first2 + (i - first1))))} for the overloads with parameter \tcode{proj1}.
-\end{itemize}
+\item
+ \tcode{last2} be \tcode{first2 + (last1 - first1)}
+ for the overloads with no parameter \tcode{last2} or \tcode{r2},
+\item
+ \tcode{pred} be \tcode{equal_to\{\}}
+ for the overloads with no parameter \tcode{pred},
+\item
+ $E$ be:
+ \begin{itemize}
+ \setlength{\emergencystretch}{1em}
+ \item
+ \tcode{pred(*i, *(first2 + (i - first1)))}
+ for the overloads with no parameter \tcode{proj1},
+ \item
+ \tcode{invoke(pred, invoke(proj1, *i), invoke(proj2, *(first2 + (i - first1))))}
+ for the overloads with parameter \tcode{proj1}.
+ \end{itemize}
\end{itemize}
\pnum
\returns
-If
-\tcode{last1 - first1 != last2 - first2},
-return
-\tcode{false}.
-Otherwise return
-\tcode{true}
-if $E$ holds for every iterator
-\tcode{i}
-in the range \range{first1}{last1}
-Otherwise, returns
-\tcode{false}.
+If \tcode{last1 - first1 != last2 - first2}, return \tcode{false}.
+Otherwise return \tcode{true}
+if $E$ holds for every iterator \tcode{i} in the range \range{first1}{last1}
+Otherwise, returns \tcode{false}.
\pnum
\complexity
If the types of \tcode{first1}, \tcode{last1}, \tcode{first2}, and \tcode{last2}:
\begin{itemize}
-\item meet the \oldconcept{RandomAccessIterator}
- requirements\iref{random.access.iterators}
+\item
+ meet the
+ \oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators}
for the overloads in namespace \tcode{std}, or
-\item pairwise model \tcode{SizedSentinel}\iref{iterator.concept.sizedsentinel} for the
-overloads in namespace \tcode{ranges},
+\item
+ pairwise model \tcode{SizedSentinel}\iref{iterator.concept.sizedsentinel}
+ for the overloads in namespace \tcode{ranges},
\end{itemize}
-and
-\tcode{last1 - first1 != last2 - first2},
-then
-no applications of the corresponding predicate and each projection; otherwise,
+and \tcode{last1 - first1 != last2 - first2},
+then no applications of the corresponding predicate and each projection;
+otherwise,
\begin{itemize}
\item
-For the overloads with no \tcode{ExecutionPolicy},
-at most
-$\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$
-applications of the corresponding predicate and any projections.
-
+ For the overloads with no \tcode{ExecutionPolicy},
+ at most $\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$
+ applications of the corresponding predicate and any projections.
\item
-For the overloads with an \tcode{ExecutionPolicy},
-\bigoh{\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})} applications
-of the corresponding predicate.
+ For the overloads with an \tcode{ExecutionPolicy},
+ \bigoh{\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})}
+ applications of the corresponding predicate.
\end{itemize}
\end{itemdescr}
@@ -3699,30 +3691,40 @@
\begin{itemdescr}
\pnum
-\requires \tcode{ForwardIterator1} and \tcode{ForwardIterator2} shall have the same
-value type. The comparison function shall be an equivalence relation.
+\requires
+\tcode{ForwardIterator1} and \tcode{ForwardIterator2} shall have
+the same value type.
+The comparison function shall be an equivalence relation.
\pnum
-\remarks If \tcode{last2} was not given in the argument list, it denotes
-\tcode{first2 + (last1 - first1)} below.
+\remarks
+If \tcode{last2} was not given in the argument list,
+it denotes \tcode{first2 + (last1 - first1)} below.
\pnum
-\returns If \tcode{last1 - first1 != last2 - first2}, return \tcode{false}.
-Otherwise return \tcode{true} if there exists a permutation of the elements in the
-range \range{first2}{first2 + (last1 - first1)}, beginning with \tcode{ForwardIterator2
-begin}, such that \tcode{equal(first1, last1, begin)} returns \tcode{true} or
-\tcode{equal(first1, last1, begin, pred)} returns \tcode{true}; otherwise, returns
-\tcode{false}.
+\returns
+If \tcode{last1 - first1 != last2 - first2}, return \tcode{false}.
+Otherwise return \tcode{true}
+if there exists a permutation of the elements
+in the range \range{first2}{first2 + (last1 - first1)},
+beginning with \tcode{ForwardIterator2 begin},
+such that \tcode{equal(first1, last1, begin)} returns \tcode{true} or
+\tcode{equal(first1, last1, begin, pred)} returns \tcode{true};
+otherwise, returns \tcode{false}.
\pnum
-\complexity No applications of the corresponding predicate if \tcode{ForwardIterator1}
-and \tcode{Forward\-Iter\-ator2} meet the requirements of random access iterators and
+\complexity
+No applications of the corresponding predicate
+if \tcode{ForwardIterator1} and \tcode{Forward\-Iter\-ator2}
+meet the requirements of random access iterators and
\tcode{last1 - first1 != last2 - first2}.
-Otherwise, exactly \tcode{last1 - first1} applications of the
-corresponding predicate if \tcode{equal(\brk{}first1, last1, first2, last2)}
-would return \tcode{true} if \tcode{pred} was not given in the argument list
-or \tcode{equal(first1, last1, first2, last2, pred)} would return \tcode{true} if pred was given in the argument list; otherwise, at
-worst \bigoh{N^2}, where $N$ has the value \tcode{last1 - first1}.
+Otherwise, exactly \tcode{last1 - first1} applications
+of the corresponding predicate
+if \tcode{equal(\brk{}first1, last1, first2, last2)} would return \tcode{true}
+if \tcode{pred} was not given in the argument list or
+\tcode{equal(first1, last1, first2, last2, pred)} would return \tcode{true}
+if \tcode{pred} was given in the argument list;
+otherwise, at worst \bigoh{N^2}, where $N$ has the value \tcode{last1 - first1}.
\end{itemdescr}
\indexlibrary{\idxcode{is_permutation}}%
@@ -3745,10 +3747,13 @@
\begin{itemdescr}
\pnum
-\returns If \tcode{last1 - first1 != last2 - first2}, return \tcode{false}.
-Otherwise return \tcode{true} if there exists a permutation of the elements in the
-range \range{first2}{last2}, bounded by \range{pfirst}{plast}, such that
-\tcode{ranges::equal(first1, last1, pfirst, plast, pred, proj1, proj2)} returns \tcode{true};
+\returns
+If \tcode{last1 - first1 != last2 - first2}, return \tcode{false}.
+Otherwise return \tcode{true} if there exists a permutation of the elements
+in the range \range{first2}{last2}, bounded by \range{pfirst}{plast},
+such that
+\tcode{ranges::equal(first1, last1, pfirst, plast, pred, proj1, proj2)}
+returns \tcode{true};
otherwise, returns \tcode{false}.
\pnum
@@ -3759,11 +3764,11 @@
\item \tcode{S2} and \tcode{I2} model \libconcept{SizedSentinel}, and
\item \tcode{last1 - first1 != last2 - first2}.
\end{itemize}
-Otherwise, exactly \tcode{last1 - first1} applications of the
-corresponding predicate and projections if
-\tcode{ranges::equal(\brk{}first1, last1, first2, last2, pred, proj1, proj2)}
-would return \tcode{true}; otherwise, at
-worst \bigoh{N^2}, where $N$ has the value \tcode{last1 - first1}.
+Otherwise, exactly \tcode{last1 - first1} applications
+of the corresponding predicate and projections
+if \tcode{ranges::equal(\brk{}first1, last1, first2, last2, pred, proj1, proj2)}
+would return \tcode{true};
+otherwise, at worst \bigoh{N^2}, where $N$ has the value \tcode{last1 - first1}.
\end{itemdescr}
\rSec2[alg.search]{Search}
@@ -3798,25 +3803,18 @@
\begin{itemdescr}
\pnum
\returns
-The first iterator
-\tcode{i}
-in the range \range{first1}{last1 - (last2-first2)}
-such that for every non-negative integer
-\tcode{n}
-less than
-\tcode{last2 - first2}
+The first iterator \tcode{i} in the range \range{first1}{last1 - (last2-first2)}
+such that
+for every non-negative integer \tcode{n} less than \tcode{last2 - first2}
the following corresponding conditions hold:
\tcode{*(i + n) == *(first2 + n), pred(*(i + n), *(first2 + n)) != false}.
-Returns \tcode{first1}
-if \range{first2}{last2} is empty,
-otherwise returns \tcode{last1}
-if no such iterator is found.
+Returns \tcode{first1} if \range{first2}{last2} is empty,
+otherwise returns \tcode{last1} if no such iterator is found.
\pnum
\complexity
-At most
-\tcode{(last1 - first1) * (last2 - first2)}
-applications of the corresponding predicate.
+At most \tcode{(last1 - first1) * (last2 - first2)} applications
+of the corresponding predicate.
\end{itemdescr}
\indexlibrary{\idxcode{search}}%
@@ -3842,28 +3840,25 @@
\pnum
\returns
\begin{itemize}
-\item \tcode{\{i, i + (last2 - first2)\}}, where \tcode{i} is
-the first iterator in the range \range{first1}{last1 - (last2 - first2)}
-such that for every non-negative integer
-\tcode{n}
-less than
-\tcode{last2 - first2}
-the condition
+\item
+ \tcode{\{i, i + (last2 - first2)\}},
+ where \tcode{i} is
+ the first iterator in the range \range{first1}{last1 - (last2 - first2)}
+ such that
+ for every non-negative integer \tcode{n} less than \tcode{last2 - first2}
+ the condition
\begin{codeblock}
bool(invoke(pred, invoke(proj1, *(i + n)), invoke(proj2, *(first2 + n))))
\end{codeblock}
-is \tcode{true}:
-
-\item Returns
-\tcode{\{last1, last1\}}
-if no such iterator exists.
+ is \tcode{true}:
+\item
+ Returns \tcode{\{last1, last1\}} if no such iterator exists.
\end{itemize}
\pnum
\complexity
-At most
-\tcode{(last1 - first1) * (last2 - first2)}
-applications of the corresponding predicate and projections.
+At most \tcode{(last1 - first1) * (last2 - first2)} applications
+of the corresponding predicate and projections.
\end{itemdescr}
\indexlibrary{\idxcode{search_n}}%
@@ -3896,29 +3891,20 @@
\begin{itemdescr}
\pnum
\requires
-The type
-\tcode{Size}
+The type \tcode{Size}
shall be convertible to integral type~(\ref{conv.integral}, \ref{class.conv}).
\pnum
\returns
-The first iterator
-\tcode{i}
-in the range \range{first}{last-count}
-such that for every non-negative integer
-\tcode{n}
-less than
-\tcode{count}
+The first iterator \tcode{i} in the range \range{first}{last-count}
+such that for every non-negative integer \tcode{n} less than \tcode{count}
the following corresponding conditions hold:
\tcode{*(i + n) == value, pred(*(i + n),value) != false}.
-Returns \tcode{last}
-if no such iterator is found.
+Returns \tcode{last} if no such iterator is found.
\pnum
\complexity
-At most
-\tcode{last - first}
-applications of the corresponding predicate.
+At most \tcode{last - first} applications of the corresponding predicate.
\end{itemdescr}
\indexlibrary{\idxcode{search_n}}%
@@ -3942,22 +3928,17 @@
\begin{itemdescr}
\pnum
\returns
-\tcode{\{i, i + count\}} where \tcode{i} is the first iterator
-in the range \range{first}{last - count}
-such that for every non-negative integer
-\tcode{n}
-less than
-\tcode{count},
+\tcode{\{i, i + count\}}
+where \tcode{i} is the first iterator in the range \range{first}{last - count}
+such that for every non-negative integer \tcode{n} less than \tcode{count},
the following condition holds:
\tcode{invoke(pred, invoke(proj, *(i + n)), value)}.
-Returns \tcode{\{last, last\}}
-if no such iterator is found.
+Returns \tcode{\{last, last\}} if no such iterator is found.
\pnum
\complexity
-At most
-\tcode{last - first}
-applications of the corresponding predicate and projection.
+At most \tcode{last - first} applications
+of the corresponding predicate and projection.
\end{itemdescr}
\indexlibrary{\idxcode{search}}%
@@ -3977,7 +3958,6 @@
\tcode{Searcher} need not meet the \oldconcept{CopyConstructible} requirements.
\end{itemdescr}
-
\rSec1[alg.modifying.operations]{Mutating sequence operations}
\rSec2[alg.copy]{Copy}
@@ -4005,24 +3985,29 @@
Let $N$ be \tcode{last - first}.
\pnum
-\requires \tcode{result} shall not be in the range \range{first}{last}.
+\requires
+\tcode{result} shall not be in the range \range{first}{last}.
\pnum
-\effects Copies elements in the range \range{first}{last} into the range \range{result}{result + $N$} starting from \tcode{first} and proceeding to \tcode{last}.
-For each non-negative integer $n < N$, performs \tcode{*(result + $n$) = *(first + $n$)}.
+\effects
+Copies elements in the range \range{first}{last}
+into the range \range{result}{result + $N$}
+starting from \tcode{first} and proceeding to \tcode{last}.
+For each non-negative integer $n < N$,
+performs \tcode{*(result + $n$) = *(first + $n$)}.
\pnum
\returns
\begin{itemize}
\item
-\tcode{result + $N$} for the overload in namespace \tcode{std}, or
+ \tcode{result + $N$} for the overload in namespace \tcode{std}, or
\item
-\tcode{\{last, result + $N$\}} for the overloads in
-namespace \tcode{ranges}.
+ \tcode{\{last, result + $N$\}} for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
-\complexity Exactly $N$ assignments.
+\complexity
+Exactly $N$ assignments.
\end{itemdescr}
\indexlibrary{\idxcode{copy}}%
@@ -4035,20 +4020,24 @@
\begin{itemdescr}
\pnum
-\requires The ranges \range{first}{last} and
-\range{result}{result + (last - first)} shall not overlap.
+\requires
+The ranges \range{first}{last} and \range{result}{result + (last - first)}
+shall not overlap.
\pnum
-\effects Copies elements in the range \range{first}{last} into
-the range \range{result}{result + (last - first)}.
+\effects
+Copies elements in the range \range{first}{last}
+into the range \range{result}{result + (last - first)}.
For each non-negative integer \tcode{n < (last - first)},
performs \tcode{*(result + n) = *(first + n)}.
\pnum
-\returns \tcode{result + (last - first)}.
+\returns
+\tcode{result + (last - first)}.
\pnum
-\complexity Exactly \tcode{last - first} assignments.
+\complexity
+Exactly \tcode{last - first} assignments.
\end{itemdescr}
\indexlibrary{\idxcode{copy_n}}%
@@ -4074,21 +4063,24 @@
Let $M$ be $\max(\tcode{n}, 0)$.
\pnum
-\effects For each non-negative integer
-$i < M$, performs \tcode{*(result + i) = *(first + i)}.
+\effects
+For each non-negative integer $i < M$,
+performs \tcode{*(result + i) = *(first + i)}.
\pnum
\returns
\begin{itemize}
\item
-\tcode{result + $M$} for the overloads in namespace \tcode{std}, or
+ \tcode{result + $M$}
+ for the overloads in namespace \tcode{std}, or
\item
-\tcode{\{first + $M$, result + $M$\}}
+ \tcode{\{first + $M$, result + $M$\}}
for the overload in namespace \tcode{ranges}.
\end{itemize}
\pnum
-\complexity Exactly $M$ assignments.
+\complexity
+Exactly $M$ assignments.
\end{itemdescr}
\indexlibrary{\idxcode{copy_if}}%
@@ -4120,38 +4112,52 @@
\pnum
Let $E$ be:
\begin{itemize}
-\item \tcode{bool(pred(*i))} for the overloads in namespace \tcode{std}, or
-\item \tcode{bool(invoke(pred, invoke(proj, *i)))} for the overloads in
- namespace \tcode{ranges}.
+\item
+ \tcode{bool(pred(*i))}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{bool(invoke(pred, invoke(proj, *i)))}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
and $N$ be the number of iterators \tcode{i} in the range \range{first}{last}
for which the condition $E$ holds.
\pnum
-\requires The ranges \range{first}{last} and \range{result}{result + (last - first)} shall not overlap.
+\requires
+The ranges \range{first}{last} and \range{result}{result + (last - first)}
+shall not overlap.
\begin{note}
-For the overload with an \tcode{ExecutionPolicy}, there may be a performance
-cost if \tcode{iterator_traits::value_type} is not
-\oldconcept{\-Move\-Constructible} (\tref{moveconstructible}).
+For the overload with an \tcode{ExecutionPolicy},
+there may be a performance cost
+if \tcode{iterator_traits::value_type}
+is not \oldconcept{\-Move\-Constructible} (\tref{moveconstructible}).
\end{note}
\pnum
-\effects Copies all of the elements referred to by the iterator \tcode{i} in the range \range{first}{last}
+\effects
+Copies all of the elements referred to
+by the iterator \tcode{i} in the range \range{first}{last}
for which $E$ is \tcode{true}.
\pnum
\returns
\begin{itemize}
-\item \tcode{result + $N$} for the overloads in namespace \tcode{std}, or
-\item \tcode{\{last, result + $N$\}}
+\item
+ \tcode{result + $N$}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{\{last, result + $N$\}}
for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
-\complexity Exactly \tcode{last - first} applications of the corresponding predicate and any projection.
+\complexity
+Exactly \tcode{last - first} applications
+of the corresponding predicate and any projection.
\pnum
-\remarks Stable\iref{algorithm.stable}.
+\remarks
+Stable\iref{algorithm.stable}.
\end{itemdescr}
\indexlibrary{\idxcode{copy_backward}}%
@@ -4180,33 +4186,26 @@
\pnum
\requires
-\tcode{result}
-shall not be in the range
-\brange{first}{last}.
+\tcode{result} shall not be in the range \brange{first}{last}.
\pnum
\effects
Copies elements in the range \range{first}{last}
-into the
-range \range{result - $N$}{result}
-starting from
-\tcode{last - 1}
-and proceeding to \tcode{first}.\footnote{\tcode{copy_backward}
-should be used instead of copy when \tcode{last}
-is in
-the range
-\range{result - $N$}{result}.}
-For each positive integer
-$n \le N$,
-performs
-\tcode{*(result - $n$) = *(last - $n$)}.
+into the range \range{result - $N$}{result}
+starting from \tcode{last - 1} and proceeding to \tcode{first}.%
+\footnote{\tcode{copy_backward} should be used instead of copy
+when \tcode{last} is in the range \range{result - $N$}{result}.}
+For each positive integer $n \le N$,
+performs \tcode{*(result - $n$) = *(last - $n$)}.
\pnum
\returns
\begin{itemize}
-\item \tcode{result - $N$}
+\item
+ \tcode{result - $N$}
for the overload in namespace \tcode{std}, or
-\item \tcode{\{last, result - $N$\}}
+\item
+ \tcode{\{last, result - $N$\}}
for the overloads in namespace \tcode{ranges}.
\end{itemize}
@@ -4239,35 +4238,35 @@
\pnum
Let $E$ be
\begin{itemize}
-\item \tcode{std::move(*(first + $n$))} for the overload in namespace \tcode{std}, or
-\item \tcode{ranges::iter_move(first + $n$)} for the overloads in namespace \tcode{ranges}.
+\item
+ \tcode{std::move(*(first + $n$))}
+ for the overload in namespace \tcode{std}, or
+\item
+ \tcode{ranges::iter_move(first + $n$)}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
Let $N$ be \tcode{last - first}.
\pnum
\requires
-\tcode{result}
-shall not be in the range
-\range{first}{last}.
+\tcode{result} shall not be in the range \range{first}{last}.
\pnum
\effects
Moves elements in the range \range{first}{last}
into the range \range{result}{result + $N$}
starting from \tcode{first} and proceeding to \tcode{last}.
-For each non-negative integer
-$n < N$,
-performs
-\tcode{*(result + $n$) = $E$}.
+For each non-negative integer $n < N$, performs \tcode{*(result + $n$) = $E$}.
\pnum
\returns
\begin{itemize}
\item
-\tcode{result + $N$} for the overload in namespace \tcode{std}, or
+ \tcode{result + $N$}
+ for the overload in namespace \tcode{std}, or
\item
-\tcode{\{last, result + $N$\}} for the overloads in
- namespace \tcode{ranges}.
+ \tcode{\{last, result + $N$\}}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
@@ -4288,20 +4287,24 @@
Let $N$ be \tcode{last - first}.
\pnum
-\requires The ranges \range{first}{last} and
-\range{result}{result + $N$} shall not overlap.
+\requires
+The ranges \range{first}{last} and \range{result}{result + $N$}
+shall not overlap.
\pnum
-\effects Moves elements in the range \range{first}{last} into
-the range \range{result}{result + $N$}.
+\effects
+Moves elements in the range \range{first}{last}
+into the range \range{result}{result + $N$}.
For each non-negative integer $n < N$,
performs \tcode{*(result + $n$) = std::\brk{}move(*(first + $n$))}.
\pnum
-\returns \tcode{result + $N$}.
+\returns
+\tcode{result + $N$}.
\pnum
-\complexity Exactly $N$ assignments.
+\complexity
+Exactly $N$ assignments.
\end{itemdescr}
\indexlibrary{\idxcode{move_backward}}%
@@ -4327,40 +4330,38 @@
\pnum
Let $E$ be
\begin{itemize}
-\item \tcode{std::move(*(last - $n$))} for the overload in namespace \tcode{std}, or
-\item \tcode{ranges::iter_move(last - $n$)} for the overloads in namespace \tcode{ranges}.
+\item
+ \tcode{std::move(*(last - $n$))}
+ for the overload in namespace \tcode{std}, or
+\item
+ \tcode{ranges::iter_move(last - $n$)}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
Let $N$ be \tcode{last - first}.
\pnum
\requires
-\tcode{result}
-shall not be in the range
-\brange{first}{last}.
+\tcode{result} shall not be in the range \brange{first}{last}.
\pnum
\effects
Moves elements in the range \range{first}{last}
-into the
-range \range{result - $N$}{result}
-starting from
-\tcode{last - 1}
-and proceeding to \tcode{first}.\footnote{\tcode{move_backward}
-should be used instead of move when last
-is in
-the range
-\range{result - $N$}{result}.}
-For each positive integer
-$n \le N$,
-performs
-\tcode{*(result - $n$) = $E$}.
+into the range \range{result - $N$}{result}
+starting from \tcode{last - 1} and proceeding to \tcode{first}.%
+\footnote{\tcode{move_backward} should be used instead of move
+when \tcode{last} is in the range \range{result - $N$}{result}.}
+For each positive integer $n \le N$,
+performs \tcode{*(result - $n$) = $E$}.
\pnum
\returns
\begin{itemize}
-\item \tcode{result - $N$} for the overload in namespace \tcode{std}, or
-\item \tcode{\{last, result - $N$\}} for the overloads
- in namespace \tcode{ranges}.
+\item
+ \tcode{result - $N$}
+ for the overload in namespace \tcode{std}, or
+\item
+ \tcode{\{last, result - $N$\}}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
@@ -4398,16 +4399,15 @@
\pnum
Let:
\begin{itemize}
-\item \tcode{last2} be \tcode{first2 + (last1 - first1)} for the overloads with
- no parameter named \tcode{last2}, and
+\item
+ \tcode{last2} be \tcode{first2 + (last1 - first1)}
+ for the overloads with no parameter named \tcode{last2}, and
\item $M$ be $\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$.
\end{itemize}
\pnum
\requires
-The two ranges \range{first1}{last1}
-and
-\range{first2}{last2}
+The two ranges \range{first1}{last1} and \range{first2}{last2}
shall not overlap.
For the overloads in namespace \tcode{std},
\tcode{*(first1 + $n$)} shall be swappable with\iref{swappable.requirements}
@@ -4415,20 +4415,24 @@
\pnum
\effects
-For each non-negative integer $n < M$
-performs:
+For each non-negative integer $n < M$ performs:
\begin{itemize}
-\item \tcode{swap(*(first1 + $n$), *(first2 + $n$))} for the overloads in
- namespace \tcode{std}, or
-\item \tcode{ranges::iter_swap(first1 + $n$, first2 + $n$)} for the overloads
- in namespace \tcode{ranges}.
+\item
+ \tcode{swap(*(first1 + $n$), *(first2 + $n$))}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{ranges::iter_swap(first1 + $n$, first2 + $n$)}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
\returns
\begin{itemize}
-\item \tcode{last2} for the overloads in namespace \tcode{std}, or
-\item \tcode{\{first1 + $M$, first2 + $M$\}}
+\item
+ \tcode{last2}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{\{first1 + $M$, first2 + $M$\}}
for the overloads in namespace \tcode{ranges}.
\end{itemize}
@@ -4518,60 +4522,66 @@
Let:
\begin{itemize}
\setlength{\emergencystretch}{1em}
-\item \tcode{last2} be \tcode{first2 + (last1 - first1)} for the overloads with
- parameter \tcode{first2} but no parameter \tcode{last2},
-\item $N$ be \tcode{last1 - first1} for unary transforms, or
+\item
+ \tcode{last2} be \tcode{first2 + (last1 - first1)}
+ for the overloads with parameter \tcode{first2}
+ but no parameter \tcode{last2},
+\item
+ $N$ be \tcode{last1 - first1} for unary transforms, or
$\min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$ for binary transforms, and
-\item $E$ be
+\item
+ $E$ be
\begin{itemize}
- \item \tcode{op(*(first1 + (i - result)))} for unary transforms defined in
- namespace \tcode{std},
- \item \tcode{binary_op(*(first1 + (i - result)), *(first2 + (i - result)))} for
- binary transforms defined in namespace \tcode{std},
- \item \tcode{invoke(op, invoke(proj, *(first1 + (i - result))))} for unary
- transforms defined in namespace \tcode{ranges}, or
- \item \tcode{invoke(binary_op, invoke(proj1, *(first1 + (i - result))), invoke(proj2,\linebreak *(first2 + (i - result))))}
+ \item
+ \tcode{op(*(first1 + (i - result)))}
+ for unary transforms defined in namespace \tcode{std},
+ \item
+ \tcode{binary_op(*(first1 + (i - result)), *(first2 + (i - result)))}
+ for binary transforms defined in namespace \tcode{std},
+ \item
+ \tcode{invoke(op, invoke(proj, *(first1 + (i - result))))}
+ for unary transforms defined in namespace \tcode{ranges}, or
+ \item
+ \tcode{invoke(binary_op, invoke(proj1, *(first1 + (i - result))), invoke(proj2,\linebreak *(first2 + (i - result))))}
for binary transforms defined in namespace \tcode{ranges}.
\end{itemize}
\end{itemize}
\pnum
\requires
-\tcode{op} and \tcode{binary_op}
-shall not invalidate iterators or subranges, or modify elements in the ranges
+\tcode{op} and \tcode{binary_op} shall not invalidate iterators or subranges, or
+modify elements in the ranges
\begin{itemize}
\item \crange{first1}{first1 + $N$},
\item \crange{first2}{first2 + $N$}, and
-\item \crange{result}{result + $N$}.\footnote{The use of fully
-closed ranges is intentional.}
+\item \crange{result}{result + $N$}.%
+\footnote{The use of fully closed ranges is intentional.}
\end{itemize}
\pnum
\effects
-Assigns through every iterator
-\tcode{i}
-in the range
-\range{result}{result + $N$}
-a new
-corresponding value equal to $E$.
+Assigns through every iterator \tcode{i}
+in the range \range{result}{result + $N$}
+a new corresponding value equal to $E$.
\pnum
\returns
\begin{itemize}
-\item \tcode{result + $N$}
+\item
+ \tcode{result + $N$}
for the overloads defined in namespace \tcode{std},
-\item \tcode{\{first1 + $N$, result + $N$\}} for unary transforms
- defined in namespace \tcode{ranges}, or
-\item \tcode{\{first1 + $N$, first2 + $N$, result + $N$\}} for binary
- transforms defined in namespace \tcode{ranges}.
+\item
+ \tcode{\{first1 + $N$, result + $N$\}}
+ for unary transforms defined in namespace \tcode{ranges}, or
+\item \tcode{\{first1 + $N$, first2 + $N$, result + $N$\}}
+ for binary transforms defined in namespace \tcode{ranges}.
\end{itemize}
\pnum
\complexity
-Exactly $N$ applications of
-\tcode{op} or \tcode{binary_op}, and any projections.
-This requirement also applies to the overload
-with an \tcode{ExecutionPolicy} .
+Exactly $N$ applications of \tcode{op} or \tcode{binary_op}, and
+any projections.
+This requirement also applies to the overload with an \tcode{ExecutionPolicy}.
\pnum
\remarks
@@ -4634,16 +4644,12 @@
\pnum
\requires
-The expression
-\tcode{*first = new_value}
-shall be valid.
+The expression \tcode{*first = new_value} shall be valid.
\pnum
\effects
-Substitutes elements referred by the iterator
-\tcode{i}
-in the range \range{first}{last}
-with \tcode{new_value},
+Substitutes elements referred by the iterator \tcode{i}
+in the range \range{first}{last} with \tcode{new_value},
when $E$ is \tcode{true}.
\pnum
@@ -4652,9 +4658,8 @@
\pnum
\complexity
-Exactly
-\tcode{last - first}
-applications of the corresponding predicate and any projection.
+Exactly \tcode{last - first} applications
+of the corresponding predicate and any projection.
\end{itemdescr}
\indexlibrary{\idxcode{replace_copy}}%
@@ -4733,46 +4738,34 @@
\pnum
\requires
-The results of the expressions
-\tcode{*first}
-and
-\tcode{new_value}
-shall be writable\iref{iterator.requirements.general} to the
-\tcode{result}
-output iterator.
-The ranges
-\range{first}{last}
-and
-\range{result}{result + (last - first)}
+The results of the expressions \tcode{*first} and \tcode{new_value}
+shall be writable\iref{iterator.requirements.general}
+to the \tcode{result} output iterator.
+The ranges \range{first}{last} and \range{result}{result + (last - first)}
shall not overlap.
\pnum
\effects
-Assigns to every iterator
-\tcode{i}
-in the
-range
-\range{result}{result + (last - first)}
-either
-\tcode{new_value}
-or
-\tcode{*\brk(first + (i - result))}
+Assigns to every iterator \tcode{i}
+in the range \range{result}{result + (last - first)}
+either \tcode{new_value} or \tcode{*\brk(first + (i - result))}
depending on whether $E$ holds.
\pnum
\returns
\begin{itemize}
-\item \tcode{result + (last - first)} for the overloads in
- namespace \tcode{std}, or
-\item \tcode{\{last, result + (last - first)\}} for the overloads in
- namespace \tcode{ranges}.
+\item
+ \tcode{result + (last - first)}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{\{last, result + (last - first)\}}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
\complexity
-Exactly
-\tcode{last - first}
-applications of the corresponding predicate and any projection.
+Exactly \tcode{last - first} applications
+of the corresponding predicate and any projection.
\end{itemdescr}
\rSec2[alg.fill]{Fill}
@@ -4810,18 +4803,19 @@
\pnum
\requires
-The expression
-\tcode{value}
-shall be writable\iref{iterator.requirements.general} to the output iterator. The type
-\tcode{Size}
-shall be convertible to an integral type~(\ref{conv.integral}, \ref{class.conv}).
+The expression \tcode{value}
+shall be writable\iref{iterator.requirements.general} to the output iterator.
+The type \tcode{Size} shall be convertible
+to an integral type~(\ref{conv.integral}, \ref{class.conv}).
\pnum
\effects
-Assigns \tcode{value} through all the iterators in the range \range{first}{first + $N$}.
+Assigns \tcode{value}
+through all the iterators in the range \range{first}{first + $N$}.
\pnum
-\returns \tcode{first + $N$}.
+\returns
+\tcode{first + $N$}.
\pnum
\complexity
@@ -4867,8 +4861,8 @@
\pnum
\requires
-\tcode{Size}
-shall be convertible to an integral type~(\ref{conv.integral}, \ref{class.conv}).
+\tcode{Size} shall be convertible
+to an integral type~(\ref{conv.integral}, \ref{class.conv}).
\pnum
\effects
@@ -4937,37 +4931,35 @@
\pnum
\requires
-For the algorithms in namespace \tcode{std}, the type of
-\tcode{*first}
-shall meet the \oldconcept{MoveAssignable}
-requirements (\tref{moveassignable}).
+For the algorithms in namespace \tcode{std},
+the type of \tcode{*first}
+shall meet the \oldconcept{MoveAssignable} requirements (\tref{moveassignable}).
\pnum
\effects
-Eliminates all the elements referred to by iterator
-\tcode{i}
-in the range \range{first}{last}
-for which $E$ holds.
+Eliminates all the elements referred to by iterator \tcode{i}
+in the range \range{first}{last} for which $E$ holds.
\pnum
\returns
The end of the resulting range.
\pnum
-\remarks Stable\iref{algorithm.stable}.
+\remarks
+Stable\iref{algorithm.stable}.
\pnum
\complexity
-Exactly
-\tcode{last - first}
-applications of the corresponding predicate and any projection.
+Exactly \tcode{last - first} applications
+of the corresponding predicate and any projection.
\pnum
\begin{note}
-Each element in the range \range{ret}{last}, where \tcode{ret} is
-the returned value, has a valid but unspecified state, because the algorithms
-can eliminate elements by moving from elements that were originally
-in that range.
+Each element in the range \range{ret}{last},
+where \tcode{ret} is the returned value,
+has a valid but unspecified state,
+because the algorithms can eliminate elements
+by moving from elements that were originally in that range.
\end{note}
\end{itemdescr}
@@ -5032,28 +5024,24 @@
\end{itemize}
\pnum
-Let $N$ be the number of elements in \range{first}{last} for which $E$ is \tcode{false}.
+Let $N$ be the number of elements in \range{first}{last}
+for which $E$ is \tcode{false}.
\pnum
\requires
-The ranges
-\range{first}{last}
-and
-\range{result}{result + (last - first)}
+The ranges \range{first}{last} and \range{result}{result + (last - first)}
shall not overlap. The expression \tcode{*result = *first} shall be valid.
\begin{note}
-For the overloads with an \tcode{ExecutionPolicy}, there may be a performance
-cost if \tcode{iterator_traits::value_type} does not meet the
-\oldconcept{\-Move\-Constructible} (\tref{moveconstructible}) requirements.
+For the overloads with an \tcode{ExecutionPolicy},
+there may be a performance cost
+if \tcode{iterator_traits::value_type} does not meet
+the \oldconcept{\-Move\-Constructible} (\tref{moveconstructible}) requirements.
\end{note}
\pnum
\effects
-Copies all the elements referred to by the iterator
-\tcode{i}
-in the range
-\range{first}{last}
-for which $E$ is \tcode{false}.
+Copies all the elements referred to by the iterator \tcode{i}
+in the range \range{first}{last} for which $E$ is \tcode{false}.
\pnum
\returns
@@ -5064,12 +5052,12 @@
\pnum
\complexity
-Exactly
-\tcode{last - first}
-applications of the corresponding predicate and any projection.
+Exactly \tcode{last - first} applications
+of the corresponding predicate and any projection.
\pnum
-\remarks Stable\iref{algorithm.stable}.
+\remarks
+Stable\iref{algorithm.stable}.
\end{itemdescr}
\rSec2[alg.unique]{Unique}
@@ -5104,13 +5092,16 @@
\begin{itemdescr}
\pnum
-Let \tcode{pred} be \tcode{equal_to\{\}} for the overloads with no
-parameter \tcode{pred}, and let $E$ be
+Let \tcode{pred} be \tcode{equal_to\{\}}
+for the overloads with no parameter \tcode{pred}, and
+let $E$ be
\begin{itemize}
\setlength{\emergencystretch}{1em}
-\item \tcode{bool(pred(*(i - 1), *i))}
+\item
+ \tcode{bool(pred(*(i - 1), *i))}
for the overloads in namespace \tcode{std}, or
-\item \tcode{bool(invoke(comp, invoke(proj, *(i - 1)), invoke(proj, *i)))}
+\item
+ \tcode{bool(invoke(comp, invoke(proj, *(i - 1)), invoke(proj, *i)))}
for the overloads in namespace \tcode{ranges}.
\end{itemize}
@@ -5118,16 +5109,14 @@
\requires
For the overloads in namepace \tcode{std},
\tcode{pred} shall be an equivalence relation and
-the type of \tcode{*first} shall meet the
-\oldconcept{MoveAssignable} requirements (\tref{moveassignable}).
+the type of \tcode{*first} shall meet
+the \oldconcept{MoveAssignable} requirements (\tref{moveassignable}).
\pnum
\effects
-For a nonempty range, eliminates all but the first element from every
-consecutive group of equivalent elements referred to by the iterator
-\tcode{i}
-in the range
-\range{first + 1}{last}
+For a nonempty range, eliminates all but the first element
+from every consecutive group of equivalent elements referred to
+by the iterator \tcode{i} in the range \range{first + 1}{last}
for which $E$ is \tcode{true}.
\pnum
@@ -5136,10 +5125,9 @@
\pnum
\complexity
-For nonempty ranges, exactly
-\tcode{(last - first) - 1}
-applications of the corresponding predicate
-and no more than twice as many applications of any projection.
+For nonempty ranges, exactly \tcode{(last - first) - 1} applications
+of the corresponding predicate and
+no more than twice as many applications of any projection.
\end{itemdescr}
\indexlibrary{\idxcode{unique_copy}}%
@@ -5188,13 +5176,16 @@
\begin{itemdescr}
\pnum
-Let \tcode{pred} be \tcode{equal_to\{\}} for the overloads in
-namespace \tcode{std} with no parameter \tcode{pred}, and let $E$ be
+Let \tcode{pred} be \tcode{equal_to\{\}} for the overloads
+in namespace \tcode{std} with no parameter \tcode{pred}, and
+let $E$ be
\begin{itemize}
\setlength{\emergencystretch}{1em}
-\item \tcode{bool(pred(*i, *(i - 1)))}
+\item
+ \tcode{bool(pred(*i, *(i - 1)))}
for the overloads in namespace \tcode{std}, or
-\item \tcode{bool(invoke(comp, invoke(proj, *i), invoke(proj, *(i - 1))))}
+\item
+ \tcode{bool(invoke(comp, invoke(proj, *i), invoke(proj, *(i - 1))))}
for the overloads in namespace \tcode{ranges}.
\end{itemize}
@@ -5202,48 +5193,42 @@
\requires
\begin{itemize}
\item
-The ranges
-\range{first}{last}
-and
-\range{result}{result+(last-first)}
-shall not overlap.
-
-\item
-For the overloads in namespace \tcode{std}:
-\begin{itemize}
+ The ranges \range{first}{last} and \range{result}{result+(last-first)}
+ shall not overlap.
\item
-The comparison function shall be an equivalence relation.
-
-\item
-The expression
-\tcode{*result = *first}
-shall be valid.
-
-\item
-For the overloads with no \tcode{ExecutionPolicy},
-let \tcode{T} be the value type of \tcode{InputIterator}.
-If \tcode{InputIterator} meets the \oldconcept{ForwardIterator} requirements,
-then there are no additional requirements for \tcode{T}.
-Otherwise, if \tcode{OutputIterator} meets the \oldconcept{ForwardIterator}
-requirements and its value type is the same as \tcode{T},
-then \tcode{T} shall meet the \oldconcept{CopyAssignable} (\tref{copyassignable}) requirements.
-Otherwise, \tcode{T} shall meet both the
-\oldconcept{CopyConstructible} (\tref{copyconstructible}) and \oldconcept{CopyAssignable} requirements.
-\begin{note}
-For the overloads with an \tcode{ExecutionPolicy}, there may be a performance
-cost if the value type of \tcode{ForwardIterator1} dos not meet both the
-\oldconcept{CopyConstructible} and \oldconcept{CopyAssignable} requirements.
-\end{note}
-\end{itemize}
+ For the overloads in namespace \tcode{std}:
+ \begin{itemize}
+ \item
+ The comparison function shall be an equivalence relation.
+ \item
+ The expression \tcode{*result = *first} shall be valid.
+ \item
+ For the overloads with no \tcode{ExecutionPolicy},
+ let \tcode{T} be the value type of \tcode{InputIterator}.
+ If \tcode{InputIterator} meets
+ the \oldconcept{ForwardIterator} requirements,
+ then there are no additional requirements for \tcode{T}.
+ Otherwise, if \tcode{OutputIterator} meets
+ the \oldconcept{ForwardIterator} requirements and
+ its value type is the same as \tcode{T},
+ then \tcode{T} shall meet
+ the \oldconcept{CopyAssignable} (\tref{copyassignable}) requirements.
+ Otherwise, \tcode{T} shall meet both
+ the \oldconcept{CopyConstructible} (\tref{copyconstructible}) and
+ \oldconcept{CopyAssignable} requirements.
+ \begin{note}
+ For the overloads with an \tcode{ExecutionPolicy},
+ there may be a performance cost
+ if the value type of \tcode{ForwardIterator1} does not meet both the
+ \oldconcept{CopyConstructible} and \oldconcept{CopyAssignable} requirements.
+ \end{note}
+ \end{itemize}
\end{itemize}
\pnum
\effects
-Copies only the first element from every consecutive group of equal elements referred to by
-the iterator
-\tcode{i}
-in the range
-\range{first}{last}
+Copies only the first element from every consecutive group of equal elements
+referred to by the iterator \tcode{i} in the range \range{first}{last}
for which $E$ holds.
\pnum
@@ -5255,10 +5240,9 @@
\pnum
\complexity
-Exactly
-\tcode{last - first - 1}
-applications of the corresponding predicate
-and no more than twice as many applications of any projectionh.
+Exactly \tcode{last - first - 1} applications
+of the corresponding predicate
+and no more than twice as many applications of any projection.
\end{itemdescr}
\rSec2[alg.reverse]{Reverse}
@@ -5285,18 +5269,15 @@
\pnum
\requires
For the overloads in namespace \tcode{std},
-\tcode{BidirectionalIterator} shall meet the
-\oldconcept{Value\-Swappable} requirements\iref{swappable.requirements}.
+\tcode{BidirectionalIterator} shall meet
+the \oldconcept{Value\-Swappable} requirements\iref{swappable.requirements}.
\pnum
\effects
-For each non-negative integer
-\tcode{i < (last - first) / 2},
-applies
-\tcode{std::iter_swap}, or
+For each non-negative integer \tcode{i < (last - first) / 2},
+applies \tcode{std::iter_swap}, or
\tcode{ranges::\brk{}iter_swap} for the overloads in namespace \tcode{ranges},
-to all pairs of iterators
-\tcode{first + i, (last - i) - 1}.
+to all pairs of iterators \tcode{first + i, (last - i) - 1}.
\pnum
\returns
@@ -5304,9 +5285,7 @@
\pnum
\complexity
-Exactly
-\tcode{(last - first)/2}
-swaps.
+Exactly \tcode{(last - first)/2} swaps.
\end{itemdescr}
\indexlibrary{\idxcode{reverse_copy}}%
@@ -5339,21 +5318,13 @@
\pnum
\requires
-The ranges
-\range{first}{last}
-and
-\range{result}{result + $N$}
+The ranges \range{first}{last} and \range{result}{result + $N$}
shall not overlap.
\pnum
\effects
-Copies the range
-\range{first}{last}
-to the range
-\range{result}{result + $N$}
-such that
-for every non-negative integer
-\tcode{i < $N$}
+Copies the range \range{first}{last} to the range \range{result}{result + $N$}
+such that for every non-negative integer \tcode{i < $N$}
the following assignment takes place:
\tcode{*(result + $N$ - 1 - i) = *(first + i)}.
@@ -5361,10 +5332,9 @@
\returns
\begin{itemize}
\item
-\tcode{result + $N$} for the overloads in namespace \tcode{std}, or
+ \tcode{result + $N$} for the overloads in namespace \tcode{std}, or
\item
-\tcode{\{last, result + $N$\}} for the overloads
- in namespace \tcode{ranges}.
+ \tcode{\{last, result + $N$\}} for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
@@ -5393,25 +5363,19 @@
\begin{itemdescr}
\pnum
\requires
-\range{first}{middle}
-and
-\range{middle}{last}
-shall be valid ranges.
+\range{first}{middle} and \range{middle}{last} shall be valid ranges.
For the overloads in namespace \tcode{std},
-\tcode{ForwardIterator} shall meet the
-\oldconcept{ValueSwappable} requirements\iref{swappable.requirements}, and
+\tcode{ForwardIterator} shall meet
+the \oldconcept{ValueSwappable} requirements\iref{swappable.requirements}, and
the type of \tcode{*first} shall meet
the \oldconcept{MoveConstructible} (\tref{moveconstructible}) and
\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
\effects
-For each non-negative integer
-\tcode{i < (last - first)},
-places the element from the position
-\tcode{first + i}
-into position
-\tcode{first + (i + (last - middle)) \% (last - first)}.
+For each non-negative integer \tcode{i < (last - first)},
+places the element from the position \tcode{first + i}
+into position \tcode{first + (i + (last - middle)) \% (last - first)}.
\begin{note}
This is a left rotate.
\end{note}
@@ -5419,17 +5383,17 @@
\pnum
\returns
\begin{itemize}
-\item \tcode{first + (last - middle)} for the overloads in
- namespace \tcode{std}, or
-\item \tcode{\{first + (last - middle), last\}} for the overload in
- namespace \tcode{ranges}.
+\item
+ \tcode{first + (last - middle)}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{\{first + (last - middle), last\}}
+ for the overload in namespace \tcode{ranges}.
\end{itemize}
\pnum
\complexity
-At most
-\tcode{last - first}
-swaps.
+At most \tcode{last - first} swaps.
\end{itemdescr}
\begin{itemdecl}
@@ -5442,7 +5406,8 @@
\begin{itemdescr}
\pnum
-\effects Equivalent to:
+\effects
+Equivalent to:
\tcode{return ranges::rotate(ranges::begin(r), middle, ranges::end(r));}
\end{itemdescr}
@@ -5472,36 +5437,24 @@
\pnum
\requires
-\range{first}{middle}
-and
-\range{middle}{last}
-shall be valid ranges.
-The ranges
-\range{first}{last}
-and
-\range{result}{result + $N$}
+\range{first}{middle} and \range{middle}{last} shall be valid ranges.
+The ranges \range{first}{last} and \range{result}{result + $N$}
shall not overlap.
\pnum
\effects
-Copies the range
-\range{first}{last}
-to the range
-\range{result}{result + $N$}
-such that for each non-negative integer
-$i < N$
+Copies the range \range{first}{last} to the range \range{result}{result + $N$}
+such that for each non-negative integer $i < N$
the following assignment takes place:
-\tcode{*(result + $i$) = *(first +
-($i$ + (middle - first)) \% $N$)}.
+\tcode{*(result + $i$) = *(first + ($i$ + (middle - first)) \% $N$)}.
\pnum
\returns
\begin{itemize}
\item
-\tcode{result + $N$} for the overloads in namespace \tcode{std}, or
+ \tcode{result + $N$} for the overloads in namespace \tcode{std}, or
\item
-\tcode{\{last, result + $N$\}} for the overload in
- namespace \tcode{ranges}.
+ \tcode{\{last, result + $N$\}} for the overload in namespace \tcode{ranges}.
\end{itemize}
\pnum
@@ -5520,7 +5473,8 @@
\begin{itemdescr}
\pnum
-\effects Equivalent to:
+\effects
+Equivalent to:
\begin{codeblock}
return ranges::rotate_copy(ranges::begin(r), middle, ranges::end(r), result);
\end{codeblock}
@@ -5542,22 +5496,27 @@
\requires
\begin{itemize}
\item
-\tcode{PopulationIterator} shall satisfy the \oldconcept{InputIterator} requirements\iref{input.iterators}.
+ \tcode{PopulationIterator} shall satisfy
+ the \oldconcept{InputIterator} requirements\iref{input.iterators}.
\item
-\tcode{SampleIterator} shall satisfy the \oldconcept{OutputIterator} requirements\iref{output.iterators}.
+ \tcode{SampleIterator} shall satisfy
+ the \oldconcept{OutputIterator} requirements\iref{output.iterators}.
\item
-\tcode{SampleIterator} shall satisfy the \oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators}
-unless \tcode{Pop\-ulat\-ion\-Iter\-ator} satisfies the \oldconcept{ForwardIterator} requirements\iref{forward.iterators}.
+ \tcode{SampleIterator} shall satisfy
+ the \oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators}
+ unless \tcode{Pop\-ulat\-ion\-Iter\-ator} satisfies
+ the \oldconcept{ForwardIterator} requirements\iref{forward.iterators}.
\item
-\tcode{PopulationIterator}'s value type shall be writable\iref{iterator.requirements.general} to \tcode{out}.
+ \tcode{PopulationIterator}'s value type shall be
+ writable\iref{iterator.requirements.general} to \tcode{out}.
\item
-\tcode{Distance} shall be an integer type.
+ \tcode{Distance} shall be an integer type.
\item
-\tcode{remove_reference_t}
-shall satisfy the requirements of a uniform random bit generator type\iref{rand.req.urng}
-whose return type is convertible to \tcode{Distance}.
+ \tcode{remove_reference_t} shall satisfy
+ the requirements of a uniform random bit generator type\iref{rand.req.urng}
+ whose return type is convertible to \tcode{Distance}.
\item
-\tcode{out} shall not be in the range \range{first}{last}.
+ \tcode{out} shall not be in the range \range{first}{last}.
\end{itemize}
\pnum
@@ -5582,12 +5541,12 @@
\remarks
\begin{itemize}
\item
-Stable if and only if \tcode{PopulationIterator} satisfies the
-\oldconcept{ForwardIterator} requirements.
+ Stable if and only if \tcode{PopulationIterator} satisfies
+ the \oldconcept{ForwardIterator} requirements.
\item
-To the extent that the implementation of this function makes use of
-random numbers, the object \tcode{g} shall serve as the
-implementation's source of randomness.
+ To the extent that the implementation of this function makes use
+ of random numbers, the object \tcode{g} shall serve as
+ the implementation's source of randomness.
\end{itemize}
\end{itemdescr}
@@ -5618,20 +5577,18 @@
For the overload in namespace \tcode{std}:
\begin{itemize}
\item
-\tcode{RandomAccessIterator} shall meet the
-\oldconcept{ValueSwappable} requirements\iref{swappable.requirements}.
+ \tcode{RandomAccessIterator} shall meet
+ the \oldconcept{ValueSwappable} requirements\iref{swappable.requirements}.
\item
-The type
-\tcode{remove_reference_t}
-shall meet the
-uniform random bit generator\iref{rand.req.urng} requirements.
+ The type \tcode{remove_reference_t} shall meet
+ the uniform random bit generator\iref{rand.req.urng} requirements.
\end{itemize}
\pnum
\effects
-Permutes the elements in the range
-\range{first}{last}
-such that each possible permutation of those elements has equal probability of appearance.
+Permutes the elements in the range \range{first}{last}
+such that each possible permutation of those elements
+has equal probability of appearance.
\pnum
\returns
@@ -5639,16 +5596,13 @@
\pnum
\complexity
-Exactly
-\tcode{(last - first) - 1}
-swaps.
+Exactly \tcode{(last - first) - 1} swaps.
\pnum
\remarks
-To the extent that the implementation of this function makes use of random
-numbers, the object referenced by \tcode{g} shall serve as the implementation's source of
-randomness.
-
+To the extent that the implementation of this function makes use
+of random numbers, the object referenced by \tcode{g} shall serve as
+the implementation's source of randomness.
\end{itemdescr}
\rSec2[alg.shift]{Shift}
@@ -5739,129 +5693,84 @@
\pnum
The operations in~\ref{alg.sorting} defined directly in namespace \tcode{std}
-have two versions: one that takes a function object of type
-\tcode{Compare}
-and one that uses an
-\tcode{operator<}.
-
-\pnum
-\tcode{Compare}
-is a function object
-type\iref{function.objects}
-that meets the requirements for a template parameter named
-\tcode{BinaryPredicate}~\iref{algorithms.requirements}.
-The return value of the function call operation applied to
-an object of type \tcode{Compare}, when contextually converted to
-\tcode{bool}\iref{conv},
-yields \tcode{true} if the first argument of the call
-is less than the second, and
-\tcode{false}
-otherwise.
-\tcode{Compare comp}
-is used throughout for algorithms assuming an ordering relation.
-
-\pnum
-For all algorithms that take
-\tcode{Compare},
-there is a version that uses
-\tcode{operator<}
-instead.
-That is,
-\tcode{comp(*i, *j) != false}
-defaults to
-\tcode{*i < *j != false}.
+have two versions:
+one that takes a function object of type \tcode{Compare} and
+one that uses an \tcode{operator<}.
+
+\pnum
+\tcode{Compare} is a function object type\iref{function.objects}
+that meets the requirements for a template parameter
+named \tcode{BinaryPredicate}~\iref{algorithms.requirements}.
+The return value of the function call operation
+applied to an object of type \tcode{Compare},
+when contextually converted to \tcode{bool}\iref{conv},
+yields \tcode{true}
+if the first argument of the call is less than the second, and
+\tcode{false} otherwise.
+\tcode{Compare comp} is used throughout
+for algorithms assuming an ordering relation.
+
+\pnum
+For all algorithms that take \tcode{Compare},
+there is a version that uses \tcode{operator<} instead.
+That is, \tcode{comp(*i, *j) != false} defaults to \tcode{*i < *j != false}.
For algorithms other than those described in~\ref{alg.binary.search},
\tcode{comp} shall induce a strict weak ordering on the values.
\pnum
-The term
-\term{strict}
-refers to the
-requirement of an irreflexive relation (\tcode{!comp(x, x)} for all \tcode{x}),
-and the term
-\term{weak}
-to requirements that are not as strong as
-those for a total ordering,
-but stronger than those for a partial
-ordering.
-If we define
-\tcode{equiv(a, b)}
-as
-\tcode{!comp(a, b) \&\& !comp(b, a)},
-then the requirements are that
-\tcode{comp}
-and
-\tcode{equiv}
-both be transitive relations:
+The term \term{strict} refers to the requirement
+of an irreflexive relation (\tcode{!comp(x, x)} for all \tcode{x}),
+and the term \term{weak} to requirements
+that are not as strong as those for a total ordering,
+but stronger than those for a partial ordering.
+If we define \tcode{equiv(a, b)} as \tcode{!comp(a, b) \&\& !comp(b, a)},
+then the requirements are that \tcode{comp} and \tcode{equiv}
+both be transitive relations:
\begin{itemize}
-\item
-\tcode{comp(a, b) \&\& comp(b, c)}
-implies
-\tcode{comp(a, c)}
-\item
-\tcode{equiv(a, b) \&\& equiv(b, c)}
-implies
-\tcode{equiv(a, c)}
+\item \tcode{comp(a, b) \&\& comp(b, c)} implies \tcode{comp(a, c)}
+\item \tcode{equiv(a, b) \&\& equiv(b, c)} implies \tcode{equiv(a, c)}
\end{itemize}
\begin{note}
Under these conditions, it can be shown that
\begin{itemize}
\item
-\tcode{equiv}
-is an equivalence relation,
+ \tcode{equiv} is an equivalence relation,
\item
-\tcode{comp}
-induces a well-defined relation on the equivalence
-classes determined by
-\tcode{equiv}, and
+ \tcode{comp} induces a well-defined relation
+ on the equivalence classes determined by \tcode{equiv}, and
\item
-the induced relation is a strict total ordering.
+ the induced relation is a strict total ordering.
\end{itemize}
\end{note}
\pnum
-A sequence is
-\term{sorted with respect to a \tcode{comp} and \tcode{proj}}
+A sequence is \term{sorted with respect to a \tcode{comp} and \tcode{proj}}
for a comparator and projection \tcode{comp} and \tcode{proj}
-if for every iterator
-\tcode{i}
-pointing to the sequence and every non-negative integer
-\tcode{n}
-such that
-\tcode{i + n}
-is a valid iterator pointing to an element of the sequence,
+if for every iterator \tcode{i} pointing to the sequence and
+every non-negative integer \tcode{n}
+such that \tcode{i + n} is a valid iterator
+pointing to an element of the sequence,
\begin{codeblock}
bool(invoke(comp, invoke(proj, *(i + n)), invoke(proj, *i)))
\end{codeblock}
is \tcode{false}.
\pnum
-A sequence
-\range{start}{finish}
-is
-\term{partitioned with respect to an expression}
-\tcode{f(e)}
-if there exists an integer
-\tcode{n}
-such that for all
-\tcode{0 <= i < (finish - start)},
-\tcode{f(*(start + i))}
-is \tcode{true} if and only if
-\tcode{i < n}.
-
-\pnum
-In the descriptions of the functions that deal with ordering relationships we frequently use a notion of
-equivalence to describe concepts such as stability.
-The equivalence to which we refer is not necessarily an
-\tcode{operator==},
+A sequence \range{start}{finish} is
+\term{partitioned with respect to an expression} \tcode{f(e)}
+if there exists an integer \tcode{n}
+such that for all \tcode{0 <= i < (finish - start)},
+\tcode{f(*(start + i))} is \tcode{true} if and only if \tcode{i < n}.
+
+\pnum
+In the descriptions of the functions that deal with ordering relationships
+we frequently use a notion of equivalence to describe concepts
+such as stability.
+The equivalence to which we refer is not necessarily an \tcode{operator==},
but an equivalence relation induced by the strict weak ordering.
-That is, two elements
-\tcode{a}
-and
-\tcode{b}
-are considered equivalent if and only if
-\tcode{!(a < b) \&\& !(b < a)}.
+That is, two elements \tcode{a} and \tcode{b} are considered equivalent
+if and only if \tcode{!(a < b) \&\& !(b < a)}.
\rSec2[alg.sort]{Sorting}
@@ -5905,16 +5814,16 @@
\pnum
\requires
For the overloads in namespace \tcode{std},
-\tcode{RandomAccessIterator} shall meet the
-\oldconcept{Value\-Swappable} requirements\iref{swappable.requirements} and
-the type of \tcode{*first} shall meet the
-\oldconcept{MoveConstructible} (\tref{moveconstructible}) and
+\tcode{RandomAccessIterator} shall meet
+the \oldconcept{Value\-Swappable} requirements\iref{swappable.requirements} and
+the type of \tcode{*first} shall meet
+the \oldconcept{MoveConstructible} (\tref{moveconstructible}) and
\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
\effects
-Sorts the elements in the range
-\range{first}{last} with respect to \tcode{comp} and \tcode{proj}.
+Sorts the elements in the range \range{first}{last}
+with respect to \tcode{comp} and \tcode{proj}.
\pnum
\returns
@@ -5965,10 +5874,10 @@
\pnum
\requires
For the overloads in namespace \tcode{std},
-\tcode{RandomAccessIterator} shall meet the
-\oldconcept{Value\-Swappable} requirements\iref{swappable.requirements} and
-the type of \tcode{*first} shall meet the
-\oldconcept{MoveConstructible} (\tref{moveconstructible}) and
+\tcode{RandomAccessIterator} shall meet
+the \oldconcept{Value\-Swappable} requirements\iref{swappable.requirements} and
+the type of \tcode{*first} shall meet
+the \oldconcept{MoveConstructible} (\tref{moveconstructible}) and
\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
@@ -5985,11 +5894,11 @@
Let $N$ be \tcode{last - first}.
If enough extra memory is available, $N \log(N)$ comparisons.
Otherwise, at most $N \log^2(N)$ comparisons.
-In either case, twice as many projections as
-the number of comparisons.
+In either case, twice as many projections as the number of comparisons.
\pnum
-\remarks Stable\iref{algorithm.stable}.
+\remarks
+Stable\iref{algorithm.stable}.
\end{itemdescr}
\rSec3[partial.sort]{\tcode{partial_sort}}
@@ -6037,22 +5946,19 @@
\requires
\range{first}{middle} and \range{middle}{last} shall be valid ranges.
For the overloads in namespace \tcode{std},
-\tcode{RandomAccessIterator} shall meet the
-\oldconcept{ValueSwappable} requirements\iref{swappable.requirements} and
-the type of \tcode{*first} shall meet the
-\oldconcept{MoveConstructible} (\tref{moveconstructible}) and
+\tcode{RandomAccessIterator} shall meet
+the \oldconcept{ValueSwappable} requirements\iref{swappable.requirements} and
+the type of \tcode{*first} shall meet
+the \oldconcept{MoveConstructible} (\tref{moveconstructible}) and
\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
\effects
-Places the first
-\tcode{middle - first}
-elements from the range
-\range{first}{last} as sorted with respect to \tcode{comp} and \tcode{proj}
-into the range
-\range{first}{middle}.
-The rest of the elements in the range
-\range{middle}{last}
+Places the first \tcode{middle - first} elements
+from the range \range{first}{last}
+as sorted with respect to \tcode{comp} and \tcode{proj}
+into the range \range{first}{middle}.
+The rest of the elements in the range \range{middle}{last}
are placed in an unspecified order.
\indextext{unspecified}%
@@ -6062,9 +5968,8 @@
\pnum
\complexity
-Approximately
-\tcode{(last - first) * log(middle - first)}
-comparisons, and twice as many projections.
+Approximately \tcode{(last - first) * log(middle - first)} comparisons, and
+twice as many projections.
\end{itemdescr}
\begin{itemdecl}
@@ -6078,7 +5983,8 @@
\begin{itemdescr}
\pnum
-\effects Equivalent to:
+\effects
+Equivalent to:
\begin{codeblock}
return ranges::partial_sort(ranges::begin(r), middle, ranges::end(r), comp, proj);
\end{codeblock}
@@ -6146,10 +6052,10 @@
\pnum
\requires
For the overloads in namespace \tcode{std},
-\tcode{RandomAccessIterator} shall meet the
-\oldconcept{Value\-Swappable} requirements\iref{swappable.requirements},
-the type of \tcode{*result_first} shall meet the
-\oldconcept{MoveConstructible} (\tref{moveconstructible}) and
+\tcode{RandomAccessIterator} shall meet
+the \oldconcept{Value\-Swappable} requirements\iref{swappable.requirements},
+the type of \tcode{*result_first} shall meet
+the \oldconcept{MoveConstructible} (\tref{moveconstructible}) and
\oldconcept{\-Move\-Assignable} (\tref{moveassignable}) requirements,
and the expression \tcode{*first}
shall be writable\iref{iterator.requirements.general} to \tcode{result_first}.
@@ -6162,8 +6068,7 @@
\begin{codeblock}
bool(invoke(comp, invoke(proj1, *a1), invoke(proj2, *y2))).
\end{codeblock}
-Then, after evaluating the assignment \tcode{*x2 = *a1},
-$E$ is equal to
+Then, after evaluating the assignment \tcode{*x2 = *a1}, $E$ is equal to
\begin{codeblock}
bool(invoke(comp, invoke(proj2, *x2), invoke(proj2, *y2))).
\end{codeblock}
@@ -6175,8 +6080,8 @@
\pnum
\effects
Places the first $N$ elements
-as sorted with respect to \tcode{comp} and \tcode{proj2} into the range
-\range{result_first}{result_first + $N$}.
+as sorted with respect to \tcode{comp} and \tcode{proj2}
+into the range \range{result_first}{result_first + $N$}.
\pnum
\returns
@@ -6199,7 +6104,7 @@
\begin{itemdescr}
\pnum
\effects
-Equivalent to: return \tcode{is_sorted_until(first, last) == last;}
+Equivalent to: \tcode{return is_sorted_until(first, last) == last;}
\end{itemdescr}
\indexlibrary{\idxcode{is_sorted}}%
@@ -6263,7 +6168,8 @@
\begin{itemdescr}
\pnum
-\effects Equivalent to:
+\effects
+Equivalent to:
\tcode{return ranges::is_sorted_until(first, last, comp, proj) == last;}
\end{itemdescr}
@@ -6306,11 +6212,13 @@
\pnum
\returns
-The last iterator \tcode{i} in \crange{first}{last} for which the
-range \range{first}{i} is sorted with respect to \tcode{comp} and \tcode{proj}.
+The last iterator \tcode{i} in \crange{first}{last}
+for which the range \range{first}{i}
+is sorted with respect to \tcode{comp} and \tcode{proj}.
\pnum
-\complexity Linear.
+\complexity
+Linear.
\end{itemdescr}
\rSec2[alg.nth.element]{Nth element}
@@ -6352,32 +6260,22 @@
\requires
\range{first}{nth} and \range{nth}{last} shall be valid ranges.
For the overloads in namespace \tcode{std},
-\tcode{RandomAccessIterator} shall meet the
-\oldconcept{ValueSwappable} requirements\iref{swappable.requirements}, and
-the type of \tcode{*first} shall meet the
-\oldconcept{MoveConstructible} (\tref{moveconstructible}) and
+\tcode{RandomAccessIterator} shall meet
+the \oldconcept{ValueSwappable} requirements\iref{swappable.requirements}, and
+the type of \tcode{*first} shall meet
+the \oldconcept{MoveConstructible} (\tref{moveconstructible}) and
\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
\effects
-After
-\tcode{nth_element}
-the element in the position pointed to by \tcode{nth}
-is the element that would be
-in that position
+After \tcode{nth_element} the element in the position pointed to by \tcode{nth}
+is the element that would be in that position
if the whole range were sorted with respect to \tcode{comp} and \tcode{proj},
unless \tcode{nth == last}.
-Also for every iterator
-\tcode{i}
-in the range
-\range{first}{nth}
-and every iterator
-\tcode{j}
-in the range
-\range{nth}{last}
+Also for every iterator \tcode{i} in the range \range{first}{nth}
+and every iterator \tcode{j} in the range \range{nth}{last}
it holds that:
-\tcode{bool(invoke(comp, invoke(proj, *j), invoke(proj, *i)))}
-is \tcode{false}.
+\tcode{bool(invoke(comp, invoke(proj, *j), invoke(proj, *i)))} is \tcode{false}.
\pnum
\returns
@@ -6401,7 +6299,8 @@
\begin{itemdescr}
\pnum
-\effects Equivalent to:
+\effects
+Equivalent to:
\begin{codeblock}
return ranges::nth_element(ranges::begin(r), nth, ranges::end(r), comp, proj);
\end{codeblock}
@@ -6410,10 +6309,10 @@
\rSec2[alg.binary.search]{Binary search}
\pnum
-All of the algorithms in this subclause are versions of binary search
-and assume that the sequence being searched is partitioned with respect to
-an expression formed by binding the search key to an argument of the
-comparison function.
+All of the algorithms in this subclause are versions of binary search and
+assume that the sequence being searched
+is partitioned with respect to an expression
+formed by binding the search key to an argument of the comparison function.
They work on non-random access iterators minimizing the number of comparisons,
which will be logarithmic for all types of iterators.
They are especially appropriate for random access iterators,
@@ -6456,30 +6355,19 @@
\pnum
\requires
-The elements
-\tcode{e}
-of
-\range{first}{last}
+The elements \tcode{e} of \range{first}{last}
shall be partitioned with respect to the expression
\tcode{bool(invoke(comp, invoke(proj, e), value))}.
\pnum
\returns
-The furthermost iterator
-\tcode{i}
-in the range
-\crange{first}{last}
-such that for every iterator
-\tcode{j}
-in the range
-\range{first}{i},
+The furthermost iterator \tcode{i} in the range \crange{first}{last}
+such that for every iterator \tcode{j} in the range \range{first}{i},
\tcode{bool(invoke(comp, invoke(proj, *j), value))} is \tcode{true}.
\pnum
\complexity
-At most
-$\log_2(\tcode{last - first}) + \bigoh{1}$
-comparisons and projections.
+At most $\log_2(\tcode{last - first}) + \bigoh{1}$ comparisons and projections.
\end{itemdescr}
\rSec3[upper.bound]{\tcode{upper_bound}}
@@ -6516,30 +6404,19 @@
\pnum
\requires
-The elements
-\tcode{e}
-of
-\range{first}{last}
+The elements \tcode{e} of \range{first}{last}
shall be partitioned with respect to the expression
\tcode{!bool(invoke(comp, value, invoke(proj, e)))}.
\pnum
\returns
-The furthermost iterator
-\tcode{i}
-in the range
-\crange{first}{last}
-such that for every iterator
-\tcode{j}
-in the range
-\range{first}{i},
+The furthermost iterator \tcode{i} in the range \crange{first}{last}
+such that for every iterator \tcode{j} in the range \range{first}{i},
\tcode{!bool(invoke(comp, value, invoke(proj, *j)))} is \tcode{true}.
\pnum
\complexity
-At most
-$\log_2(\tcode{last - first}) + \bigoh{1}$
-comparisons and projections.
+At most $\log_2(\tcode{last - first}) + \bigoh{1}$ comparisons and projections.
\end{itemdescr}
\rSec3[equal.range]{\tcode{equal_range}}
@@ -6578,18 +6455,11 @@
\pnum
\requires
-The elements
-\tcode{e}
-of
-\range{first}{last}
+The elements \tcode{e} of \range{first}{last}
shall be partitioned with respect to the expressions
-\tcode{bool(invoke(comp, invoke(proj, e), value))}
-and
+\tcode{bool(invoke(comp, invoke(proj, e), value))} and
\tcode{!bool(invoke(comp, value, invoke(proj, e)))}.
-Also, for all elements
-\tcode{e}
-of
-\tcode{[first, last)},
+Also, for all elements \tcode{e} of \tcode{[first, last)},
\tcode{bool(comp(e, value))} shall imply \tcode{!bool(comp(\brk{}value, e))}
for the overloads in namespace \tcode{std}.
@@ -6611,8 +6481,7 @@
\pnum
\complexity
At most
-$2 * \log_2(\tcode{last - first}) + \bigoh{1}$
-comparisons and projections.
+$2 * \log_2(\tcode{last - first}) + \bigoh{1}$ comparisons and projections.
\end{itemdescr}
\rSec3[binary.search]{\tcode{binary_search}}
@@ -6650,36 +6519,25 @@
\pnum
\requires
-The elements
-\tcode{e}
-of
-\range{first}{last}
+The elements \tcode{e} of \range{first}{last}
shall be partitioned with respect to the expressions
\tcode{bool(invoke(comp, invoke(proj, e), value))} and
\tcode{!bool(invoke(comp, value, invoke(proj, e)))}.
-Also, for all elements
-\tcode{e}
-of
-\tcode{[first, last)},
-\tcode{bool(comp(e, value))}
-shall imply
-\tcode{!bool(comp(\brk{}value, e))}
+Also, for all elements \tcode{e} of \tcode{[first, last)},
+\tcode{bool(comp(e, value))} shall imply \tcode{!bool(comp(\brk{}value, e))}
for the overloads in namespace \tcode{std}.
\pnum
\returns
-\tcode{true}
-if and only if for some iterator
-\tcode{i}
-in the range
-\range{first}{last},
-\tcode{!bool(invoke(comp, invoke(proj, *i), value)) \&\& !bool(invoke(comp, value, invoke(proj, *i)))} is \tcode{true}.
+\tcode{true} if and only if
+for some iterator \tcode{i} in the range \range{first}{last},
+\tcode{!bool(invoke(comp, invoke(proj, *i), value)) \&\&
+!bool(invoke(comp, value, invoke(proj, *i)))}
+is \tcode{true}.
\pnum
\complexity
-At most
-$\log_2(\tcode{last - first}) + \bigoh{1}$
-comparisons and projections.
+At most $\log_2(\tcode{last - first}) + \bigoh{1}$ comparisons and projections.
\end{itemdescr}
\rSec2[alg.partitions]{Partitions}
@@ -6704,18 +6562,19 @@
\begin{itemdescr}
\pnum
-Let \tcode{proj} be \tcode{identity\{\}} for
-the overloads with no parameter named \tcode{proj}.
+Let \tcode{proj} be \tcode{identity\{\}}
+for the overloads with no parameter named \tcode{proj}.
\pnum
-\returns \tcode{true} if and only if
-the elements \tcode{e} of
-\range{first}{last} are partitioned with respect to the expression
+\returns
+\tcode{true} if and only if the elements \tcode{e} of \range{first}{last}
+are partitioned with respect to the expression
\tcode{bool(invoke(pred, invoke(proj, e)))}.
\pnum
-\complexity Linear. At most \tcode{last - first} applications of \tcode{pred}
-and \tcode{proj}.
+\complexity
+Linear.
+At most \tcode{last - first} applications of \tcode{pred} and \tcode{proj}.
\end{itemdescr}
\indexlibrary{\idxcode{partition}}%
@@ -6743,38 +6602,42 @@
\begin{itemdescr}
\pnum
-Let \tcode{proj} be \tcode{identity\{\}} for the overloads
-with no parameter named \tcode{proj}
+Let \tcode{proj} be \tcode{identity\{\}}
+for the overloads with no parameter named \tcode{proj}
and let $E(x)$ be \tcode{bool(invoke(\brk{}pred, invoke(proj, $x$)))}.
\pnum
\requires
For the overloads in namespace \tcode{std},
-\tcode{ForwardIterator} shall meet the
-\oldconcept{ValueSwappable} requirements\iref{swappable.requirements}.
+\tcode{ForwardIterator} shall meet
+the \oldconcept{ValueSwappable} requirements\iref{swappable.requirements}.
\pnum
-\effects Places all the elements \tcode{e} in \range{first}{last}
+\effects
+Places all the elements \tcode{e} in \range{first}{last}
that satisfy $E(\tcode{e})$ before all the elements that do not.
\pnum
-\returns An iterator \tcode{i} such that $E(\tcode{*j})$ is \tcode{true}
-for every iterator \tcode{j} in
-\range{first}{i} and \tcode{false} for every iterator \tcode{j} in
-\range{i}{last}.
+\returns
+An iterator \tcode{i} such that $E(\tcode{*j})$ is
+\tcode{true} for every iterator \tcode{j} in \range{first}{i} and
+\tcode{false} for every iterator \tcode{j} in \range{i}{last}.
\pnum
\complexity Let $N = \tcode{last - first}$:
\begin{itemize}
-\item For the overload with no \tcode{ExecutionPolicy}, exactly $N$ applications
-of the predicate and projection. At most $N / 2$ swaps if the type of \tcode{first} meets the
-\oldconcept{BidirectionalIterator} requirements
-for the overloads in namespace \tcode{std} or
-models \libconcept{BidirectionalIterator} for the
-overloads in namespace \tcode{ranges},
-and at most $N$ swaps otherwise.
-\item For the overload with an \tcode{ExecutionPolicy},
-\bigoh{N \log N} swaps and \bigoh{N} applications of the predicate.
+\item
+ For the overload with no \tcode{ExecutionPolicy},
+ exactly $N$ applications of the predicate and projection.
+ At most $N / 2$ swaps if the type of \tcode{first} meets
+ the \oldconcept{BidirectionalIterator} requirements
+ for the overloads in namespace \tcode{std} or
+ models \libconcept{BidirectionalIterator}
+ for the overloads in namespace \tcode{ranges},
+ and at most $N$ swaps otherwise.
+\item
+ For the overload with an \tcode{ExecutionPolicy},
+ \bigoh{N \log N} swaps and \bigoh{N} applications of the predicate.
\end{itemize}
\end{itemdescr}
@@ -6803,52 +6666,44 @@
\begin{itemdescr}
\pnum
-\pnum
-Let \tcode{proj} be \tcode{identity\{\}} for the overloads
-with no parameter named \tcode{proj}
+Let \tcode{proj} be \tcode{identity\{\}}
+for the overloads with no parameter named \tcode{proj}
and let $E(x)$ be \tcode{bool(invoke(\brk{}pred, invoke(proj, $x$)))}.
\requires
For the overloads in namespace \tcode{std},
-\tcode{BidirectionalIterator} shall meet the
-\oldconcept{Value\-Swappable} requirements\iref{swappable.requirements} and
-the type of \tcode{*first} shall meet the
-\oldconcept{MoveConstructible} (\tref{moveconstructible}) and
+\tcode{BidirectionalIterator} shall meet
+the \oldconcept{Value\-Swappable} requirements\iref{swappable.requirements} and
+the type of \tcode{*first} shall meet
+the \oldconcept{MoveConstructible} (\tref{moveconstructible}) and
\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
\effects
Places all the elements \tcode{e} in \range{first}{last}
-that satisfy $E(\tcode{e})$ before all the
-elements that do not.
+that satisfy $E(\tcode{e})$ before all the elements that do not.
The relative order of the elements in both groups is preserved.
\pnum
\returns
-An iterator
-\tcode{i}
-such that for every iterator
-\tcode{j}
-in
-\range{first}{i},
+An iterator \tcode{i}
+such that for every iterator \tcode{j} in \range{first}{i},
$E(\tcode{*j})$ is \tcode{true},
-and for every iterator
-\tcode{j}
-in the range
-\range{i}{last},
+and for every iterator \tcode{j} in the range \range{i}{last},
$E(\tcode{*j})$ is \tcode{false},
\pnum
\complexity
Let $N$ = \tcode{last - first}:
\begin{itemize}
-\item For the overloads with no \tcode{ExecutionPolicy}, at most $N \log N$ swaps,
-but only \bigoh{N} swaps if there is enough extra memory. Exactly $N$
-applications of the predicate and projection.
-\item For the overload with an \tcode{ExecutionPolicy},
-\bigoh{N \log N} swaps and \bigoh{N} applications of the predicate.
+\item
+ For the overloads with no \tcode{ExecutionPolicy}, at most $N \log N$ swaps,
+ but only \bigoh{N} swaps if there is enough extra memory.
+ Exactly $N$ applications of the predicate and projection.
+\item
+ For the overload with an \tcode{ExecutionPolicy},
+ \bigoh{N \log N} swaps and \bigoh{N} applications of the predicate.
\end{itemize}
-
\end{itemdescr}
\indexlibrary{\idxcode{partition_copy}}%
@@ -6884,17 +6739,17 @@
\begin{itemdescr}
\pnum
-Let \tcode{proj} be \tcode{identity\{\}} for the overloads
-with no parameter named \tcode{proj}
-and let $E(x)$ be \tcode{bool(invoke(\brk{}pred, invoke(proj, $x$)))}.
+Let \tcode{proj} be \tcode{identity\{\}}
+for the overloads with no parameter named \tcode{proj} and
+let $E(x)$ be \tcode{bool(invoke(\brk{}pred, invoke(proj, $x$)))}.
\pnum
\requires
The input range and output ranges shall not overlap.
For the overloads in namespace \tcode{std},
-the expression \tcode{*first} shall be
-writable\iref{iterator.requirements.general} to
-\tcode{out_true} and \tcode{out_false}.
+the expression \tcode{*first}
+shall be writable\iref{iterator.requirements.general}
+to \tcode{out_true} and \tcode{out_false}.
\begin{note}
For the overload with an \tcode{ExecutionPolicy},
there may be a performance cost if \tcode{first}'s value type
@@ -6903,7 +6758,10 @@
\pnum
\effects
-For each iterator \tcode{i} in \range{first}{last}, copies \tcode{*i} to the output range beginning with \tcode{out_true} if \tcode{$E(\tcode{*i})$} is \tcode{true}, or to the output range beginning with \tcode{out_false} otherwise.
+For each iterator \tcode{i} in \range{first}{last},
+copies \tcode{*i} to the output range beginning with \tcode{out_true}
+if \tcode{$E(\tcode{*i})$} is \tcode{true}, or
+to the output range beginning with \tcode{out_false} otherwise.
\pnum
\returns
@@ -6916,8 +6774,8 @@
\end{itemize}
\pnum
-\complexity Exactly \tcode{last - first} applications of \tcode{pred}
-and \tcode{proj}.
+\complexity
+Exactly \tcode{last - first} applications of \tcode{pred} and \tcode{proj}.
\end{itemdescr}
\indexlibrary{\idxcode{partition_point}}%
@@ -6939,8 +6797,8 @@
\begin{itemdescr}
\pnum
-Let \tcode{proj} be \tcode{identity\{\}} for the overloads
-with no parameter named \tcode{proj}
+Let \tcode{proj} be \tcode{identity\{\}}
+for the overloads with no parameter named \tcode{proj}
and let $E(x)$ be \tcode{bool(invoke(\brk{}pred, invoke(proj, $x$)))}.
\pnum
@@ -6950,14 +6808,15 @@
\pnum
\returns
-An iterator \tcode{mid} such that
-$E(\tcode{*i})$ is \tcode{true} for all iterators \tcode{i}
-in \range{first}{mid}, and
+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}
\pnum
-\complexity \bigoh{\log(\tcode{last - first})} applications of \tcode{pred}
-and \tcode{proj}.
+\complexity
+\bigoh{\log(\tcode{last - first})} applications
+of \tcode{pred} and \tcode{proj}.
\end{itemdescr}
\rSec2[alg.merge]{Merge}
@@ -7018,39 +6877,49 @@
for the overloads with no parameters by those names.
\pnum
-\requires The ranges \range{first1}{last1} and \range{first2}{last2} shall be
-sorted with respect to \tcode{comp} and \tcode{proj1} or \tcode{proj2}, respectively.
+\requires
+The ranges \range{first1}{last1} and \range{first2}{last2}
+shall be sorted with respect to \tcode{comp} and \tcode{proj1} or \tcode{proj2},
+respectively.
The resulting range shall not overlap with either of the original ranges.
\pnum
-\effects Copies all the elements of the two ranges \range{first1}{last1} and
-\range{first2}{last2} into the range \range{result}{result_last}, where \tcode{result_last}
-is \tcode{result + $N$}.
-If an element \tcode{a} precedes \tcode{b} in an input range, \tcode{a} is
-copied into the output range before \tcode{b}. If \tcode{e1} is an element of
-\range{first1}{last1} and \tcode{e2} of \range{first2}{last2}, \tcode{e2} is
-copied into the output range before \tcode{e1} if and only if
+\effects
+Copies all the elements of the two ranges \range{first1}{last1} and
+\range{first2}{last2} into the range \range{result}{result_last},
+where \tcode{result_last} is \tcode{result + $N$}.
+If an element \tcode{a} precedes \tcode{b} in an input range,
+\tcode{a} is copied into the output range before \tcode{b}.
+If \tcode{e1} is an element of \range{first1}{last1} and
+\tcode{e2} of \range{first2}{last2},
+\tcode{e2} is copied into the output range before \tcode{e1} if and only if
\tcode{bool(invoke(comp, invoke(proj2, e2), invoke(proj1, e1)))}
is \tcode{true}.
\pnum
\returns
\begin{itemize}
-\item \tcode{result_last} for the overloads in namespace \tcode{std}, or
-\item \tcode{\{last1, last2, result_last\}} for the overloads in
- namespace \tcode{ranges}.
+\item
+ \tcode{result_last}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{\{last1, last2, result_last\}}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
\complexity
\begin{itemize}
-\item For the overloads with no \tcode{ExecutionPolicy}, at most $N - 1$ comparisons
-and applications of each projection.
-\item For the overloads with an \tcode{ExecutionPolicy}, \bigoh{N} comparisons.
+\item
+ For the overloads with no \tcode{ExecutionPolicy},
+ at most $N - 1$ comparisons and applications of each projection.
+\item
+ For the overloads with an \tcode{ExecutionPolicy}, \bigoh{N} comparisons.
\end{itemize}
\pnum
-\remarks Stable\iref{algorithm.stable}.
+\remarks
+Stable\iref{algorithm.stable}.
\end{itemdescr}
\indexlibrary{\idxcode{inplace_merge}}%
@@ -7094,20 +6963,17 @@
\range{first}{middle} and \range{middle}{last} shall be valid ranges
sorted with respect to \tcode{comp} and \tcode{proj}.
For the overloads in namespace \tcode{std},
-\tcode{BidirectionalIterator} shall meet the
-\oldconcept{Value\-Swappable} requirements\iref{swappable.requirements} and
-the type of \tcode{*first} shall meet the
-\oldconcept{MoveConstructible} (\tref{moveconstructible}) and
+\tcode{BidirectionalIterator} shall meet
+the \oldconcept{Value\-Swappable} requirements\iref{swappable.requirements} and
+the type of \tcode{*first} shall meet
+the \oldconcept{MoveConstructible} (\tref{moveconstructible}) and
\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
\effects
Merges two sorted consecutive ranges
-\range{first}{middle}
-and
-\range{middle}{last},
-putting the result of the merge into the range
-\range{first}{last}.
+\range{first}{middle} and \range{middle}{last},
+putting the result of the merge into the range \range{first}{last}.
The resulting range is sorted with respect to \tcode{comp} and \tcode{proj}.
\pnum
@@ -7115,16 +6981,20 @@
\tcode{last} for the overload in namespace \tcode{ranges}.
\pnum
-\complexity Let $N = \tcode{last - first}$:
+\complexity
+Let $N = \tcode{last - first}$:
\begin{itemize}
-\item For the overloads with no \tcode{ExecutionPolicy}, and if enough additional
-memory is available, exactly $N - 1$ comparisons.
-\item Otherwise, \bigoh{N \log N} comparisons.
+\item
+ For the overloads with no \tcode{ExecutionPolicy}, and
+ if enough additional memory is available, exactly $N - 1$ comparisons.
+\item
+ Otherwise, \bigoh{N \log N} comparisons.
\end{itemize}
In either case, twice as many projections as comparisons.
\pnum
-\remarks Stable\iref{algorithm.stable}.
+\remarks
+Stable\iref{algorithm.stable}.
\end{itemdescr}
\begin{itemdecl}
@@ -7138,7 +7008,8 @@
\begin{itemdescr}
\pnum
-\effects Equivalent to:
+\effects
+Equivalent to:
\begin{codeblock}
return ranges::inplace_merge(ranges::begin(r), middle, ranges::end(r), comp, proj);
\end{codeblock}
@@ -7148,16 +7019,12 @@
\pnum
This subclause defines all the basic set operations on sorted structures.
-They also work with
-\tcode{multiset}s\iref{multiset}
+They also work with \tcode{multiset}s\iref{multiset}
containing multiple copies of equivalent elements.
-The semantics of the set operations are generalized to
-\tcode{multiset}s
-in a standard way by defining
-\tcode{set_union()}
+The semantics of the set operations are generalized to \tcode{multiset}s
+in a standard way by defining \tcode{set_union()}
to contain the maximum number of occurrences of every element,
-\tcode{set_intersection()}
-to contain the minimum, and so on.
+\tcode{set_intersection()} to contain the minimum, and so on.
\rSec3[includes]{\tcode{includes}}
@@ -7206,9 +7073,8 @@
\pnum
\requires
-The ranges \range{first1}{last1} and \range{first2}{last2}
-shall be sorted with respect to \tcode{comp}
-and \tcode{proj1} or \tcode{proj2}, respectively.
+The ranges \range{first1}{last1} and \range{first2}{last2} shall be sorted
+with respect to \tcode{comp} and \tcode{proj1} or \tcode{proj2}, respectively.
\pnum
\returns
@@ -7222,8 +7088,7 @@
\pnum
\complexity
-At most
-\tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
+At most \tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
comparisons and applications of each projection.
\end{itemdescr}
@@ -7284,9 +7149,8 @@
\pnum
\requires
-The ranges \range{first1}{last1} and \range{first2}{last2} shall be
-sorted with respect to \tcode{comp} and
-\tcode{proj1} or \tcode{proj2}, respectively.
+The ranges \range{first1}{last1} and \range{first2}{last2} shall be sorted
+with respect to \tcode{comp} and \tcode{proj1} or \tcode{proj2}, respectively.
The resulting range shall not overlap with either of the original ranges.
\pnum
@@ -7299,25 +7163,30 @@
Let \tcode{result_last} be the end of the constructed range.
Returns
\begin{itemize}
-\item \tcode{result_last} for the overloads in namespace \tcode{std}, or
-\item \tcode{\{last1, last2, result_last\}} for the overloads in
- namespace \tcode{ranges}.
+\item
+ \tcode{result_last}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{\{last1, last2, result_last\}}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
\complexity
-At most
-\tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
+At most \tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
comparisons and applications of each projection.
\pnum
\remarks
Stable\iref{algorithm.stable}.
-If \range{first1}{last1} contains $m$ elements that are equivalent to
-each other and \range{first2}{last2} contains $n$ elements that are equivalent
-to them, then all $m$ elements from the first range are copied to the output
-range, in order, and then the final $\max(n - m, 0)$ elements from the second range are
-copied to the output range, in order.
+If \range{first1}{last1} contains $m$ elements
+that are equivalent to each other and
+\range{first2}{last2} contains $n$ elements
+that are equivalent to them,
+then all $m$ elements from the first range
+are copied to the output range, in order, and
+then the final $\max(n - m, 0)$ elements from the second range
+are copied to the output range, in order.
\end{itemdescr}
\rSec3[set.intersection]{\tcode{set_intersection}}
@@ -7377,9 +7246,8 @@
\pnum
\requires
-The ranges \range{first1}{last1} and \range{first2}{last2} shall be
-sorted with respect to \tcode{comp} and
-\tcode{proj1} or \tcode{proj2}, respectively.
+The ranges \range{first1}{last1} and \range{first2}{last2} shall be sorted
+with respect to \tcode{comp} and \tcode{proj1} or \tcode{proj2}, respectively.
The resulting range shall not overlap with either of the original ranges.
\pnum
@@ -7392,24 +7260,28 @@
Let \tcode{result_last} be the end of the constructed range.
Returns
\begin{itemize}
-\item \tcode{result_last} for the overloads in namespace \tcode{std}, or
-\item \tcode{\{last1, last2, result_last\}} for the overloads in
- namespace \tcode{ranges}.
+\item
+ \tcode{result_last}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{\{last1, last2, result_last\}}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
\complexity
-At most
-\tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
+At most \tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
comparisons and applications of each projection.
\pnum
\remarks
Stable\iref{algorithm.stable}.
-If \range{first1}{last1} contains $m$ elements that are equivalent to
-each other and \range{first2}{last2} contains $n$ elements that are equivalent
-to them, the first $\min(m, n)$ elements are copied from the first range
-to the output range, in order.
+If \range{first1}{last1} contains $m$ elements
+that are equivalent to each other and
+\range{first2}{last2} contains $n$ elements
+that are equivalent to them,
+the first $\min(m, n)$ elements
+are copied from the first range to the output range, in order.
\end{itemdescr}
\rSec3[set.difference]{\tcode{set_difference}}
@@ -7469,19 +7341,15 @@
\pnum
\requires
-The ranges \range{first1}{last1} and \range{first2}{last2} shall be
-sorted with respect to \tcode{comp} and
-\tcode{proj1} or \tcode{proj2}, respectively.
+The ranges \range{first1}{last1} and \range{first2}{last2} shall be sorted
+with respect to \tcode{comp} and \tcode{proj1} or \tcode{proj2}, respectively.
The resulting range shall not overlap with either of the original ranges.
\pnum
\effects
-Copies the elements of the range
-\range{first1}{last1}
-which are not present in the range
-\range{first2}{last2}
-to the range beginning at
-\tcode{result}.
+Copies the elements of the range \range{first1}{last1}
+which are not present in the range \range{first2}{last2}
+to the range beginning at \tcode{result}.
The elements in the constructed range are sorted.
\pnum
@@ -7489,29 +7357,26 @@
Let \tcode{result_last} be the end of the constructed range.
Returns
\begin{itemize}
-\item \tcode{result_last} for the overloads in namespace \tcode{std}, or
-\item \tcode{\{last1, result_last\}} for the overloads in
- namespace \tcode{ranges}.
+\item
+ \tcode{result_last}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{\{last1, result_last\}}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
\complexity
-At most
-\tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
+At most \tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
comparisons and applications of each projection.
\pnum
\remarks
-If
-\range{first1}{last1}
-contains $m$
-elements that are equivalent to each other and
-\range{first2}{last2}
-contains $n$
-elements that are equivalent to them, the last
-$\max(m - n, 0)$
-elements from
-\range{first1}{last1}
+If \range{first1}{last1} contains $m$ elements
+that are equivalent to each other and
+\range{first2}{last2} contains $n$ elements
+that are equivalent to them,
+the last $\max(m - n, 0)$ elements from \range{first1}{last1}
is copied to the output range, in order.
\end{itemdescr}
@@ -7574,23 +7439,17 @@
\pnum
\requires
The resulting range shall not overlap with either of the original ranges.
-The ranges \range{first1}{last1} and \range{first2}{last2} shall be
-sorted with respect to \tcode{comp} and
-\tcode{proj1} or \tcode{proj2}, respectively.
+The ranges \range{first1}{last1} and \range{first2}{last2} shall be sorted
+with respect to \tcode{comp} and \tcode{proj1} or \tcode{proj2}, respectively.
The resulting range shall not overlap with either of the original ranges.
\pnum
\effects
-Copies the elements of the range
-\range{first1}{last1}
-that are not present in the range
-\range{first2}{last2},
-and the elements of the range
-\range{first2}{last2}
-that are not present in the range
-\range{first1}{last1}
-to the range beginning at
-\tcode{result}.
+Copies the elements of the range \range{first1}{last1}
+that are not present in the range \range{first2}{last2},
+and the elements of the range \range{first2}{last2}
+that are not present in the range \range{first1}{last1}
+to the range beginning at \tcode{result}.
The elements in the constructed range are sorted.
\pnum
@@ -7598,25 +7457,29 @@
Let \tcode{result_last} be the end of the constructed range.
Returns
\begin{itemize}
-\item \tcode{result_last} for the overloads in namespace \tcode{std}, or
-\item \tcode{\{last1, last2, result_last\}} for the overloads in
- namespace \tcode{ranges}.
+\item
+ \tcode{result_last}
+ for the overloads in namespace \tcode{std}, or
+\item
+ \tcode{\{last1, last2, result_last\}}
+ for the overloads in namespace \tcode{ranges}.
\end{itemize}
\pnum
\complexity
-At most
-\tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
+At most \tcode{2 * ((last1 - first1) + (last2 - first2)) - 1}
comparisons and applications of each projection.
\pnum
\remarks
Stable\iref{algorithm.stable}.
-If \range{first1}{last1} contains $m$ elements that are equivalent to each other and
-\range{first2}{last2} contains $n$ elements that are equivalent to them, then
-$|m - n|$ of those elements shall be copied to the output range: the last
-$m - n$ of these elements from \range{first1}{last1} if $m > n$, and the last
-$n - m$ of these elements from \range{first2}{last2} if $m < n$.
+If \range{first1}{last1} contains $m$ elements
+that are equivalent to each other and
+\range{first2}{last2} contains $n$ elements
+that are equivalent to them,
+then $|m - n|$ of those elements shall be copied to the output range:
+the last $m - n$ of these elements from \range{first1}{last1} if $m > n$, and
+the last $n - m$ of these elements from \range{first2}{last2} if $m < n$.
In either case, the elements are copied in order.
\end{itemdescr}
@@ -7630,27 +7493,22 @@
if its elements are organized such that:
\begin{itemize}
-\item With \tcode{$N$ = b - a}, for all $i$, $0 < i < N$,
-\tcode{bool(invoke(comp, invoke(proj, a[$\left \lfloor{\frac{i - 1}{2}}\right \rfloor$]), invoke(\brk{}proj, a[$i$])))}
-is \tcode{false}.
-\item \tcode{*a}
-may be removed by
-\tcode{pop_heap},
-or a new element added by
-\tcode{push_heap},
-in
-\bigoh{\log N}
-time.
+\item
+ With \tcode{$N$ = b - a}, for all $i$, $0 < i < N$,
+ \tcode{bool(invoke(comp, invoke(proj, a[$\left \lfloor{\frac{i - 1}{2}}\right \rfloor$]), invoke(\brk{}proj, a[$i$])))}
+ is \tcode{false}.
+\item
+ \tcode{*a} may be removed by \tcode{pop_heap}, or
+ a new element added by \tcode{push_heap},
+ in \bigoh{\log N} time.
\end{itemize}
\pnum
These properties make heaps useful as priority queues.
\pnum
-\tcode{make_heap}
-converts a range into a heap and
-\tcode{sort_heap}
-turns a heap into a sorted sequence.
+\tcode{make_heap} converts a range into a heap and
+\tcode{sort_heap} turns a heap into a sorted sequence.
\rSec3[push.heap]{\tcode{push_heap}}
@@ -7684,22 +7542,17 @@
\pnum
\requires
-The range
-\range{first}{last - 1}
+The range \range{first}{last - 1}
shall be a valid heap with respect to \tcode{comp} and \tcode{proj}.
For the overloads in namespace \tcode{std},
the type of \tcode{*first} shall meet
-the \oldconcept{MoveConstructible} requirements
-(\tref{moveconstructible}) and the
-\oldconcept{MoveAssignable} requirements
-(\tref{moveassignable}).
+the \oldconcept{MoveConstructible} requirements (\tref{moveconstructible}) and
+the \oldconcept{MoveAssignable} requirements (\tref{moveassignable}).
\pnum
\effects
-Places the value in the location
-\tcode{last - 1}
-into the resulting heap
-\range{first}{last}.
+Places the value in the location \tcode{last - 1}
+into the resulting heap \range{first}{last}.
\pnum
\returns
@@ -7707,9 +7560,7 @@
\pnum
\complexity
-At most
-$\log(\tcode{last - first})$
-comparisons and twice as many projections.
+At most $\log(\tcode{last - first})$ comparisons and twice as many projections.
\end{itemdescr}
\rSec3[pop.heap]{\tcode{pop_heap}}
@@ -7744,14 +7595,13 @@
\pnum
\requires
-The range
-\range{first}{last}
+The range \range{first}{last}
shall be a valid non-empty heap with respect to \tcode{comp} and \tcode{proj}.
For the overloads in namespace \tcode{std},
-\tcode{RandomAccessIterator} shall meet the
-\oldconcept{ValueSwappable} requirements\iref{swappable.requirements} and
-the type of \tcode{*first} shall met the
-\oldconcept{MoveConstructible} (\tref{moveconstructible}) and
+\tcode{RandomAccessIterator} shall meet
+the \oldconcept{ValueSwappable} requirements\iref{swappable.requirements} and
+the type of \tcode{*first} shall meet
+the \oldconcept{MoveConstructible} (\tref{moveconstructible}) and
\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
@@ -7769,9 +7619,8 @@
\pnum
\complexity
-At most
-$2 \log(\tcode{last - first})$
-comparisons and twice as many projections.
+At most $2 \log(\tcode{last - first})$ comparisons and
+twice as many projections.
\end{itemdescr}
\rSec3[make.heap]{\tcode{make_heap}}
@@ -7808,15 +7657,13 @@
\requires
For the overloads in namespace \tcode{std},
the type of \tcode{*first} shall meet
-the \oldconcept{Move\-Constructible}
-(\tref{moveconstructible}) and
-\oldconcept{MoveAssignable}
-(\tref{moveassignable}) requirements.
+the \oldconcept{Move\-Constructible} (\tref{moveconstructible}) and
+\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
\effects
-Constructs a heap with respect to \tcode{comp} and \tcode{proj} out of the range
-\range{first}{last}.
+Constructs a heap with respect to \tcode{comp} and \tcode{proj}
+out of the range \range{first}{last}.
\pnum
\returns
@@ -7824,9 +7671,7 @@
\pnum
\complexity
-At most
-$3(\tcode{last - first})$
-comparisons and twice as many projections.
+At most $3(\tcode{last - first})$ comparisons and twice as many projections.
\end{itemdescr}
\rSec3[sort.heap]{\tcode{sort_heap}}
@@ -7864,16 +7709,16 @@
The range \range{first}{last} shall be
a valid heap with respect to \tcode{comp} and \tcode{proj}.
For the overloads in namespace \tcode{std},
-\tcode{RandomAccessIterator} shall meet the
-\oldconcept{ValueSwappable} requirements\iref{swappable.requirements} and
-the type of \tcode{*first} shall meet the
-\oldconcept{MoveConst\-ruct\-ible} (\tref{moveconstructible}) and
+\tcode{RandomAccessIterator} shall meet
+the \oldconcept{ValueSwappable} requirements\iref{swappable.requirements} and
+the type of \tcode{*first} shall meet
+the \oldconcept{MoveConst\-ruct\-ible} (\tref{moveconstructible}) and
\oldconcept{MoveAssignable} (\tref{moveassignable}) requirements.
\pnum
\effects
-Sorts elements in the heap
-\range{first}{last} with respect to \tcode{comp} and \tcode{proj}.
+Sorts elements in the heap \range{first}{last}
+with respect to \tcode{comp} and \tcode{proj}.
\pnum
\returns
@@ -7881,9 +7726,8 @@
\pnum
\complexity
-At most $2N \log N$
-comparisons, where
-$N = \tcode{last - first}$, and twice as many projections.
+At most $2N \log N$ comparisons, where $N = \tcode{last - first}$, and
+twice as many projections.
\end{itemdescr}
\rSec3[is.heap]{\tcode{is_heap}}
@@ -7916,7 +7760,6 @@
\end{codeblock}
\end{itemdescr}
-
\indexlibrary{\idxcode{is_heap}}%
\begin{itemdecl}
template
@@ -7961,7 +7804,8 @@
\begin{itemdescr}
\pnum
-\effects Equivalent to:
+\effects
+Equivalent to:
\tcode{return ranges::is_heap_until(first, last, comp, proj) == last;}
\end{itemdescr}
@@ -8004,11 +7848,13 @@
\pnum
\returns
-The last iterator \tcode{i} in \crange{first}{last} for which the
-range \range{first}{i} is a heap with respect to \tcode{comp} and \tcode{proj}.
+The last iterator \tcode{i} in \crange{first}{last}
+for which the range \range{first}{i}
+is a heap with respect to \tcode{comp} and \tcode{proj}.
\pnum
-\complexity Linear.
+\complexity
+Linear.
\end{itemdescr}
@@ -8016,7 +7862,8 @@
\indexlibrary{\idxcode{min}}%
\begin{itemdecl}
-template constexpr const T& min(const T& a, const T& b);
+template
+ constexpr const T& min(const T& a, const T& b);
template
constexpr const T& min(const T& a, const T& b, Compare comp);
@@ -8040,8 +7887,8 @@
\pnum
\remarks
Returns the first argument when the arguments are equivalent.
-An invocation may explicitly specify an argument
-for the template parameter \tcode{T}
+An invocation may explicitly specify
+an argument for the template parameter \tcode{T}
of the overloads in namespace \tcode{std}.
\pnum
@@ -8077,12 +7924,15 @@
For the first form, type \tcode{T} shall be \oldconcept{LessThanComparable}.
\pnum
-\returns The smallest value in the input range.
+\returns
+The smallest value in the input range.
\pnum
-\remarks Returns a copy of the leftmost element when several elements are equivalent to the smallest.
-An invocation may explicitly specify an argument
-for the template parameter \tcode{T}
+\remarks
+Returns a copy of the leftmost element
+when several elements are equivalent to the smallest.
+An invocation may explicitly specify
+an argument for the template parameter \tcode{T}
of the overloads in namespace \tcode{std}.
\pnum
@@ -8093,7 +7943,8 @@
\indexlibrary{\idxcode{max}}%
\begin{itemdecl}
-template constexpr const T& max(const T& a, const T& b);
+template
+ constexpr const T& max(const T& a, const T& b);
template
constexpr const T& max(const T& a, const T& b, Compare comp);
@@ -8117,8 +7968,8 @@
\pnum
\remarks
Returns the first argument when the arguments are equivalent.
-An invocation may explicitly specify an argument
-for the template parameter \tcode{T}
+An invocation may explicitly specify
+an argument for the template parameter \tcode{T}
of the overloads in namespace \tcode{std}.
\pnum
@@ -8154,12 +8005,15 @@
For the first form, type \tcode{T} shall be \oldconcept{LessThanComparable}.
\pnum
-\returns The largest value in the input range.
+\returns
+The largest value in the input range.
\pnum
-\remarks Returns a copy of the leftmost element when several elements are equivalent to the largest.
-An invocation may explicitly specify an argument
-for the template parameter \tcode{T}
+\remarks
+Returns a copy of the leftmost element
+when several elements are equivalent to the largest.
+An invocation may explicitly specify
+an argument for the template parameter \tcode{T}
of the overloads in namespace \tcode{std}.
\pnum
@@ -8170,7 +8024,8 @@
\indexlibrary{\idxcode{minmax}}%
\begin{itemdecl}
-template constexpr pair minmax(const T& a, const T& b);
+template
+ constexpr pair minmax(const T& a, const T& b);
template
constexpr pair minmax(const T& a, const T& b, Compare comp);
@@ -8191,13 +8046,13 @@
\pnum
\returns
-\tcode{\{(b, a)\}} if \tcode{b} is smaller than \tcode{a}, and
+\tcode{\{b, a\}} if \tcode{b} is smaller than \tcode{a}, and
\tcode{\{a, b\}} otherwise.
\pnum
\remarks
-An invocation may explicitly specify an argument
-for the template parameter \tcode{T}
+An invocation may explicitly specify
+an argument for the template parameter \tcode{T}
of the overloads in namespace \tcode{std}.
\pnum
@@ -8235,20 +8090,22 @@
\pnum
\returns
-Let \tcode{X} be the return type. Returns
-\tcode{X{x, y}}, where \tcode{x} is a copy of the leftmost element with
-the smallest and \tcode{y} a copy of the rightmost element with the
-largest value in the input range.
+Let \tcode{X} be the return type.
+Returns \tcode{X{x, y}},
+where \tcode{x} is a copy of the leftmost element with the smallest and
+\tcode{y} a copy of the rightmost element with the largest value
+in the input range.
\pnum
\remarks
-An invocation may explicitly specify an argument
-for the template parameter \tcode{T}
+An invocation may explicitly specify
+an argument for the template parameter \tcode{T}
of the overloads in namespace \tcode{std}.
\pnum
\complexity
-At most $(3/2)\tcode{ranges::distance(r)}$ applications of the corresponding predicate
+At most $(3/2)\tcode{ranges::distance(r)}$ applications
+of the corresponding predicate
and twice as many applications of the projection, if any.
\end{itemdescr}
@@ -8288,28 +8145,18 @@
\pnum
\returns
-The first iterator
-\tcode{i}
-in the range
-\range{first}{last}
-such that for every iterator
-\tcode{j}
-in the range
-\range{first}{last},
+The first iterator \tcode{i} in the range \range{first}{last}
+such that for every iterator \tcode{j} in the range \range{first}{last},
\begin{codeblock}
bool(invoke(comp, invoke(proj, *j), invoke(proj, *i)))
\end{codeblock}
is \tcode{false}.
-Returns
-\tcode{last}
-if
-\tcode{first == last}.
+Returns \tcode{last} if \tcode{first == last}.
\pnum
\complexity
-Exactly
-$\max(\tcode{last - first - 1}, 0)$
-comparisons and twice as many projections.
+Exactly $\max(\tcode{last - first - 1}, 0)$ comparisons and
+twice as many projections.
\end{itemdescr}
\indexlibrary{\idxcode{max_element}}%
@@ -8347,28 +8194,18 @@
\pnum
\returns
-The first iterator
-\tcode{i}
-in the range
-\range{first}{last}
-such that for every iterator
-\tcode{j}
-in the range
-\range{first}{last},
+The first iterator \tcode{i} in the range \range{first}{last}
+such that for every iterator \tcode{j} in the range \range{first}{last},
\begin{codeblock}
bool(invoke(comp, invoke(proj, *i), invoke(proj, *j)))
\end{codeblock}
is \tcode{false}.
-Returns
-\tcode{last}
-if
-\tcode{first == last}.
+Returns \tcode{last} if \tcode{first == last}.
\pnum
\complexity
-Exactly
-$\max(\tcode{last - first - 1}, 0)$
-comparisons and twice as many projections.
+Exactly $\max(\tcode{last - first - 1}, 0)$ comparisons and
+twice as many projections.
\end{itemdescr}
\indexlibrary{\idxcode{minmax_element}}%
@@ -8415,9 +8252,8 @@
\pnum
\complexity
Let $N$ be \tcode{last - first}.
-At most
-$\max(\bigl\lfloor{\frac{3}{2}} (N-1)\bigr\rfloor, 0)$
-comparisons and twice as many applications of the projection, if any.
+At most $\max(\bigl\lfloor{\frac{3}{2}} (N-1)\bigr\rfloor, 0)$ comparisons and
+twice as many applications of the projection, if any.
\end{itemdescr}
\rSec2[alg.clamp]{Bounded value}
@@ -8501,28 +8337,26 @@
\begin{itemdescr}
\pnum
\returns
-\tcode{true}
-if and only if the sequence of elements defined by the range
-\range{first1}{last1}
-is lexicographically less than the sequence of elements defined by the range
-\range{first2}{last2}.
+\tcode{true} if and only if
+the sequence of elements defined by the range \range{first1}{last1}
+is lexicographically less than
+the sequence of elements defined by the range \range{first2}{last2}.
\pnum
\complexity
-At most
-$2 \min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$
-applications of the corresponding comparison and each projection, if any.
+At most $2 \min(\tcode{last1 - first1}, \ \tcode{last2 - first2})$ applications
+of the corresponding comparison and each projection, if any.
\pnum
\remarks
-If two sequences have the same number of elements and their corresponding
-elements (if any) are equivalent, then neither sequence is lexicographically
-less than the other.
-If one sequence is a proper prefix of the other, then the shorter sequence is
-lexicographically less than the longer sequence.
-Otherwise, the lexicographical comparison of the sequences yields the same
-result as the comparison of the first corresponding pair of
-elements that are not equivalent.
+If two sequences have the same number of elements and
+their corresponding elements (if any) are equivalent,
+then neither sequence is lexicographically less than the other.
+If one sequence is a proper prefix of the other,
+then the shorter sequence is lexicographically less than the longer sequence.
+Otherwise, the lexicographical comparison of the sequences yields
+the same result as the comparison
+of the first corresponding pair of elements that are not equivalent.
\pnum
\begin{example}
@@ -8538,10 +8372,10 @@
\end{example}
\pnum
-\begin{note} An empty sequence is lexicographically less than any non-empty sequence, but
-not less than any empty sequence.
+\begin{note}
+An empty sequence is lexicographically less than any non-empty sequence,
+but not less than any empty sequence.
\end{note}
-
\end{itemdescr}
\rSec2[alg.3way]{Three-way comparison algorithms}
@@ -8554,27 +8388,26 @@
\begin{itemdescr}
\pnum
\effects
-Compares two values and produces a result of the strongest applicable
-comparison category type:
+Compares two values and produces a result
+of the strongest applicable comparison category type:
\begin{itemize}
\item
-Returns \tcode{a <=> b} if that expression is well-formed.
+ Returns \tcode{a <=> b} if that expression is well-formed.
\item
-Otherwise, if the expressions \tcode{a == b} and \tcode{a < b}
-are each well-formed and convertible to \tcode{bool},
-returns \tcode{strong_ordering::equal}
-when \tcode{a == b} is \tcode{true},
-otherwise returns \tcode{strong_ordering::less}
-when \tcode{a < b} is \tcode{true},
-and otherwise returns \tcode{strong_ordering::greater}.
+ Otherwise, if the expressions \tcode{a == b} and \tcode{a < b}
+ are each well-formed and convertible to \tcode{bool},
+ returns \tcode{strong_ordering::equal}
+ when \tcode{a == b} is \tcode{true},
+ otherwise returns \tcode{strong_ordering::less}
+ when \tcode{a < b} is \tcode{true},
+ and otherwise returns \tcode{strong_ordering::greater}.
\item
-Otherwise, if the expression \tcode{a == b}
-is well-formed and convertible to \tcode{bool},
-returns \tcode{strong_equality::equal}
-when \tcode{a == b} is \tcode{true},
-and otherwise returns \tcode{strong_equality::nonequal}.
+ Otherwise, if the expression \tcode{a == b}
+ is well-formed and convertible to \tcode{bool},
+ returns \tcode{strong_equality::equal} when \tcode{a == b} is \tcode{true},
+ and otherwise returns \tcode{strong_equality::nonequal}.
\item
-Otherwise, the function is defined as deleted.
+ Otherwise, the function is defined as deleted.
\end{itemize}
\end{itemdescr}
@@ -8597,8 +8430,7 @@
\pnum
\effects
Lexicographically compares two ranges and
-produces a result of the strongest applicable
-comparison category type.
+produces a result of the strongest applicable comparison category type.
Equivalent to:
\begin{codeblock}
for ( ; b1 != e1 && b2 != e2; void(++b1), void(++b2) )
@@ -8665,16 +8497,15 @@
\pnum
\requires
For the overloads in namespace \tcode{std},
-\tcode{BidirectionalIterator} shall meet the
-\oldconcept{Value\-Swappable} requirements\iref{swappable.requirements}.
+\tcode{BidirectionalIterator} shall meet
+the \oldconcept{Value\-Swappable} requirements\iref{swappable.requirements}.
\pnum
\effects
-Takes a sequence defined by the range
-\range{first}{last}
+Takes a sequence defined by the range \range{first}{last}
and transforms it into the next permutation.
-The next permutation is found by assuming that the set of all permutations is
-lexicographically sorted with respect to \tcode{comp} and \tcode{proj}.
+The next permutation is found by assuming that the set of all permutations
+is lexicographically sorted with respect to \tcode{comp} and \tcode{proj}.
If no such permutation exists,
transforms the sequence into the first permutation;
that is, the ascendingly-sorted one.
@@ -8685,9 +8516,7 @@
\pnum
\complexity
-At most
-\tcode{(last - first) / 2}
-swaps.
+At most \tcode{(last - first) / 2} swaps.
\end{itemdescr}
\indexlibrary{\idxcode{prev_permutation}}%
@@ -8723,16 +8552,15 @@
\pnum
\requires
For the overloads in namespace \tcode{std},
-\tcode{BidirectionalIterator} shall meet the
-\oldconcept{Value\-Swappable} requirements\iref{swappable.requirements}.
+\tcode{BidirectionalIterator} shall meet
+the \oldconcept{Value\-Swappable} requirements\iref{swappable.requirements}.
\pnum
\effects
-Takes a sequence defined by the range
-\range{first}{last}
+Takes a sequence defined by the range \range{first}{last}
and transforms it into the previous permutation.
-The previous permutation is found by assuming that the set of all permutations is
-lexicographically sorted with respect to \tcode{comp} and \tcode{proj}.
+The previous permutation is found by assuming that the set of all permutations
+is lexicographically sorted with respect to \tcode{comp} and \tcode{proj}.
If no such permutation exists,
transforms the sequence into the last permutation;
that is, the descendingly-sorted one.
@@ -8743,9 +8571,7 @@
\pnum
\complexity
-At most
-\tcode{(last - first) / 2}
-swaps.
+At most \tcode{(last - first) / 2} swaps.
\end{itemdescr}
\rSec1[numeric.ops.overview]{Header \tcode{} synopsis}
@@ -8981,15 +8807,16 @@
\pnum
\begin{note}
-The use of closed ranges as well as semi-open ranges to specify requirements
-throughout this subclause is intentional.
+The use of closed ranges as well as semi-open ranges
+to specify requirements throughout this subclause is intentional.
\end{note}
\rSec2[numerics.defns]{Definitions}
\indexlibrary{generalized_noncommutative_sum@\tcode{\placeholder{GENERALIZED_NONCOMMUTATIVE_SUM}}}%
\pnum
-Define \tcode{\placeholdernc{GENERALIZED_NONCOMMUTATIVE_SUM}(op, a1, ..., aN)} as follows:
+Define \tcode{\placeholdernc{GENERALIZED_NONCOMMUTATIVE_SUM}(op, a1, ..., aN)}
+as follows:
\begin{itemize}
\item
\tcode{a1} when \tcode{N} is \tcode{1}, otherwise
@@ -9021,30 +8848,26 @@
\begin{itemdescr}
\pnum
\requires
-\tcode{T} shall satisfy the \oldconcept{CopyConstructible} (\tref{copyconstructible})
+\tcode{T} shall satisfy
+the \oldconcept{CopyConstructible} (\tref{copyconstructible})
and \oldconcept{CopyAssignable} (\tref{copyassignable}) requirements.
-In the range
-\crange{first}{last},
-\tcode{binary_op}
-shall neither modify elements nor invalidate iterators or subranges.\footnote{The use of fully closed ranges is intentional.}
+In the range \crange{first}{last},
+\tcode{binary_op} shall neither modify elements
+nor invalidate iterators or subranges.%
+\footnote{The use of fully closed ranges is intentional.}
\pnum
\effects
-Computes its result by initializing the accumulator
-\tcode{acc}
-with the initial value
-\tcode{init}
+Computes its result by
+initializing the accumulator \tcode{acc} with the initial value \tcode{init}
and then modifies it with
-\tcode{acc = std::move(acc) + *i}
-or
+\tcode{acc = std::move(acc) + *i} or
\tcode{acc = binary_op(std::move(acc), *i)}
-for every iterator
-\tcode{i}
-in the range \range{first}{last}
-in order.\footnote{\tcode{accumulate}
-is similar to the APL reduction operator and Common Lisp reduce function, but
-it avoids the difficulty of defining the result of reduction on an empty
-sequence by always requiring an initial value.}
+for every iterator \tcode{i} in the range \range{first}{last} in order.%
+\footnote{\tcode{accumulate} is similar
+to the APL reduction operator and Common Lisp reduce function,
+but it avoids the difficulty of defining the result of reduction
+on an empty sequence by always requiring an initial value.}
\end{itemdescr}
\rSec2[reduce]{Reduce}
@@ -9128,17 +8951,21 @@
\pnum
\requires
\begin{itemize}
-\item \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
-\item All of \tcode{binary_op(init, *first)}, \tcode{binary_op(*first, init)},
-\tcode{binary_op(init, init)}, and \tcode{binary_op(*first, *first)} shall be
-convertible to \tcode{T}.
-\item \tcode{binary_op} shall neither invalidate iterators or subranges, nor modify
-elements in the range \crange{first}{last}.
+\item
+ \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
+\item
+ All of \tcode{binary_op(init, *first)}, \tcode{binary_op(*first, init)},
+ \tcode{binary_op(init, init)}, and \tcode{binary_op(*first, *first)}
+ shall be convertible to \tcode{T}.
+\item
+ \tcode{binary_op} shall neither invalidate iterators or subranges,
+ nor modify elements in the range \crange{first}{last}.
\end{itemize}
\pnum
\returns
-\tcode{\placeholdernc{GENERALIZED_SUM}(binary_op, init, *i, ...)} for every \tcode{i} in \range{first}{last}.
+\tcode{\placeholdernc{GENERALIZED_SUM}(binary_op, init, *i, ...)}
+for every \tcode{i} in \range{first}{last}.
\pnum
\complexity
@@ -9147,9 +8974,10 @@
\pnum
\begin{note}
The difference between \tcode{reduce} and \tcode{accumulate} is that
-\tcode{reduce} applies \tcode{binary_op} in an unspecified order, which yields
-a nondeterministic result for non-associative or non-commutative
-\tcode{binary_op} such as floating-point addition.
+\tcode{reduce} applies \tcode{binary_op} in an unspecified order,
+which yields a nondeterministic result
+for non-associative or non-commutative \tcode{binary_op}
+such as floating-point addition.
\end{note}
\end{itemdescr}
@@ -9171,34 +8999,24 @@
\begin{itemdescr}
\pnum
\requires
-\tcode{T} shall satisfy the \oldconcept{CopyConstructible} (\tref{copyconstructible})
+\tcode{T} shall satisfy
+the \oldconcept{CopyConstructible} (\tref{copyconstructible})
and \oldconcept{CopyAssignable} (\tref{copyassignable}) requirements.
-In the ranges
-\crange{first1}{last1}
-and
+In the ranges \crange{first1}{last1} and
\crange{first2}{first2 + (last1 - first1)}
-\tcode{binary_op1}
-and
-\tcode{binary_op2}
-shall neither modify elements nor invalidate iterators or subranges.\footnote{The use of fully closed ranges is intentional.}
+\tcode{binary_op1} and \tcode{binary_op2}
+shall neither modify elements nor invalidate iterators or subranges.%
+\footnote{The use of fully closed ranges is intentional.}
\pnum
\effects
-Computes its result by initializing the accumulator
-\tcode{acc}
-with the initial value
-\tcode{init}
+Computes its result by
+initializing the accumulator \tcode{acc} with the initial value \tcode{init}
and then modifying it with
-\tcode{acc = std::move(acc) + (*i1) * (*i2)}
-or
+\tcode{acc = std::move(acc) + (*i1) * (*i2)} or
\tcode{acc = binary_op1(std::move(acc), binary_op2(*i1, *i2))}
-for every iterator
-\tcode{i1}
-in the range \range{first1}{last1}
-and iterator
-\tcode{i2}
-in the range
-\range{first2}{first2 + (last1 - first1)}
+for every iterator \tcode{i1} in the range \range{first1}{last1}
+and iterator \tcode{i2} in the range \range{first2}{first2 + (last1 - first1)}
in order.
\end{itemdescr}
@@ -9213,7 +9031,8 @@
\begin{itemdescr}
\pnum
-\effects Equivalent to:
+\effects
+Equivalent to:
\begin{codeblock}
return transform_reduce(first1, last1, first2, init, plus<>(), multiplies<>());
\end{codeblock}
@@ -9231,7 +9050,8 @@
\begin{itemdescr}
\pnum
-\effects Equivalent to:
+\effects
+Equivalent to:
\begin{codeblock}
return transform_reduce(std::forward(exec),
first1, last1, first2, init, plus<>(), multiplies<>());
@@ -9262,18 +9082,21 @@
\pnum
\requires
\begin{itemize}
-\item \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
-\item All of
-\begin{itemize}
-\item \tcode{binary_op1(init, init)},
-\item \tcode{binary_op1(init, binary_op2(*first1, *first2))},
-\item \tcode{binary_op1(binary_op2(*first1, *first2), init)}, and
-\item \tcode{binary_op1(binary_op2(*first1, *first2), binary_op2(*first1, *first2))}
-\end{itemize}
-shall be convertible to \tcode{T}.
-\item Neither \tcode{binary_op1} nor \tcode{binary_op2} shall invalidate
-subranges, or modify elements in the ranges \crange{first1}{last1} and
-\crange{first2}{first2 + (last1 - first1)}.
+\item
+ \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
+\item
+ All of
+ \begin{itemize}
+ \item \tcode{binary_op1(init, init)},
+ \item \tcode{binary_op1(init, binary_op2(*first1, *first2))},
+ \item \tcode{binary_op1(binary_op2(*first1, *first2), init)}, and
+ \item \tcode{binary_op1(binary_op2(*first1, *first2), binary_op2(*first1, *first2))}
+ \end{itemize}
+ shall be convertible to \tcode{T}.
+\item
+ Neither \tcode{binary_op1} nor \tcode{binary_op2}
+ shall invalidate subranges, or modify elements in the ranges
+ \crange{first1}{last1} and \crange{first2}{first2 + (last1 - first1)}.
\end{itemize}
\pnum
@@ -9284,8 +9107,9 @@
for every iterator \tcode{i} in \range{first1}{last1}.
\pnum
-\complexity \bigoh{\tcode{last1 - first1}} applications each of \tcode{binary_op1} and
-\tcode{binary_op2}.
+\complexity
+\bigoh{\tcode{last1 - first1}} applications each
+of \tcode{binary_op1} and \tcode{binary_op2}.
\end{itemdescr}
\indexlibrary{\idxcode{transform_reduce}}%
@@ -9306,17 +9130,20 @@
\pnum
\requires
\begin{itemize}
-\item \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
-\item All of
-\begin{itemize}
-\item \tcode{binary_op(init, init)},
-\item \tcode{binary_op(init, unary_op(*first))},
-\item \tcode{binary_op(unary_op(*first), init)}, and
-\item \tcode{binary_op(unary_op(*first), unary_op(*first))}
-\end{itemize}
-shall be convertible to \tcode{T}.
-\item Neither \tcode{unary_op} nor \tcode{binary_op} shall invalidate subranges,
-or modify elements in the range \crange{first}{last}.
+\item
+ \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
+\item
+ All of
+ \begin{itemize}
+ \item \tcode{binary_op(init, init)},
+ \item \tcode{binary_op(init, unary_op(*first))},
+ \item \tcode{binary_op(unary_op(*first), init)}, and
+ \item \tcode{binary_op(unary_op(*first), unary_op(*first))}
+ \end{itemize}
+ shall be convertible to \tcode{T}.
+\item
+ Neither \tcode{unary_op} nor \tcode{binary_op} shall invalidate subranges,
+ or modify elements in the range \crange{first}{last}.
\end{itemize}
\pnum
@@ -9354,24 +9181,28 @@
\begin{itemdescr}
\pnum
\requires
-\tcode{InputIterator}'s value type shall be constructible from the type of \tcode{*first}.
-The result of the expression \tcode{std::move(acc) + *i} or \tcode{binary_op(std::move(acc), *i)} shall be
-implicitly convertible to \tcode{InputIterator}'s value type. \tcode{acc}
-shall be writable\iref{iterator.requirements.general} to the \tcode{result} output iterator.
-In the ranges
-\crange{first}{last}
-and
-\crange{result}{result + (last - first)}
-\tcode{binary_op}
-shall neither modify elements nor invalidate iterators or subranges.\footnote{The use of fully closed ranges is intentional.
-}
+\tcode{InputIterator}'s value type shall be constructible
+from the type of \tcode{*first}.
+The result of the
+expression \tcode{std::move(acc) + *i} or \tcode{binary_op(std::move(acc), *i)}
+shall be implicitly convertible to \tcode{InputIterator}'s value type.
+\tcode{acc} shall be writable\iref{iterator.requirements.general} to
+the \tcode{result} output iterator.
+In the ranges \crange{first}{last} and \crange{result}{result + (last - first)}
+\tcode{binary_op} shall neither modify elements
+nor invalidate iterators or subranges.%
+\footnote{The use of fully closed ranges is intentional.}
\pnum
-\effects For a non-empty range,
-the function creates an accumulator \tcode{acc} whose type is \tcode{InputIterator}'s
-value type, initializes it with \tcode{*first},
-and assigns the result to \tcode{*result}. For every iterator \tcode{i} in \range{first + 1}{last}
-in order, \tcode{acc} is then modified by \tcode{acc = std::move(acc) + *i} or \tcode{acc = binary_op(std::move(acc), *i)}
+\effects
+For a non-empty range,
+the function creates an accumulator \tcode{acc}
+whose type is \tcode{InputIterator}'s value type,
+initializes it with \tcode{*first},
+and assigns the result to \tcode{*result}.
+For every iterator \tcode{i} in \range{first + 1}{last} in order,
+\tcode{acc} is then modified by
+\tcode{acc = std::move(acc) + *i} or \tcode{acc = binary_op(std::move(acc), *i)}
and the result is assigned to \tcode{*(result + (i - first))}.
\pnum
@@ -9380,16 +9211,11 @@
\pnum
\complexity
-Exactly
-\tcode{(last - first) - 1}
-applications of
-the binary operation.
+Exactly \tcode{(last - first) - 1} applications of the binary operation.
\pnum
\remarks
-\tcode{result}
-may be equal to
-\tcode{first}.
+\tcode{result} may be equal to \tcode{first}.
\end{itemdescr}
\rSec2[exclusive.scan]{Exclusive scan}
@@ -9426,7 +9252,6 @@
\end{codeblock}
\end{itemdescr}
-
\indexlibrary{\idxcode{exclusive_scan}}%
\begin{itemdecl}
template
@@ -9443,11 +9268,18 @@
\pnum
\requires
\begin{itemize}
-\item \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
-\item All of \tcode{binary_op(init, init)}, \tcode{binary_op(init, *first)},
-and \tcode{binary_op(*first, *first)} shall be convertible to \tcode{T}.
-\item \tcode{binary_op} shall neither invalidate iterators or subranges, nor modify
-elements in the ranges \crange{first}{last} or \crange{result}{result + (last - first)}.
+\item
+ \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
+\item
+ All of
+ \tcode{binary_op(init, init)},
+ \tcode{binary_op(init, *first)},
+ and \tcode{binary_op(*first, *first)}
+ shall be convertible to \tcode{T}.
+\item
+ \tcode{binary_op} shall neither invalidate iterators or subranges,
+ nor modify elements in
+ the ranges \crange{first}{last} or \crange{result}{result + (last - first)}.
\end{itemize}
\pnum
@@ -9474,9 +9306,10 @@
\pnum
\begin{note}
The difference between \tcode{exclusive_scan} and \tcode{inclusive_scan} is
-that \tcode{exclusive_scan} excludes the $i^\text{th}$ input element from the
-$i^\text{th}$ sum. If \tcode{binary_op} is not mathematically associative, the
-behavior of \tcode{exclusive_scan} may be nondeterministic.
+that \tcode{exclusive_scan} excludes the $i^\text{th}$ input element
+from the $i^\text{th}$ sum.
+If \tcode{binary_op} is not mathematically associative,
+the behavior of \tcode{exclusive_scan} may be nondeterministic.
\end{note}
\end{itemdescr}
@@ -9512,7 +9345,6 @@
\end{codeblock}
\end{itemdescr}
-
\indexlibrary{\idxcode{inclusive_scan}}%
\begin{itemdecl}
template
@@ -9538,18 +9370,23 @@
\pnum
\requires
\begin{itemize}
-\item If \tcode{init} is provided, \tcode{T} shall be \oldconcept{MoveConstructible}
-(\tref{moveconstructible}); otherwise, \tcode{ForwardIterator1}'s value
-type shall be \oldconcept{MoveConstructible}.
-
-\item If \tcode{init} is provided, all of \tcode{binary_op(init, init)},
-\tcode{binary_op(init, *first)}, and \tcode{binary_op(*first, *first)} shall be
-convertible to \tcode{T}; otherwise, \tcode{binary_op(*first, *first)} shall be
-convertible to \tcode{ForwardIterator1}'s value type.
-
-\item \tcode{binary_op} shall neither invalidate iterators or subranges, nor
-modify elements in the ranges \crange{first}{last} or
-\crange{result}{result + (last - first)}.
+\item
+ If \tcode{init} is provided,
+ \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible});
+ otherwise, \tcode{ForwardIterator1}'s value type
+ shall be \oldconcept{MoveConstructible}.
+\item
+ If \tcode{init} is provided, all of
+ \tcode{binary_op(init, init)},
+ \tcode{binary_op(init, *first)}, and
+ \tcode{binary_op(*first, *first)}
+ shall be convertible to \tcode{T};
+ otherwise, \tcode{binary_op(*first, *first)}
+ shall be convertible to \tcode{ForwardIterator1}'s value type.
+\item
+ \tcode{binary_op} shall neither invalidate iterators or subranges,
+ nor modify elements in
+ the ranges \crange{first}{last} or \crange{result}{result + (last - first)}.
\end{itemize}
\pnum
@@ -9580,9 +9417,10 @@
\pnum
\begin{note}
The difference between \tcode{exclusive_scan} and \tcode{inclusive_scan} is
-that \tcode{inclusive_scan} includes the $i^\text{th}$ input element in the
-$i^\text{th}$ sum. If \tcode{binary_op} is not mathematically associative, the
-behavior of \tcode{inclusive_scan} may be nondeterministic.
+that \tcode{inclusive_scan} includes the $i^\text{th}$ input element
+in the $i^\text{th}$ sum.
+If \tcode{binary_op} is not mathematically associative,
+the behavior of \tcode{inclusive_scan} may be nondeterministic.
\end{note}
\end{itemdescr}
@@ -9608,18 +9446,20 @@
\pnum
\requires
\begin{itemize}
-\item \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
-\item All of
-\begin{itemize}
-\item \tcode{binary_op(init, init)},
-\item \tcode{binary_op(init, unary_op(*first))}, and
-\item \tcode{binary_op(unary_op(*first), unary_op(*first))}
-\end{itemize}
-shall be convertible to \tcode{T}.
-\item Neither \tcode{unary_op} nor \tcode{binary_op} shall invalidate iterators or
-subranges, or modify elements in the ranges
-\crange{first}{last} or
-\crange{result}{result + (last - first)}.
+\item
+ \tcode{T} shall be \oldconcept{MoveConstructible} (\tref{moveconstructible}).
+\item
+ All of
+ \begin{itemize}
+ \item \tcode{binary_op(init, init)},
+ \item \tcode{binary_op(init, unary_op(*first))}, and
+ \item \tcode{binary_op(unary_op(*first), unary_op(*first))}
+ \end{itemize}
+ shall be convertible to \tcode{T}.
+\item
+ Neither \tcode{unary_op} nor \tcode{binary_op} shall
+ invalidate iterators or subranges, or modify elements in
+ the ranges \crange{first}{last} or \crange{result}{result + (last - first)}.
\end{itemize}
\pnum
@@ -9638,8 +9478,8 @@
\pnum
\complexity
-\bigoh{\tcode{last - first}} applications each of \tcode{unary_op} and
-\tcode{binary_op}.
+\bigoh{\tcode{last - first}} applications each
+of \tcode{unary_op} and \tcode{binary_op}.
\pnum
\remarks
@@ -9649,10 +9489,11 @@
\begin{note}
The difference between \tcode{transform_exclusive_scan} and
\tcode{transform_inclusive_scan} is that \tcode{transform_exclusive_scan}
-excludes the $i^\text{th}$ input element from the $i^\text{th}$ sum. If \tcode{binary_op} is not
-mathematically associative, the behavior of \tcode{transform_exclusive_scan}
-may be nondeterministic. \tcode{transform_exclusive_scan} does not apply
-\tcode{unary_op} to \tcode{init}.
+excludes the $i^\text{th}$ input element from the $i^\text{th}$ sum.
+If \tcode{binary_op} is not mathematically associative,
+the behavior of \tcode{transform_exclusive_scan} may be nondeterministic.
+\tcode{transform_exclusive_scan}
+does not apply \tcode{unary_op} to \tcode{init}.
\end{note}
\end{itemdescr}
@@ -9692,23 +9533,25 @@
\pnum
\requires
\begin{itemize}
-\item If \tcode{init} is provided, \tcode{T} shall be \oldconcept{MoveConstructible}
-(\tref{moveconstructible}); otherwise, \tcode{ForwardIterator1}'s value
-type shall be \oldconcept{MoveConstructible}.
-
-\item If \tcode{init} is provided, all of
-\begin{itemize}
-\item \tcode{binary_op(init, init)},
-\item \tcode{binary_op(init, unary_op(*first))}, and
-\item \tcode{binary_op(unary_op(*first), unary_op(*first))}
-\end{itemize}
-shall be convertible to
-\tcode{T}; otherwise, \tcode{binary_op(unary_op(*first), unary_op(*first))}
-shall be convertible to \tcode{ForwardIterator1}'s value type.
-
-\item Neither \tcode{unary_op} nor \tcode{binary_op} shall invalidate iterators
-or subranges, nor modify elements in the ranges \crange{first}{last} or
-\crange{result}{result + (last - first)}.
+\item
+ If \tcode{init} is provided, \tcode{T} shall be
+ \oldconcept{MoveConstructible} (\tref{moveconstructible});
+ otherwise, \tcode{ForwardIterator1}'s value type shall be
+ \oldconcept{MoveConstructible}.
+\item
+ If \tcode{init} is provided, all of
+ \begin{itemize}
+ \item \tcode{binary_op(init, init)},
+ \item \tcode{binary_op(init, unary_op(*first))}, and
+ \item \tcode{binary_op(unary_op(*first), unary_op(*first))}
+ \end{itemize}
+ shall be convertible to \tcode{T};
+ otherwise, \tcode{binary_op(unary_op(*first), unary_op(*first))}
+ shall be convertible to \tcode{ForwardIterator1}'s value type.
+\item
+ Neither \tcode{unary_op} nor \tcode{binary_op} shall
+ invalidate iterators or subranges, nor modify elements in
+ the ranges \crange{first}{last} or \crange{result}{result + (last - first)}.
\end{itemize}
\pnum
@@ -9730,8 +9573,8 @@
\pnum
\complexity
-\bigoh{\tcode{last - first}} applications each of \tcode{unary_op} and
-\tcode{binary_op}.
+\bigoh{\tcode{last - first}} applications each
+of \tcode{unary_op} and \tcode{binary_op}.
\pnum
\remarks
@@ -9741,10 +9584,11 @@
\begin{note}
The difference between \tcode{transform_exclusive_scan} and
\tcode{transform_inclusive_scan} is that \tcode{transform_inclusive_scan}
-includes the $i^\text{th}$ input element in the $i^\text{th}$ sum. If \tcode{binary_op} is not
-mathematically associative, the behavior of \tcode{transform_inclusive_scan}
-may be nondeterministic. \tcode{transform_inclusive_scan} does not apply
-\tcode{unary_op} to \tcode{init}.
+includes the $i^\text{th}$ input element in the $i^\text{th}$ sum.
+If \tcode{binary_op} is not mathematically associative,
+the behavior of \tcode{transform_inclusive_scan} may be nondeterministic.
+\tcode{transform_inclusive_scan} does not
+apply \tcode{unary_op} to \tcode{init}.
\end{note}
\end{itemdescr}
@@ -9783,36 +9627,38 @@
\requires
\begin{itemize}
\item
-For the overloads with no \tcode{ExecutionPolicy},
-\tcode{T} shall be \oldconcept{MoveAssignable} (\tref{moveassignable}) and shall
-be constructible from the type of \tcode{*first}. \tcode{acc} (defined below)
-shall be writable\iref{iterator.requirements.general} to the \tcode{result}
-output iterator. The result of the expression
-\tcode{binary_op(val, std::move(acc))} shall be writable to the \tcode{result} output iterator.
-
+ For the overloads with no \tcode{ExecutionPolicy},
+ \tcode{T} shall be \oldconcept{MoveAssignable} (\tref{moveassignable}) and
+ shall be constructible from the type of \tcode{*first}.
+ \tcode{acc} (defined below) shall be
+ writable\iref{iterator.requirements.general}
+ to the \tcode{result} output iterator.
+ The result of the expression \tcode{binary_op(val, std::move(acc))}
+ shall be writable to the \tcode{result} output iterator.
\item
-For the overloads with an \tcode{ExecutionPolicy},
-the result of the expressions \tcode{binary_op(*first, *first)} and
-\tcode{*first} shall be writable to \tcode{result}.
-
+ For the overloads with an \tcode{ExecutionPolicy},
+ the result of the expressions \tcode{binary_op(*first, *first)} and
+ \tcode{*first} shall be writable to \tcode{result}.
\item
-For all overloads, in the ranges
-\crange{first}{last}
-and
-\crange{result}{result + (last - first)},
-\tcode{binary_op}
-shall neither modify elements nor invalidate iterators or
-subranges.\footnote{The use of fully closed ranges is intentional.}
+ For all overloads, in the ranges \crange{first}{last}
+ and \crange{result}{result + (last - first)},
+ \tcode{binary_op} shall neither modify elements
+ nor invalidate iterators or subranges.%
+ \footnote{The use of fully closed ranges is intentional.}
\end{itemize}
\pnum
-\effects For the overloads with no \tcode{ExecutionPolicy} and a non-empty range,
+\effects
+For the overloads with no \tcode{ExecutionPolicy} and a non-empty range,
the function creates an accumulator \tcode{acc} of type \tcode{T},
initializes it with \tcode{*first},
-and assigns the result to \tcode{*result}. For every iterator \tcode{i} in \range{first + 1}{last}
-in order, creates an object \tcode{val} whose type is \tcode{T}, initializes it
-with \tcode{*i}, computes \tcode{binary_op(val, std::move(acc))}, assigns the result
-to \tcode{*(result + (i - first))}, and move assigns from \tcode{val} to \tcode{acc}.
+and assigns the result to \tcode{*result}.
+For every iterator \tcode{i} in \range{first + 1}{last} in order,
+creates an object \tcode{val} whose type is \tcode{T},
+initializes it with \tcode{*i},
+computes \tcode{binary_op(val, std::move(acc))},
+assigns the result to \tcode{*(result + (i - first))}, and
+move assigns from \tcode{val} to \tcode{acc}.
\pnum
For the overloads with an \tcode{ExecutionPolicy} and a non-empty range,
@@ -9826,16 +9672,15 @@
\pnum
\complexity
-Exactly
-\tcode{(last - first) - 1}
-applications of
-the binary operation.
+Exactly \tcode{(last - first) - 1} applications of the binary operation.
\pnum
\remarks
-For the overloads with no \tcode{ExecutionPolicy}, \tcode{result} may be equal
-to \tcode{first}. For the overloads with an \tcode{ExecutionPolicy}, the ranges
-\range{first}{last} and \range{result}{result + (last - first)} shall not overlap.
+For the overloads with no \tcode{ExecutionPolicy},
+\tcode{result} may be equal to \tcode{first}.
+For the overloads with an \tcode{ExecutionPolicy},
+the ranges \range{first}{last} and \range{result}{result + (last - first)}
+shall not overlap.
\end{itemdescr}
\rSec2[numeric.iota]{Iota}
@@ -9848,17 +9693,21 @@
\begin{itemdescr}
\pnum
-\requires \tcode{T} shall be convertible to \tcode{ForwardIterator}'s value
-type. The expression \tcode{++val}, where \tcode{val} has type \tcode{T}, shall
-be well-formed.
+\requires
+\tcode{T} shall be convertible to \tcode{ForwardIterator}'s value type.
+The expression \tcode{++val}, where \tcode{val} has type \tcode{T},
+shall be well-formed.
\pnum
-\effects For each element referred to by the iterator \tcode{i} in the range
-\range{first}{last}, assigns \tcode{*i = value} and increments \tcode{value} as
-if by \tcode{++value}.
+\effects
+For each element referred to by the iterator \tcode{i}
+in the range \range{first}{last},
+assigns \tcode{*i = value} and increments \tcode{value}
+as if by \tcode{++value}.
\pnum
-\complexity Exactly \tcode{last - first} increments and assignments.
+\complexity
+Exactly \tcode{last - first} increments and assignments.
\end{itemdescr}
\rSec2[numeric.ops.gcd]{Greatest common divisor}
@@ -9872,10 +9721,13 @@
\begin{itemdescr}
\pnum
\requires
-$|\tcode{m}|$ and $|\tcode{n}|$ shall
-be representable as a value of \tcode{common_type_t}.
-\begin{note} These requirements ensure, for example,
-that $\tcode{gcd(m, m)} = |\tcode{m}|$ is representable as a value of type \tcode{M}. \end{note}
+$|\tcode{m}|$ and $|\tcode{n}|$
+shall be representable as a value of \tcode{common_type_t}.
+\begin{note}
+These requirements ensure, for example,
+that $\tcode{gcd(m, m)} = |\tcode{m}|$
+is representable as a value of type \tcode{M}.
+\end{note}
\pnum
\remarks
@@ -9884,8 +9736,8 @@
\pnum
\returns
-Zero when \tcode{m} and \tcode{n} are both zero.
-Otherwise, returns the greatest common divisor of $|\tcode{m}|$ and $|\tcode{n}|$.
+Zero when \tcode{m} and \tcode{n} are both zero. Otherwise,
+returns the greatest common divisor of $|\tcode{m}|$ and $|\tcode{n}|$.
\pnum
\throws
@@ -9903,8 +9755,8 @@
\begin{itemdescr}
\pnum
\requires
-$|\tcode{m}|$ and $|\tcode{n}|$ shall
-be representable as a value of \tcode{common_type_t}.
+$|\tcode{m}|$ and $|\tcode{n}|$
+shall be representable as a value of \tcode{common_type_t}.
The least common multiple of $|\tcode{m}|$ and $|\tcode{n}|$
shall be representable as a value of type \tcode{common_type_t}.
@@ -9951,8 +9803,7 @@
\pnum
\remarks
The behavior is undefined
-unless the objects in the array pointed to by \tcode{base}
-are of trivial type.
+unless the objects in the array pointed to by \tcode{base} are of trivial type.
\pnum
\throws
diff --git a/source/basic.tex b/source/basic.tex
index b6ff96acde..af3c0804d0 100644
--- a/source/basic.tex
+++ b/source/basic.tex
@@ -1209,8 +1209,8 @@
declaration used further in expression processing\iref{expr}.
\pnum
-A name ``looked up in the context of an expression'' is looked up as an
-unqualified name in the scope where the expression is found.
+A name ``looked up in the context of an expression'' is looked up
+in the scope where the expression is found.
\pnum
The injected-class-name of a class\iref{class} is also
@@ -2209,15 +2209,17 @@
followed by a \tcode{<}, the identifier must be looked up to determine
whether the \tcode{<} is the beginning of a template argument
list\iref{temp.names} or a less-than operator. The identifier is first
-looked up in the class of the object expression. If the identifier is
-not found, it is then looked up in the context of the entire
+looked up in the class of the object expression\iref{class.member.lookup}.
+If the identifier is not found,
+it is then looked up in the context of the entire
\grammarterm{postfix-expression} and shall name a class template.
\pnum
If the \grammarterm{id-expression} in a class member
access\iref{expr.ref} is an \grammarterm{unqualified-id}, and the type of
the object expression is of a class type \tcode{C}, the
-\grammarterm{unqualified-id} is looked up in the scope of class \tcode{C}.
+\grammarterm{unqualified-id} is looked up
+in the scope of class \tcode{C}\iref{class.member.lookup}.
\pnum
If the \grammarterm{unqualified-id} is \tcode{\~}\grammarterm{type-name}, the
@@ -2248,7 +2250,8 @@
\end{codeblock}
the \tcode{\placeholder{class-name-or-namespace-name}} following the \tcode{.} or
\tcode{->} operator is
-first looked up in the class of the object expression and the name, if found,
+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
describes the lookup of a name before \tcode{::}, which will only find a type
@@ -2271,7 +2274,9 @@
\pnum
If the \grammarterm{id-expression} is a \grammarterm{conversion-function-id},
its \grammarterm{conversion-type-id}
-is first looked up in the class of the object expression and the name, if
+is 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}.
In each of these lookups, only names that denote types or templates whose
@@ -2826,7 +2831,7 @@
\end{note}%
\indextext{object model|)}
-\rSec2[basic.life]{Object lifetime}
+\rSec2[basic.life]{Object and reference lifetime}
\pnum
\indextext{object lifetime|(}%
@@ -2855,8 +2860,9 @@
\end{itemize}
\pnum
+\indextext{reference lifetime}%
The lifetime of a reference begins when its initialization is complete.
-The lifetime of a reference ends as if it were a scalar object.
+The lifetime of a reference ends as if it were a scalar object requiring storage.
\pnum
\begin{note} \ref{class.base.init}
@@ -3084,6 +3090,76 @@
thread without adequate synchronization. \end{note}%
\indextext{object lifetime|)}
+\rSec2[basic.indet]{Indeterminate values}
+
+\pnum
+\indextext{value!indeterminate}%
+\indextext{indeterminate value}%
+When storage for an object with automatic or dynamic storage duration
+is obtained, the object has an \defnadj{indeterminate}{value}, and if
+no initialization is performed for the object, that object retains an
+indeterminate value until that value is replaced\iref{expr.ass}.
+\begin{note}
+Objects with static or thread storage duration are zero-initialized,
+see~\ref{basic.start.static}.
+\end{note}
+
+\pnum
+If an indeterminate value is produced by an evaluation,
+the behavior is undefined except in the following cases:
+\begin{itemize}
+\item
+ If an indeterminate value of
+ unsigned ordinary character type\iref{basic.fundamental}
+ or \tcode{std::byte} type\iref{cstddef.syn}
+ is produced by the evaluation of:
+ \begin{itemize}
+ \item
+ the second or third operand of a conditional expression\iref{expr.cond},
+ \item
+ the right operand of a comma expression\iref{expr.comma},
+ \item
+ the operand of a cast or conversion~(\ref{conv.integral},
+ \ref{expr.type.conv}, \ref{expr.static.cast}, \ref{expr.cast})
+ to an unsigned ordinary character type
+ or \tcode{std::byte} type\iref{cstddef.syn}, or
+ \item
+ a discarded-value expression\iref{expr.context},
+ \end{itemize}
+ then the result of the operation is an indeterminate value.
+\item
+ If an indeterminate value of
+ unsigned ordinary character type or \tcode{std::byte} type
+ is produced by the evaluation of
+ the right operand of a simple assignment operator\iref{expr.ass}
+ whose first operand is an lvalue of
+ unsigned ordinary character type or \tcode{std::byte} type,
+ an indeterminate value replaces
+ the value of the object referred to by the left operand.
+\item
+ If an indeterminate value of unsigned ordinary character type
+ is produced by the evaluation of the initialization expression
+ when initializing an object of unsigned ordinary character type,
+ that object is initialized to an indeterminate
+ value.
+\item
+ If an indeterminate value of
+ unsigned ordinary character type or \tcode{std::byte} type
+ is produced by the evaluation of the initialization expression
+ when initializing an object of \tcode{std::byte} type,
+ that object is initialized to an indeterminate value.
+\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}
+ }
+\end{codeblock}
+\end{example}
+
\rSec2[basic.stc]{Storage duration}
\pnum
@@ -3649,7 +3725,7 @@
\item
for certain unevaluated operands~(\ref{expr.typeid}, \ref{expr.sizeof}), and
\item
-when a prvalue appears as a discarded-value expression\iref{expr.prop}.
+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:
diff --git a/source/classes.tex b/source/classes.tex
index 2502e797ad..26432ad745 100644
--- a/source/classes.tex
+++ b/source/classes.tex
@@ -10,7 +10,7 @@
\indextext{\idxcode{\{\}}!class declaration}%
\indextext{\idxcode{\{\}}!class definition}%
\indextext{type!class and}%
-\indextext{object class|seealso{class object}}%
+\indextext{object class|see{class object}}%
A class is a type.
\indextext{name class|see{class name}}%
Its name becomes a \grammarterm{class-name}\iref{class.name} within its
@@ -6796,8 +6796,8 @@
\begin{codeblock}
struct C {
friend std::strong_equality operator<=>(const C&, const C&);
- friend bool operator==(const C& x, const C& y) = default; // OK, returns \tcode{x <=> y == 0}
- bool operator<(const C&) = default; // OK, function is deleted
+ friend bool operator==(const C&, const C&) = default; // OK, returns \tcode{x <=> y == 0}
+ bool operator<(const C&) const = default; // OK, function is deleted
};
\end{codeblock}
\end{example}
diff --git a/source/compatibility.tex b/source/compatibility.tex
index adb1ec3dfa..68745cc68e 100644
--- a/source/compatibility.tex
+++ b/source/compatibility.tex
@@ -249,7 +249,7 @@
\howwide
Common.
-\diffrefs{expr.post.incr}{expr.pre.incr}
+\diffref{expr.post.incr,expr.pre.incr}
\change
Decrement operator is not allowed with \tcode{bool} operand.
\rationale Feature with surprising semantics.
@@ -257,7 +257,7 @@
a \tcode{bool} lvalue (for instance, via the C typedef in \tcode{})
is ill-formed in this International Standard.
-\diffrefs{expr.sizeof}{expr.cast}
+\diffref{expr.sizeof,expr.cast}
\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,
@@ -275,7 +275,7 @@
\howwide
Seldom.
-\diffrefs{expr.cond}{expr.ass}, \ref{expr.comma}
+\diffref{expr.cond,expr.ass,expr.comma}
\indextext{conversion!lvalue-to-rvalue}%
\indextext{rvalue!lvalue conversion to}%
\indextext{lvalue}%
@@ -306,7 +306,7 @@
\rSec2[diff.stat]{\ref{stmt.stmt}: statements}
-\diffrefs{stmt.switch}{stmt.goto}
+\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).
\rationale
Constructors used in initializers may allocate
@@ -423,7 +423,7 @@
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.
@@ -446,7 +446,7 @@
In the following example, the
left-hand column presents valid C;
the right-hand column presents
-equivalent \Cpp{} :
+equivalent \Cpp{}:
\begin{codeblock}
void f(const parm); void f(const int parm);
@@ -986,7 +986,7 @@
\rSec2[diff.cpp03.class]{\ref{class}: classes}
-\diffrefs{class.default.ctor}{class.dtor}, \ref{class.copy.ctor}, \ref{class.copy.assign}
+\diffref{class.default.ctor,class.dtor,class.copy.ctor,class.copy.assign}
\change Implicitly-declared special member functions are defined as deleted
when the implicit definition would have been ill-formed.
\rationale Improves template argument deduction failure.
@@ -1144,8 +1144,7 @@
that interacts with newer \Cpp{} code using regions declared reachable may
have different runtime behavior.
-\diffrefs{refwrap}{arithmetic.operations}, \ref{comparisons},
-\ref{logical.operations}, \ref{bitwise.operations}
+\diffref{refwrap,arithmetic.operations,comparisons,logical.operations,bitwise.operations}
\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
@@ -1206,7 +1205,7 @@
Valid \CppIII{} code that attempts to explicitly instantiate a container using
a user-defined type with no default constructor may fail to compile.
-\diffrefs{sequence.reqmts}{associative.reqmts}
+\diffref{sequence.reqmts,associative.reqmts}
\change Signature changes: from \tcode{void} return types.
\rationale Old signature threw away useful information that may be expensive
to recalculate.
@@ -1223,7 +1222,7 @@
(e.g., code that creates a pointer to member function that points to one
of these functions) will fail to compile with this International Standard.
-\diffrefs{sequence.reqmts}{associative.reqmts}
+\diffref{sequence.reqmts,associative.reqmts}
\change Signature changes: from \tcode{iterator} to \tcode{const_iterator}
parameters.
\rationale Overspecification.
@@ -1244,7 +1243,7 @@
Valid \CppIII{} code that uses these functions may fail to compile with this
International Standard.
-\diffrefs{sequence.reqmts}{associative.reqmts}
+\diffref{sequence.reqmts,associative.reqmts}
\change Signature changes: \tcode{resize}.
\rationale Performance, compatibility with move semantics.
\effect
@@ -1278,7 +1277,7 @@
\rSec2[diff.cpp03.input.output]{\ref{input.output}: input/output library}
-\diffrefs{istream.sentry}{ostream.sentry}, \ref{iostate.flags}
+\diffref{istream.sentry,ostream.sentry,iostate.flags}
\change Specify use of \tcode{explicit} in existing boolean conversion functions.
\rationale Clarify intentions, avoid workarounds.
\effect
@@ -1500,7 +1499,7 @@
\rSec2[diff.cpp14.expr]{\ref{expr}: expressions}
-\diffrefs{expr.post.incr}{expr.pre.incr}
+\diffref{expr.post.incr,expr.pre.incr}
\change
Remove increment operator with \tcode{bool} operand.
\rationale Obsolete feature with occasionally surprising semantics.
@@ -1509,7 +1508,7 @@
Note that this might occur when the lvalue has a type given by a template
parameter.
-\diffrefs{expr.new}{expr.delete}
+\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}
@@ -1929,7 +1928,7 @@
\rSec2[diff.cpp17.class]{\ref{class}: classes}
-\diffrefs{class.ctor}{class.conv.fct}
+\diffref{class.ctor,class.conv.fct}
\change
The class name can no longer be used parenthesized
immediately after an \tcode{explicit} \grammarterm{decl-specifier}
@@ -1950,7 +1949,7 @@
};
\end{codeblock}
-\diffrefs{class.ctor}{class.dtor}
+\diffref{class.ctor,class.dtor}
\change
A \grammarterm{simple-template-id}
is no longer valid as the \grammarterm{declarator-id} of a constructor or destructor.
@@ -2030,6 +2029,7 @@
\tcode{},
\tcode{},
\tcode{},
+\tcode{},
\tcode{},
\tcode{}, and
\tcode{}.
@@ -2067,7 +2067,7 @@
\rSec2[diff.cpp17.containers]{\ref{containers}: containers library}
-\diffrefs{forwardlist}{list}
+\diffref{forwardlist,list}
\change
Return types of \tcode{remove}, \tcode{remove_if}, and \tcode{unique}
changed from \tcode{void} to \tcode{container::size_type}.
diff --git a/source/config.tex b/source/config.tex
index 174d8ed223..5fa1de17ed 100644
--- a/source/config.tex
+++ b/source/config.tex
@@ -1,8 +1,8 @@
%!TEX root = std.tex
%%--------------------------------------------------
%% Version numbers
-\newcommand{\docno}{N4791}
-\newcommand{\prevdocno}{N4778}
+\newcommand{\docno}{N4800}
+\newcommand{\prevdocno}{N4791}
\newcommand{\cppver}{201703L}
%% Release date
diff --git a/source/containers.tex b/source/containers.tex
index 0c392463a8..79ed5d63c1 100644
--- a/source/containers.tex
+++ b/source/containers.tex
@@ -2929,7 +2929,7 @@
of the \tcode{value_type}, to the predicate returned by \tcode{key_eq()},
and to the hasher returned by \tcode{hash_function()}) is proportional to
$N$ in the average case and to $N^2$ in the worst case, where $N$ is
-a.size(). For \tcode{unordered_multiset} and \tcode{unordered_multimap},
+\tcode{a.size()}. For \tcode{unordered_multiset} and \tcode{unordered_multimap},
the complexity of \tcode{operator==} is proportional to $\sum E_i^2$
in the average case and to $N^2$ in the worst case, where $N$ is \tcode{a.size()},
and $E_i$ is the size of the $i^\text{th}$ equivalent-key group in \tcode{a}.
diff --git a/source/declarations.tex b/source/declarations.tex
index 7a7b78af4b..591d7c5c4d 100644
--- a/source/declarations.tex
+++ b/source/declarations.tex
@@ -613,7 +613,7 @@
\pnum
\indextext{redefinition!\idxcode{typedef}}%
In a given non-class scope, a \tcode{typedef} specifier can be used to
-redefine the name of any type declared in that scope to refer to the
+redeclare the name of any type declared in that scope to refer to the
type to which it already refers.
\begin{example}
@@ -627,7 +627,7 @@
\pnum
In a given class scope, a \tcode{typedef} specifier can be used to
-redefine any \grammarterm{class-name} declared in that scope that is not
+redeclare any \grammarterm{class-name} declared in that scope that is not
also a \grammarterm{typedef-name} to refer to the type to which it already
refers.
\begin{example}
@@ -642,7 +642,7 @@
\end{example}
\pnum
-If a \tcode{typedef} specifier is used to redefine in a given scope an
+If a \tcode{typedef} specifier is used to redeclare in a given scope an
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
@@ -659,7 +659,7 @@
\pnum
In a given scope, a \tcode{typedef} specifier shall not be used to
-redefine the name of any type declared in that scope to refer to a
+redeclare the name of any type declared in that scope to refer to a
different type.
\begin{example}
\begin{codeblock}
@@ -735,8 +735,9 @@
The \tcode{friend} specifier is used to specify access to class members;
see~\ref{class.friend}.
-\rSec2[dcl.constexpr]{The \tcode{constexpr} specifier}%
+\rSec2[dcl.constexpr]{The \tcode{constexpr} and \tcode{consteval} specifiers}%
\indextext{specifier!\idxcode{constexpr}}
+\indextext{specifier!\idxcode{consteval}}
\pnum
The \tcode{constexpr} specifier shall be applied only to
@@ -4280,72 +4281,7 @@
\end{note}
\pnum
-\indextext{value!indeterminate}%
-\indextext{indeterminate value}%
If no initializer is specified for an object, the object is default-initialized.
-When storage for an object with automatic or dynamic storage duration
-is obtained, the object has an \term{indeterminate value}, and if
-no initialization is performed for the object, that object retains an
-indeterminate value until that value is replaced\iref{expr.ass}.
-\begin{note} Objects with static or thread storage duration are zero-initialized,
-see~\ref{basic.start.static}. \end{note}
-If an indeterminate value is produced by an evaluation, the behavior is
-undefined except in the following cases:
-
-\begin{itemize}
-\item
-If an indeterminate value of
-unsigned ordinary character type\iref{basic.fundamental}
-or \tcode{std::byte} type\iref{cstddef.syn}
-is produced by the evaluation of:
-\begin{itemize}
-\item the second or third operand of a conditional expression\iref{expr.cond},
-\item the right operand of a comma expression\iref{expr.comma},
-\item the operand of a cast or conversion~(\ref{conv.integral},
-\ref{expr.type.conv}, \ref{expr.static.cast}, \ref{expr.cast}) to an
-unsigned ordinary character type
-or \tcode{std::byte} type\iref{cstddef.syn}, or
-\item a discarded-value expression\iref{expr.prop},
-\end{itemize}
-then the result of the operation is an indeterminate value.
-
-\item
-If an indeterminate value of
-unsigned ordinary character type
-or \tcode{std::byte} type
-is produced by the evaluation of the right
-operand of a simple assignment operator\iref{expr.ass} whose first operand
-is an lvalue of
-unsigned ordinary character type
-or \tcode{std::byte} type,
-an indeterminate value replaces
-the value of the object referred to by the left operand.
-
-\item
-If an indeterminate value of unsigned ordinary character type is produced by the
-evaluation of the initialization expression when initializing an object of
-unsigned ordinary character type, that object is initialized to an indeterminate
-value.
-
-\item
-If an indeterminate value of
-unsigned ordinary character type
-or \tcode{std::byte} type
-is produced by the
-evaluation of the initialization expression when initializing an object of
-\tcode{std::byte} type, that object is initialized to an indeterminate
-value.
-\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}
- }
-\end{codeblock}
-\end{example}
\pnum
\indextext{initialization!class member}%
@@ -5942,7 +5878,7 @@
storage duration that is implicitly defined (see~\ref{basic.scope.block}).
\pnum
-The function-local predefined variable \tcode{__func__} is
+The function-local predefined variable \mname{func} is
defined as if a definition of the form
\begin{codeblock}
static const char __func__[] = "@\placeholder{function-name}@";
@@ -5960,7 +5896,7 @@
S() : s(__func__) { } // OK
const char* s;
};
-void f(const char* s = __func__); // error: \tcode{__func__} is undeclared
+void f(const char* s = __func__); // error: \mname{func} is undeclared
\end{codeblock}
\end{example}
diff --git a/source/expressions.tex b/source/expressions.tex
index a98f375a57..30f4eb6cf0 100644
--- a/source/expressions.tex
+++ b/source/expressions.tex
@@ -140,7 +140,8 @@
\item A \defn{glvalue} is an expression whose evaluation determines the identity of an object, bit-field, or function.
\item A \defn{prvalue} is an expression whose evaluation initializes an object or a bit-field,
or computes the value of an operand of an operator,
-as specified by the context in which it appears.
+as specified by the context in which it appears,
+or an expression that has type \cv{}~\tcode{void}.
\item An \defn{xvalue} is a glvalue that denotes an object or bit-field whose resources can be reused (usually because it is near the end of its lifetime).
\item An \defn{lvalue} is a glvalue that is not an xvalue.
\item An \defn{rvalue} is a prvalue or an xvalue.
@@ -210,22 +211,23 @@
\end{example}
\pnum
+The \defnx{result}{result!glvalue} of a glvalue is the entity denoted by the expression.
The \defnx{result}{result!prvalue} of a prvalue
-is the value that the expression stores into its context.
+is the value that the expression stores into its context;
+a prvalue that has type \cv{}~\tcode{void} has no result.
A prvalue whose result is the value \placeholder{V}
is sometimes said to have or name the value \placeholder{V}.
-The \defn{result object} of a prvalue
-is the object initialized by the prvalue;
+The \defn{result object} of a prvalue is the object initialized by the prvalue;
a non-discarded prvalue
-that is used to compute the value of an operand of a built-in operator or
-that has type \cv{}~\tcode{void}
+that is used to compute the value of an operand of a built-in operator
+or a prvalue that has type \cv{}~\tcode{void}
has no result object.
\begin{note}
Except when the prvalue is the operand of a \grammarterm{decltype-specifier},
a prvalue of class or array type always has a result object.
-For a discarded prvalue, a temporary object is materialized; see \ref{expr.context}.
+For a discarded prvalue that has type other than \cv{}~\tcode{void},
+a temporary object is materialized; see \ref{expr.context}.
\end{note}
-The \defnx{result}{result!glvalue} of a glvalue is the entity denoted by the expression.
\pnum
Whenever a glvalue appears as an operand of an operator that
@@ -1509,7 +1511,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.} is a floating-point literal\iref{lex.fcon}
+ 0.T::~T(); // error: \tcode{0.T} is a \grammarterm{user-defined-floating-literal}\iref{lex.ext}
}
\end{codeblock}
\end{example}
@@ -1687,17 +1689,18 @@
\grammarterm{parameter-declaration-clause} is followed by \tcode{consteval}.
\begin{note} Names referenced in
the \grammarterm{lambda-declarator} are looked up in the context in which the
-\grammarterm{lambda-expression} appears. \end{note}
+\grammarterm{lambda-expression} appears.
+\end{note}
\begin{example}
\begin{codeblock}
auto ID = [](auto a) { return a; };
-static_assert(ID(3) == 3); // OK
+static_assert(ID(3) == 3); // OK
struct NonLiteral {
NonLiteral(int n) : n(n) { }
int n;
};
-static_assert(ID(NonLiteral{3}).n == 3); // ill-formed
+static_assert(ID(NonLiteral{3}).n == 3); // ill-formed
\end{codeblock}
\end{example}
@@ -1717,15 +1720,15 @@
};
constexpr auto zero = monoid(0);
constexpr auto one = monoid(1);
-static_assert(add(one)(zero)() == one()); // OK
+static_assert(add(one)(zero)() == one()); // OK
// Since \tcode{two} below is not declared \tcode{constexpr}, an evaluation of its \tcode{constexpr} member function call operator
// cannot perform an lvalue-to-rvalue conversion on one of its subobjects (that represents its capture)
// in a constant expression.
auto two = monoid(2);
assert(two() == 2); // OK, not a constant expression.
-static_assert(add(one)(one)() == two()); // ill-formed: \tcode{two()} is not a constant expression
-static_assert(add(one)(one)() == monoid(2)()); // OK
+static_assert(add(one)(one)() == two()); // ill-formed: \tcode{two()} is not a constant expression
+static_assert(add(one)(one)() == monoid(2)()); // OK
\end{codeblock}
\end{example}
@@ -1813,18 +1816,18 @@
void f1(int (*)(int)) { }
void f2(char (*)(int)) { }
-void g(int (*)(int)) { } // \#1
-void g(char (*)(char)) { } // \#2
+void g(int (*)(int)) { } // \#1
+void g(char (*)(char)) { } // \#2
-void h(int (*)(int)) { } // \#3
-void h(char (*)(int)) { } // \#4
+void h(int (*)(int)) { } // \#3
+void h(char (*)(int)) { } // \#4
auto glambda = [](auto a) { return a; };
-f1(glambda); // OK
-f2(glambda); // error: ID is not convertible
-g(glambda); // error: ambiguous
-h(glambda); // OK: calls \#3 since it is convertible from ID
-int& (*fpi)(int*) = [](auto* a) -> auto& { return *a; }; // OK
+f1(glambda); // OK
+f2(glambda); // error: ID is not convertible
+g(glambda); // error: ambiguous
+h(glambda); // OK: calls \#3 since it is convertible from ID
+int& (*fpi)(int*) = [](auto* a) -> auto& { return *a; }; // OK
\end{codeblock}
\end{example}
@@ -1843,8 +1846,8 @@
\begin{example}
\begin{codeblock}
auto GL = [](auto a) { std::cout << a; return a; };
-int (*GL_int)(int) = GL; // OK: through conversion function template
-GL_int(3); // OK: same as \tcode{GL(3)}
+int (*GL_int)(int) = GL; // OK: through conversion function template
+GL_int(3); // OK: same as \tcode{GL(3)}
\end{codeblock}
\end{example}
@@ -1857,11 +1860,11 @@
auto Fwd = [](int (*fp)(int), auto a) { return fp(a); };
auto C = [](auto a) { return a; };
-static_assert(Fwd(C,3) == 3); // OK
+static_assert(Fwd(C,3) == 3); // OK
// No specialization of the function call operator template can be constexpr (due to the local static).
auto NC = [](auto a) { static int s; return a; };
-static_assert(Fwd(NC,3) == 3); // ill-formed
+static_assert(Fwd(NC,3) == 3); // ill-formed
\end{codeblock}
\end{example}
@@ -1872,22 +1875,22 @@
\tcode{this}\iref{class.this} and transforming \grammarterm{id-expression}{s}
referring to non-static class members into class member access expressions using
\tcode{(*this)}~(\ref{class.mfct.non-static}), the \grammarterm{compound-statement} is
-considered in the context of the \grammarterm{lambda-expression}. \begin{example}
-
+considered in the context of the \grammarterm{lambda-expression}.
+\begin{example}
\begin{codeblock}
struct S1 {
int x, y;
int operator()(int);
void f() {
[=]()->int {
- return operator()(this->x + y); // equivalent to \tcode{S1::operator()(this->x + (*this).y)}
- // \tcode{this} has type \tcode{S1*}
+ return operator()(this->x + y); // equivalent to \tcode{S1::operator()(this->x + (*this).y)}
+ // \tcode{this} has type \tcode{S1*}
};
}
};
\end{codeblock}
\end{example}
-Further, a variable \tcode{__func__} is implicitly defined at the beginning of
+Further, a variable \mname{func} is implicitly defined at the beginning of
the \grammarterm{compound-statement} of the \grammarterm{lambda-expression},
with semantics as described in~\ref{dcl.fct.def.general}.
@@ -1973,12 +1976,13 @@
``\tcode{this}'',
or ``\tcode{* this}''.
\begin{note} The form \tcode{[\&,this]} is redundant but accepted
-for compatibility with ISO \CppXIV{}. \end{note}
+for compatibility with ISO \CppXIV{}.
+\end{note}
Ignoring appearances in
\grammarterm{initializer}{s} of \grammarterm{init-capture}{s}, an identifier or
\tcode{this} shall not appear more than once in a
-\grammarterm{lambda-capture}. \begin{example}
-
+\grammarterm{lambda-capture}.
+\begin{example}
\begin{codeblock}
struct S2 { void f(int i); };
void S2::f(int i) {
@@ -2021,7 +2025,7 @@
\begin{codeblock}
void f() {
int x = 0;
- auto g = [x](int x) { return 0; } // error: parameter and \grammarterm{simple-capture} have the same name
+ auto g = [x](int x) { return 0; }; // error: parameter and \grammarterm{simple-capture} have the same name
}
\end{codeblock}
\end{example}
@@ -2051,9 +2055,9 @@
auto y = [&r = x, x = x+1]()->int {
r += 2;
return x+2;
- }(); // Updates \tcode{::x} to 6, and initializes \tcode{y} to 7.
+ }(); // Updates \tcode{::x} to 6, and initializes \tcode{y} to 7.
-auto z = [a = 42](int a) { return 1; } // error: parameter and local variable have the same name
+auto z = [a = 42](int a) { return 1; }; // error: parameter and local variable have the same name
\end{codeblock}
\end{example}
@@ -2146,7 +2150,8 @@
or
captures a structured binding (explicitly or implicitly),
the program is
-ill-formed. \begin{example}
+ill-formed.
+\begin{example}
\indextext{Bond!James Bond}%
\begin{codeblock}
void f1(int i) {
@@ -2182,7 +2187,7 @@
return [this] {
return [*this] {
return ohseven; // OK
- }
+ };
}();
}
auto g() {
@@ -2196,8 +2201,8 @@
\pnum
A \grammarterm{lambda-expression} appearing in a default argument shall not
-implicitly or explicitly capture any entity. \begin{example}
-
+implicitly or explicitly capture any entity.
+\begin{example}
\begin{codeblock}
void f2() {
int i = 1;
@@ -4096,7 +4101,7 @@
\indextext{expression!unary operator}%
\indextext{operator!unary}%
The unary \tcode{*} operator performs \defn{indirection}:
-\indextext{dereferencing|seealso{indirection}}%
+\indextext{dereferencing|see{indirection}}%
the expression to which it is applied shall be a pointer to an object
type, or a pointer to a function type and the result is an lvalue
referring to the object or function to which the expression points. If
@@ -4357,7 +4362,7 @@
\pnum
\indextext{expression!\idxcode{new}}%
\indextext{free store|seealso{\tcode{new}, \tcode{delete}}}%
-\indextext{memory management|seealso{\tcode{new}, \tcode{delete}}}%
+\indextext{memory management|see{\tcode{new}, \tcode{delete}}}%
\indextext{storage management|see{\tcode{new}, \tcode{delete}}}%
\indextext{\idxcode{new}}%
The \grammarterm{new-expression} attempts to create an object of the
@@ -4824,7 +4829,8 @@
If the \grammarterm{new-expression} creates an object or an array of
objects of class type, access and ambiguity control are done for the
allocation function, the deallocation function\iref{class.free}, and
-the constructor\iref{class.ctor}. If the \grammarterm{new-expression}
+the constructor\iref{class.ctor} selected for the initialization (if any).
+If the \grammarterm{new-expression}
creates an array of objects of class type, the destructor is potentially
invoked\iref{class.dtor}.
@@ -5982,6 +5988,7 @@
\end{bnf}
\pnum
+The \tcode{\&} operator groups left-to-right.
The operands shall be of integral or unscoped enumeration type.
The usual arithmetic conversions\iref{expr.arith.conv} are performed.
Given the coefficients $\tcode{x}_i$ and $\tcode{y}_i$
@@ -6006,6 +6013,7 @@
\end{bnf}
\pnum
+The \tcode{\^} operator groups left-to-right.
The operands shall be of integral or unscoped enumeration type.
The usual arithmetic conversions\iref{expr.arith.conv} are performed.
Given the coefficients $\tcode{x}_i$ and $\tcode{y}_i$
@@ -6031,6 +6039,7 @@
\end{bnf}
\pnum
+The \tcode{|} operator groups left-to-right.
The operands shall be of integral or unscoped enumeration type.
The usual arithmetic conversions\iref{expr.arith.conv} are performed.
Given the coefficients $\tcode{x}_i$ and $\tcode{y}_i$
diff --git a/source/future.tex b/source/future.tex
index 1fb805188a..a09031cb40 100644
--- a/source/future.tex
+++ b/source/future.tex
@@ -1018,7 +1018,8 @@
\begin{itemdescr}
\pnum
\effects
-Implementation defined, except that
+Behavior is \impldef{behavior of \tcode{strstreambuf::setbuf}},
+except that
\tcode{setbuf(0, 0)}
has no effect.%
\end{itemdescr}
diff --git a/source/iterators.tex b/source/iterators.tex
index edf48d7992..a2bba557d6 100644
--- a/source/iterators.tex
+++ b/source/iterators.tex
@@ -25,13 +25,13 @@
\ref{predef.iterators} & Iterator adaptors & \\
\ref{stream.iterators} & Stream iterators & \\
\ref{iterator.range} & Range access & \\
-\ref{iterator.container} & Container and view access & \\
\end{libsumtab}
\rSec1[iterator.synopsis]{Header \tcode{}\ synopsis}
\indexhdr{iterator}%
\indexlibrary{\idxcode{default_sentinel}}%
+\indexlibrary{\idxcode{unreachable_sentinel}}%
\begin{codeblock}
#include
@@ -65,10 +65,10 @@
namespace ranges {
// \ref{iterator.cust}, customization points
inline namespace @\unspec@ {
- // \ref{iterator.cust.move}, \tcode{iter_move}
+ // \ref{iterator.cust.move}, \tcode{ranges::iter_move}
inline constexpr @\unspec@ iter_move = @\unspec@;
- // \ref{iterator.cust.swap}, \tcode{iter_swap}
+ // \ref{iterator.cust.swap}, \tcode{ranges::iter_swap}
inline constexpr @\unspec@ iter_swap = @\unspec@;
}
}
@@ -306,6 +306,11 @@
template
constexpr reverse_iterator make_reverse_iterator(Iterator i);
+ template
+ requires (!SizedSentinel)
+ inline constexpr bool disable_sized_sentinel,
+ reverse_iterator> = true;
+
// \ref{insert.iterators}, insert iterators
template class back_insert_iterator;
template
@@ -322,6 +327,7 @@
// \ref{move.iterators}, move iterators and sentinels
template class move_iterator;
+
template
constexpr bool operator==(
const move_iterator& x, const move_iterator& y);
@@ -348,6 +354,7 @@
template
constexpr move_iterator operator+(
typename move_iterator::difference_type n, const move_iterator& x);
+
template
constexpr move_iterator make_move_iterator(Iterator i);
@@ -429,7 +436,6 @@
template constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c));
template constexpr auto crend(const C& c) -> decltype(std::rend(c));
- // \ref{iterator.container}, container access
template constexpr auto size(const C& c) -> decltype(c.size());
template constexpr size_t size(const T (&array)[N]) noexcept;
template [[nodiscard]] constexpr auto empty(const C& c) -> decltype(c.empty());
@@ -855,11 +861,11 @@
@\placeholder{cpp17-iterator}@ && EqualityComparable && requires(I i) {
typename incrementable_traits::difference_type;
typename readable_traits::value_type;
- typename common_reference_t &&,
- typename readable_traits::value_type &>;
+ typename common_reference_t&&,
+ typename readable_traits::value_type&>;
*i++;
- typename common_reference_t::value_type &>;
+ typename common_reference_t::value_type&>;
requires SignedIntegral::difference_type>;
};
@@ -1033,13 +1039,13 @@
\rSec2[iterator.cust]{Customization points}
-\rSec3[iterator.cust.move]{\tcode{iter_move}}
+\rSec3[iterator.cust.move]{\tcode{ranges::iter_move}}
\indexlibrary{\idxcode{iter_move}}%
\pnum
-The name \tcode{iter_move} denotes
+The name \tcode{ranges::iter_move} denotes
a customization point object\iref{customization.point.object}.
-The expression \tcode{ranges::iter_move(E)} for some subexpression \tcode{E} is
+The expression \tcode{ranges::\-iter_move(E)} for some subexpression \tcode{E} is
expression-equivalent to the following:
\begin{itemize}
@@ -1065,11 +1071,11 @@
If \tcode{ranges::iter_move(E)} is not equal to \tcode{*E}, the program is
ill-formed with no diagnostic required.
-\rSec3[iterator.cust.swap]{\tcode{iter_swap}}
+\rSec3[iterator.cust.swap]{\tcode{ranges::iter_swap}}
\indexlibrary{\idxcode{iter_swap}}%
\pnum
-The name \tcode{iter_swap} denotes
+The name \tcode{ranges::iter_swap} denotes
a customization point object\iref{customization.point.object}
that exchanges the values\iref{concept.swappable} denoted by its
arguments.
@@ -1601,7 +1607,7 @@
\begin{itemize}
\item \tcode{addressof(--a) == addressof(a)}
\item \tcode{bool(a-- == b)}
- \item after evaluating both \tcode{a--} and \tcode{--b}
+ \item after evaluating both \tcode{a--} and \tcode{--b},
\tcode{bool(a == b)} is still \tcode{true}
\item \tcode{bool(++(--a) == b)}
\end{itemize}
@@ -2152,7 +2158,7 @@
\pnum
There are several concepts that group requirements of algorithms that
-take callable objects~(\ref{func.require}) as arguments.
+take callable objects~(\ref{func.def}) as arguments.
\rSec3[indirectcallable.indirectinvocable]{Indirect callables}
@@ -2447,8 +2453,8 @@
\rSec1[iterator.primitives]{Iterator primitives}
\pnum
-To simplify the task of defining iterators, the library provides
-several classes and functions:
+To simplify the use of iterators, the library provides
+several classes and functions.
\rSec2[std.iterator.tags]{Standard iterator tags}
@@ -2686,7 +2692,7 @@
\indexlibrary{\idxcode{advance}}%
\begin{itemdecl}
template
- constexpr void advance(I& i, iter_difference_t n);
+ constexpr void ranges::advance(I& i, iter_difference_t n);
\end{itemdecl}
\begin{itemdescr}
@@ -2709,7 +2715,7 @@
\indexlibrary{\idxcode{advance}}%
\begin{itemdecl}
template S>
- constexpr void advance(I& i, S bound);
+ constexpr void ranges::advance(I& i, S bound);
\end{itemdecl}
\begin{itemdescr}
@@ -2732,7 +2738,7 @@
\indexlibrary{\idxcode{advance}}%
\begin{itemdecl}
template S>
- constexpr iter_difference_t advance(I& i, iter_difference_t n, S bound);
+ constexpr iter_difference_t ranges::advance(I& i, iter_difference_t n, S bound);
\end{itemdecl}
\begin{itemdescr}
@@ -2774,7 +2780,7 @@
\indexlibrary{\idxcode{distance}}%
\begin{itemdecl}
template S>
- constexpr iter_difference_t distance(I first, S last);
+ constexpr iter_difference_t ranges::distance(I first, S last);
\end{itemdecl}
\begin{itemdescr}
@@ -2798,7 +2804,7 @@
\indexlibrary{\idxcode{distance}}%
\begin{itemdecl}
template
- constexpr iter_difference_t> distance(R&& r);
+ constexpr iter_difference_t> ranges::distance(R&& r);
\end{itemdecl}
\begin{itemdescr}
@@ -2819,7 +2825,7 @@
\indexlibrary{\idxcode{next}}%
\begin{itemdecl}
template
- constexpr I next(I x);
+ constexpr I ranges::next(I x);
\end{itemdecl}
\begin{itemdescr}
@@ -2830,7 +2836,7 @@
\indexlibrary{\idxcode{next}}%
\begin{itemdecl}
template
- constexpr I next(I x, iter_difference_t n);
+ constexpr I ranges::next(I x, iter_difference_t n);
\end{itemdecl}
\begin{itemdescr}
@@ -2841,7 +2847,7 @@
\indexlibrary{\idxcode{next}}%
\begin{itemdecl}
template S>
- constexpr I next(I x, S bound);
+ constexpr I ranges::next(I x, S bound);
\end{itemdecl}
\begin{itemdescr}
@@ -2852,7 +2858,7 @@
\indexlibrary{\idxcode{next}}%
\begin{itemdecl}
template S>
- constexpr I next(I x, iter_difference_t n, S bound);
+ constexpr I ranges::next(I x, iter_difference_t n, S bound);
\end{itemdecl}
\begin{itemdescr}
@@ -2864,7 +2870,7 @@
\indexlibrary{\idxcode{prev}}%
\begin{itemdecl}
template
- constexpr I prev(I x);
+ constexpr I ranges::prev(I x);
\end{itemdecl}
\begin{itemdescr}
@@ -2875,7 +2881,7 @@
\indexlibrary{\idxcode{prev}}%
\begin{itemdecl}
template
- constexpr I prev(I x, iter_difference_t n);
+ constexpr I ranges::prev(I x, iter_difference_t n);
\end{itemdecl}
\begin{itemdescr}
@@ -2886,7 +2892,7 @@
\indexlibrary{\idxcode{prev}}%
\begin{itemdecl}
template
- constexpr I prev(I x, iter_difference_t n, I bound);
+ constexpr I ranges::prev(I x, iter_difference_t n, I bound);
\end{itemdecl}
\begin{itemdescr}
@@ -2941,53 +2947,12 @@
iter_move(const reverse_iterator& i) noexcept(@\seebelow@);
template Iterator2>
friend constexpr void
- iter_swap(const reverse_iterator\& x,
- const reverse_iterator\& y) noexcept(@\seebelow@);
+ iter_swap(const reverse_iterator& x,
+ const reverse_iterator& y) noexcept(@\seebelow@);
protected:
Iterator current;
};
-
- template
- constexpr bool operator==(
- const reverse_iterator& x,
- const reverse_iterator& y);
- template
- constexpr bool operator!=(
- const reverse_iterator& x,
- const reverse_iterator& y);
- template
- constexpr bool operator<(
- const reverse_iterator& x,
- const reverse_iterator& y);
- template
- constexpr bool operator>(
- const reverse_iterator& x,
- const reverse_iterator& y);
- template
- constexpr bool operator<=(
- const reverse_iterator& x,
- const reverse_iterator& y);
- template
- constexpr bool operator>=(
- const reverse_iterator& x,
- const reverse_iterator& y);
- template
- constexpr auto operator-(
- const reverse_iterator& x,
- const reverse_iterator& y) -> decltype(y.base() - x.base());
- template
- constexpr reverse_iterator operator+(
- typename reverse_iterator::difference_type n,
- const reverse_iterator& x);
-
- template
- constexpr reverse_iterator make_reverse_iterator(Iterator i);
-
- template
- requires (!SizedSentinel)
- inline constexpr bool disable_sized_sentinel,
- reverse_iterator> = true;
}
\end{codeblock}
@@ -3100,14 +3065,14 @@
\indexlibrarymember{operator=}{reverse_iterator}%
\begin{itemdecl}
template
-constexpr reverse_iterator&
- operator=(const reverse_iterator& u);
+ constexpr reverse_iterator&
+ operator=(const reverse_iterator& u);
\end{itemdecl}
\begin{itemdescr}
\pnum
\effects
-Assigns \tcode{u.base()} to current.
+Assigns \tcode{u.base()} to \tcode{current}.
\pnum
\returns
@@ -3304,12 +3269,12 @@
\begin{itemdescr}
\pnum
\constraints
-The expression \tcode{x.current == y.current} shall be valid and
+The expression \tcode{x.base() == y.base()} shall be valid and
convertible to \tcode{bool}.
\pnum
\returns
-\tcode{x.current == y.current}.
+\tcode{x.base() == y.base()}.
\end{itemdescr}
\indexlibrarymember{operator"!=}{reverse_iterator}%
@@ -3323,12 +3288,12 @@
\begin{itemdescr}
\pnum
\constraints
-The expression \tcode{x.current != y.current} shall be valid and
+The expression \tcode{x.base() != y.base()} shall be valid and
convertible to \tcode{bool}.
\pnum
\returns
-\tcode{x.current != y.current}.
+\tcode{x.base() != y.base()}.
\end{itemdescr}
\indexlibrarymember{operator<}{reverse_iterator}%
@@ -3342,12 +3307,12 @@
\begin{itemdescr}
\pnum
\constraints
-The expression \tcode{x.current > y.current} shall be valid and
+The expression \tcode{x.base() > y.base()} shall be valid and
convertible to \tcode{bool}.
\pnum
\returns
-\tcode{x.current > y.current}.
+\tcode{x.base() > y.base()}.
\end{itemdescr}
\indexlibrarymember{operator>}{reverse_iterator}%
@@ -3361,12 +3326,12 @@
\begin{itemdescr}
\pnum
\constraints
-The expression \tcode{x.current < y.current} shall be valid and
+The expression \tcode{x.base() < y.base()} shall be valid and
convertible to \tcode{bool}.
\pnum
\returns
-\tcode{x.current < y.current}.
+\tcode{x.base() < y.base()}.
\end{itemdescr}
\indexlibrarymember{operator<=}{reverse_iterator}%
@@ -3380,12 +3345,12 @@
\begin{itemdescr}
\pnum
\constraints
-The expression \tcode{x.current >= y.current} shall be valid and
+The expression \tcode{x.base() >= y.base()} shall be valid and
convertible to \tcode{bool}.
\pnum
\returns
-\tcode{x.current >= y.current}.
+\tcode{x.base() >= y.base()}.
\end{itemdescr}
\indexlibrarymember{operator>=}{reverse_iterator}%
@@ -3399,12 +3364,12 @@
\begin{itemdescr}
\pnum
\constraints
-The expression \tcode{x.current <= y.current} shall be valid and
+The expression \tcode{x.base() <= y.base()} shall be valid and
convertible to \tcode{bool}.
\pnum
\returns
-\tcode{x.current <= y.current}.
+\tcode{x.base() <= y.base()}.
\end{itemdescr}
\rSec3[reverse.iter.nonmember]{Non-member functions}
@@ -3412,7 +3377,7 @@
\indexlibrarymember{operator-}{reverse_iterator}%
\begin{itemdecl}
template
- constexpr auto operator-(
+ constexpr auto operator-(
const reverse_iterator& x,
const reverse_iterator& y) -> decltype(y.base() - x.base());
\end{itemdecl}
@@ -3420,7 +3385,7 @@
\begin{itemdescr}
\pnum
\returns
-\tcode{y.current - x.current}.
+\tcode{y.base() - x.base()}.
\end{itemdescr}
\indexlibrarymember{operator+}{reverse_iterator}%
@@ -3434,7 +3399,7 @@
\begin{itemdescr}
\pnum
\returns
-\tcode{reverse_iterator (x.current - n)}.
+\tcode{reverse_iterator(x.base() - n)}.
\end{itemdescr}
\indexlibrarymember{iter_move}{reverse_iterator}%
@@ -3447,7 +3412,7 @@
\pnum
\effects Equivalent to:
\begin{codeblock}
-auto tmp = i.current;
+auto tmp = i.base();
return ranges::iter_move(--tmp);
\end{codeblock}
@@ -3471,8 +3436,8 @@
\pnum
\effects Equivalent to:
\begin{codeblock}
-auto xtmp = x.current;
-auto ytmp = y.current;
+auto xtmp = x.base();
+auto ytmp = y.base();
ranges::iter_swap(--xtmp, --ytmp);
\end{codeblock}
@@ -3574,9 +3539,6 @@
constexpr back_insert_iterator& operator++();
constexpr back_insert_iterator operator++(int);
};
-
- template
- constexpr back_insert_iterator back_inserter(Container& x);
}
\end{codeblock}
@@ -3689,9 +3651,6 @@
constexpr front_insert_iterator& operator++();
constexpr front_insert_iterator operator++(int);
};
-
- template
- constexpr front_insert_iterator front_inserter(Container& x);
}
\end{codeblock}
@@ -3805,10 +3764,6 @@
constexpr insert_iterator& operator++();
constexpr insert_iterator& operator++(int);
};
-
- template
- constexpr insert_iterator
- inserter(Container& x, iterator_t i);
}
\end{codeblock}
@@ -3993,35 +3948,6 @@
private:
Iterator current; // \expos
};
-
- template
- constexpr bool operator==(
- const move_iterator& x, const move_iterator& y);
- template
- constexpr bool operator!=(
- const move_iterator& x, const move_iterator& y);
- template
- constexpr bool operator<(
- const move_iterator& x, const move_iterator& y);
- template
- constexpr bool operator>(
- const move_iterator& x, const move_iterator& y);
- template
- constexpr bool operator<=(
- const move_iterator& x, const move_iterator& y);
- template
- constexpr bool operator>=(
- const move_iterator& x, const move_iterator& y);
-
- template
- constexpr auto operator-(const move_iterator& x,
- const move_iterator& y)
- -> decltype(x.base() - y.base());
- template
- constexpr move_iterator
- operator+(iter_difference_t n, const move_iterator& x);
- template
- constexpr move_iterator make_move_iterator(Iterator i);
}
\end{codeblock}
@@ -5480,7 +5406,7 @@
\pnum
\begin{note}
-The argument order in the \textit{Effects} element is reversed
+The argument order in the \effects{} element is reversed
because \tcode{length} counts down, not up.
\end{note}
\end{itemdescr}
@@ -5554,11 +5480,10 @@
\rSec3[unreachable.sentinel]{Class \tcode{unreachable_sentinel_t}}
\indexlibrary{\idxcode{unreachable_sentinel_t}}%
-\indexlibrary{\idxcode{unreachable_sentinel}}%
\pnum
Class \tcode{unreachable_sentinel_t} can be used with
any \libconcept{WeaklyIncrementable} type
-to denote the ``upper bound'' of an open interval.
+to denote the ``upper bound'' of an unbounded interval.
\pnum
\begin{example}
@@ -5726,13 +5651,6 @@
basic_istream* in_stream; // \expos
T value; // \expos
};
-
- template
- bool operator==(const istream_iterator& x,
- const istream_iterator& y);
- template
- bool operator!=(const istream_iterator