Re: [multi] Formal Review Begins

Rainer Deyke via Boost <[email protected]>
Newsgroups gmane.comp.lib.boost.devel
Message-ID <[email protected]>
On 3/12/26 17:02, Ruben Perez via Boost wrote:
> * Subarrays and array references are not copyable. This is unusual,
> since all reference
>    types I know of (span, mdspan, string_view, url_view,
> mysql::rows_view) are copyable.
>    It looks like the library tries to make the type appear like a reference, but
>    I don't think that's wise - exotic references are not language references,
>    no matter how hard you try.
>    I would make subarrays copyable to avoid surprises.

I would agree, except that this would actually break some major uses of 
subarrays.  For example:

   multi::array<int, 2> a({5, 5}), b({5, 5});
   a({0, 2}, {0, 2}) = b({0, 2}, {0, 2});

This copies a 2×2 square from one array to another array.  a's 
operator() returns a subarray.  b's operator() returns another subarray. 
  The first subarray's operator= copies the data from b to a.  This can 
only work if subarray::operator= copies the actual data instead of 
changing the array the subarray refers to.


-- 
Rainer Deyke - [email protected]

_______________________________________________
Boost mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.boost.org/mailman3/lists/boost.lists.boost.org/
Archived at: https://lists.boost.org/archives/list/[email protected]/message/3AJUROKNZLA7G4VZT7QHZ4QNS7ID2LXL/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.