Simplify API
diff --git a/fmt/format.h b/fmt/format.h
index 303091f..fb3beb4 100644
--- a/fmt/format.h
+++ b/fmt/format.h
@@ -1443,9 +1443,6 @@
// If the arguments are not packed, add one more element to mark the end.
std::array<value_type, NUM_ARGS + (IS_PACKED ? 0 : 1)> data_;
- template <typename ...A>
- friend format_arg_store<Context, A...> make_format_args(const A & ... args);
-
public:
static const uint64_t TYPES = internal::make_type<Args..., void>();
@@ -1457,10 +1454,16 @@
template <typename Context, typename ...Args>
inline format_arg_store<Context, Args...>
- make_format_args(const Args & ... args) {
+ make_xformat_args(const Args & ... args) {
return format_arg_store<Context, Args...>(args...);
}
+template <typename ...Args>
+inline format_arg_store<format_context, Args...>
+ make_format_args(const Args & ... args) {
+ return format_arg_store<format_context, Args...>(args...);
+}
+
/** Formatting arguments. */
template <typename Context>
class basic_format_args {
@@ -2271,7 +2274,7 @@
*/
template <typename... Args>
SystemError(int error_code, CStringRef message, const Args & ... args) {
- init(error_code, message, make_format_args<format_context>(args...));
+ init(error_code, message, make_format_args(args...));
}
~SystemError() throw();
@@ -2494,7 +2497,7 @@
*/
template <typename... Args>
void write(BasicCStringRef<Char> format, const Args & ... args) {
- vwrite(format, make_format_args<basic_format_context<Char>>(args...));
+ vwrite(format, make_xformat_args<basic_format_context<Char>>(args...));
}
BasicWriter &operator<<(int value) {
@@ -3122,7 +3125,7 @@
*/
template <typename... Args>
WindowsError(int error_code, CStringRef message, const Args & ... args) {
- init(error_code, message, make_format_args<format_context>(args...));
+ init(error_code, message, make_format_args(args...));
}
};
@@ -3146,7 +3149,7 @@
template <typename... Args>
inline void print_colored(Color c, CStringRef format_str,
const Args & ... args) {
- vprint_colored(c, format_str, make_format_args<format_context>(args...));
+ vprint_colored(c, format_str, make_format_args(args...));
}
inline std::string vformat(CStringRef format_str, format_args args) {
@@ -3166,7 +3169,7 @@
*/
template <typename... Args>
inline std::string format(CStringRef format_str, const Args & ... args) {
- return vformat(format_str, make_format_args<format_context>(args...));
+ return vformat(format_str, make_format_args(args...));
}
inline std::wstring vformat(WCStringRef format_str, wformat_args args) {
@@ -3177,7 +3180,7 @@
template <typename... Args>
inline std::wstring format(WCStringRef format_str, const Args & ... args) {
- auto vargs = make_format_args<wformat_context>(args...);
+ auto vargs = make_xformat_args<wformat_context>(args...);
return vformat(format_str, vargs);
}
@@ -3194,7 +3197,7 @@
*/
template <typename... Args>
inline void print(std::FILE *f, CStringRef format_str, const Args & ... args) {
- vprint(f, format_str, make_format_args<format_context>(args...));
+ vprint(f, format_str, make_format_args(args...));
}
FMT_API void vprint(CStringRef format_str, format_args args);
@@ -3210,7 +3213,7 @@
*/
template <typename... Args>
inline void print(CStringRef format_str, const Args & ... args) {
- vprint(format_str, make_format_args<format_context>(args...));
+ vprint(format_str, make_format_args(args...));
}
/**
diff --git a/fmt/ostream.h b/fmt/ostream.h
index feafc3b..920d041 100644
--- a/fmt/ostream.h
+++ b/fmt/ostream.h
@@ -105,7 +105,7 @@
template <typename... Args>
inline void print(std::ostream &os, CStringRef format_str,
const Args & ... args) {
- vprint(os, format_str, make_format_args<format_context>(args...));
+ vprint(os, format_str, make_format_args(args...));
}
} // namespace fmt
diff --git a/fmt/posix.h b/fmt/posix.h
index c6c6c13..4758a85 100644
--- a/fmt/posix.h
+++ b/fmt/posix.h
@@ -172,7 +172,7 @@
template <typename... Args>
inline void print(CStringRef format_str, const Args & ... args) {
- vprint(format_str, make_format_args<format_context>(args...));
+ vprint(format_str, make_format_args(args...));
}
};
diff --git a/fmt/printf.h b/fmt/printf.h
index 42728b7..85572c4 100644
--- a/fmt/printf.h
+++ b/fmt/printf.h
@@ -523,7 +523,7 @@
*/
template <typename... Args>
inline std::string sprintf(CStringRef format_str, const Args & ... args) {
- return vsprintf(format_str, make_format_args<printf_context<char>>(args...));
+ return vsprintf(format_str, make_xformat_args<printf_context<char>>(args...));
}
inline std::wstring vsprintf(WCStringRef format,
@@ -535,7 +535,7 @@
template <typename... Args>
inline std::wstring sprintf(WCStringRef format_str, const Args & ... args) {
- auto vargs = make_format_args<printf_context<wchar_t>>(args...);
+ auto vargs = make_xformat_args<printf_context<wchar_t>>(args...);
return vsprintf(format_str, vargs);
}
@@ -553,7 +553,7 @@
*/
template <typename... Args>
inline int fprintf(std::FILE *f, CStringRef format_str, const Args & ... args) {
- auto vargs = make_format_args<printf_context<char>>(args...);
+ auto vargs = make_xformat_args<printf_context<char>>(args...);
return vfprintf(f, format_str, vargs);
}
@@ -573,7 +573,7 @@
*/
template <typename... Args>
inline int printf(CStringRef format_str, const Args & ... args) {
- return vprintf(format_str, make_format_args<printf_context<char>>(args...));
+ return vprintf(format_str, make_xformat_args<printf_context<char>>(args...));
}
inline int vfprintf(std::ostream &os, CStringRef format_str,
@@ -596,7 +596,7 @@
template <typename... Args>
inline int fprintf(std::ostream &os, CStringRef format_str,
const Args & ... args) {
- auto vargs = make_format_args<printf_context<char>>(args...);
+ auto vargs = make_xformat_args<printf_context<char>>(args...);
return vfprintf(os, format_str, vargs);
}
} // namespace fmt
diff --git a/test/custom-formatter-test.cc b/test/custom-formatter-test.cc
index 65888b2..83648ab 100644
--- a/test/custom-formatter-test.cc
+++ b/test/custom-formatter-test.cc
@@ -54,7 +54,7 @@
template <typename... Args>
std::string custom_format(const char *format_str, const Args & ... args) {
- auto va = fmt::make_format_args<fmt::format_context>(args...);
+ auto va = fmt::make_format_args(args...);
return custom_vformat(format_str, va);
}
@@ -72,7 +72,7 @@
template <typename... Args>
std::string custom_sprintf(const char *format_str, const Args & ... args) {
- auto va = fmt::make_format_args<CustomPrintfFormatter>(args...);
+ auto va = fmt::make_xformat_args<CustomPrintfFormatter>(args...);
return custom_vsprintf(format_str, va);
}
diff --git a/test/format-test.cc b/test/format-test.cc
index 1e919b7..bb195a3 100644
--- a/test/format-test.cc
+++ b/test/format-test.cc
@@ -1559,7 +1559,7 @@
template <typename... Args>
std::string format_message(int id, const char *format, const Args & ... args) {
- auto va = fmt::make_format_args<fmt::format_context>(args...);
+ auto va = fmt::make_format_args(args...);
return vformat_message(id, format, va);
}
@@ -1640,7 +1640,7 @@
template <typename... Args>
void custom_format(const char *format_str, const Args & ... args) {
- auto va = fmt::make_format_args<fmt::format_context>(args...);
+ auto va = fmt::make_format_args(args...);
return custom_vformat(format_str, va);
}