commit 1b425f3ac516f7250e9f7eac7cd4fe0908ccfa4e
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Feb 19 21:56:29 2020 +0000
libstdc++: make common_iterator<I, S> require copyable<I> (LWG 3385)
* include/bits/stl_iterator.h (common_iterator): Add copyable<I>
requirement (LWG 3385).
* testsuite/24_iterators/headers/iterator/synopsis_c++20.cc: Adjust
expected declaration.
@@ -1,5 +1,10 @@
2020-02-19 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/stl_iterator.h (common_iterator): Add copyable<I>
+ requirement (LWG 3385).
+ * testsuite/24_iterators/headers/iterator/synopsis_c++20.cc: Adjust
+ expected declaration.
+
* include/std/ranges (take_while_view, drop_view, drop_while_view)
(elements_view:_Iterator): Initialize data members (LWG 3364).
@@ -1426,7 +1426,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// An iterator/sentinel adaptor for representing a non-common range.
template<input_or_output_iterator _It, sentinel_for<_It> _Sent>
- requires (!same_as<_It, _Sent>)
+ requires (!same_as<_It, _Sent>) && copyable<_It>
class common_iterator
{
template<typename _Tp, typename _Up>
@@ -56,7 +56,7 @@ namespace std
template<semiregular S> class move_sentinel;
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>
commit 7433536b3d864c0d8d5180348690e1c280a3eaf2
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Feb 19 22:00:14 2020 +0000
libstdc++: Add default-initializers to views (LWG 3364)
* include/std/ranges (take_while_view, drop_view, drop_while_view)
(elements_view:_Iterator): Initialize data members (LWG 3364).
@@ -1,5 +1,8 @@
2020-02-19 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/ranges (take_while_view, drop_view, drop_while_view)
+ (elements_view:_Iterator): Initialize data members (LWG 3364).
+
* libsupc++/compare (three_way_comparable): Remove always-false check
that should have been removed with weak_equality (P1959R0).
(three_way_comparable_with): Likewise. Reorder requirements (LWG 3360).
@@ -2008,7 +2008,7 @@ namespace views
{ return __y._M_end == __x || !std::__invoke(*__y._M_pred, *__x); }
};
- _Vp _M_base;
+ _Vp _M_base = _Vp();
__detail::__box<_Pred> _M_pred;
public:
@@ -2068,8 +2068,8 @@ namespace views
class drop_view : public view_interface<drop_view<_Vp>>
{
private:
- _Vp _M_base;
- range_difference_t<_Vp> _M_count;
+ _Vp _M_base = _Vp();
+ range_difference_t<_Vp> _M_count = 0;
public:
drop_view() = default;
@@ -2147,7 +2147,7 @@ namespace views
class drop_while_view : public view_interface<drop_while_view<_Vp, _Pred>>
{
private:
- _Vp _M_base;
+ _Vp _M_base = _Vp();
__detail::__box<_Pred> _M_pred;
public:
@@ -3179,7 +3179,7 @@ namespace views
{
using _Base = conditional_t<_Const, const _Vp, _Vp>;
- iterator_t<_Base> _M_current;
+ iterator_t<_Base> _M_current = iterator_t<_Base>();
friend _Iterator<!_Const>;
commit 256f67aa078de0e7bf53a0870c2cb87ab90cda09
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Feb 19 21:45:59 2020 +0000
libstdc++: Simplify std::three_way_comparable_with (LWG 3360)
This also removes a useless condition that was supposed to be removed by
the P1959R0 changes, but left in when that was implemented.
* libsupc++/compare (three_way_comparable): Remove always-false check
that should have been removed with weak_equality (P1959R0).
(three_way_comparable_with): Likewise. Reorder requirements (LWG 3360).
@@ -1,5 +1,9 @@
2020-02-19 Jonathan Wakely <jwakely@redhat.com>
+ * libsupc++/compare (three_way_comparable): Remove always-false check
+ that should have been removed with weak_equality (P1959R0).
+ (three_way_comparable_with): Likewise. Reorder requirements (LWG 3360).
+
* include/std/concepts (__detail::__partially_ordered_with): Move here
from <compare>.
(totally_ordered, totally_ordered_with): Use __partially_ordered_with
@@ -417,8 +417,7 @@ namespace std
template<typename _Tp, typename _Cat = partial_ordering>
concept three_way_comparable
= __detail::__weakly_eq_cmp_with<_Tp, _Tp>
- && (!convertible_to<_Cat, partial_ordering>
- || __detail::__partially_ordered_with<_Tp, _Tp>)
+ && __detail::__partially_ordered_with<_Tp, _Tp>
&& requires(const remove_reference_t<_Tp>& __a,
const remove_reference_t<_Tp>& __b) {
{ __a <=> __b } -> __detail::__compares_as<_Cat>;
@@ -426,16 +425,15 @@ namespace std
template<typename _Tp, typename _Up, typename _Cat = partial_ordering>
concept three_way_comparable_with
- = __detail::__weakly_eq_cmp_with<_Tp, _Up>
- && (!convertible_to<_Cat, partial_ordering>
- || __detail::__partially_ordered_with<_Tp, _Up>)
- && three_way_comparable<_Tp, _Cat>
+ = three_way_comparable<_Tp, _Cat>
&& three_way_comparable<_Up, _Cat>
&& common_reference_with<const remove_reference_t<_Tp>&,
const remove_reference_t<_Up>&>
&& three_way_comparable<
common_reference_t<const remove_reference_t<_Tp>&,
const remove_reference_t<_Up>&>, _Cat>
+ && __detail::__weakly_eq_cmp_with<_Tp, _Up>
+ && __detail::__partially_ordered_with<_Tp, _Up>
&& requires(const remove_reference_t<_Tp>& __t,
const remove_reference_t<_Up>& __u) {
{ __t <=> __u } -> __detail::__compares_as<_Cat>;
commit 0294dc5f4eec5a07d70fac48f75c498c3b1a339b
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Feb 19 21:40:03 2020 +0000
libstdc++: Simplify std::totally_ordered (LWG 3331)
* include/std/concepts (__detail::__partially_ordered_with): Move here
from <compare>.
(totally_ordered, totally_ordered_with): Use __partially_ordered_with
to simplify definition (LWG 3331).
* libsupc++/compare (__detail::__partially_ordered_with): Move to
<concepts>.
@@ -1,5 +1,12 @@
2020-02-19 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/concepts (__detail::__partially_ordered_with): Move here
+ from <compare>.
+ (totally_ordered, totally_ordered_with): Use __partially_ordered_with
+ to simplify definition (LWG 3331).
+ * libsupc++/compare (__detail::__partially_ordered_with): Move to
+ <concepts>.
+
* include/std/concepts (totally_ordered_with): Remove redundant
requirement (LWG 3329).
@@ -297,16 +297,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__detail::__cref<_Up>>>
&& __detail::__weakly_eq_cmp_with<_Tp, _Up>;
+ namespace __detail
+ {
+ template<typename _Tp, typename _Up>
+ concept __partially_ordered_with
+ = requires(const remove_reference_t<_Tp>& __t,
+ const remove_reference_t<_Up>& __u) {
+ { __t < __u } -> __boolean_testable;
+ { __t > __u } -> __boolean_testable;
+ { __t <= __u } -> __boolean_testable;
+ { __t >= __u } -> __boolean_testable;
+ { __u < __t } -> __boolean_testable;
+ { __u > __t } -> __boolean_testable;
+ { __u <= __t } -> __boolean_testable;
+ { __u >= __t } -> __boolean_testable;
+ };
+ } // namespace __detail
+
// [concept.totallyordered], concept totally_ordered
template<typename _Tp>
concept totally_ordered
= equality_comparable<_Tp>
- && requires(__detail::__cref<_Tp> __a, __detail::__cref<_Tp> __b) {
- { __a < __b } -> __detail::__boolean_testable;
- { __a > __b } -> __detail::__boolean_testable;
- { __a <= __b } -> __detail::__boolean_testable;
- { __a >= __b } -> __detail::__boolean_testable;
- };
+ && __detail::__partially_ordered_with<_Tp, _Tp>;
template<typename _Tp, typename _Up>
concept totally_ordered_with
@@ -314,16 +326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& equality_comparable_with<_Tp, _Up>
&& totally_ordered<common_reference_t<__detail::__cref<_Tp>,
__detail::__cref<_Up>>>
- && requires(__detail::__cref<_Tp> __t, __detail::__cref<_Up> __u) {
- { __t < __u } -> __detail::__boolean_testable;
- { __t > __u } -> __detail::__boolean_testable;
- { __t <= __u } -> __detail::__boolean_testable;
- { __t >= __u } -> __detail::__boolean_testable;
- { __u < __t } -> __detail::__boolean_testable;
- { __u > __t } -> __detail::__boolean_testable;
- { __u <= __t } -> __detail::__boolean_testable;
- { __u >= __t } -> __detail::__boolean_testable;
- };
+ && __detail::__partially_ordered_with<_Tp, _Up>;
template<typename _Tp>
concept regular = semiregular<_Tp> && equality_comparable<_Tp>;
@@ -411,20 +411,6 @@ namespace std
template<typename _Tp, typename _Cat>
concept __compares_as
= same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>;
-
- template<typename _Tp, typename _Up>
- concept __partially_ordered_with
- = requires(const remove_reference_t<_Tp>& __t,
- const remove_reference_t<_Up>& __u) {
- { __t < __u } -> __boolean_testable;
- { __t > __u } -> __boolean_testable;
- { __t <= __u } -> __boolean_testable;
- { __t >= __u } -> __boolean_testable;
- { __u < __t } -> __boolean_testable;
- { __u > __t } -> __boolean_testable;
- { __u <= __t } -> __boolean_testable;
- { __u >= __t } -> __boolean_testable;
- };
} // namespace __detail
// [cmp.concept], concept three_way_comparable
commit 241ed965509ac931e9ae5f331d0294c1ee4ccd89
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Feb 19 21:31:06 2020 +0000
libstdc++: Simplify std::totally_ordered_with (LWG 3329)
* include/std/concepts (totally_ordered_with): Remove redundant
requirement (LWG 3329).
@@ -1,5 +1,8 @@
2020-02-19 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/concepts (totally_ordered_with): Remove redundant
+ requirement (LWG 3329).
+
* include/std/ranges (__detail::__convertible_to_non_slicing): New
helper concept.
(__detail::__pair_like_convertible_to): Remove.
@@ -311,10 +311,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp, typename _Up>
concept totally_ordered_with
= totally_ordered<_Tp> && totally_ordered<_Up>
- && common_reference_with<__detail::__cref<_Tp>, __detail::__cref<_Up>>
+ && equality_comparable_with<_Tp, _Up>
&& totally_ordered<common_reference_t<__detail::__cref<_Tp>,
__detail::__cref<_Up>>>
- && equality_comparable_with<_Tp, _Up>
&& requires(__detail::__cref<_Tp> __t, __detail::__cref<_Up> __u) {
{ __t < __u } -> __detail::__boolean_testable;
{ __t > __u } -> __detail::__boolean_testable;