Skip to content

Commit

Permalink
P1871R1 disable_sized_sentinel_for (#607)
Browse files Browse the repository at this point in the history
Rename the variable template `disable_sized_sentinel` to `disable_sized_sentinel_for` for consistency with the name of the associated concept `sized_sentinel_for`.

Addresses #39.
  • Loading branch information
CaseyCarter authored Mar 16, 2020
1 parent 285187b commit 2ff4d34
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -744,17 +744,20 @@ concept input_or_output_iterator = requires(_It __i) {

// CONCEPT sentinel_for
template <class _Se, class _It>
concept sentinel_for = semiregular<_Se> && input_or_output_iterator<_It> && _Weakly_equality_comparable_with<_Se, _It>;
concept sentinel_for = semiregular<_Se>
&& input_or_output_iterator<_It>
&& _Weakly_equality_comparable_with<_Se, _It>;
// clang-format on

// VARIABLE TEMPLATE disable_sized_sentinel
// VARIABLE TEMPLATE disable_sized_sentinel_for
template <class _Se, class _It>
inline constexpr bool disable_sized_sentinel = false;
inline constexpr bool disable_sized_sentinel_for = false;

// CONCEPT sized_sentinel_for
// clang-format off
template <class _Se, class _It>
concept sized_sentinel_for = sentinel_for<_Se, _It> && !disable_sized_sentinel<remove_cv_t<_Se>, remove_cv_t<_It>>
concept sized_sentinel_for = sentinel_for<_Se, _It>
&& !disable_sized_sentinel_for<remove_cv_t<_Se>, remove_cv_t<_It>>
&& requires(const _It& __i, const _Se& __s) {
{ __s - __i } -> same_as<iter_difference_t<_It>>;
{ __i - __s } -> same_as<iter_difference_t<_It>>;
Expand Down
1 change: 1 addition & 0 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
// P1716R3 Range Comparison Algorithms Are Over-Constrained
// P1754R1 Rename Concepts To standard_case
// P1870R1 Rename forwarding-range To borrowed_range (Was safe_range before LWG-3379)
// P1871R1 disable_sized_sentinel_for
// P1872R0 span Should Have size_type, Not index_type
// P1878R1 Constraining Readable Types
// P1956R1 <bit> has_single_bit(), bit_ceil(), bit_floor(), bit_width()
Expand Down
2 changes: 1 addition & 1 deletion tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ std::iter_difference_t<iterator_archetype<J>> operator-(
// clang-format on

template <class I>
inline constexpr bool std::disable_sized_sentinel<sized_sentinel_archetype<11>, I> = true;
inline constexpr bool std::disable_sized_sentinel_for<sized_sentinel_archetype<11>, I> = true;

inline constexpr std::size_t sized_sentinel_archetype_max = 12;

Expand Down

0 comments on commit 2ff4d34

Please sign in to comment.