C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Range version constructor for std::valarray?

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Thu, 25 Apr 2024 11:25:14 +0200
On 25/04/2024 06.39, Hewill Kang via Std-Proposals wrote:
> Hi all,
>
> I know no one cares about `std::valarray`, and I'm curious if anyone actually uses it.
> I'm wondering though, does it make sense to provide a range-version constructor for it?
> `std::valarray` is indeed a `contiguous_range` in C++20, but its constructor does not provide any iterator-pair or range versions. I suspect this is because the iterator system may not have matured when it was introduced.
> Providing a range-version of the constructor allows us to construct it through `ranges::to`, otherwise, there is currently no way for `ranges::to` to construct a `std::valarray` (unless `ranges::to` provides a new branch that uses `C(ranges::data(r), ranges::size(r))` to make objects, which also enables Eigen classes).
> So does it make sense to provide such new constructors? Is there any value in doing this? Or is it just like stated previously, no one actually cares at all?

I think you need to demonstrate actual use of std::valarray with ranges,
instead of just showing an abstract "wouldn't it be nice" opinion.

Otherwise, this looks like a waste of committee time.

Jens

Received on 2024-04-25 09:25:19