]>
git.proxmox.com Git - ceph.git/blob - ceph/src/include/types_fmt.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
5 * \file fmtlib formatters for some types.h classes
8 #include <fmt/format.h>
10 #include <string_view>
12 #include "include/types.h"
14 template <class A
, class B
, class Comp
, class Alloc
>
15 struct fmt::formatter
<std::map
<A
, B
, Comp
, Alloc
>> {
16 constexpr auto parse(format_parse_context
& ctx
) { return ctx
.begin(); }
18 template <typename FormatContext
>
19 auto format(const std::map
<A
, B
, Comp
, Alloc
>& m
, FormatContext
& ctx
)
21 std::string_view sep
= "{";
22 for (const auto& [k
, v
] : m
) {
23 fmt::format_to(ctx
.out(), "{}{}={}", sep
, k
, v
);
26 return fmt::format_to(ctx
.out(), "}}");