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

LWG Poll 3: P2117R0 C++ Standard Library Issues Resolved Directly In Prague #3749

Merged
merged 65 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
ffb23d0
LWG1203 More useful rvalue stream insertion
Feb 17, 2020
5cb2353
LWG2859 Definition of reachable in [ptr.launder] misses pointer arith…
Feb 17, 2020
c36fe2d
LWG3018 shared_ptr of function type
Feb 17, 2020
7fb48d1
LWG3050 Conversion specification problem in chrono::duration constructor
Feb 17, 2020
0433c2b
LWG3141 CopyConstructible doesn't preserve source values
Feb 17, 2020
4f8b121
LWG3150 UniformRandomBitGenerator should validate min and max
Feb 17, 2020
f45c8df
LWG3175 The CommonReference requirement of concept SwappableWith is n…
Feb 14, 2020
43307b1
LWG3200 midpoint should not constrain T is complete
Feb 17, 2020
b795649
LWG3201 lerp should be marked as noexcept
Feb 18, 2020
e6237b4
LWG3226 zoned_time constructor from string_view should accept zoned_t…
Feb 14, 2020
b1ac52a
LWG3237 LWG 3038 and 3190 have inconsistent PRs
Feb 18, 2020
000771c
LWG3238 Insufficiently-defined behavior of std::function deduction gu…
Feb 18, 2020
6a5a1e0
LWG3242 std::format: missing rules for arg-id in width and precision
Feb 14, 2020
894c265
LWG3243 std::format and negative zeroes
Feb 18, 2020
852dd05
LWG3247 ranges::iter_move should perform ADL-only lookup of iter_move
zygoloid Feb 27, 2020
10bf2e6
LWG3248 std::format #b, #B, #o, #x, and #X presentation types misform…
Feb 18, 2020
d13144b
LWG3250 std::format: # (alternate form) for NaN and inf
Feb 14, 2020
0f99ec3
LWG3251 Are std::format alignment specifiers applied to string argume…
Feb 18, 2020
e176114
LWG3252 Parse locale's aware modifiers for commands are not consisten…
Feb 14, 2020
2ae3810
LWG3255 span's array constructor is too strict
Feb 18, 2020
c9cb914
LWG3260 year_month* arithmetic rejects durations convertible to years
Feb 18, 2020
0545ab3
LWG3262 Formatting of negative durations is not specified
Feb 14, 2020
6a1a78b
LWG3269 Parse manipulators do not specify the result of the extractio…
Feb 18, 2020
6b7d42f
LWG3270 Parsing and formatting %j with durations
Feb 18, 2020
eb01518
LWG3282 subrange converting constructor should disallow derived to ba…
Feb 14, 2020
c0d3a1d
LWG3301 transform_view::iterator has incorrect iterator_category
Feb 14, 2020
b8509c4
LWG3314 Is stream insertion behavior locale dependent when Period::ty…
Feb 18, 2020
73816ca
LWG3328 Clarify that std::string is not good for UTF-8
Feb 14, 2020
ba1008c
LWG3334 basic_osyncstream move assignment and destruction calls basic…
Feb 18, 2020
03e310e
LWG3335 Resolve C++20 NB comments US 273 and GB 274
Feb 14, 2020
1d32026
LWG3340 Formatting functions should throw on argument/format string m…
Feb 14, 2020
ae174cd
LWG3347 std::pair<T, U> now requires T and U to be less-than-comparable
Feb 14, 2020
8c5856c
LWG3348 __cpp_lib_unwrap_ref in wrong header
Feb 18, 2020
19edf32
LWG3352 strong_equality isn't a thing
Feb 14, 2020
1860d94
LWG3354 has_strong_structural_equality has a meaningless definition
zygoloid Feb 27, 2020
f508a6c
LWG3355 The memory algorithms should support move-only input iterator…
Feb 18, 2020
d052971
LWG3358 [span.cons] is mistaken that to_address can throw
Feb 12, 2020
0a12f14
LWG3359 <chrono> leap second support should allow for negative leap s…
Feb 18, 2020
51f8eb3
LWG3362 Strike stop_source's operator!=
Feb 12, 2020
3065e49
LWG3363 drop_while_view should opt-out of sized_range
Feb 14, 2020
a6c77a7
LWG3364 Initialize data members of ranges and their iterators
Feb 12, 2020
e1322a6
LWG3367 Integer-class conversions should not throw
Feb 12, 2020
78cf96a
LWG3369 span's deduction-guide for built-in arrays doesn't work
Feb 12, 2020
b65c9bb
LWG3371 visit_format_arg and make_format_args are not hidden friends
Feb 12, 2020
681890f
LWG3372 format_to should not try to deduce Out twice
Feb 12, 2020
287caa4
LWG3373 {to,from}_chars_result and format_to_n_result need the "we re…
Feb 12, 2020
5161ed3
LWG3374 P0653 + P1006 should have made the other std::to_address over…
Feb 12, 2020
de5d45f
LWG3375 decay in viewable_range should be remove_cvref
Feb 14, 2020
aedc6e2
LWG3377 elements_view::iterator befriends a specialization of itself
Feb 12, 2020
ee3a10b
LWG3379 "safe" in several library names is misleading
Feb 14, 2020
bb8cc74
LWG3380 common_type and comparison categories
Feb 12, 2020
2dad1b6
LWG3381 begin and data must agree for contiguous_range
Feb 14, 2020
55f729c
LWG3382 NTTP for pair and array
Feb 18, 2020
824d859
LWG3383 [time.zone.leap.nonmembers] sys_seconds should be replaced wi…
Feb 14, 2020
2da18b6
LWG3384 transform_view::sentinel has an incorrect operator-
Feb 14, 2020
69d825b
LWG3385 common_iterator is not sufficiently constrained for non-copya…
Feb 14, 2020
96e2bc4
LWG3387 [range.reverse.view] reverse_view<V> unintentionally requires…
Feb 14, 2020
944bb13
LWG3388 view iterator types have ill-formed <=> operators
Feb 14, 2020
5c30109
LWG3389 A move-only iterator still does not have a counted_iterator
Feb 14, 2020
f343f31
LWG3390 make_move_iterator() cannot be used to construct a move_itera…
Feb 14, 2020
859d793
LWG3393 Missing/incorrect feature test macro for coroutines
Feb 14, 2020
b6ef98b
LWG3395 Definition for three-way comparison needs to be updated (US 152)
Feb 14, 2020
ade9b15
LWG3396 Clarify point of reference for source_location::current() (DE…
Feb 18, 2020
99cce31
LWG3397 ranges::basic_istream_view::iterator should not provide itera…
Feb 18, 2020
7f42183
LWG3398 tuple_element_t is also wrong for const subrange
Feb 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 135 additions & 129 deletions source/algorithms.tex

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions source/concepts.tex
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,14 @@
\item If \tcode{T} and \tcode{U} are the same type, the result of the operation
is that \tcode{t1} equals \tcode{u2} and \tcode{u1} equals \tcode{t2}.

\item If \tcode{T} and \tcode{U} are different types that model
\tcode{\libconcept{common_reference_with}<const T\&, const U\&>},
\item If \tcode{T} and \tcode{U} are different types and
\tcode{\libconcept{common_reference_with}<decltype((t1)), decltype((u1))>}
is modeled,
the result of the operation is that
\tcode{C(t1)} equals \tcode{C(u2)}
and
\tcode{C(u1)} equals \tcode{C(t2)}
where \tcode{C} is \tcode{common_reference_t<const T\&, const U\&>}.
where \tcode{C} is \tcode{common_reference_t<decltype((t1)), decltype((u1))>}.
\end{itemize}

\pnum
Expand Down Expand Up @@ -648,7 +649,7 @@
\begin{itemdecl}
template<class T, class U>
concept @\deflibconcept{swappable_with}@ =
common_reference_with<const remove_reference_t<T>&, const remove_reference_t<U>&> &&
common_reference_with<T, U> &&
requires(T&& t, U&& u) {
ranges::swap(std::forward<T>(t), std::forward<T>(t));
ranges::swap(std::forward<U>(u), std::forward<U>(u));
Expand Down Expand Up @@ -686,13 +687,14 @@

namespace N {
struct A { int m; };
struct Proxy { A* a; };
Proxy proxy(A& a) { return Proxy{ &a }; }

void swap(A& x, Proxy p) {
ranges::swap(x.m, p.a->m);
}
void swap(Proxy p, A& x) { swap(x, p); } // satisfy symmetry requirement
struct Proxy {
A* a;
Proxy(A& a) : a{&a} {}
friend void swap(Proxy x, Proxy y) {
ranges::swap(*x.a, *y.a);
}
};
Proxy proxy(A& a) { return Proxy{ a }; }
}

int main() {
Expand Down Expand Up @@ -805,9 +807,11 @@
\tcode{T} models \libconcept{copy_constructible} only if

\begin{itemize}
\item After the definition \tcode{T u = v;}, \tcode{u} is equal to \tcode{v}.
\item After the definition \tcode{T u = v;},
\tcode{u} is equal to \tcode{v}\iref{concepts.equality} and
\tcode{v} is not modified.

\item \tcode{T(v)} is equal to \tcode{v}.
\item \tcode{T(v)} is equal to \tcode{v} and does not modify \tcode{v}.
\end{itemize}

\end{itemdescr}
Expand Down
56 changes: 34 additions & 22 deletions source/containers.tex
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,9 @@
constant \\ \rowsep

\tcode{i <=> j} &
\tcode{strong_ordering}
if \tcode{X::iterator} meets the random access iterator requirements,
otherwise \tcode{strong_equality} &
&
&
\tcode{strong_ordering} &
&
\constraints \tcode{X::iterator} meets the random access iterator requirements. &
constant \\ \rowsep

\tcode{a == b} &
Expand Down Expand Up @@ -3121,6 +3119,13 @@
// \ref{array}, class template \tcode{array}
template<class T, size_t N> struct array;

template<class T, size_t N>
constexpr bool operator==(const array<T, N>& x, const array<T, N>& y);
template<class T, size_t N>
constexpr @\placeholder{synth-three-way-result}@<T>
operator<=>(const array<T, N>& x, const array<T, N>& y);

// \ref{array.special}, specialized algorithms
template<class T, size_t N>
constexpr void swap(array<T, N>& x, array<T, N>& y) noexcept(noexcept(x.swap(y)));

Expand Down Expand Up @@ -3319,6 +3324,14 @@
one of these tables and
for operations where there is additional semantic information.

\pnum
\tcode{array<T, N>} is a structural type\iref{temp.param} if
\tcode{T} is a structural type.
Two values \tcode{a1} and \tcode{a2} of type \tcode{array<T, N>}
are template-argument-equivalent\iref{temp.type} if and only if
each pair of corresponding elements in \tcode{a1} and \tcode{a2}
are template-argument-equivalent.

\pnum
The types \tcode{iterator} and \tcode{const_iterator} meet
the constexpr iterator requirements\iref{iterator.requirements.general}.
Expand Down Expand Up @@ -3383,10 +3396,6 @@

constexpr T * data() noexcept;
constexpr const T * data() const noexcept;

friend constexpr bool operator==(const array&, const array&) = default;
friend constexpr @\placeholder{synth-three-way-result}@<value_type>
operator<=>(const array&, const array&);
};

template<class T, class... U>
Expand Down Expand Up @@ -10529,7 +10538,7 @@
inline constexpr bool ranges::enable_view<span<ElementType, Extent>> =
Extent == 0 || Extent == dynamic_extent;
burblebee marked this conversation as resolved.
Show resolved Hide resolved
template<class ElementType, size_t Extent>
inline constexpr bool ranges::enable_safe_range<span<ElementType, Extent>> = true;
inline constexpr bool ranges::enable_borrowed_range<span<ElementType, Extent>> = true;

// \ref{span.objectrep}, views of object representation
template<class ElementType, size_t Extent>
Expand Down Expand Up @@ -10592,11 +10601,11 @@
template<class It, class End>
constexpr span(It first, End last);
template<size_t N>
constexpr span(element_type (&arr)[N]) noexcept;
template<size_t N>
constexpr span(array<value_type, N>& arr) noexcept;
template<size_t N>
constexpr span(const array<value_type, N>& arr) noexcept;
constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept;
template<class T, size_t N>
constexpr span(array<T, N>& arr) noexcept;
template<class T, size_t N>
constexpr span(const array<T, N>& arr) noexcept;
template<class R>
constexpr span(R&& r);
constexpr span(const span& other) noexcept = default;
Expand Down Expand Up @@ -10756,14 +10765,14 @@

\pnum
\throws
Nothing.
When and what \tcode{last - first} throws.
\end{itemdescr}

\indexlibraryctor{span}%
\begin{itemdecl}
template<size_t N> constexpr span(element_type (&arr)[N]) noexcept;
template<size_t N> constexpr span(array<value_type, N>& arr) noexcept;
template<size_t N> constexpr span(const array<value_type, N>& arr) noexcept;
template<size_t N> constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept;
template<class T, size_t N> constexpr span(array<T, N>& arr) noexcept;
template<class T, size_t N> constexpr span(const array<T, N>& arr) noexcept;
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -10777,10 +10786,13 @@
\pnum
\effects
Constructs a \tcode{span} that is a view over the supplied array.
\begin{note}
\tcode{type_identity_t} affects class template argument deduction.
\end{note}

\pnum
\ensures
\tcode{size() == N \&\& data() == data(arr)}.
\tcode{size() == N \&\& data() == data(arr)} is \tcode{true}.
\end{itemdescr}

\indexlibraryctor{span}%
Expand All @@ -10796,7 +10808,7 @@
\item \tcode{extent == dynamic_extent} is \tcode{true}.
\item \tcode{R} satisfies \tcode{ranges::\libconcept{contiguous_range}} and
\tcode{ranges::\libconcept{sized_range}}.
\item Either \tcode{R} satisfies \tcode{ranges::\libconcept{safe_range}} or
\item Either \tcode{R} satisfies \tcode{ranges::\libconcept{borrowed_range}} or
\tcode{is_const_v<element_type>} is \tcode{true}.
\item \tcode{remove_cvref_t<R>} is not a specialization of \tcode{span}.
\item \tcode{remove_cvref_t<R>} is not a specialization of \tcode{array}.
Expand All @@ -10815,7 +10827,7 @@
\item \tcode{R} models \tcode{ranges::\libconcept{contiguous_range}} and
\tcode{ranges::\libconcept{sized_range}}.
\item If \tcode{is_const_v<element_type>} is \tcode{false},
\tcode{R} models \tcode{ranges::\libconcept{safe_range}}.
\tcode{R} models \tcode{ranges::\libconcept{borrowed_range}}.
\end{itemize}

\pnum
Expand Down
7 changes: 7 additions & 0 deletions source/future.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2477,6 +2477,13 @@
For Windows-based operating systems a conversion from UTF-8 to
UTF-16 occurs.
\end{example}
\begin{note}
The example above is representative of
a historical use of \tcode{filesystem::u8path}.
Passing a \tcode{std::u8string} to \tcode{path}'s constructor is preferred
for an indication of UTF-8 encoding more consistent with
\tcode{path}'s handling of other encodings.
\end{note}
\end{itemdescr}

\rSec1[depr.atomics]{Deprecated atomic initialization}
Expand Down
62 changes: 13 additions & 49 deletions source/iostreams.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5548,21 +5548,23 @@

\indexlibrarymember{operator>>}{basic_istream}%
\begin{itemdecl}
template<class charT, class traits, class T>
basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>&& is, T&& x);
template<class Istream, class T>
Istream&& operator>>(Istream&& is, T&& x);
\end{itemdecl}

\begin{itemdescr}
\pnum
\constraints
The expression \tcode{is >> std::forward<T>(x)} is well-formed when treated as an unevaluated operand.
The expression \tcode{is >> std::forward<T>(x)} is well-formed
when treated as an unevaluated operand and
\tcode{Istream} is publicly and unambiguously derived from \tcode{ios_base}.

\pnum
\effects
Equivalent to:
\begin{codeblock}
is >> std::forward<T>(x);
return is;
return std::move(is);
\end{codeblock}
\end{itemdescr}

Expand Down Expand Up @@ -6759,22 +6761,24 @@

\indexlibrarymember{operator<<}{basic_ostream}%
\begin{itemdecl}
template<class charT, class traits, class T>
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>&& os, const T& x);
template<class Ostream, class T>
Ostream&& operator<<(Ostream&& os, const T& x);
\end{itemdecl}

