tmp/tmps9t63anv/{from.md → to.md}
RENAMED
|
@@ -1,110 +1,159 @@
|
|
| 1 |
### Header `<format>` synopsis <a id="format.syn">[[format.syn]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
// [format.functions], formatting functions
|
| 6 |
template<class... Args>
|
| 7 |
-
string format(
|
| 8 |
template<class... Args>
|
| 9 |
-
wstring format(
|
| 10 |
template<class... Args>
|
| 11 |
-
string format(const locale& loc,
|
| 12 |
template<class... Args>
|
| 13 |
-
wstring format(const locale& loc,
|
| 14 |
|
| 15 |
string vformat(string_view fmt, format_args args);
|
| 16 |
wstring vformat(wstring_view fmt, wformat_args args);
|
| 17 |
string vformat(const locale& loc, string_view fmt, format_args args);
|
| 18 |
wstring vformat(const locale& loc, wstring_view fmt, wformat_args args);
|
| 19 |
|
| 20 |
template<class Out, class... Args>
|
| 21 |
-
Out format_to(Out out,
|
| 22 |
template<class Out, class... Args>
|
| 23 |
-
Out format_to(Out out,
|
| 24 |
template<class Out, class... Args>
|
| 25 |
-
Out format_to(Out out, const locale& loc,
|
| 26 |
template<class Out, class... Args>
|
| 27 |
-
Out format_to(Out out, const locale& loc,
|
| 28 |
|
| 29 |
template<class Out>
|
| 30 |
-
Out vformat_to(Out out, string_view fmt,
|
| 31 |
-
format_args_t<type_identity_t<Out>, char> args);
|
| 32 |
template<class Out>
|
| 33 |
-
Out vformat_to(Out out, wstring_view fmt,
|
| 34 |
-
format_args_t<type_identity_t<Out>, wchar_t> args);
|
| 35 |
template<class Out>
|
| 36 |
-
Out vformat_to(Out out, const locale& loc, string_view fmt,
|
| 37 |
-
format_args_t<type_identity_t<Out>, char> args);
|
| 38 |
template<class Out>
|
| 39 |
-
Out vformat_to(Out out, const locale& loc, wstring_view fmt,
|
| 40 |
-
format_args_t<type_identity_t<Out>, wchar_t> args);
|
| 41 |
|
| 42 |
template<class Out> struct format_to_n_result {
|
| 43 |
Out out;
|
| 44 |
iter_difference_t<Out> size;
|
| 45 |
};
|
| 46 |
template<class Out, class... Args>
|
| 47 |
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
|
| 48 |
-
|
| 49 |
template<class Out, class... Args>
|
| 50 |
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
|
| 51 |
-
|
| 52 |
template<class Out, class... Args>
|
| 53 |
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
|
| 54 |
-
const locale& loc,
|
| 55 |
-
|
| 56 |
template<class Out, class... Args>
|
| 57 |
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
|
| 58 |
-
const locale& loc,
|
| 59 |
-
|
| 60 |
|
| 61 |
template<class... Args>
|
| 62 |
-
size_t formatted_size(
|
| 63 |
template<class... Args>
|
| 64 |
-
size_t formatted_size(
|
| 65 |
template<class... Args>
|
| 66 |
-
size_t formatted_size(const locale& loc,
|
| 67 |
template<class... Args>
|
| 68 |
-
size_t formatted_size(const locale& loc,
|
| 69 |
|
| 70 |
// [format.formatter], formatter
|
| 71 |
template<class T, class charT = char> struct formatter;
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
// [format.parse.ctx], class template basic_format_parse_context
|
| 74 |
template<class charT> class basic_format_parse_context;
|
| 75 |
using format_parse_context = basic_format_parse_context<char>;
|
| 76 |
using wformat_parse_context = basic_format_parse_context<wchar_t>;
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
// [format.arguments], arguments
|
| 83 |
// [format.arg], class template basic_format_arg
|
| 84 |
template<class Context> class basic_format_arg;
|
| 85 |
|
| 86 |
template<class Visitor, class Context>
|
| 87 |
-
|
| 88 |
|
| 89 |
// [format.arg.store], class template format-arg-store
|
| 90 |
-
template<class Context, class... Args>
|
| 91 |
|
| 92 |
template<class Context = format_context, class... Args>
|
| 93 |
format-arg-store<Context, Args...>
|
| 94 |
-
make_format_args(
|
| 95 |
template<class... Args>
|
| 96 |
format-arg-store<wformat_context, Args...>
|
| 97 |
-
make_wformat_args(
|
| 98 |
-
|
| 99 |
-
// [format.args], class template basic_format_args
|
| 100 |
-
template<class Context> class basic_format_args;
|
| 101 |
-
using format_args = basic_format_args<format_context>;
|
| 102 |
-
using wformat_args = basic_format_args<wformat_context>;
|
| 103 |
-
|
| 104 |
-
template<class Out, class charT>
|
| 105 |
-
using format_args_t = basic_format_args<basic_format_context<Out, charT>>;
|
| 106 |
|
| 107 |
// [format.error], class format_error
|
| 108 |
class format_error;
|
| 109 |
}
|
| 110 |
```
|
|
|
|
| 1 |
### Header `<format>` synopsis <a id="format.syn">[[format.syn]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
+
// [format.context], class template basic_format_context
|
| 6 |
+
template<class Out, class charT> class basic_format_context;
|
| 7 |
+
using format_context = basic_format_context<unspecified, char>;
|
| 8 |
+
using wformat_context = basic_format_context<unspecified, wchar_t>;
|
| 9 |
+
|
| 10 |
+
// [format.args], class template basic_format_args
|
| 11 |
+
template<class Context> class basic_format_args;
|
| 12 |
+
using format_args = basic_format_args<format_context>;
|
| 13 |
+
using wformat_args = basic_format_args<wformat_context>;
|
| 14 |
+
|
| 15 |
+
// [format.fmt.string], class template basic_format_string
|
| 16 |
+
template<class charT, class... Args>
|
| 17 |
+
struct basic_format_string;
|
| 18 |
+
|
| 19 |
+
template<class... Args>
|
| 20 |
+
using format_string = basic_format_string<char, type_identity_t<Args>...>;
|
| 21 |
+
template<class... Args>
|
| 22 |
+
using wformat_string = basic_format_string<wchar_t, type_identity_t<Args>...>;
|
| 23 |
+
|
| 24 |
// [format.functions], formatting functions
|
| 25 |
template<class... Args>
|
| 26 |
+
string format(format_string<Args...> fmt, Args&&... args);
|
| 27 |
template<class... Args>
|
| 28 |
+
wstring format(wformat_string<Args...> fmt, Args&&... args);
|
| 29 |
template<class... Args>
|
| 30 |
+
string format(const locale& loc, format_string<Args...> fmt, Args&&... args);
|
| 31 |
template<class... Args>
|
| 32 |
+
wstring format(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
|
| 33 |
|
| 34 |
string vformat(string_view fmt, format_args args);
|
| 35 |
wstring vformat(wstring_view fmt, wformat_args args);
|
| 36 |
string vformat(const locale& loc, string_view fmt, format_args args);
|
| 37 |
wstring vformat(const locale& loc, wstring_view fmt, wformat_args args);
|
| 38 |
|
| 39 |
template<class Out, class... Args>
|
| 40 |
+
Out format_to(Out out, format_string<Args...> fmt, Args&&... args);
|
| 41 |
template<class Out, class... Args>
|
| 42 |
+
Out format_to(Out out, wformat_string<Args...> fmt, Args&&... args);
|
| 43 |
template<class Out, class... Args>
|
| 44 |
+
Out format_to(Out out, const locale& loc, format_string<Args...> fmt, Args&&... args);
|
| 45 |
template<class Out, class... Args>
|
| 46 |
+
Out format_to(Out out, const locale& loc, wformat_string<Args...> fmt, Args&&... args);
|
| 47 |
|
| 48 |
template<class Out>
|
| 49 |
+
Out vformat_to(Out out, string_view fmt, format_args args);
|
|
|
|
| 50 |
template<class Out>
|
| 51 |
+
Out vformat_to(Out out, wstring_view fmt, wformat_args args);
|
|
|
|
| 52 |
template<class Out>
|
| 53 |
+
Out vformat_to(Out out, const locale& loc, string_view fmt, format_args args);
|
|
|
|
| 54 |
template<class Out>
|
| 55 |
+
Out vformat_to(Out out, const locale& loc, wstring_view fmt, wformat_args args);
|
|
|
|
| 56 |
|
| 57 |
template<class Out> struct format_to_n_result {
|
| 58 |
Out out;
|
| 59 |
iter_difference_t<Out> size;
|
| 60 |
};
|
| 61 |
template<class Out, class... Args>
|
| 62 |
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
|
| 63 |
+
format_string<Args...> fmt, Args&&... args);
|
| 64 |
template<class Out, class... Args>
|
| 65 |
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
|
| 66 |
+
wformat_string<Args...> fmt, Args&&... args);
|
| 67 |
template<class Out, class... Args>
|
| 68 |
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
|
| 69 |
+
const locale& loc, format_string<Args...> fmt,
|
| 70 |
+
Args&&... args);
|
| 71 |
template<class Out, class... Args>
|
| 72 |
format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
|
| 73 |
+
const locale& loc, wformat_string<Args...> fmt,
|
| 74 |
+
Args&&... args);
|
| 75 |
|
| 76 |
template<class... Args>
|
| 77 |
+
size_t formatted_size(format_string<Args...> fmt, Args&&... args);
|
| 78 |
template<class... Args>
|
| 79 |
+
size_t formatted_size(wformat_string<Args...> fmt, Args&&... args);
|
| 80 |
template<class... Args>
|
| 81 |
+
size_t formatted_size(const locale& loc, format_string<Args...> fmt, Args&&... args);
|
| 82 |
template<class... Args>
|
| 83 |
+
size_t formatted_size(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
|
| 84 |
|
| 85 |
// [format.formatter], formatter
|
| 86 |
template<class T, class charT = char> struct formatter;
|
| 87 |
|
| 88 |
+
// [format.formattable], concept formattable
|
| 89 |
+
template<class T, class charT>
|
| 90 |
+
concept formattable = see below;
|
| 91 |
+
|
| 92 |
+
template<class R, class charT>
|
| 93 |
+
concept const-formattable-range = // exposition only
|
| 94 |
+
ranges::input_range<const R> &&
|
| 95 |
+
formattable<ranges::range_reference_t<const R>, charT>;
|
| 96 |
+
|
| 97 |
+
template<class R, class charT>
|
| 98 |
+
using fmt-maybe-const = // exposition only
|
| 99 |
+
conditional_t<const-formattable-range<R, charT>, const R, R>;
|
| 100 |
+
|
| 101 |
// [format.parse.ctx], class template basic_format_parse_context
|
| 102 |
template<class charT> class basic_format_parse_context;
|
| 103 |
using format_parse_context = basic_format_parse_context<char>;
|
| 104 |
using wformat_parse_context = basic_format_parse_context<wchar_t>;
|
| 105 |
|
| 106 |
+
// [format.range], formatting of ranges
|
| 107 |
+
// [format.range.fmtkind], variable template format_kind
|
| 108 |
+
enum class range_format {
|
| 109 |
+
disabled,
|
| 110 |
+
map,
|
| 111 |
+
set,
|
| 112 |
+
sequence,
|
| 113 |
+
string,
|
| 114 |
+
debug_string
|
| 115 |
+
};
|
| 116 |
+
|
| 117 |
+
template<class R>
|
| 118 |
+
constexpr unspecified format_kind = unspecified;
|
| 119 |
+
|
| 120 |
+
template<ranges::input_range R>
|
| 121 |
+
requires same_as<R, remove_cvref_t<R>>
|
| 122 |
+
constexpr range_format format_kind<R> = see below;
|
| 123 |
+
|
| 124 |
+
// [format.range.formatter], class template range_formatter
|
| 125 |
+
template<class T, class charT = char>
|
| 126 |
+
requires same_as<remove_cvref_t<T>, T> && formattable<T, charT>
|
| 127 |
+
class range_formatter;
|
| 128 |
+
|
| 129 |
+
// [format.range.fmtdef], class template range-default-formatter
|
| 130 |
+
template<range_format K, ranges::input_range R, class charT>
|
| 131 |
+
struct range-default-formatter; // exposition only
|
| 132 |
+
|
| 133 |
+
// [format.range.fmtmap], [format.range.fmtset], [format.range.fmtstr], specializations for maps, sets, and strings
|
| 134 |
+
template<ranges::input_range R, class charT>
|
| 135 |
+
requires (format_kind<R> != range_format::disabled) &&
|
| 136 |
+
formattable<ranges::range_reference_t<R>, charT>
|
| 137 |
+
struct formatter<R, charT> : range-default-formatter<format_kind<R>, R, charT> { };
|
| 138 |
|
| 139 |
// [format.arguments], arguments
|
| 140 |
// [format.arg], class template basic_format_arg
|
| 141 |
template<class Context> class basic_format_arg;
|
| 142 |
|
| 143 |
template<class Visitor, class Context>
|
| 144 |
+
decltype(auto) visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg);
|
| 145 |
|
| 146 |
// [format.arg.store], class template format-arg-store
|
| 147 |
+
template<class Context, class... Args> class format-arg-store; // exposition only
|
| 148 |
|
| 149 |
template<class Context = format_context, class... Args>
|
| 150 |
format-arg-store<Context, Args...>
|
| 151 |
+
make_format_args(Args&&... fmt_args);
|
| 152 |
template<class... Args>
|
| 153 |
format-arg-store<wformat_context, Args...>
|
| 154 |
+
make_wformat_args(Args&&... args);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
// [format.error], class format_error
|
| 157 |
class format_error;
|
| 158 |
}
|
| 159 |
```
|