[libcxx-commits] [PATCH] D69882: [libcxx] Implement P0325: to_array from LFTS with updates.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 13 09:32:30 PST 2019


ldionne added inline comments.


================
Comment at: libcxx/include/array:504
+  static_assert(
+      is_copy_constructible_v<_Tp>,
+      "[array.creation]/1: to_array requires copy constructible elements.");
----------------
lichray wrote:
> ldionne wrote:
> > Did they really mean `is_constructible_v<T, T&>` in the paper? They say:
> > 
> > > Mandates: `is_array_v<T>` is `false` and `is_constructible_v<T, T&>` is `true`.
> > 
> > It seems like they should have said this instead?
> > 
> > > Mandates: `is_array_v<T>` is `false` and `is_copy_constructible_v<T>` is `true`.
> > 
> > Regardless, I think it would be better if you used `is_constructible_v<T, T&>` here, since that's what the paper says.
> > 
> > @lichray , why did you write the wording that way? Any reason?
> LWG raised this, probably because someone realized that built-in array initializer and `std::array` aggregate initialization allow types that "copy-constructs" from mutable references, so it seems not so motivated to ban those in `to_array`.
Thanks a lot for the context. Ugh, bad design IMO, since now we have a subtle difference with anything that requires the usual copy-constructibility. But oh well. @curdeius let's match what the paper says.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69882/new/

https://reviews.llvm.org/D69882





More information about the libcxx-commits mailing list