WPILibC++ 2023.4.3-108-ge5452e3
ranges.h
Go to the documentation of this file.
1// Formatting library for C++ - experimental range support
2//
3// Copyright (c) 2012 - present, Victor Zverovich
4// All rights reserved.
5//
6// For the license information refer to format.h.
7//
8// Copyright (c) 2018 - present, Remotion (Igor Schulz)
9// All Rights Reserved
10// {fmt} support for ranges, containers and types tuple interface.
11
12#ifndef FMT_RANGES_H_
13#define FMT_RANGES_H_
14
15#include <initializer_list>
16#include <tuple>
17#include <type_traits>
18
19#include "format.h"
20
22
23namespace detail {
24
25template <typename RangeT, typename OutputIterator>
26OutputIterator copy(const RangeT& range, OutputIterator out) {
27 for (auto it = range.begin(), end = range.end(); it != end; ++it)
28 *out++ = *it;
29 return out;
30}
31
32template <typename OutputIterator>
33OutputIterator copy(const char* str, OutputIterator out) {
34 while (*str) *out++ = *str++;
35 return out;
36}
37
38template <typename OutputIterator>
39OutputIterator copy(char ch, OutputIterator out) {
40 *out++ = ch;
41 return out;
42}
43
44template <typename OutputIterator>
45OutputIterator copy(wchar_t ch, OutputIterator out) {
46 *out++ = ch;
47 return out;
48}
49
50// Returns true if T has a std::string-like interface, like std::string_view.
51template <typename T> class is_std_string_like {
52 template <typename U>
53 static auto check(U* p)
54 -> decltype((void)p->find('a'), p->length(), (void)p->data(), int());
55 template <typename> static void check(...);
56
57 public:
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;
62};
63
64template <typename Char>
65struct is_std_string_like<fmt::basic_string_view<Char>> : std::true_type {};
66
67template <typename T> class is_map {
68 template <typename U> static auto check(U*) -> typename U::mapped_type;
69 template <typename> static void check(...);
70
71 public:
72#ifdef FMT_FORMAT_MAP_AS_LIST
73 static constexpr const bool value = false;
74#else
75 static constexpr const bool value =
76 !std::is_void<decltype(check<T>(nullptr))>::value;
77#endif
78};
79
80template <typename T> class is_set {
81 template <typename U> static auto check(U*) -> typename U::key_type;
82 template <typename> static void check(...);
83
84 public:
85#ifdef FMT_FORMAT_SET_AS_LIST
86 static constexpr const bool value = false;
87#else
88 static constexpr const bool value =
89 !std::is_void<decltype(check<T>(nullptr))>::value && !is_map<T>::value;
90#endif
91};
92
93template <typename... Ts> struct conditional_helper {};
94
95template <typename T, typename _ = void> struct is_range_ : std::false_type {};
96
97#if !FMT_MSC_VERSION || FMT_MSC_VERSION > 1800
98
99# define FMT_DECLTYPE_RETURN(val) \
100 ->decltype(val) { return val; } \
101 static_assert( \
102 true, "") // This makes it so that a semicolon is required after the
103 // macro, which helps clang-format handle the formatting.
104
105// C array overload
106template <typename T, std::size_t N>
107auto range_begin(const T (&arr)[N]) -> const T* {
108 return arr;
109}
110template <typename T, std::size_t N>
111auto range_end(const T (&arr)[N]) -> const T* {
112 return arr + N;
113}
114
115template <typename T, typename Enable = void>
116struct has_member_fn_begin_end_t : std::false_type {};
117
118template <typename T>
119struct has_member_fn_begin_end_t<T, void_t<decltype(std::declval<T>().begin()),
120 decltype(std::declval<T>().end())>>
121 : std::true_type {};
122
123// Member function overload
124template <typename T>
125auto range_begin(T&& rng) FMT_DECLTYPE_RETURN(static_cast<T&&>(rng).begin());
126template <typename T>
127auto range_end(T&& rng) FMT_DECLTYPE_RETURN(static_cast<T&&>(rng).end());
128
129// ADL overload. Only participates in overload resolution if member functions
130// are not found.
131template <typename T>
132auto range_begin(T&& rng)
134 decltype(begin(static_cast<T&&>(rng)))> {
135 return begin(static_cast<T&&>(rng));
136}
137template <typename T>
139 decltype(end(static_cast<T&&>(rng)))> {
140 return end(static_cast<T&&>(rng));
141}
142
143template <typename T, typename Enable = void>
144struct has_const_begin_end : std::false_type {};
145template <typename T, typename Enable = void>
146struct has_mutable_begin_end : std::false_type {};
147
148template <typename T>
150 T,
151 void_t<
152 decltype(detail::range_begin(std::declval<const remove_cvref_t<T>&>())),
153 decltype(detail::range_end(std::declval<const remove_cvref_t<T>&>()))>>
154 : std::true_type {};
155
156template <typename T>
158 T, void_t<decltype(detail::range_begin(std::declval<T>())),
159 decltype(detail::range_end(std::declval<T>())),
160 enable_if_t<std::is_copy_constructible<T>::value>>>
161 : std::true_type {};
162
163template <typename T>
164struct is_range_<T, void>
165 : std::integral_constant<bool, (has_const_begin_end<T>::value ||
166 has_mutable_begin_end<T>::value)> {};
167# undef FMT_DECLTYPE_RETURN
168#endif
169
170// tuple_size and tuple_element check.
171template <typename T> class is_tuple_like_ {
172 template <typename U>
173 static auto check(U* p) -> decltype(std::tuple_size<U>::value, int());
174 template <typename> static void check(...);
175
176 public:
177 static constexpr const bool value =
178 !std::is_void<decltype(check<T>(nullptr))>::value;
179};
180
181// Check for integer_sequence
182#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VERSION >= 1900
183template <typename T, T... N>
184using integer_sequence = std::integer_sequence<T, N...>;
185template <size_t... N> using index_sequence = std::index_sequence<N...>;
186template <size_t N> using make_index_sequence = std::make_index_sequence<N>;
187#else
188template <typename T, T... N> struct integer_sequence {
189 using value_type = T;
190
191 static FMT_CONSTEXPR size_t size() { return sizeof...(N); }
192};
193
194template <size_t... N> using index_sequence = integer_sequence<size_t, N...>;
195
196template <typename T, size_t N, T... Ns>
197struct make_integer_sequence : make_integer_sequence<T, N - 1, N - 1, Ns...> {};
198template <typename T, T... Ns>
199struct make_integer_sequence<T, 0, Ns...> : integer_sequence<T, Ns...> {};
200
201template <size_t N>
203#endif
204
205template <typename T>
207
208template <typename T, typename C, bool = is_tuple_like_<T>::value>
210 public:
211 static constexpr const bool value = false;
212};
213template <typename T, typename C> class is_tuple_formattable_<T, C, true> {
214 template <std::size_t... I>
215 static std::true_type check2(index_sequence<I...>,
216 integer_sequence<bool, (I == I)...>);
217 static std::false_type check2(...);
218 template <std::size_t... I>
219 static decltype(check2(
223 C>::value)...>{})) check(index_sequence<I...>);
224
225 public:
226 static constexpr const bool value =
227 decltype(check(tuple_index_sequence<T>{}))::value;
228};
229
230template <class Tuple, class F, size_t... Is>
231void for_each(index_sequence<Is...>, Tuple&& tup, F&& f) noexcept {
232 using std::get;
233 // using free function get<I>(T) now.
234 const int _[] = {0, ((void)f(get<Is>(tup)), 0)...};
235 (void)_; // blocks warnings
236}
237
238template <class T>
240 T const&) {
241 return {};
242}
243
244template <class Tuple, class F> void for_each(Tuple&& tup, F&& f) {
245 const auto indexes = get_indexes(tup);
246 for_each(indexes, std::forward<Tuple>(tup), std::forward<F>(f));
247}
248
249#if FMT_MSC_VERSION && FMT_MSC_VERSION < 1920
250// Older MSVC doesn't get the reference type correctly for arrays.
251template <typename R> struct range_reference_type_impl {
252 using type = decltype(*detail::range_begin(std::declval<R&>()));
253};
254
255template <typename T, std::size_t N> struct range_reference_type_impl<T[N]> {
256 using type = T&;
257};
258
259template <typename T>
261#else
262template <typename Range>
264 decltype(*detail::range_begin(std::declval<Range&>()));
265#endif
266
267// We don't use the Range's value_type for anything, but we do need the Range's
268// reference type, with cv-ref stripped.
269template <typename Range>
271
272template <typename Range>
274 remove_cvref_t<decltype(std::declval<range_reference_type<Range>>().first)>;
275
276template <typename Range>
278 decltype(std::declval<range_reference_type<Range>>().second)>;
279
280template <typename OutputIt> OutputIt write_delimiter(OutputIt out) {
281 *out++ = ',';
282 *out++ = ' ';
283 return out;
284}
285
286template <typename Char, typename OutputIt>
287auto write_range_entry(OutputIt out, basic_string_view<Char> str) -> OutputIt {
288 return write_escaped_string(out, str);
289}
290
291template <typename Char, typename OutputIt, typename T,
292 FMT_ENABLE_IF(std::is_convertible<T, std_string_view<char>>::value)>
293inline auto write_range_entry(OutputIt out, const T& str) -> OutputIt {
294 auto sv = std_string_view<Char>(str);
295 return write_range_entry<Char>(out, basic_string_view<Char>(sv));
296}
297
298template <typename Char, typename OutputIt, typename Arg,
299 FMT_ENABLE_IF(std::is_same<Arg, Char>::value)>
300OutputIt write_range_entry(OutputIt out, const Arg v) {
301 return write_escaped_char(out, v);
302}
303
304template <
305 typename Char, typename OutputIt, typename Arg,
306 FMT_ENABLE_IF(!is_std_string_like<typename std::decay<Arg>::type>::value &&
307 !std::is_same<Arg, Char>::value)>
308OutputIt write_range_entry(OutputIt out, const Arg& v) {
309 return write<Char>(out, v);
310}
311
312} // namespace detail
313
314template <typename T> struct is_tuple_like {
315 static constexpr const bool value =
317};
318
319template <typename T, typename C> struct is_tuple_formattable {
320 static constexpr const bool value =
322};
323
324template <typename TupleT, typename Char>
325struct formatter<TupleT, Char,
326 enable_if_t<fmt::is_tuple_like<TupleT>::value &&
327 fmt::is_tuple_formattable<TupleT, Char>::value>> {
328 private:
330 basic_string_view<Char> opening_bracket_ =
331 detail::string_literal<Char, '('>{};
332 basic_string_view<Char> closing_bracket_ =
334
335 // C++11 generic lambda for format().
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);
340 ++i;
341 }
342 int i;
343 typename FormatContext::iterator& out;
344 basic_string_view<Char> separator;
345 };
346
347 public:
349
351 separator_ = sep;
352 }
353
356 opening_bracket_ = open;
357 closing_bracket_ = close;
358 }
359
360 template <typename ParseContext>
361 FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
362 return ctx.begin();
363 }
364
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);
370 detail::for_each(values, format_each<FormatContext>{0, out, separator_});
371 out = detail::copy_str<Char>(closing_bracket_, out);
372 return out;
373 }
374};
375
376template <typename T, typename Char> struct is_range {
377 static constexpr const bool value =
379 !std::is_convertible<T, std::basic_string<Char>>::value &&
380 !std::is_convertible<T, detail::std_string_view<Char>>::value;
381};
382
383namespace detail {
384template <typename Context> struct range_mapper {
386
387 template <typename T,
389 static auto map(T&& value) -> T&& {
390 return static_cast<T&&>(value);
391 }
392 template <typename T,
394 static auto map(T&& value)
395 -> decltype(mapper().map(static_cast<T&&>(value))) {
396 return mapper().map(static_cast<T&&>(value));
397 }
398};
399
400template <typename Char, typename Element>
404 std::declval<Element>()))>,
405 Char>,
407
408template <typename R>
411
412// Workaround a bug in MSVC 2015 and earlier.
413#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910
414template <typename R, typename Char>
416 : disjunction<
417 is_formattable<uncvref_type<maybe_const_range<R>>, Char>,
418 has_fallback_formatter<uncvref_type<maybe_const_range<R>>, Char>> {};
419#endif
420
421} // namespace detail
422
423template <typename T, typename Char, typename Enable = void>
425
426template <typename T, typename Char>
428 T, Char,
430 std::is_same<T, remove_cvref_t<T>>,
431 disjunction<is_formattable<T, Char>,
432 detail::has_fallback_formatter<T, Char>>>::value>> {
433 private:
435 bool custom_specs_ = false;
437 basic_string_view<Char> opening_bracket_ =
439 basic_string_view<Char> closing_bracket_ =
441
442 template <class U>
443 FMT_CONSTEXPR static auto maybe_set_debug_format(U& u, int)
444 -> decltype(u.set_debug_format()) {
445 u.set_debug_format();
446 }
447
448 template <class U>
449 FMT_CONSTEXPR static void maybe_set_debug_format(U&, ...) {}
450
451 FMT_CONSTEXPR void maybe_set_debug_format() {
452 maybe_set_debug_format(underlying_, 0);
453 }
454
455 public:
457
459 return underlying_;
460 }
461
463 separator_ = sep;
464 }
465
468 opening_bracket_ = open;
469 closing_bracket_ = close;
470 }
471
472 template <typename ParseContext>
473 FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
474 auto it = ctx.begin();
475 auto end = ctx.end();
476 if (it == end || *it == '}') {
477 maybe_set_debug_format();
478 return it;
479 }
480
481 if (*it == 'n') {
482 set_brackets({}, {});
483 ++it;
484 }
485
486 if (*it == '}') {
487 maybe_set_debug_format();
488 return it;
489 }
490
491 if (*it != ':')
492 FMT_THROW(format_error("no other top-level range formatters supported"));
493
494 custom_specs_ = true;
495 ++it;
496 ctx.advance_to(it);
497 return underlying_.parse(ctx);
498 }
499
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);
505 int i = 0;
506 auto it = detail::range_begin(range);
507 auto end = detail::range_end(range);
508 for (; it != end; ++it) {
509 if (i > 0) out = detail::copy_str<Char>(separator_, out);
510 ;
511 ctx.advance_to(out);
512 out = underlying_.format(mapper.map(*it), ctx);
513 ++i;
514 }
515 out = detail::copy_str<Char>(closing_bracket_, out);
516 return out;
517 }
518};
519
521
522namespace detail {
523template <typename T> struct range_format_kind_ {
524 static constexpr auto value = std::is_same<range_reference_type<T>, T>::value
529};
530
531template <range_format K, typename R, typename Char, typename Enable = void>
533
534template <range_format K>
535using range_format_constant = std::integral_constant<range_format, K>;
536
537template <range_format K, typename R, typename Char>
539 K, R, Char,
541 K == range_format::set)>> {
544
546
548 underlying_.set_brackets(detail::string_literal<Char, '{'>{},
550 }
551
553 underlying_.set_brackets(detail::string_literal<Char, '{'>{},
555 underlying_.underlying().set_brackets({}, {});
556 underlying_.underlying().set_separator(
558 }
559
561
562 template <typename ParseContext>
563 FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
564 return underlying_.parse(ctx);
565 }
566
567 template <typename FormatContext>
568 auto format(range_type& range, FormatContext& ctx) const
569 -> decltype(ctx.out()) {
570 return underlying_.format(range, ctx);
571 }
572};
573} // namespace detail
574
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>> {};
580
581template <typename R, typename Char>
583 R, Char,
586// Workaround a bug in MSVC 2015 and earlier.
587#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1910
588 ,
590#endif
591 >::value>>
592 : detail::range_default_formatter<range_format_kind<R, Char>::value, R,
593 Char> {
594};
595
596template <typename Char, typename... T> struct tuple_join_view : detail::view {
597 const std::tuple<T...>& tuple;
599
600 tuple_join_view(const std::tuple<T...>& t, basic_string_view<Char> s)
601 : tuple(t), sep{s} {}
602};
603
604template <typename Char, typename... T>
605using tuple_arg_join = tuple_join_view<Char, T...>;
606
607// Define FMT_TUPLE_JOIN_SPECIFIERS to enable experimental format specifiers
608// support in tuple_join. It is disabled by default because of issues with
609// the dynamic width and precision.
610#ifndef FMT_TUPLE_JOIN_SPECIFIERS
611# define FMT_TUPLE_JOIN_SPECIFIERS 0
612#endif
613
614template <typename Char, typename... T>
615struct formatter<tuple_join_view<Char, T...>, Char> {
616 template <typename ParseContext>
617 FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
618 return do_parse(ctx, std::integral_constant<size_t, sizeof...(T)>());
619 }
620
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)>());
626 }
627
628 private:
630
631 template <typename ParseContext>
632 FMT_CONSTEXPR auto do_parse(ParseContext& ctx,
633 std::integral_constant<size_t, 0>)
634 -> decltype(ctx.begin()) {
635 return ctx.begin();
636 }
637
638 template <typename ParseContext, size_t N>
639 FMT_CONSTEXPR auto do_parse(ParseContext& ctx,
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);
645 if (N > 1) {
646 auto end1 = do_parse(ctx, std::integral_constant<size_t, N - 1>());
647 if (end != end1)
648 FMT_THROW(format_error("incompatible format specs for tuple elements"));
649 }
650#endif
651 return end;
652 }
653
654 template <typename FormatContext>
655 auto do_format(const tuple_join_view<Char, T...>&, FormatContext& ctx,
656 std::integral_constant<size_t, 0>) const ->
657 typename FormatContext::iterator {
658 return ctx.out();
659 }
660
661 template <typename FormatContext, size_t N>
662 auto do_format(const tuple_join_view<Char, T...>& value, FormatContext& ctx,
663 std::integral_constant<size_t, N>) const ->
664 typename FormatContext::iterator {
665 auto out = std::get<sizeof...(T) - N>(formatters_)
666 .format(std::get<sizeof...(T) - N>(value.tuple), ctx);
667 if (N > 1) {
668 out = std::copy(value.sep.begin(), value.sep.end(), out);
669 ctx.advance_to(out);
670 return do_format(value, ctx, std::integral_constant<size_t, N - 1>());
671 }
672 return out;
673 }
674};
675
677
678/**
679 \rst
680 Returns an object that formats `tuple` with elements separated by `sep`.
681
682 **Example**::
683
684 std::tuple<int, char> t = {1, 'a'};
685 fmt::print("{}", fmt::join(t, ", "));
686 // Output: "1, a"
687 \endrst
688 */
689template <typename... T>
690FMT_CONSTEXPR auto join(const std::tuple<T...>& tuple, string_view sep)
691 -> tuple_join_view<char, T...> {
692 return {tuple, sep};
693}
694
695template <typename... T>
696FMT_CONSTEXPR auto join(const std::tuple<T...>& tuple,
698 -> tuple_join_view<wchar_t, T...> {
699 return {tuple, sep};
700}
701
702/**
703 \rst
704 Returns an object that formats `initializer_list` with elements separated by
705 `sep`.
706
707 **Example**::
708
709 fmt::print("{}", fmt::join({1, 2, 3}, ", "));
710 // Output: "1, 2, 3"
711 \endrst
712 */
713template <typename T>
714auto join(std::initializer_list<T> list, string_view sep)
716 return join(std::begin(list), std::end(list), sep);
717}
718
721
722#endif // FMT_RANGES_H_
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
Definition: ranges.h:67
Definition: ranges.h:80
Definition: ranges.h:51
Definition: ranges.h:209
static constexpr const bool value
Definition: ranges.h:211
Definition: ranges.h:171
A formatting error such as invalid format string.
Definition: format.h:957
Definition: core.h:1240
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
auto write_escaped_string(OutputIt out, basic_string_view< Char > str) -> OutputIt
Definition: format.h:1840
auto write_escaped_char(OutputIt out, Char v) -> OutputIt
Definition: format.h:1856
#define FMT_THROW(x)
Definition: format.h:95
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
Definition: core.h:1345
Definition: core.h:319
Definition: ranges.h:93
Definition: ranges.h:144
Definition: ranges.h:116
Definition: ranges.h:146
Definition: ranges.h:188
static FMT_CONSTEXPR size_t size()
Definition: ranges.h:191
T value_type
Definition: ranges.h:189
Definition: ranges.h:418
Definition: ranges.h:95
Definition: ranges.h:197
FMT_CONSTEXPR void init(range_format_constant< range_format::sequence >)
Definition: ranges.h:560
FMT_CONSTEXPR auto parse(ParseContext &ctx) -> decltype(ctx.begin())
Definition: ranges.h:563
auto format(range_type &range, FormatContext &ctx) const -> decltype(ctx.out())
Definition: ranges.h:568
Definition: ranges.h:532
Definition: ranges.h:523
Definition: ranges.h:384
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
Definition: format.h:252
Definition: core.h:313
Definition: core.h:1123
FMT_CONSTEXPR auto parse(ParseContext &ctx) -> decltype(ctx.begin())
Definition: ranges.h:361
auto format(const TupleT &values, FormatContext &ctx) const -> decltype(ctx.out())
Definition: ranges.h:366
FMT_CONSTEXPR void set_brackets(basic_string_view< Char > open, basic_string_view< Char > close)
Definition: ranges.h:354
auto format(const tuple_join_view< Char, T... > &value, FormatContext &ctx) const -> typename FormatContext::iterator
Definition: ranges.h:622
FMT_CONSTEXPR auto parse(ParseContext &ctx) -> decltype(ctx.begin())
Definition: ranges.h:617
Definition: core.h:791
Definition: ranges.h:376
static constexpr const bool value
Definition: ranges.h:377
Definition: core.h:566
Definition: ranges.h:319
Definition: ranges.h:314
Definition: format.h:3937
Definition: ranges.h:579
Definition: ranges.h:424
Definition: core.h:382
Definition: ranges.h:596
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