\begin{itemdescr}
\pnum
\constraints
The expression \tcode{os << x} is well-formed when treated as an unevaluated operand.
The expression \tcode{os << x} is well-formed
when treated as an unevaluated operand and
\tcode{Ostream} is publicly and unambiguously derived from \tcode{ios_base}.

\pnum
\effects
As if by: \tcode{os << x;}

\pnum
\returns
\tcode{os}.
\tcode{std::move(os)}.
\end{itemdescr}


Expand Down Expand Up @@ -11054,7 +11058,7 @@
basic_osyncstream(basic_osyncstream&&) noexcept;
~basic_osyncstream();

// \ref{syncstream.osyncstream.assign}, assignment
// assignment
basic_osyncstream& operator=(basic_osyncstream&&) noexcept;

// \ref{syncstream.osyncstream.members}, member functions
Expand Down Expand Up @@ -11140,46 +11144,6 @@
\tcode{nullptr == other.get_wrapped()} is \tcode{true}.
\end{itemdescr}

\indexlibrarydtor{basic_osyncstream}%
\begin{itemdecl}
~basic_osyncstream();
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Calls \tcode{emit()}.
If an exception is thrown from \tcode{emit()},
that exception is caught and ignored.
\end{itemdescr}

\rSec3[syncstream.osyncstream.assign]{Assignment}

