17#if FMT_HAS_INCLUDE(<version>)
21#if FMT_CPLUSPLUS >= 201703L
22# if FMT_HAS_INCLUDE(<filesystem>)
25# if FMT_HAS_INCLUDE(<variant>)
30#ifdef __cpp_lib_filesystem
35template <
typename Char>
37 const std::filesystem::path& p) {
38 write_escaped_string<Char>(std::back_inserter(quoted), p.string<Char>());
43 const std::filesystem::path& p) {
44 auto s = p.u8string();
45 write_escaped_string<char>(
46 std::back_inserter(quoted),
47 string_view(
reinterpret_cast<const char*
>(s.c_str()), s.size()));
51inline void write_escaped_path<std::filesystem::path::value_type>(
53 const std::filesystem::path& p) {
54 write_escaped_string<std::filesystem::path::value_type>(
55 std::back_inserter(quoted), p.native());
60template <
typename Char>
63 template <
typename FormatContext>
64 auto format(
const std::filesystem::path& p, FormatContext& ctx)
const ->
65 typename FormatContext::iterator {
67 detail::write_escaped_path(quoted, p);
76template <
typename Char>
80#ifdef __cpp_lib_variant
83 template <
typename ParseContext>
84 FMT_CONSTEXPR auto parse(ParseContext& ctx) ->
decltype(ctx.begin()) {
88 template <
typename FormatContext>
89 auto format(
const std::monostate&, FormatContext& ctx)
const
90 ->
decltype(ctx.out()) {
92 out = detail::write<Char>(out,
"monostate");
100using variant_index_sequence =
101 std::make_index_sequence<std::variant_size<T>::value>;
104template <
typename T,
typename U =
void>
105struct is_variant_like_ : std::false_type {};
107struct is_variant_like_<T,
std::
void_t<decltype(std::variant_size<T>::value)>>
111template <
typename T,
typename C>
class is_variant_formattable_ {
112 template <std::size_t... I>
113 static std::conjunction<
115 check(std::index_sequence<I...>);
118 static constexpr const bool value =
119 decltype(check(variant_index_sequence<T>{}))
::value;
122template <
typename Char,
typename OutputIt,
typename T>
123auto write_variant_alternative(OutputIt out,
const T& v) -> OutputIt {
126 else if constexpr (std::is_same_v<T, Char>)
129 return write<Char>(out, v);
134template <
typename T>
struct is_variant_like {
135 static constexpr const bool value = detail::is_variant_like_<T>::value;
138template <
typename T,
typename C>
struct is_variant_formattable {
139 static constexpr const bool value =
140 detail::is_variant_formattable_<T, C>::value;
143template <
typename Variant,
typename Char>
147 is_variant_like<Variant>, is_variant_formattable<Variant, Char>>>> {
148 template <
typename ParseContext>
149 FMT_CONSTEXPR auto parse(ParseContext& ctx) ->
decltype(ctx.begin()) {
153 template <
typename FormatContext>
154 auto format(
const Variant&
value, FormatContext& ctx)
const
155 ->
decltype(ctx.out()) {
156 auto out = ctx.out();
158 out = detail::write<Char>(out,
"variant(");
161 out = detail::write_variant_alternative<Char>(out, v);
\rst A dynamically growing memory buffer for trivially copyable/constructible types with the first SI...
Definition: format.h:819
An implementation of std::basic_string_view for pre-C++17.
Definition: core.h:430
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:298
basic_string_view< char > string_view
Definition: core.h:520
#define FMT_CONSTEXPR
Definition: core.h:106
bool_constant< !std::is_base_of< detail::unformattable, decltype(detail::arg_mapper< buffer_context< Char > >().map(std::declval< T >()))>::value &&!detail::has_fallback_formatter< T, Char >::value > is_formattable
Definition: core.h:1855
#define FMT_BEGIN_NAMESPACE
Definition: core.h:214
void void_t
Definition: core.h:1682
FMT_INLINE auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition: core.h:536
#define FMT_END_NAMESPACE
Definition: core.h:217
Definition: StdDeque.h:50
auto format(wformat_string< T... > fmt, T &&... args) -> std::wstring
Definition: xchar.h:87