15#include <initializer_list>
25template <
typename RangeT,
typename OutputIterator>
26OutputIterator
copy(
const RangeT& range, OutputIterator out) {
27 for (
auto it = range.begin(),
end = range.end(); it !=
end; ++it)
32template <
typename OutputIterator>
33OutputIterator
copy(
const char* str, OutputIterator out) {
34 while (*str) *out++ = *str++;
38template <
typename OutputIterator>
39OutputIterator
copy(
char ch, OutputIterator out) {
44template <
typename OutputIterator>
45OutputIterator
copy(
wchar_t ch, OutputIterator out) {
53 static auto check(U* p)
54 ->
decltype((void)p->find(
'a'), p->length(), (void)p->data(), int());
55 template <
typename>
static void check(...);
58 static constexpr const bool value =
60 std::is_convertible<T, std_string_view<char>>
::value ||
61 !std::is_void<decltype(check<T>(
nullptr))>
::value;
64template <
typename Char>
68 template <
typename U>
static auto check(U*) ->
typename U::mapped_type;
69 template <
typename>
static void check(...);
72#ifdef FMT_FORMAT_MAP_AS_LIST
73 static constexpr const bool value =
false;
75 static constexpr const bool value =
76 !std::is_void<decltype(check<T>(
nullptr))>
::value;
81 template <
typename U>
static auto check(U*) ->
typename U::key_type;
82 template <
typename>
static void check(...);
85#ifdef FMT_FORMAT_SET_AS_LIST
86 static constexpr const bool value =
false;
88 static constexpr const bool value =
95template <
typename T,
typename _ =
void>
struct is_range_ : std::false_type {};
97#if !FMT_MSC_VERSION || FMT_MSC_VERSION > 1800
99# define FMT_DECLTYPE_RETURN(val) \
100 ->decltype(val) { return val; } \
106template <
typename T, std::
size_t N>
110template <
typename T, std::
size_t N>
115template <
typename T,
typename Enable =
void>
120 decltype(std::declval<T>().end())>>
134 decltype(begin(
static_cast<T&&
>(rng)))> {
135 return begin(
static_cast<T&&
>(rng));
139 decltype(
end(
static_cast<T&&
>(rng)))> {
140 return end(
static_cast<T&&
>(rng));
143template <
typename T,
typename Enable =
void>
145template <
typename T,
typename Enable =
void>
153 decltype(detail::range_end(std::declval<const remove_cvref_t<T>&>()))>>
159 decltype(detail::range_end(std::declval<T>())),
160 enable_if_t<std::is_copy_constructible<T>::value>>>
165 : std::integral_constant<bool, (has_const_begin_end<T>::value ||
166 has_mutable_begin_end<T>::value)> {};
167# undef FMT_DECLTYPE_RETURN
172 template <
typename U>
173 static auto check(U* p) ->
decltype(std::tuple_size<U>::value, int());
174 template <
typename>
static void check(...);
178 !std::is_void<decltype(check<T>(
nullptr))>
::value;
182#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VERSION >= 1900
183template <
typename T, T... N>
196template <
typename T,
size_t N, T... Ns>
198template <
typename T, T... Ns>
208template <typename T, typename C, bool = is_tuple_like_<T>::value>
211 static constexpr const bool value =
false;
214 template <std::size_t... I>
217 static std::false_type check2(...);
218 template <std::size_t... I>
219 static decltype(check2(
230template <
class Tuple,
class F,
size_t... Is>
234 const int _[] = {0, ((void)f(get<Is>(tup)), 0)...};
244template <
class Tuple,
class F>
void for_each(Tuple&& tup,
F&& f) {
246 for_each(indexes, std::forward<Tuple>(tup), std::forward<F>(f));
249#if FMT_MSC_VERSION && FMT_MSC_VERSION < 1920
251template <
typename R>
struct range_reference_type_impl {
255template <
typename T, std::
size_t N>
struct range_reference_type_impl<T[N]> {
262template <
typename Range>
269template <
typename Range>
272template <
typename Range>
276template <
typename Range>
278 decltype(std::declval<range_reference_type<Range>>().second)>;
286template <
typename Char,
typename OutputIt>
291template <
typename Char,
typename OutputIt,
typename T,
298template <
typename Char,
typename OutputIt,
typename Arg,
305 typename Char,
typename OutputIt,
typename Arg,
307 !std::is_same<Arg, Char>::value)>
309 return write<Char>(out, v);
324template <
typename TupleT,
typename Char>
327 fmt::is_tuple_formattable<TupleT, Char>
::value>> {
336 template <
typename FormatContext>
struct format_each {
337 template <
typename T>
void operator()(
const T& v) {
338 if (i > 0) out = detail::copy_str<Char>(separator, out);
339 out = detail::write_range_entry<Char>(out, v);
343 typename FormatContext::iterator& out;
356 opening_bracket_ = open;
357 closing_bracket_ = close;
360 template <
typename ParseContext>
365 template <
typename FormatContext = format_context>
366 auto format(
const TupleT& values, FormatContext& ctx)
const
367 ->
decltype(ctx.out()) {
368 auto out = ctx.out();
369 out = detail::copy_str<Char>(opening_bracket_, out);
371 out = detail::copy_str<Char>(closing_bracket_, out);
376template <
typename T,
typename Char>
struct is_range {
379 !std::is_convertible<T, std::basic_string<Char>>
::value &&
380 !std::is_convertible<T, detail::std_string_view<Char>>
::value;
387 template <
typename T,
390 return static_cast<T&&
>(
value);
392 template <
typename T,
395 ->
decltype(
mapper().map(
static_cast<T&&
>(
value))) {
400template <
typename Char,
typename Element>
404 std::declval<Element>()))>,
413#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910
414template <
typename R,
typename Char>
417 is_formattable<uncvref_type<maybe_const_range<R>>, Char>,
418 has_fallback_formatter<uncvref_type<maybe_const_range<R>>, Char>> {};
423template <
typename T,
typename Char,
typename Enable =
void>
426template <
typename T,
typename Char>
430 std::is_same<T, remove_cvref_t<T>>,
432 detail::has_fallback_formatter<T, Char>>>
::value>> {
435 bool custom_specs_ =
false;
444 ->
decltype(u.set_debug_format()) {
445 u.set_debug_format();
452 maybe_set_debug_format(underlying_, 0);
468 opening_bracket_ = open;
469 closing_bracket_ = close;
472 template <
typename ParseContext>
474 auto it = ctx.begin();
475 auto end = ctx.end();
476 if (it ==
end || *it ==
'}') {
477 maybe_set_debug_format();
482 set_brackets({}, {});
487 maybe_set_debug_format();
494 custom_specs_ =
true;
497 return underlying_.parse(ctx);
500 template <
typename R,
class FormatContext>
501 auto format(
R&& range, FormatContext& ctx)
const ->
decltype(ctx.out()) {
503 auto out = ctx.out();
504 out = detail::copy_str<Char>(opening_bracket_, out);
508 for (; it !=
end; ++it) {
509 if (i > 0) out = detail::copy_str<Char>(separator_, out);
512 out = underlying_.format(mapper.
map(*it), ctx);
515 out = detail::copy_str<Char>(closing_bracket_, out);
524 static constexpr auto value = std::is_same<range_reference_type<T>, T>
::value
531template <range_format K,
typename R,
typename Char,
typename Enable =
void>
534template <range_format K>
537template <range_format K,
typename R,
typename Char>
555 underlying_.underlying().set_brackets({}, {});
556 underlying_.underlying().set_separator(
562 template <
typename ParseContext>
564 return underlying_.parse(ctx);
567 template <
typename FormatContext>
569 ->
decltype(ctx.out()) {
570 return underlying_.format(range, ctx);
575template <
typename T,
typename Char,
typename Enable =
void>
578 is_range<T, Char>::value, detail::range_format_kind_<T>,
579 std::integral_constant<range_format, range_format::disabled>> {};
581template <
typename R,
typename Char>
587#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910
604template <
typename Char,
typename... T>
610#ifndef FMT_TUPLE_JOIN_SPECIFIERS
611# define FMT_TUPLE_JOIN_SPECIFIERS 0
614template <
typename Char,
typename... T>
616 template <
typename ParseContext>
618 return do_parse(ctx, std::integral_constant<
size_t,
sizeof...(T)>());
621 template <
typename FormatContext>
623 FormatContext& ctx)
const ->
typename FormatContext::iterator {
624 return do_format(
value, ctx,
625 std::integral_constant<
size_t,
sizeof...(T)>());
631 template <
typename ParseContext>
633 std::integral_constant<size_t, 0>)
634 ->
decltype(ctx.begin()) {
638 template <
typename ParseContext,
size_t N>
640 std::integral_constant<size_t, N>)
641 ->
decltype(ctx.begin()) {
642 auto end = ctx.begin();
643#if FMT_TUPLE_JOIN_SPECIFIERS
644 end =
std::get<
sizeof...(T) - N>(formatters_).parse(ctx);
646 auto end1 = do_parse(ctx, std::integral_constant<size_t, N - 1>());
654 template <
typename FormatContext>
656 std::integral_constant<size_t, 0>)
const ->
657 typename FormatContext::iterator {
661 template <
typename FormatContext,
size_t N>
663 std::integral_constant<size_t, N>)
const ->
664 typename FormatContext::iterator {
665 auto out =
std::get<
sizeof...(T) - N>(formatters_)
670 return do_format(
value, ctx, std::integral_constant<size_t, N - 1>());
689template <
typename... T>
695template <
typename... T>
internal::enable_if< internal::valid_indexed_view_overload< RowIndices, ColIndices >::value &&internal::traits< typenameEIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::ReturnAsIndexedView, typenameEIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::type operator()(const RowIndices &rowIndices, const ColIndices &colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
Definition: IndexedViewMethods.h:73
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
std::integral_constant< bool, B > bool_constant
Definition: core.h:301
#define FMT_MODULE_EXPORT_BEGIN
Definition: core.h:224
#define FMT_CONSTEXPR
Definition: core.h:106
std::is_constructible< typename Context::template formatter_type< T > > has_formatter
Definition: core.h:800
type
Definition: core.h:575
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:1862
#define FMT_BEGIN_NAMESPACE
Definition: core.h:214
#define FMT_ENABLE_IF(...)
Definition: core.h:335
void void_t
Definition: core.h:1682
typename std::conditional< B, T, F >::type conditional_t
Definition: core.h:300
typename std::remove_cv< remove_reference_t< T > >::type remove_cvref_t
Definition: core.h:307
#define FMT_END_NAMESPACE
Definition: core.h:217
#define FMT_MODULE_EXPORT_END
Definition: core.h:225
static EIGEN_DEPRECATED const end_t end
Definition: IndexedViewHelper.h:181
Definition: format-inl.h:32
OutputIt write_delimiter(OutputIt out)
Definition: ranges.h:280
OutputIterator copy(wchar_t ch, OutputIterator out)
Definition: ranges.h:45
void for_each(index_sequence< Is... >, Tuple &&tup, F &&f) noexcept
Definition: ranges.h:231
auto range_begin(const T(&arr)[N]) -> const T *
Definition: ranges.h:107
remove_cvref_t< decltype(std::declval< range_reference_type< Range > >().first)> uncvref_first_type
Definition: ranges.h:274
FMT_CONSTEXPR make_index_sequence< std::tuple_size< T >::value > get_indexes(T const &)
Definition: ranges.h:239
OutputIterator copy(const RangeT &range, OutputIterator out)
Definition: ranges.h:26
const T & first(const T &value, const Tail &...)
Definition: compile.h:138
remove_cvref_t< range_reference_type< Range > > uncvref_type
Definition: ranges.h:270
auto range_end(const T(&arr)[N]) -> const T *
Definition: ranges.h:111
conditional_t< has_const_begin_end< R >::value, const R, R > maybe_const_range
Definition: ranges.h:410
auto write_range_entry(OutputIt out, basic_string_view< Char > str) -> OutputIt
Definition: ranges.h:287
integer_sequence< size_t, N... > index_sequence
Definition: ranges.h:194
std::integral_constant< range_format, K > range_format_constant
Definition: ranges.h:535
decltype(*detail::range_begin(std::declval< Range & >())) range_reference_type
Definition: ranges.h:264
remove_cvref_t< decltype(std::declval< range_reference_type< Range > >().second)> uncvref_second_type
Definition: ranges.h:278
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:406
Definition: BFloat16.h:88
static constexpr const unit_t< compound_unit< energy::joules, inverse< temperature::kelvin >, inverse< substance::moles > > > R(8.3144598)
Gas constant.
static constexpr const unit_t< compound_unit< charge::coulomb, inverse< substance::mol > > > F(N_A *e)
Faraday constant.
range_format
Definition: ranges.h:520
#define FMT_DECLTYPE_RETURN(val)
Definition: ranges.h:99
FMT_MODULE_EXPORT_BEGIN FMT_CONSTEXPR auto join(const std::tuple< T... > &tuple, string_view sep) -> tuple_join_view< char, T... >
\rst Returns an object that formats tuple with elements separated by sep.
Definition: ranges.h:690
static FMT_CONSTEXPR size_t size()
Definition: ranges.h:191
T value_type
Definition: ranges.h:189
arg_mapper< Context > mapper
Definition: ranges.h:385
static auto map(T &&value) -> decltype(mapper().map(static_cast< T && >(value)))
Definition: ranges.h:394
static auto map(T &&value) -> T &&
Definition: ranges.h:389
static constexpr const bool value
Definition: ranges.h:377
Definition: format.h:3937
tuple_join_view(const std::tuple< T... > &t, basic_string_view< Char > s)
Definition: ranges.h:600
const std::tuple< T... > & tuple
Definition: ranges.h:597
basic_string_view< Char > sep
Definition: ranges.h:598
constexpr T & get(wpi::array< T, N > &arr) noexcept
Definition: array.h:66