Created on 2025-04-18.00:00:00 last changed 2 weeks ago
Proposed resolution:
This wording is relative to N5008.
Modify [counted.iterator] as indicated:
namespace std { template<input_or_output_iterator I> class counted_iterator { public: […] friend constexpr iter_difference_t<I> operator-( const counted_iterator& x, default_sentinel_t) noexcept; friend constexpr iter_difference_t<I> operator-( default_sentinel_t, const counted_iterator& y) noexcept; […] friend constexpr bool operator==( const counted_iterator& x, default_sentinel_t) noexcept; […] }; […] }
Modify [counted.iter.nav] as indicated:
friend constexpr iter_difference_t<I> operator-( const counted_iterator& x, default_sentinel_t) noexcept;-15- Effects: Equivalent to:
return -x.length;
friend constexpr iter_difference_t<I> operator-( default_sentinel_t, const counted_iterator& y) noexcept;-16- Effects: Equivalent to:
return y.length;
Modify [counted.iter.cmp] as indicated:
friend constexpr bool operator==( const counted_iterator& x, default_sentinel_t) noexcept;-3- Effects: Equivalent to:
return x.length == 0;
`counted_iterator` can be compared or subtracted from `default_sentinel_t`, which only involves simple integer arithmetic and does not have any Preconditions.
In this case, it is reasonable to declare them asnoexcept
.
History | |||
---|---|---|---|
Date | User | Action | Args |
2025-04-21 10:17:51 | admin | set | messages: + msg14727 |
2025-04-18 00:00:00 | admin | create |