[libcxx-commits] [PATCH] D144277: [libc++][format] Addresses	LWG3881.
    Tim Song via Phabricator via libcxx-commits 
    libcxx-commits at lists.llvm.org
       
    Fri Mar  3 20:33:55 PST 2023
    
    
  
tcanens 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_;
 
----------------
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`.
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