\indexlibrarymember{operator=}{basic_osyncstream}%
\begin{itemdecl}
basic_osyncstream& operator=(basic_osyncstream&& rhs) noexcept;
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
First, calls \tcode{emit()}.
If an exception is thrown from \tcode{emit()},
that exception is caught and ignored.
Move assigns \tcode{sb} from \tcode{rhs.sb}.
\begin{note}
This disassociates \tcode{rhs}
from its wrapped stream buffer
ensuring destruction of \tcode{rhs} produces no output.
\end{note}

\pnum
\ensures
\tcode{nullptr == rhs.get_wrapped()} is \tcode{true}.
\tcode{get_wrapped()} returns the value
previously returned by \tcode{rhs.get_wrapped()}.
\end{itemdescr}

\rSec3[syncstream.osyncstream.members]{Member functions}

\indexlibrarymember{set_emit_on_sync}{basic_osyncstream}%
Expand Down
32 changes: 20 additions & 12 deletions source/iterators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@

// \ref{iterators.common}, common iterators
template<input_or_output_iterator I, sentinel_for<I> S>
requires (!same_as<I, S>)
requires (!same_as<I, S> && copyable<I>)
class common_iterator;

template<class I, class S>
Expand Down Expand Up @@ -1058,9 +1058,13 @@
\begin{itemize}
\item \tcode{iter_move(E)}, if
\tcode{E} has class or enumeration type and
\tcode{iter_move(E)} is a well-formed expression with overload
resolution performed in a context that does not include a declaration of
\tcode{ranges::iter_move}.
\tcode{iter_move(E)} is a well-formed expression when treated as an unevaluated operand,
with overload resolution performed in a context
that does not include a declaration of \tcode{ranges::iter_move}
but does include the declaration
\begin{codeblock}
void iter_move();
\end{codeblock}

