[libcxx-commits] [PATCH] D144277: [libc++][format] Addresses LWG3881.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Mar 4 05:04:55 PST 2023


Mordante added inline comments.


================
Comment at: libcxx/include/__format/container_adaptor.h:42
+  using __maybe_const_adaptor   = __maybe_const<is_const_v<__maybe_const_container>, _Adaptor>;
+  formatter<ranges::ref_view<__maybe_const_container>, _CharT> __underlying_;
 
----------------
tcanens wrote:
> Mordante wrote:
> > ldionne wrote:
> > > Any reason why you're using `ref_view` instead of `all_t`? Those are not always equivalent -- is the difference not relevant?
> > Mainly since that is what the wording in the LWG issue is. Victor's original proposed wording did use `views::all_t`.
> > This is the rationale in the issue to make the change:
> > ```
> > [2023-02-10 Tim provides updated wording]
> > 
> > The container elements may not be const-formattable so we cannot use the const formatter unconditionally. Also the current wording is broken because an adaptor is not range and we cannot use fmt-maybe-const on the adaptor — only the underlying container.
> > ```
> This is for passing a slightly disguised container into a function, not for view composition. It does not need the sometimes-by-reference-sometimes-by-copy-sometimes-ill-formed behavior of `all_t`.
Thanks for the information.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144277



More information about the libcxx-commits mailing list