Date: Thu, 23 May 2024 12:25:39 -0500
On Thu, May 23, 2024, 11:39 AM Hewill Kang via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> The standard specifies a legal case for `std::array` where `N` is `0`. It
> seems to me that `array<T, 0>` always meets the semantic requirements of
> `ranges::view`.
> I'm wondering if there is value in making it a `view` since it behaves
> very similarly to `views::empty<T>`? For example:
>
> template<class T>
> constexpr bool ranges::enable_view<array<T, 0>> = true;
> template<class T>
> constexpr bool ranges::enable_borrowed_range<array<T, 0>> = true;
>
> Is this reasonable or is this just a bad idea?
>
> Hewill
>
This also gets into like... well should array<T, 1> be a view? single is a
view.
And then array<T, 2> is like concat with two singles, and that is a view.
etc.
Plus what does O(1) copyable even mean on a type that doesn't have variable
size? Is array<T, N> always O(1) copyable?
Barry
>
std-proposals_at_[hidden]> wrote:
> The standard specifies a legal case for `std::array` where `N` is `0`. It
> seems to me that `array<T, 0>` always meets the semantic requirements of
> `ranges::view`.
> I'm wondering if there is value in making it a `view` since it behaves
> very similarly to `views::empty<T>`? For example:
>
> template<class T>
> constexpr bool ranges::enable_view<array<T, 0>> = true;
> template<class T>
> constexpr bool ranges::enable_borrowed_range<array<T, 0>> = true;
>
> Is this reasonable or is this just a bad idea?
>
> Hewill
>
This also gets into like... well should array<T, 1> be a view? single is a
view.
And then array<T, 2> is like concat with two singles, and that is a view.
etc.
Plus what does O(1) copyable even mean on a type that doesn't have variable
size? Is array<T, N> always O(1) copyable?
Barry
>
Received on 2024-05-23 17:25:53