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