\item Otherwise, if the expression \tcode{*E} is well-formed:
\begin{itemize}
Expand Down Expand Up @@ -1357,13 +1361,17 @@
\end{itemize}

\pnum
All integer-class types are explicitly convertible to all integral types and
implicitly and explicitly convertible from all integral types.
Expressions of integer-class type are
explicitly convertible to any integral type.
Expressions of integral type are
both implicitly and explicitly convertible to any integer-class type.
Conversions between integral and integer-class types
do not exit via an exception.

\pnum
All integer-class types are contextually convertible to \tcode{bool}
as if by \tcode{bool(a != I(0))}, where \tcode{a} is an
instance of the integral-class type \tcode{I}.
An expression \tcode{E} of integer-class type \tcode{I} is
contextually convertible to \tcode{bool}
as if by \tcode{bool(E != I(0))}.

\pnum
All integer-class types model
Expand Down Expand Up @@ -4556,7 +4564,7 @@
\begin{itemdescr}
\pnum
\returns
\tcode{move_iterator<Iterator>(i)}.
\tcode{move_iterator<Iterator>(std::move(i))}.
\end{itemdescr}

\rSec3[move.sentinel]{Class template \tcode{move_sentinel}}
Expand Down Expand Up @@ -4704,7 +4712,7 @@
\begin{codeblock}
namespace std {
template<input_or_output_iterator I, sentinel_for<I> S>
requires (!same_as<I, S>)
requires (!same_as<I, S> && copyable<I>)
class common_iterator {
public:
constexpr common_iterator() = default;
Expand Down Expand Up @@ -5238,7 +5246,7 @@

\pnum
\effects
Initializes \tcode{current} with \tcode{i} and
Initializes \tcode{current} with \tcode{std::move(i)} and
\tcode{length} with \tcode{n}.
\end{itemdescr}

Expand Down
Loading