make_args -> make_format_args

This commit is contained in:
Victor Zverovich 2018-04-08 07:21:26 -07:00
parent 9382b76f2a
commit 7d28674d3a
7 changed files with 24 additions and 23 deletions

View File

@ -1003,13 +1003,14 @@ const uint64_t format_arg_store<Context, Args...>::TYPES = IS_PACKED ?
\endrst
*/
template <typename Context, typename ...Args>
inline format_arg_store<Context, Args...> make_args(const Args & ... args) {
inline format_arg_store<Context, Args...>
make_format_args(const Args & ... args) {
return format_arg_store<Context, Args...>(args...);
}
template <typename ...Args>
inline format_arg_store<format_context, Args...>
make_args(const Args & ... args) {
make_format_args(const Args & ... args) {
return format_arg_store<format_context, Args...>(args...);
}
@ -1165,7 +1166,7 @@ FMT_API void vprint_colored(color c, string_view format, format_args args);
template <typename... Args>
inline void print_colored(color c, string_view format_str,
const Args & ... args) {
vprint_colored(c, format_str, make_args(args...));
vprint_colored(c, format_str, make_format_args(args...));
}
format_context::iterator vformat_to(
@ -1210,7 +1211,7 @@ std::wstring vformat(wstring_view format_str, wformat_args args);
template <typename... Args>
inline std::string format(string_view format_str, const Args & ... args) {
// This should be just
// return vformat(format_str, make_args(args...));
// return vformat(format_str, make_format_args(args...));
// but gcc has trouble optimizing the latter, so break it down.
format_arg_store<format_context, Args...> as(args...);
return vformat(format_str, as);

View File

@ -2266,7 +2266,7 @@ class system_error : public std::runtime_error {
template <typename... Args>
system_error(int error_code, string_view message, const Args & ... args)
: std::runtime_error("") {
init(error_code, message, make_args(args...));
init(error_code, message, make_format_args(args...));
}
FMT_API ~system_error() FMT_DTOR_NOEXCEPT;
@ -2927,7 +2927,7 @@ class windows_error : public system_error {
*/
template <typename... Args>
windows_error(int error_code, string_view message, const Args & ... args) {
init(error_code, message, make_args(args...));
init(error_code, message, make_format_args(args...));
}
};
@ -3383,13 +3383,13 @@ inline wformat_context::iterator vformat_to(
template <typename... Args>
inline format_context::iterator format_to(
memory_buffer &buf, string_view format_str, const Args & ... args) {
return vformat_to(buf, format_str, make_args(args...));
return vformat_to(buf, format_str, make_format_args(args...));
}
template <typename... Args>
inline wformat_context::iterator format_to(
wmemory_buffer &buf, wstring_view format_str, const Args & ... args) {
return vformat_to(buf, format_str, make_args<wformat_context>(args...));
return vformat_to(buf, format_str, make_format_args<wformat_context>(args...));
}
template <typename OutputIt, typename Char = char>
@ -3414,7 +3414,7 @@ template <typename OutputIt, typename... Args>
inline OutputIt format_to(OutputIt out, string_view format_str,
const Args & ... args) {
return vformat_to(out, format_str,
*make_args<typename format_context_t<OutputIt>::type>(args...));
*make_format_args<typename format_context_t<OutputIt>::type>(args...));
}
template <typename Container, typename... Args>
@ -3422,7 +3422,7 @@ inline typename std::enable_if<
is_contiguous<Container>::value, std::back_insert_iterator<Container>>::type
format_to(std::back_insert_iterator<Container> out,
string_view format_str, const Args & ... args) {
return vformat_to(out, format_str, make_args(args...));
return vformat_to(out, format_str, make_format_args(args...));
}
template <typename OutputIt>
@ -3445,7 +3445,7 @@ inline format_to_n_result<OutputIt> format_to_n(
OutputIt out, std::size_t n, string_view format_str, const Args & ... args) {
typedef internal::truncating_iterator<OutputIt> It;
auto it = vformat_to(It(out, n), format_str,
*make_args<typename format_context_t<It>::type>(args...));
*make_format_args<typename format_context_t<It>::type>(args...));
return {it.base(), it.count()};
}
@ -3466,14 +3466,14 @@ inline typename std::enable_if<
internal::is_format_string<String>::value, std::string>::type
format(String format_str, const Args & ... args) {
internal::check_format_string<Args...>(format_str);
return vformat(format_str.data(), make_args(args...));
return vformat(format_str.data(), make_format_args(args...));
}
template <typename String, typename... Args>
inline typename std::enable_if<internal::is_format_string<String>::value>::type
print(String format_str, const Args & ... args) {
internal::check_format_string<Args...>(format_str);
return vprint(format_str.data(), make_args(args...));
return vprint(format_str.data(), make_format_args(args...));
}
// Counts the number of characters in the output of format(format_str, args...).

View File

@ -139,7 +139,7 @@ inline void vprint(std::ostream &os, string_view format_str, format_args args) {
template <typename... Args>
inline void print(std::ostream &os, string_view format_str,
const Args & ... args) {
vprint(os, format_str, make_args(args...));
vprint(os, format_str, make_format_args(args...));
}
} // namespace fmt

View File

@ -218,7 +218,7 @@ public:
template <typename... Args>
inline void print(string_view format_str, const Args & ... args) {
vprint(format_str, make_args(args...));
vprint(format_str, make_format_args(args...));
}
};

View File

@ -570,7 +570,7 @@ inline std::string vsprintf(string_view format, printf_args args) {
template <typename... Args>
inline std::string sprintf(string_view format_str, const Args & ... args) {
return vsprintf(format_str,
make_args<typename printf_context<internal::buffer>::type>(args...));
make_format_args<typename printf_context<internal::buffer>::type>(args...));
}
inline std::wstring vsprintf(
@ -583,7 +583,7 @@ inline std::wstring vsprintf(
template <typename... Args>
inline std::wstring sprintf(wstring_view format_str, const Args & ... args) {
auto vargs = make_args<
auto vargs = make_format_args<
typename printf_context<internal::wbuffer>::type>(args...);
return vsprintf(format_str, vargs);
}
@ -607,7 +607,7 @@ inline int vfprintf(std::FILE *f, string_view format, printf_args args) {
*/
template <typename... Args>
inline int fprintf(std::FILE *f, string_view format_str, const Args & ... args) {
auto vargs = make_args<
auto vargs = make_format_args<
typename printf_context<internal::buffer>::type>(args...);
return vfprintf(f, format_str, vargs);
}
@ -628,7 +628,7 @@ inline int vprintf(string_view format, printf_args args) {
template <typename... Args>
inline int printf(string_view format_str, const Args & ... args) {
return vprintf(format_str,
make_args<typename printf_context<internal::buffer>::type>(args...));
make_format_args<typename printf_context<internal::buffer>::type>(args...));
}
inline int vfprintf(std::ostream &os, string_view format_str,
@ -651,7 +651,7 @@ inline int vfprintf(std::ostream &os, string_view format_str,
template <typename... Args>
inline int fprintf(std::ostream &os, string_view format_str,
const Args & ... args) {
auto vargs = make_args<
auto vargs = make_format_args<
typename printf_context<internal::buffer>::type>(args...);
return vfprintf(os, format_str, vargs);
}

View File

@ -37,7 +37,7 @@ std::string custom_vformat(fmt::string_view format_str, fmt::format_args args) {
template <typename... Args>
std::string custom_format(const char *format_str, const Args & ... args) {
auto va = fmt::make_args(args...);
auto va = fmt::make_format_args(args...);
return custom_vformat(format_str, va);
}

View File

@ -1324,7 +1324,7 @@ std::string vformat_message(int id, const char *format, fmt::format_args args) {
template <typename... Args>
std::string format_message(int id, const char *format, const Args & ... args) {
auto va = fmt::make_args(args...);
auto va = fmt::make_format_args(args...);
return vformat_message(id, format, va);
}
@ -1433,7 +1433,7 @@ void custom_vformat(fmt::string_view format_str, fmt::format_args args) {
template <typename... Args>
void custom_format(const char *format_str, const Args & ... args) {
auto va = fmt::make_args(args...);
auto va = fmt::make_format_args(args...);
return custom_vformat(format_str, va);
}