Created on 2023-12-31.00:00:00 last changed 8 months ago
Proposed resolution:
This wording is relative to N4971.
Modify [range.single.view] as indicated:
[…]namespace std::ranges { template<move_constructible T> requires is_object_v<T> class single_view : public view_interface<single_view<T>> { […] public: […] constexpr T* begin() noexcept; constexpr const T* begin() const noexcept; constexpr T* end() noexcept; constexpr const T* end() const noexcept; static constexpr bool empty() noexcept; static constexpr size_t size() noexcept; constexpr T* data() noexcept; constexpr const T* data() const noexcept; }; […] }constexpr T* end() noexcept; constexpr const T* end() const noexcept;-5- Effects: Equivalent to: return data() + 1;
static constexpr bool empty() noexcept;-?- Effects: Equivalent to: return false;
[ Tokyo 2024-03-23; Status changed: Voting → WP. ]
[ 2024-03-12; Reflector poll ]
Set status to Tentatively Ready after six votes in favour during reflector poll.
Although single_view::empty can be synthesized through view_interface, it seems more worthwhile to provide a static empty for it which eliminates the need to pass in an object parameter, guarantees noexcept-ness, and is consistent with the design of empty_view (demo):
#include <ranges>
auto empty = std::views::empty<int>;
static_assert(noexcept(empty.empty()));
static_assert(noexcept(empty.size()));
auto single = std::views::single(0);
static_assert(noexcept(single.empty())); // fire
static_assert(noexcept(single.size()));
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-04-02 10:29:12 | admin | set | messages: + msg14043 |
2024-04-02 10:29:12 | admin | set | status: voting -> wp |
2024-03-18 09:32:04 | admin | set | status: ready -> voting |
2024-03-12 00:57:03 | admin | set | messages: + msg13994 |
2024-03-12 00:57:03 | admin | set | status: new -> ready |
2024-01-13 17:19:15 | admin | set | messages: + msg13914 |
2023-12-31 00:00:00 | admin | create |