15#include <initializer_list>
26 template <
typename RangeT,
typename OutputIterator>
27 OutputIterator
copy(
const RangeT& range, OutputIterator
out)
29 for (
auto it = range.begin(), end = range.end(); it != end; ++it)
34 template <
typename OutputIterator>
35 OutputIterator
copy(
const char* str, OutputIterator
out)
42 template <
typename OutputIterator>
43 OutputIterator
copy(
char ch, OutputIterator
out)
49 template <
typename OutputIterator>
50 OutputIterator
copy(
wchar_t ch, OutputIterator
out)
62 ->
decltype((void)
p->find(
'a'),
p->length(), (void)
p->data(), int());
67 static constexpr const bool value =
69 std::is_convertible<T, std_string_view<char>>
::value ||
70 !std::is_void<decltype(check<T>(
nullptr))>
::value;
73 template <
typename Char>
82 static auto check(U*) ->
typename U::mapped_type;
87#ifdef FMT_FORMAT_MAP_AS_LIST
88 static constexpr const bool value =
false;
90 static constexpr const bool value =
91 !std::is_void<decltype(check<T>(
nullptr))>
::value;
99 static auto check(U*) ->
typename U::key_type;
104#ifdef FMT_FORMAT_SET_AS_LIST
105 static constexpr const bool value =
false;
112 template <
typename... Ts>
117 template <
typename T,
typename _ =
void>
122#if !FMT_MSC_VERSION || FMT_MSC_VERSION > 1800
124#define FMT_DECLTYPE_RETURN(val) \
134 template <
typename T, std::
size_t N>
139 template <
typename T, std::
size_t N>
145 template <
typename T,
typename Enable =
void>
150 template <
typename T>
157 template <
typename T>
159 template <
typename T>
164 template <
typename T>
167 decltype(begin(
static_cast<T&&
>(rng)))>
169 return begin(
static_cast<T&&
>(rng));
171 template <
typename T>
173 decltype(end(
static_cast<T&&
>(rng)))>
175 return end(
static_cast<T&&
>(rng));
178 template <
typename T,
typename Enable =
void>
182 template <
typename T,
typename Enable =
void>
187 template <
typename T>
192 decltype(detail::range_end(std::declval<const remove_cvref_t<T>&>()))>>
197 template <
typename T>
201 decltype(detail::range_end(std::declval<T>())),
202 enable_if_t<std::is_copy_constructible<T>::value>>>
207 template <
typename T>
209 : std::integral_constant<bool, (has_const_begin_end<T>::value || has_mutable_begin_end<T>::value)>
212#undef FMT_DECLTYPE_RETURN
216 template <
typename T>
219 template <
typename U>
220 static auto check(U*
p) ->
decltype(std::tuple_size<U>::value, int());
226 !std::is_void<decltype(check<T>(
nullptr))>
::value;
230#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VERSION >= 1900
231 template <
typename T, T... N>
233 template <
size_t... N>
238 template <
typename T, T... N>
249 template <
size_t... N>
252 template <
typename T,
size_t N, T... Ns>
256 template <
typename T, T... Ns>
265 template <
typename T>
268 template <typename T, typename C, bool = is_tuple_like_<T>::value>
272 static constexpr const bool value =
false;
274 template <
typename T,
typename C>
277 template <std::size_t... I>
281 template <std::size_t... I>
282 static decltype(check2(
294 template <
class Tuple,
class F,
size_t... Is>
299 const int _[] = {0, ((void)f(get<Is>(tup)), 0)...};
310 template <
class Tuple,
class F>
314 for_each(indexes, std::forward<Tuple>(tup), std::forward<F>(f));
317#if FMT_MSC_VERSION && FMT_MSC_VERSION < 1920
319 template <
typename R>
320 struct range_reference_type_impl
325 template <
typename T, std::
size_t N>
326 struct range_reference_type_impl<T[N]>
331 template <
typename T>
334 template <
typename Range>
341 template <
typename Range>
344 template <
typename Range>
348 template <
typename Range>
350 decltype(std::declval<range_reference_type<Range>>().second)>;
352 template <
typename OutputIt>
360 template <
typename Char,
typename OutputIt>
366 template <
typename Char,
typename OutputIt,
typename T, FMT_ENABLE_IF(std::is_convertible<T, std_
string_view<
char>>::value)>
373 template <
typename Char,
typename OutputIt,
typename Arg, FMT_ENABLE_IF(std::is_same<Arg, Char>::value)>
384 !std::is_same<Arg, Char>::value)>
387 return write<Char>(
out, v);
399template <
typename T,
typename C>
406template <
typename TupleT,
typename Char>
417 template <
typename FormatContext>
420 template <
typename T>
424 out = detail::copy_str<Char>(separator,
out);
425 out = detail::write_range_entry<Char>(
out, v);
429 typename FormatContext::iterator&
out;
446 opening_bracket_ = open;
447 closing_bracket_ = close;
450 template <
typename ParseContext>
456 template <
typename FormatContext = format_context>
457 auto format(
const TupleT& values, FormatContext& ctx)
const
458 ->
decltype(ctx.out())
460 auto out = ctx.out();
461 out = detail::copy_str<Char>(opening_bracket_,
out);
463 out = detail::copy_str<Char>(closing_bracket_,
out);
468template <
typename T,
typename Char>
473 !std::is_convertible<T, std::basic_string<Char>>
::value &&
474 !std::is_convertible<T, detail::std_string_view<Char>>
::value;
479 template <
typename Context>
484 template <
typename T,
488 return static_cast<T&&
>(
value);
490 template <
typename T,
499 template <
typename Char,
typename Element>
503 std::declval<Element>()))>,
507 template <
typename R>
512#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910
513 template <
typename R,
typename Char>
516 is_formattable<uncvref_type<maybe_const_range<R>>, Char>,
517 has_fallback_formatter<uncvref_type<maybe_const_range<R>>, Char>>
524template <
typename T,
typename Char,
typename Enable =
void>
527template <
typename T,
typename Char>
532 std::is_same<T, remove_cvref_t<T>>,
534 detail::has_fallback_formatter<T, Char>>>
::value>>
538 bool custom_specs_ =
false;
547 ->
decltype(
u.set_debug_format())
549 u.set_debug_format();
559 maybe_set_debug_format(underlying_, 0);
580 opening_bracket_ = open;
581 closing_bracket_ = close;
584 template <
typename ParseContext>
587 auto it = ctx.begin();
588 auto end = ctx.end();
589 if (it == end || *it ==
'}')
591 maybe_set_debug_format();
597 set_brackets({}, {});
603 maybe_set_debug_format();
610 custom_specs_ =
true;
613 return underlying_.parse(ctx);
616 template <
typename R,
class FormatContext>
617 auto format(R&& range, FormatContext& ctx)
const ->
decltype(ctx.out())
620 auto out = ctx.out();
621 out = detail::copy_str<Char>(opening_bracket_,
out);
625 for (; it != end; ++it)
628 out = detail::copy_str<Char>(separator_,
out);
631 out = underlying_.format(mapper.
map(*it), ctx);
634 out = detail::copy_str<Char>(closing_bracket_,
out);
651 template <
typename T>
654 static constexpr auto value = std::is_same<range_reference_type<T>, T>
::value
661 template <range_format K,
typename R,
typename Char,
typename Enable =
void>
664 template <range_format K>
667 template <range_format K,
typename R,
typename Char>
693 underlying_.underlying().set_brackets({}, {});
694 underlying_.underlying().set_separator(
702 template <
typename ParseContext>
705 return underlying_.parse(ctx);
708 template <
typename FormatContext>
710 ->
decltype(ctx.out())
712 return underlying_.format(range, ctx);
717template <
typename T,
typename Char,
typename Enable =
void>
720 is_range<T, Char>::value,
721 detail::range_format_kind_<T>,
722 std::integral_constant<range_format, range_format::disabled>>
726template <
typename R,
typename Char>
733#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910
742template <
typename Char,
typename... T>
754template <
typename Char,
typename... T>
760#ifndef FMT_TUPLE_JOIN_SPECIFIERS
761#define FMT_TUPLE_JOIN_SPECIFIERS 0
764template <
typename Char,
typename... T>
767 template <
typename ParseContext>
770 return do_parse(ctx, std::integral_constant<
size_t,
sizeof...(T)>());
773 template <
typename FormatContext>
775 FormatContext& ctx)
const ->
typename FormatContext::iterator
777 return do_format(
value, ctx,
778 std::integral_constant<
size_t,
sizeof...(T)>());
782 std::tuple<formatter<typename std::decay<T>::type, Char>...>
formatters_;
784 template <
typename ParseContext>
786 std::integral_constant<size_t, 0>)
787 ->
decltype(ctx.begin())
792 template <
typename ParseContext,
size_t N>
794 std::integral_constant<size_t, N>)
795 ->
decltype(ctx.begin())
797 auto end = ctx.begin();
798#if FMT_TUPLE_JOIN_SPECIFIERS
799 end = std::get<
sizeof...(T) - N>(formatters_).parse(ctx);
802 auto end1 = do_parse(ctx, std::integral_constant<size_t, N - 1>());
810 template <
typename FormatContext>
812 typename FormatContext::iterator
817 template <
typename FormatContext,
size_t N>
819 typename FormatContext::iterator
821 auto out = std::get<
sizeof...(T) - N>(formatters_)
822 .format(std::get<
sizeof...(T) - N>(
value.tuple), ctx);
827 return do_format(
value, ctx, std::integral_constant<size_t, N - 1>());
846template <
typename... T>
853template <
typename... T>
876 return join(std::begin(list), std::end(list), sep);
range_format
Definition ranges.h:640
#define FMT_DECLTYPE_RETURN(val)
Definition ranges.h:124
tuple_join_view< Char, T... > tuple_arg_join
Definition ranges.h:755
FMT_MODULE_EXPORT_BEGIN FMT_CONSTEXPR auto join(const std::tuple< T... > &tuple, string_view sep) -> tuple_join_view< char, T... >
Definition ranges.h:847
static auto check(U *) -> typename U::mapped_type
static auto check(U *) -> typename U::key_type
static auto check(U *p) -> decltype((void) p->find('a'), p->length(),(void) p->data(), int())
static auto check(U *p) -> decltype(std::tuple_size< U >::value, int())
typename std::enable_if< B, T >::type enable_if_t
Definition core.h:302
std::integral_constant< bool, B > bool_constant
Definition core.h:306
#define FMT_MODULE_EXPORT_BEGIN
Definition core.h:226
#define FMT_CONSTEXPR
Definition core.h:106
std::is_constructible< typename Context::template formatter_type< T > > has_formatter
Definition core.h:953
type
Definition core.h:681
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:2427
#define FMT_BEGIN_NAMESPACE
Definition core.h:214
#define FMT_ENABLE_IF(...)
Definition core.h:364
void void_t
Definition core.h:2201
typename std::conditional< B, T, F >::type conditional_t
Definition core.h:304
typename std::remove_cv< remove_reference_t< T > >::type remove_cvref_t
Definition core.h:312
#define FMT_END_NAMESPACE
Definition core.h:219
#define FMT_MODULE_EXPORT_END
Definition core.h:227
#define out
Definition encodings.cpp:5
OutputIt write_delimiter(OutputIt out)
Definition ranges.h:353
void for_each(index_sequence< Is... >, Tuple &&tup, F &&f) noexcept
Definition ranges.h:295
auto range_begin(const T(&arr)[N]) -> const T *
Definition ranges.h:135
remove_cvref_t< decltype(std::declval< range_reference_type< Range > >().first)> uncvref_first_type
Definition ranges.h:346
FMT_CONSTEXPR make_index_sequence< std::tuple_size< T >::value > get_indexes(T const &)
Definition ranges.h:304
OutputIterator copy(const RangeT &range, OutputIterator out)
Definition ranges.h:27
const T & first(const T &value, const Tail &...)
Definition compile.h:179
make_integer_sequence< size_t, N > make_index_sequence
Definition ranges.h:262
remove_cvref_t< range_reference_type< Range > > uncvref_type
Definition ranges.h:342
auto range_end(const T(&arr)[N]) -> const T *
Definition ranges.h:140
conditional_t< has_const_begin_end< R >::value, const R, R > maybe_const_range
Definition ranges.h:509
auto write_range_entry(OutputIt out, basic_string_view< Char > str) -> OutputIt
Definition ranges.h:361
integer_sequence< size_t, N... > index_sequence
Definition ranges.h:250
std::integral_constant< range_format, K > range_format_constant
Definition ranges.h:665
make_index_sequence< std::tuple_size< T >::value > tuple_index_sequence
Definition ranges.h:266
decltype(*detail::range_begin(std::declval< Range & >())) range_reference_type
Definition ranges.h:336
remove_cvref_t< decltype(std::declval< range_reference_type< Range > >().second)> uncvref_second_type
Definition ranges.h:350
conditional_t< is_formattable< Element, Char >::value, formatter< remove_cvref_t< decltype(range_mapper< buffer_context< Char > >{}.map(std::declval< Element >()))>, Char >, fallback_formatter< Element, Char > > range_formatter_type
Definition ranges.h:505
Definition bin_to_hex.h:111
static FMT_CONSTEXPR size_t size()
Definition ranges.h:243
T value_type
Definition ranges.h:241
arg_mapper< Context > mapper
Definition ranges.h:482
static auto map(T &&value) -> decltype(mapper().map(static_cast< T && >(value)))
Definition ranges.h:492
static auto map(T &&value) -> T &&
Definition ranges.h:486
static constexpr const bool value
Definition ranges.h:471
tuple_join_view(const std::tuple< T... > &t, basic_string_view< Char > s)
Definition ranges.h:748
const std::tuple< T... > & tuple
Definition ranges.h:745
basic_string_view< Char > sep
Definition ranges.h:746
s
Definition tag_strings.h:47
u
Definition tag_strings.h:62
i
Definition tag_strings.h:60
p
Definition tag_strings.h:29