One reviewer suggests: iota + cartesian_product should mean that we can construct a range over the input mdarray or mdspan, and thus should be able to use ranges::to construction. Thus, we shouldn't have to preallocate an empty container with default-constructed elements. This would remove the requirement that elements be default constructible.
However, see #13 (if we need to use a particular parallel ExecutionPolicy for iterating over elements, then the current ranges::to interface will not suffice).
The question is whether we should permit implementations to separate container allocation (with default construction of elements if they are not trivially default constructible) from copying elements into the container. This permission would let conforming implementations use a parallel algorithm to copy elements into the container, rather than (essentially) requiring ranges::to. In turn, this permission would make it possible to write mdarray in Standard C++ without requiring default constructibility of the elements. (Note that vector does not require default constructibility of its elements, unless you invoke one of the vector constructors that default-constructs elements.)
This comes from 1684R2 LEWG review on 2022/04/19.
One reviewer suggests:
iota
+cartesian_product
should mean that we can construct a range over the inputmdarray
ormdspan
, and thus should be able to useranges::to
construction. Thus, we shouldn't have to preallocate an empty container with default-constructed elements. This would remove the requirement that elements be default constructible.However, see #13 (if we need to use a particular parallel
ExecutionPolicy
for iterating over elements, then the currentranges::to
interface will not suffice).The question is whether we should permit implementations to separate container allocation (with default construction of elements if they are not trivially default constructible) from copying elements into the container. This permission would let conforming implementations use a parallel algorithm to copy elements into the container, rather than (essentially) requiring
ranges::to
. In turn, this permission would make it possible to writemdarray
in Standard C++ without requiring default constructibility of the elements. (Note thatvector
does not require default constructibility of its elements, unless you invoke one of thevector
constructors that default-constructs elements.)