Date: Tue, 2 Jul 2019 10:06:19 +0100
Limitations of an underlying type dont justify anything. That's the point
of encapsulating it within a superior type system.
On Tue, 2 Jul 2019, 09:59 Bjorn Reese via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
> On 7/1/19 11:47 PM, Jorg Brown wrote:
> > A vector can be empty; a string can be empty; a string_view can be
> > empty; even a std::array can be empty. So why block a std::span from
> > being empty, just because its extent isn't dynamic? I think this would
> > end up blocking some compile-time programming cases.
>
> A span with dynamic extent can be empty.
>
> > Speaking of which, it's annoying that this doesn't currently work, due
> > to data()'s implemenetation within std::array:
> >
> > constexpr const std::array<int, 0> ar0{};
> > constexpr auto spanned_empty_array = std::span<const int, 0>{ar0};
> >
> > See https://godbolt.org/z/L4-9r8
>
> It does not seem to work for begin/end (or cbegin/cend) either when
> N = 0.
>
> Furthermore, we cannot have zero-sized C arrays.
>
> That sort of argues in favor of using zero as the value for dynamic
> extent.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
of encapsulating it within a superior type system.
On Tue, 2 Jul 2019, 09:59 Bjorn Reese via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
> On 7/1/19 11:47 PM, Jorg Brown wrote:
> > A vector can be empty; a string can be empty; a string_view can be
> > empty; even a std::array can be empty. So why block a std::span from
> > being empty, just because its extent isn't dynamic? I think this would
> > end up blocking some compile-time programming cases.
>
> A span with dynamic extent can be empty.
>
> > Speaking of which, it's annoying that this doesn't currently work, due
> > to data()'s implemenetation within std::array:
> >
> > constexpr const std::array<int, 0> ar0{};
> > constexpr auto spanned_empty_array = std::span<const int, 0>{ar0};
> >
> > See https://godbolt.org/z/L4-9r8
>
> It does not seem to work for begin/end (or cbegin/cend) either when
> N = 0.
>
> Furthermore, we cannot have zero-sized C arrays.
>
> That sort of argues in favor of using zero as the value for dynamic
> extent.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2019-07-02 04:08:18