Date: Thu, 25 Apr 2024 12:39:28 +0800
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?
Hewill
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?
Hewill
Received on 2024-04-25 04:39:40