From a34409a2ae1aa72fe19cc2585b562467628a57d8 Mon Sep 17 00:00:00 2001
From: Victor Zverovich
-An object of type Returns: Formatting argument
template <class Context>
class basic_arg {
public:
+ class handle;
+
basic_arg();
explicit operator bool() const noexcept;
@@ -1089,10 +1091,10 @@
Formatting argument
basic_arg<Context>
represents a reference
-to a formatting argument parameterized on a formatting context (see
-3.9). It can hold a value of one of the following
-types:
+The class template basic_arg
describes objects that store a copy of
+or a reference to a formatting argument. It is parameterized on a formatting
+context (see 4.9) and can hold a value of one of the
+following types:
@@ -1131,12 +1132,13 @@ int
unsigned int
@@ -1101,12 +1103,11 @@ Formatting argument
charT
double
double
-const char*
-string_view
-basic_string_view<charT>
if different from
- string_view
+const charT*
+basic_string_view<charT>
const void*
-handle
which stores a reference to an object of a user-defined
+type and a pointer to a formatting function
monostate
representing an empty state, i.e. when the
object doesn't refer to an argument
Formatting argument
bool is_integral() const;
true
if *this
represents an
-argument of an integral type.
bool is_numeric() const;
Returns: true
if *this
represents an
-argument of a numeric type.
bool is_pointer() const;
+template <class Context>
+class basic_arg<Context>::handle {
+public:
+ using char_type = typename Context::char_type;
+
+ void format(basic_buffer<char_type>& buf, Context& ctx);
+};
+
+
+void format(basic_buffer<char_type>& buf, Context& ctx);
Effects: Formats the object referred to by this handle into the buffer
+buf
.
+
The class basic_context
represents a formatting context for
-user-defined types. It provides access to formatting arguments and the current
-position in the format string being parsed.
+user-defined types. It can be used to implement different types of formatters,
+e.g. a printf formatter.
basic_context(const charT* format_str, args_type args);
basic_context(args_type args);
Effects: Constructs an object of class basic_context
-storing references to the formatting arguments and the format string in it.
+storing references to the formatting arguments.
Postcondition: ptr() == format_str
.
Postcondition: args() == args
.
args_type args() const;
template <class T, class charT = char>
struct formatter {
- constexpr typename basic_parse_context<charT>::iterator parse(parse_context<charT>& ctx);
+ constexpr typename basic_parse_context<charT>::iterator parse(basic_parse_context<charT>& ctx);
void format(basic_buffer<charT>& buf, const T& value, basic_context<charT>& ctx);
};