]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
include/types_fmt: use fmt::join() to format containers 47255/head
authorKefu Chai <tchaikov@gmail.com>
Sun, 24 Jul 2022 16:16:33 +0000 (00:16 +0800)
committerKefu Chai <tchaikov@gmail.com>
Mon, 25 Jul 2022 13:59:07 +0000 (21:59 +0800)
commitb7b7ff4cce3669fba69e9468304465bacdc7b7c5
tree9d53a698fc727290f1d87679bf535dfae8c4d663
parentb287fadde3e0e660fe69afad23c649b4cc6482fa
include/types_fmt: use fmt::join() to format containers

* add formatter for classes with stream insertion operator.
  as in fmtlib v6.1.2, which is the one shipped with ubuntu focal,
  fmt::join() requires the printed element to have formatter.
  see https://github.com/fmtlib/fmt/issues/2040 and
  https://github.com/fmtlib/fmt/issues/1462
* use template parameter pack to represent container template argument,
  simpler this way. also, this enables us to print specialized
  classes which uses non-default template parameters.
* use fmt::join() to print container elements. see also
  https://fmt.dev/latest/api.html#_CPPv4I0EN3fmt4joinE9join_viewIN6detail10iterator_tI5RangeEEN6detail10sentinel_tI5RangeEEERR5Range11string_view

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/include/types_fmt.h