30#ifndef _GLIBCXX_FORMAT_FWD_H
31#define _GLIBCXX_FORMAT_FWD_H 1
34#pragma GCC system_header
38#ifdef __glibcxx_format
42#if __glibcxx_format_ranges
46namespace std _GLIBCXX_VISIBILITY(default)
48_GLIBCXX_BEGIN_NAMESPACE_VERSION
51 template<
typename _Out,
typename _CharT>
class basic_format_context;
54 template<
typename _CharT>
class basic_format_parse_context;
57 template<
typename _Tp,
typename _CharT =
char>
struct formatter;
62 __throw_format_error(
const char* __what);
66#ifdef _GLIBCXX_USE_WCHAR_T
67 template<
typename _CharT>
68 concept __char = same_as<_CharT, char> || same_as<_CharT, wchar_t>;
70 template<
typename _CharT>
71 concept __char = same_as<_CharT, char>;
74 enum class _Align :
unsigned char {
82 template<
typename _CharT>
struct _Spec;
84 template<__
char _CharT>
struct __formatter_str;
85 template<__
char _CharT>
struct __formatter_int;
86 template<__
char _CharT>
struct __formatter_ptr;
88 template<
typename _Tp,
typename _Context,
90 =
typename _Context::template formatter_type<remove_const_t<_Tp>>,
91 typename _ParseContext
92 = basic_format_parse_context<typename _Context::char_type>>
93 concept __parsable_with
94 = semiregular<_Formatter>
95 &&
requires (_Formatter __f, _ParseContext __pc)
97 { __f.parse(__pc) } -> same_as<typename _ParseContext::iterator>;
100 template<
typename _Tp,
typename _Context,
102 =
typename _Context::template formatter_type<remove_const_t<_Tp>>,
103 typename _ParseContext
104 = basic_format_parse_context<typename _Context::char_type>>
105 concept __formattable_with
106 = semiregular<_Formatter>
107 &&
requires (
const _Formatter __cf, _Tp&& __t, _Context __fc)
109 { __cf.format(__t, __fc) } -> same_as<typename _Context::iterator>;
113 template<
typename _CharT>
115 template<
typename _CharT>
116 using _Iter_for_t =
typename _Iter_for<_CharT>::type;
118 template<
typename _Tp,
typename _CharT,
119 typename _Context = basic_format_context<_Iter_for_t<_CharT>, _CharT>>
120 concept __formattable_impl
121 = __parsable_with<_Tp, _Context> && __formattable_with<_Tp, _Context>;
123 template<
typename _Formatter>
124 concept __has_debug_format =
requires(_Formatter __f)
126 __f.set_debug_format();
131#if __glibcxx_format_ranges
133 template<
typename _Tp,
typename _CharT>
135 = __format::__formattable_impl<remove_reference_t<_Tp>, _CharT>;
137 template<
typename _Tp, __format::__
char _CharT =
char>
138 requires same_as<remove_cvref_t<_Tp>, _Tp> && formattable<_Tp, _CharT>
139 class range_formatter;
144 template<
typename _Rg,
typename _CharT>
145 concept __const_formattable_range
146 = ranges::input_range<const _Rg>
147 && formattable<ranges::range_reference_t<const _Rg>, _CharT>;
151 template<
typename _Rg,
typename _CharT>
152 concept __simply_formattable_range
153 = __const_formattable_range<_Rg, _CharT>
154 && same_as<remove_cvref_t<ranges::range_reference_t<_Rg>>,
155 remove_cvref_t<ranges::range_reference_t<const _Rg>>>;
157 template<
typename _Rg,
typename _CharT>
158 using __maybe_const_range
159 = __conditional_t<__const_formattable_range<_Rg, _CharT>,
const _Rg, _Rg>;
161 template<
typename _Tp,
typename _CharT>
163 = __conditional_t<formattable<const _Tp, _CharT>,
const _Tp, _Tp>;
168 enum class range_format {
186 template<
typename _Rg>
187 constexpr auto format_kind = []{
188 static_assert(
false,
"cannot use primary template of 'std::format_kind'");
189 return type_identity<_Rg>{};
193_GLIBCXX_END_NAMESPACE_VERSION
ISO C++ entities toplevel namespace is std.