[libcxx-commits] [PATCH] D145847: [libc++][format] Implements LWG3892.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 12 07:10:25 PDT 2023


Mordante created this revision.
Herald added a project: All.
Mordante updated this revision to Diff 504373.
Mordante added a comment.
Mordante published this revision for review.
Mordante added reviewers: ldionne, vitaut.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

CI fixes


This LWG issue is based on the discussion regarding

  P2733R3 Fix handling of empty specifiers in std::format

This paper was disussed and changed a few times in LEWG during the
Issaquah meeting. The paper was not voted in, instead LEWG asked for
a DR against C++26.

This LWG issue contains the direction voted by LEWG. This issue has not
been voted in yet. However it fixes some of the defencies on the
container based formatting. Without this fix the range-default-formatter
for strings looks bad when used in containers.

The changes of this issue match the intended changes of P27333.

type                      fmt     before     after (if changed)
---------------------------------------------------------------

char                      {}      a
char                      {:?}    'a'
array<char, 1>            {}      ['a']
array<char, 1>            {::}    [a]
array<char, 1>            {::c}   [a]
array<char, 1>            {::?}   ['a']
map<char, char>           {}      {a: a}     -> {'a': 'a'}
map<char, char>           {::}    {'a': 'a'}
set<char>                 {}      {'a'}
set<char>                 {::}    {a}
set<char>                 {::c}   {a}
set<char>                 {::?}   {'a'}
tuple<char>               {}      ('a')
stack<char>               {}      ['a']
stack<char>               {::}    [a]
stack<char>               {::c}   [a]
stack<char>               {::?}   ['a']
array<array<char, 1>, 1>  {}      [[a]]      -> {'a': 'a'}
array<array<char, 1>, 1>  {::}    [['a']]
array<array<char, 1>, 1>  {:::}   [[a]]
array<array<char, 1>, 1>  {:::c}  [[a]]
array<array<char, 1>, 1>  {:::?}  [['a']]
array<tuple<char>, 1>     {}      [(a)]      -> [('a')]
tuple<tuple<char>>        {}      ((a))      -> (('a'))
tuple<array<char, 1>>     {}      ([a])      -> (['a'])

Note the optimization text as mentioned in the tuple formatter can't be
done. The call to parse may affect the formatter so its state needs to
be preserved.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145847

Files:
  libcxx/docs/Status/Cxx2bIssues.csv
  libcxx/include/__format/formatter_tuple.h
  libcxx/include/__format/range_formatter.h
  libcxx/test/std/utilities/format/format.range/format.range.fmtdef/format.pass.cpp
  libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.format.pass.cpp
  libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h
  libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.pass.cpp
  libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.format.pass.cpp
  libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h
  libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.pass.cpp
  libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.format.pass.cpp
  libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h
  libcxx/test/std/utilities/format/format.range/format.range.formatter/format.pass.cpp
  libcxx/test/std/utilities/format/format.tuple/format.functions.format.pass.cpp
  libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h
  libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
  libcxx/test/support/format.functions.common.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145847.504373.patch
Type: text/x-patch
Size: 44979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230312/6d339ec6/attachment-0001.bin>


More information about the libcxx-commits mailing list