Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P2385R0 C++ Standard Library Issues to be moved in Virtual Plenary, June 2021 #4695

Merged
merged 36 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9069758
LWG2774 std::function construction vs assignment
jensmaurer Jun 12, 2021
9a4fe7d
LWG2818 "::std::" everywhere rule needs tweaking
jensmaurer Jun 12, 2021
0f6641d
LWG2997 LWG 491 and the specification of {forward_,}list::unique
jensmaurer Jun 12, 2021
7ec7b45
LWG3410 lexicographical_compare_three_way is overspecified
jensmaurer Jun 12, 2021
de3b0bc
LWG3430 std::fstream & co. should be constructible from string_view
jensmaurer Jun 12, 2021
cb919d3
LWG3462 [formatter.requirements]: Formatter requirements forbid use o…
jensmaurer Jun 12, 2021
4fbf72e
LWG3481 viewable_range mishandles lvalue move-only views
jensmaurer Jun 12, 2021
e2200c6
LWG3506 Missing allocator-extended constructors for priority_queue
jensmaurer Jun 12, 2021
38a59d9
LWG3517 join_view::iterator's iter_swap is underconstrained
jensmaurer Jun 12, 2021
4cd2dbd
LWG3518 Exception requirements on char trait operations unclear
jensmaurer Jun 12, 2021
a853f2f
LWG3519 Incomplete synopses for <random> classes
jensmaurer Jun 12, 2021
b9dc2a4
LWG3520 iter_move and iter_swap are inconsistent for transform_view::…
jensmaurer Jun 12, 2021
5a9b561
LWG3521 Overly strict requirements on qsort and bsearch
jensmaurer Jun 12, 2021
0d8c1fd
LWG3522 Missing requirement on InputIterator template parameter for p…
jensmaurer Jun 13, 2021
45451b2
LWG3523 iota_view::sentinel is not always iota_view's sentinel
jensmaurer Jun 13, 2021
f2336c4
LWG3526 Return types of uses_allocator_construction_args unspecified
jensmaurer Jun 13, 2021
9ffd955
LWG3527 uses_allocator_construction_args handles rvalue pairs of rval…
jensmaurer Jun 13, 2021
4183259
LWG3528 make_from_tuple can perform (the equivalent of) a C-style cast
jensmaurer Jun 13, 2021
c3cd733
LWG3529 priority_queue(first, last) should construct c with (first, l…
jensmaurer Jun 13, 2021
5205bcf
LWG3530 BUILTIN-PTR-MEOW should not opt the type out of syntactic checks
jensmaurer Jun 13, 2021
fd44dd4
LWG3532 split_view<V, P>::inner-iterator<true>::operator++(int) shoul…
jensmaurer Jun 13, 2021
92fe70a
LWG3533 Make base() const & consistent across iterator wrappers that …
jensmaurer Jun 13, 2021
c953bef
LWG3536 Should chrono::from_stream() assign zero to duration for fail…
jensmaurer Jun 13, 2021
cf4caae
LWG3539 format_to must not copy models of output_iterator<const charT&>
jensmaurer Jun 13, 2021
273627e
LWG3540 [format.arg] There should be no const in basic_format_arg(con…
jensmaurer Jun 13, 2021
0826d1c
LWG3541 indirectly_readable_traits should be SFINAE-friendly for all …
jensmaurer Jun 13, 2021
7828d1c
LWG3542 basic_format_arg mis-handles basic_string_view with custom tr…
jensmaurer Jun 13, 2021
2c762d8
LWG3543 Definition of when counted_iterators refer to the same sequen…
jensmaurer Jun 13, 2021
fa2aa68
LWG3544 format-arg-store::args is unintentionally not exposition-only
jensmaurer Jun 13, 2021
5938770
LWG3546 common_iterator's postfix-proxy is not quite right
jensmaurer Jun 13, 2021
83ebaa1
LWG3548 shared_ptr construction from unique_ptr should move (not copy…
jensmaurer Jun 13, 2021
96d4993
LWG3549 view_interface is overspecified to derive from view_base
jensmaurer Jun 13, 2021
2828e7e
LWG3551 borrowed_{iterator,subrange}_t are overspecified
jensmaurer Jun 13, 2021
8e2adc6
LWG3552 Parallel specialized memory algorithms should require forward…
jensmaurer Jun 13, 2021
857e985
LWG3553 Useless constraint in split_view::outer-iterator::value_type:…
jensmaurer Jun 13, 2021
c9a295b
LWG3555 {transform,elements}_view::iterator::iterator_concept should …
jensmaurer Jun 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 14 additions & 13 deletions source/algorithms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8618,23 +8618,23 @@
\end{itemdecl}

\begin{itemdescr}
\pnum
Let $N$ be $\min(\tcode{e1 - b1}, \tcode{e2 - b2})$.
Let $E(n)$ be \tcode{comp(*(b1 + $n$), *(b2 + $n$))}.

\pnum
\mandates
\tcode{decltype(comp(*b1, *b2))} is a comparison category type.

\pnum
\effects
Lexicographically compares two ranges and
produces a result of the strongest applicable comparison category type.
Equivalent to:
\begin{codeblock}
for ( ; b1 != e1 && b2 != e2; void(++b1), void(++b2) )
if (auto cmp = comp(*b1,*b2); cmp != 0)
return cmp;
return b1 != e1 ? strong_ordering::greater :
b2 != e2 ? strong_ordering::less :
strong_ordering::equal;
\end{codeblock}
\returns
$E(i)$, where $i$ is the smallest integer in \range{0}{$N$}
such that \tcode{$E(i)$ != 0} is \tcode{true}, or
\tcode{(e1 - b1) <=> (e2 - b2)} if no such integer exists.

\pnum
\complexity
At most $N$ applications of \tcode{comp}.
\end{itemdescr}

\indexlibraryglobal{lexicographical_compare_three_way}%
Expand Down Expand Up @@ -10831,7 +10831,8 @@
\begin{itemdescr}
\pnum
\expects
The objects in the array pointed to by \tcode{base} are of trivial type.
For \tcode{qsort}, the objects in the array pointed to by \tcode{base}
are of trivially copyable type.

\pnum
\effects
Expand Down
199 changes: 173 additions & 26 deletions source/containers.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4651,6 +4651,12 @@
arguments for a template parameter
named \tcode{Predicate} or \tcode{BinaryPredicate}
shall meet the corresponding requirements in \ref{algorithms.requirements}.
The semantics of \tcode{i + n},
where \tcode{i} is an iterator into the list and \tcode{n} is an integer,
are the same as those of \tcode{next(i, n)}.
The expression \tcode{i - n},
where \tcode{i} is an iterator into the list and \tcode{n} is an integer,
means an iterator \tcode{j} such that \tcode{j + n == i} is \tcode{true}.
For \tcode{merge} and \tcode{sort},
the definitions and requirements in \ref{alg.sorting} apply.

Expand Down Expand Up @@ -4784,16 +4790,24 @@
\indexlibrarymember{unique}{forward_list}%
\begin{itemdecl}
size_type unique();
template<class BinaryPredicate> size_type unique(BinaryPredicate pred);
template<class BinaryPredicate> size_type unique(BinaryPredicate binary_pred);
\end{itemdecl}

\begin{itemdescr}
\pnum
Let \tcode{binary_pred} be \tcode{equal_to<>\{\}} for the first overload.
tkoeppe marked this conversation as resolved.
Show resolved Hide resolved

\pnum
\expects
\tcode{binary_pred} is an equivalence relation.

\pnum
\effects
Erases all but the first element from every consecutive
group of equal elements referred to by the iterator \tcode{i} in the range \range{first +
1}{last} for which \tcode{*i == *(i-1)} (for the version with no arguments) or \tcode{pred(*i,
*(i - 1))} (for the version with a predicate argument) holds.
group of equivalent elements.
That is, for a nonempty list, erases all elements referred to
by the iterator \tcode{i} in the range \range{begin() + 1}{end()}
for which \tcode{binary_pred(*i, *(i - 1))} is \tcode{true}.
Invalidates only the iterators and references to the erased elements.

\pnum
Expand All @@ -4802,11 +4816,14 @@

\pnum
\throws
Nothing unless an exception is thrown by the equality comparison or the predicate.
Nothing unless an exception is thrown by the predicate.

\pnum
\complexity
If the range \range{first}{last} is not empty, exactly \tcode{(last - first) - 1} applications of the corresponding predicate, otherwise no applications of the predicate.
If \tcode{empty()} is \tcode{false},
exactly \tcode{distance(begin(), end()) - 1} applications of
the corresponding predicate,
otherwise no applications of the predicate.
\end{itemdescr}

\indexlibrarymember{merge}{forward_list}%
Expand Down Expand Up @@ -5296,6 +5313,10 @@
arguments for a template parameter
named \tcode{Predicate} or \tcode{BinaryPredicate}
shall meet the corresponding requirements in \ref{algorithms.requirements}.
The semantics of \tcode{i + n} and \tcode{i - n},
where \tcode{i} is an iterator into the list and \tcode{n} is an integer,
are the same as those of \tcode{next(i, n)} and \tcode{prev(i, n)},
respectively.
For \tcode{merge} and \tcode{sort},
the definitions and requirements in \ref{alg.sorting} apply.

Expand Down Expand Up @@ -5474,13 +5495,20 @@
\end{itemdecl}

\begin{itemdescr}
\pnum
Let \tcode{binary_pred} be \tcode{equal_to<>\{\}} for the first overload.
tkoeppe marked this conversation as resolved.
Show resolved Hide resolved

\pnum
\expects
\tcode{binary_pred} is an equivalence relation.

\pnum
\effects
Erases all but the first element from every
consecutive group of equal elements referred to by the iterator \tcode{i} in the range
\range{first + 1}{last} for which \tcode{*i == *(i-1)} (for the version of
\tcode{unique} with no arguments) or \tcode{binary_pred(*i, *(i - 1))} (for the version of
\tcode{unique} with a predicate argument) holds.
consecutive group of equivalent elements.
That is, for a nonempty list, erases all elements referred to
by the iterator \tcode{i} in the range \range{begin() + 1}{end()}
for which \tcode{binary_pred(*i, *(i - 1))} is \tcode{true}.
Invalidates only the iterators and references to the erased elements.

\pnum
Expand All @@ -5489,18 +5517,12 @@

\pnum
\throws
Nothing unless an exception is thrown by
\tcode{*i == *(i-1)}
or
\tcode{pred(*i, *(i - 1))}.
Nothing unless an exception is thrown by the predicate.

\pnum
\complexity
If the range
\tcode{[first, last)}
is not empty, exactly
\tcode{(last - first) - 1}
applications of the corresponding predicate,
If \tcode{empty()} is \tcode{false},
exactly \tcode{size() - 1} applications of the corresponding predicate,
otherwise no applications of the predicate.
\end{itemdescr}

Expand Down Expand Up @@ -9695,6 +9717,12 @@
exception is thrown by the swap of the adaptor's \tcode{Container} or
\tcode{Compare} object (if any).

\pnum
A constructor template of a container adaptor
shall not participate in overload resolution
if it has an \tcode{InputIterator} template parameter and
a type that does not qualify as an input iterator is deduced for that parameter.

\pnum
A deduction guide for a container adaptor shall not participate in overload resolution if any of the following are true:
\begin{itemize}
Expand All @@ -9705,6 +9733,11 @@
\item It has both \tcode{Container} and \tcode{Allocator} template parameters, and \tcode{uses_allocator_v<Container, Allocator>} is \tcode{false}.
\end{itemize}

\pnum
The exposition-only alias template \exposid{iter-value-type}
defined in \ref{sequences.general}
may appear in deduction guides for container adaptors.

\rSec2[queue.syn]{Header \tcode{<queue>} synopsis}

\indexheader{queue}
Expand Down Expand Up @@ -10087,18 +10120,29 @@
explicit priority_queue(const Compare& x) : priority_queue(x, Container()) {}
priority_queue(const Compare& x, const Container&);
priority_queue(const Compare& x, Container&&);
template<class InputIterator>
priority_queue(InputIterator first, InputIterator last, const Compare& x = Compare());
template<class InputIterator>
priority_queue(InputIterator first, InputIterator last, const Compare& x,
const Container&);
template<class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Compare& x = Compare(), Container&& = Container());
priority_queue(InputIterator first, InputIterator last, const Compare& x,
Container&&);
template<class Alloc> explicit priority_queue(const Alloc&);
template<class Alloc> priority_queue(const Compare&, const Alloc&);
template<class Alloc> priority_queue(const Compare&, const Container&, const Alloc&);
template<class Alloc> priority_queue(const Compare&, Container&&, const Alloc&);
template<class Alloc> priority_queue(const priority_queue&, const Alloc&);
template<class Alloc> priority_queue(priority_queue&&, const Alloc&);
template<class InputIterator, class Alloc>
priority_queue(InputIterator, InputIterator, const Alloc&);
template<class InputIterator, class Alloc>
priority_queue(InputIterator, InputIterator, const Compare&, const Alloc&);
template<class InputIterator, class Alloc>
priority_queue(InputIterator, InputIterator, const Compare&, const Container&,
const Alloc&);
template<class InputIterator, class Alloc>
priority_queue(InputIterator, InputIterator, const Compare&, Container&&, const Alloc&);

[[nodiscard]] bool empty() const { return c.empty(); }
size_type size() const { return c.size(); }
Expand All @@ -10117,15 +10161,30 @@
-> priority_queue<typename Container::value_type, Container, Compare>;

template<class InputIterator,
class Compare = less<typename iterator_traits<InputIterator>::value_type>,
class Container = vector<typename iterator_traits<InputIterator>::value_type>>
class Compare = less<@\exposid{iter-value-type}@<InputIterator>>,
class Container = vector<@\exposid{iter-value-type}@<InputIterator>>>
priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container())
-> priority_queue<typename iterator_traits<InputIterator>::value_type, Container, Compare>;
-> priority_queue<@\exposid{iter-value-type}@<InputIterator>, Container, Compare>;

template<class Compare, class Container, class Allocator>
priority_queue(Compare, Container, Allocator)
-> priority_queue<typename Container::value_type, Container, Compare>;

template<class InputIterator, class Allocator>
priority_queue(InputIterator, InputIterator, Allocator)
-> priority_queue<@\exposid{iter-value-type}@<InputIterator>,
vector<@\exposid{iter-value-type}@<InputIterator>, Allocator>,
less<@\exposid{iter-value-type}@<InputIterator>>>;

template<class InputIterator, class Compare, class Allocator>
priority_queue(InputIterator, InputIterator, Compare, Allocator)
-> priority_queue<@\exposid{iter-value-type}@<InputIterator>,
vector<@\exposid{iter-value-type}@<InputIterator>, Allocator>, Compare>;

template<class InputIterator, class Compare, class Container, class Allocator>
priority_queue(InputIterator, InputIterator, Compare, Container, Allocator)
-> priority_queue<typename Container::value_type, Container, Compare>;

// no equality is provided

template<class T, class Container, class Compare, class Alloc>
Expand Down Expand Up @@ -10158,13 +10217,32 @@
\tcode{make_heap(c.begin(), c.end(), comp)}.
\end{itemdescr}

\indexlibraryctor{priority_queue}%
\begin{itemdecl}
template<class InputIterator>
priority_queue(InputIterator first, InputIterator last, const Compare& x = Compare());
\end{itemdecl}

\begin{itemdescr}
\pnum
\expects
\tcode{x} defines a strict weak ordering\iref{alg.sorting}.

\pnum
\effects
Initializes \tcode{c} with
\tcode{first} as the first argument and
\tcode{last} as the second argument, and
initializes \tcode{comp} with \tcode{x};
then calls \tcode{make_heap(c.begin(), c.end(), comp)}.
\end{itemdescr}

\indexlibraryctor{priority_queue}%
\begin{itemdecl}
template<class InputIterator>
priority_queue(InputIterator first, InputIterator last, const Compare& x, const Container& y);
template<class InputIterator>
priority_queue(InputIterator first, InputIterator last, const Compare& x = Compare(),
Container&& y = Container());
priority_queue(InputIterator first, InputIterator last, const Compare& x, Container&& y);
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -10265,6 +10343,75 @@
as the second argument, and initializes \tcode{comp} with \tcode{std::move(q.comp)}.
\end{itemdescr}

\indexlibraryctor{priority_queue}%
\begin{itemdecl}
template<class InputIterator, class Alloc>
priority_queue(InputIterator first, InputIterator last, const Alloc& a);
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Initializes \tcode{c} with
\tcode{first} as the first argument,
\tcode{last} as the second argument, and
\tcode{a} as the third argument, and
value-initializes \tcode{comp};
calls \tcode{make_heap(c.begin(), c.end(), comp)}.
\end{itemdescr}

\indexlibraryctor{priority_queue}%
\begin{itemdecl}
template<class InputIterator, class Alloc>
priority_queue(InputIterator first, InputIterator last, const Compare& compare, const Alloc& a);
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Initializes \tcode{c} with
\tcode{first} as the first argument,
\tcode{last} as the second argument, and
\tcode{a} as the third argument, and
initializes \tcode{comp} with \tcode{compare};
calls \tcode{make_heap(c.begin(), c.end(), comp)}.
\end{itemdescr}

\indexlibraryctor{priority_queue}%
\begin{itemdecl}
template<class InputIterator, class Alloc>
priority_queue(InputIterator first, InputIterator last, const Compare& compare,
const Container& cont, const Alloc& a);
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Initializes \tcode{c} with
\tcode{cont} as the first argument and \tcode{a} as the second argument, and
initializes \tcode{comp} with \tcode{compare};
calls \tcode{c.insert(c.end(), first, last)}; and
finally calls \tcode{make_heap(c.begin(), c.end(), comp)}.
\end{itemdescr}

\indexlibraryctor{priority_queue}%
\begin{itemdecl}
template<class InputIterator, class Alloc>
priority_queue(InputIterator first, InputIterator last, const Compare& compare, Container&& cont,
const Alloc& a);
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Initializes \tcode{c} with
\tcode{std::move(cont)} as the first argument and
\tcode{a} as the second argument, and
initializes \tcode{comp} with \tcode{compare};
calls \tcode{c.insert(c.end(), first, last)}; and
finally calls \tcode{make_heap(c.begin(), c.end(), comp)}.
\end{itemdescr}

\rSec3[priqueue.members]{Members}

\indexlibrarymember{push}{priority_queue}%
Expand Down