mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-27 06:35:37 +00:00
typedef -> using
This commit is contained in:
parent
c92dc37464
commit
f6f0415b83
@ -506,12 +506,12 @@ struct chrono_formatter {
|
|||||||
conditional_t<std::is_integral<Rep>::value && sizeof(Rep) < sizeof(int),
|
conditional_t<std::is_integral<Rep>::value && sizeof(Rep) < sizeof(int),
|
||||||
unsigned, typename make_unsigned_or_unchanged<Rep>::type>;
|
unsigned, typename make_unsigned_or_unchanged<Rep>::type>;
|
||||||
rep val;
|
rep val;
|
||||||
typedef std::chrono::duration<rep> seconds;
|
using seconds = std::chrono::duration<rep>;
|
||||||
seconds s;
|
seconds s;
|
||||||
typedef std::chrono::duration<rep, std::milli> milliseconds;
|
using milliseconds = std::chrono::duration<rep, std::milli>;
|
||||||
bool negative;
|
bool negative;
|
||||||
|
|
||||||
typedef typename FormatContext::char_type char_type;
|
using char_type = typename FormatContext::char_type;
|
||||||
|
|
||||||
explicit chrono_formatter(FormatContext& ctx, OutputIt o,
|
explicit chrono_formatter(FormatContext& ctx, OutputIt o,
|
||||||
std::chrono::duration<Rep, Period> d)
|
std::chrono::duration<Rep, Period> d)
|
||||||
@ -717,11 +717,11 @@ struct formatter<std::chrono::duration<Rep, Period>, Char> {
|
|||||||
private:
|
private:
|
||||||
basic_format_specs<Char> specs;
|
basic_format_specs<Char> specs;
|
||||||
int precision;
|
int precision;
|
||||||
typedef internal::arg_ref<Char> arg_ref_type;
|
using arg_ref_type = internal::arg_ref<Char>;
|
||||||
arg_ref_type width_ref;
|
arg_ref_type width_ref;
|
||||||
arg_ref_type precision_ref;
|
arg_ref_type precision_ref;
|
||||||
mutable basic_string_view<Char> format_str;
|
mutable basic_string_view<Char> format_str;
|
||||||
typedef std::chrono::duration<Rep, Period> duration;
|
using duration = std::chrono::duration<Rep, Period>;
|
||||||
|
|
||||||
struct spec_handler {
|
struct spec_handler {
|
||||||
formatter& f;
|
formatter& f;
|
||||||
@ -759,7 +759,7 @@ struct formatter<std::chrono::duration<Rep, Period>, Char> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef typename basic_parse_context<Char>::iterator iterator;
|
using iterator = typename basic_parse_context<Char>::iterator;
|
||||||
struct parse_range {
|
struct parse_range {
|
||||||
iterator begin;
|
iterator begin;
|
||||||
iterator end;
|
iterator end;
|
||||||
|
@ -78,7 +78,7 @@ inline int fmt_snprintf(char* buffer, size_t size, const char* format, ...) {
|
|||||||
# define FMT_SNPRINTF fmt_snprintf
|
# define FMT_SNPRINTF fmt_snprintf
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
typedef void (*FormatFunc)(internal::buffer<char>&, int, string_view);
|
using format_func = void (*)(internal::buffer<char>&, int, string_view);
|
||||||
|
|
||||||
// Portable thread-safe version of strerror.
|
// Portable thread-safe version of strerror.
|
||||||
// Sets buffer to point to a string describing the error code.
|
// Sets buffer to point to a string describing the error code.
|
||||||
@ -182,7 +182,7 @@ FMT_FUNC void fwrite_fully(const void* ptr, size_t size, size_t count,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FMT_FUNC void report_error(FormatFunc func, int error_code,
|
FMT_FUNC void report_error(format_func func, int error_code,
|
||||||
string_view message) FMT_NOEXCEPT {
|
string_view message) FMT_NOEXCEPT {
|
||||||
memory_buffer full_message;
|
memory_buffer full_message;
|
||||||
func(full_message, error_code, message);
|
func(full_message, error_code, message);
|
||||||
@ -355,7 +355,7 @@ template <typename T> struct bits {
|
|||||||
// A handmade floating-point number f * pow(2, e).
|
// A handmade floating-point number f * pow(2, e).
|
||||||
class fp {
|
class fp {
|
||||||
private:
|
private:
|
||||||
typedef uint64_t significand_type;
|
using significand_type = uint64_t;
|
||||||
|
|
||||||
// All sizes are in bits.
|
// All sizes are in bits.
|
||||||
// Subtract 1 to account for an implicit most significant bit in the
|
// Subtract 1 to account for an implicit most significant bit in the
|
||||||
@ -379,7 +379,7 @@ class fp {
|
|||||||
// errors on platforms where double is not IEEE754.
|
// errors on platforms where double is not IEEE754.
|
||||||
template <typename Double> explicit fp(Double d) {
|
template <typename Double> explicit fp(Double d) {
|
||||||
// Assume double is in the format [sign][exponent][significand].
|
// Assume double is in the format [sign][exponent][significand].
|
||||||
typedef std::numeric_limits<Double> limits;
|
using limits = std::numeric_limits<Double>;
|
||||||
const int exponent_size =
|
const int exponent_size =
|
||||||
bits<Double>::value - double_significand_size - 1; // -1 for sign
|
bits<Double>::value - double_significand_size - 1; // -1 for sign
|
||||||
const uint64_t significand_mask = implicit_bit - 1;
|
const uint64_t significand_mask = implicit_bit - 1;
|
||||||
|
@ -69,7 +69,7 @@ FMT_BEGIN_NAMESPACE
|
|||||||
A reference to a null-terminated string. It can be constructed from a C
|
A reference to a null-terminated string. It can be constructed from a C
|
||||||
string or ``std::string``.
|
string or ``std::string``.
|
||||||
|
|
||||||
You can use one of the following typedefs for common character types:
|
You can use one of the following type aliases for common character types:
|
||||||
|
|
||||||
+---------------+-----------------------------+
|
+---------------+-----------------------------+
|
||||||
| Type | Definition |
|
| Type | Definition |
|
||||||
@ -108,8 +108,8 @@ template <typename Char> class basic_cstring_view {
|
|||||||
const Char* c_str() const { return data_; }
|
const Char* c_str() const { return data_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef basic_cstring_view<char> cstring_view;
|
using cstring_view = basic_cstring_view<char>;
|
||||||
typedef basic_cstring_view<wchar_t> wcstring_view;
|
using wcstring_view = basic_cstring_view<wchar_t>;
|
||||||
|
|
||||||
// An error code.
|
// An error code.
|
||||||
class error_code {
|
class error_code {
|
||||||
@ -266,7 +266,7 @@ long getpagesize();
|
|||||||
class Locale {
|
class Locale {
|
||||||
private:
|
private:
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
typedef _locale_t locale_t;
|
using locale_t = _locale_t;
|
||||||
|
|
||||||
enum { LC_NUMERIC_MASK = LC_NUMERIC };
|
enum { LC_NUMERIC_MASK = LC_NUMERIC };
|
||||||
|
|
||||||
@ -287,14 +287,14 @@ class Locale {
|
|||||||
void operator=(const Locale&) = delete;
|
void operator=(const Locale&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef locale_t Type;
|
using type = locale_t;
|
||||||
|
|
||||||
Locale() : locale_(newlocale(LC_NUMERIC_MASK, "C", nullptr)) {
|
Locale() : locale_(newlocale(LC_NUMERIC_MASK, "C", nullptr)) {
|
||||||
if (!locale_) FMT_THROW(system_error(errno, "cannot create locale"));
|
if (!locale_) FMT_THROW(system_error(errno, "cannot create locale"));
|
||||||
}
|
}
|
||||||
~Locale() { freelocale(locale_); }
|
~Locale() { freelocale(locale_); }
|
||||||
|
|
||||||
Type get() const { return locale_; }
|
type get() const { return locale_; }
|
||||||
|
|
||||||
// Converts string to floating-point number and advances str past the end
|
// Converts string to floating-point number and advances str past the end
|
||||||
// of the parsed input.
|
// of the parsed input.
|
||||||
|
@ -70,17 +70,17 @@ class is_zero_int {
|
|||||||
|
|
||||||
template <typename T> struct make_unsigned_or_bool : std::make_unsigned<T> {};
|
template <typename T> struct make_unsigned_or_bool : std::make_unsigned<T> {};
|
||||||
|
|
||||||
template <> struct make_unsigned_or_bool<bool> { typedef bool type; };
|
template <> struct make_unsigned_or_bool<bool> { using type = bool; };
|
||||||
|
|
||||||
template <typename T, typename Context> class arg_converter {
|
template <typename T, typename Context> class arg_converter {
|
||||||
private:
|
private:
|
||||||
typedef typename Context::char_type Char;
|
using char_type = typename Context::char_type;
|
||||||
|
|
||||||
basic_format_arg<Context>& arg_;
|
basic_format_arg<Context>& arg_;
|
||||||
typename Context::char_type type_;
|
char_type type_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
arg_converter(basic_format_arg<Context>& arg, Char type)
|
arg_converter(basic_format_arg<Context>& arg, char_type type)
|
||||||
: arg_(arg), type_(type) {}
|
: arg_(arg), type_(type) {}
|
||||||
|
|
||||||
void operator()(bool value) {
|
void operator()(bool value) {
|
||||||
@ -97,9 +97,9 @@ template <typename T, typename Context> class arg_converter {
|
|||||||
arg_ = internal::make_arg<Context>(
|
arg_ = internal::make_arg<Context>(
|
||||||
static_cast<int>(static_cast<target_type>(value)));
|
static_cast<int>(static_cast<target_type>(value)));
|
||||||
} else {
|
} else {
|
||||||
typedef typename make_unsigned_or_bool<target_type>::type Unsigned;
|
using unsigned_type = typename make_unsigned_or_bool<target_type>::type;
|
||||||
arg_ = internal::make_arg<Context>(
|
arg_ = internal::make_arg<Context>(
|
||||||
static_cast<unsigned>(static_cast<Unsigned>(value)));
|
static_cast<unsigned>(static_cast<unsigned_type>(value)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_signed) {
|
if (is_signed) {
|
||||||
@ -137,8 +137,8 @@ template <typename Context> class char_converter {
|
|||||||
|
|
||||||
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||||
void operator()(T value) {
|
void operator()(T value) {
|
||||||
typedef typename Context::char_type Char;
|
arg_ = internal::make_arg<Context>(
|
||||||
arg_ = internal::make_arg<Context>(static_cast<Char>(value));
|
static_cast<typename Context::char_type>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||||
@ -149,7 +149,7 @@ template <typename Context> class char_converter {
|
|||||||
// left alignment if it is negative.
|
// left alignment if it is negative.
|
||||||
template <typename Char> class printf_width_handler {
|
template <typename Char> class printf_width_handler {
|
||||||
private:
|
private:
|
||||||
typedef basic_format_specs<Char> format_specs;
|
using format_specs = basic_format_specs<Char>;
|
||||||
|
|
||||||
format_specs& specs_;
|
format_specs& specs_;
|
||||||
|
|
||||||
@ -203,12 +203,12 @@ template <typename OutputIt, typename Char> class basic_printf_context;
|
|||||||
template <typename Range>
|
template <typename Range>
|
||||||
class printf_arg_formatter : public internal::arg_formatter_base<Range> {
|
class printf_arg_formatter : public internal::arg_formatter_base<Range> {
|
||||||
public:
|
public:
|
||||||
typedef decltype(std::declval<Range>().begin()) iterator;
|
using iterator = typename Range::iterator;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef typename Range::value_type char_type;
|
using char_type = typename Range::value_type;
|
||||||
typedef internal::arg_formatter_base<Range> base;
|
using base = internal::arg_formatter_base<Range>;
|
||||||
typedef basic_printf_context<iterator, char_type> context_type;
|
using context_type = basic_printf_context<iterator, char_type>;
|
||||||
|
|
||||||
context_type& context_;
|
context_type& context_;
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ class printf_arg_formatter : public internal::arg_formatter_base<Range> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename base::format_specs format_specs;
|
using format_specs = typename base::format_specs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
@ -328,7 +328,7 @@ template <typename OutputIt, typename Char> class basic_printf_context {
|
|||||||
template <typename T> using formatter_type = printf_formatter<T>;
|
template <typename T> using formatter_type = printf_formatter<T>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef basic_format_specs<char_type> format_specs;
|
using format_specs = basic_format_specs<char_type>;
|
||||||
|
|
||||||
OutputIt out_;
|
OutputIt out_;
|
||||||
basic_format_args<basic_printf_context> args_;
|
basic_format_args<basic_printf_context> args_;
|
||||||
@ -563,17 +563,15 @@ OutputIt basic_printf_context<OutputIt, Char>::format() {
|
|||||||
return std::copy(start, it, out);
|
return std::copy(start, it, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Buffer> struct basic_printf_context_t {
|
template <typename Char> using basic_printf_context_t =
|
||||||
typedef basic_printf_context<std::back_insert_iterator<Buffer>,
|
basic_printf_context<std::back_insert_iterator<internal::buffer<Char>>,
|
||||||
typename Buffer::value_type>
|
Char>;
|
||||||
type;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef basic_printf_context_t<internal::buffer<char>>::type printf_context;
|
using printf_context = basic_printf_context_t<char>;
|
||||||
typedef basic_printf_context_t<internal::buffer<wchar_t>>::type wprintf_context;
|
using wprintf_context = basic_printf_context_t<wchar_t>;
|
||||||
|
|
||||||
typedef basic_format_args<printf_context> printf_args;
|
using printf_args = basic_format_args<printf_context>;
|
||||||
typedef basic_format_args<wprintf_context> wprintf_args;
|
using wprintf_args = basic_format_args<wprintf_context>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
@ -602,9 +600,7 @@ inline format_arg_store<wprintf_context, Args...> make_wprintf_args(
|
|||||||
template <typename S, typename Char = char_t<S>>
|
template <typename S, typename Char = char_t<S>>
|
||||||
inline std::basic_string<Char> vsprintf(
|
inline std::basic_string<Char> vsprintf(
|
||||||
const S& format,
|
const S& format,
|
||||||
basic_format_args<
|
basic_format_args<basic_printf_context_t<Char>> args) {
|
||||||
typename basic_printf_context_t<internal::buffer<Char>>::type>
|
|
||||||
args) {
|
|
||||||
basic_memory_buffer<Char> buffer;
|
basic_memory_buffer<Char> buffer;
|
||||||
printf(buffer, to_string_view(format), args);
|
printf(buffer, to_string_view(format), args);
|
||||||
return to_string(buffer);
|
return to_string(buffer);
|
||||||
@ -622,17 +618,14 @@ inline std::basic_string<Char> vsprintf(
|
|||||||
template <typename S, typename... Args,
|
template <typename S, typename... Args,
|
||||||
typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
|
typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
|
||||||
inline std::basic_string<Char> sprintf(const S& format, const Args&... args) {
|
inline std::basic_string<Char> sprintf(const S& format, const Args&... args) {
|
||||||
using context = typename basic_printf_context_t<internal::buffer<Char>>::type;
|
using context = basic_printf_context_t<Char>;
|
||||||
format_arg_store<context, Args...> as{args...};
|
return vsprintf(to_string_view(format), {make_format_args<context>(args...)});
|
||||||
return vsprintf(to_string_view(format), basic_format_args<context>(as));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename S, typename Char = char_t<S>>
|
template <typename S, typename Char = char_t<S>>
|
||||||
inline int vfprintf(
|
inline int vfprintf(
|
||||||
std::FILE* f, const S& format,
|
std::FILE* f, const S& format,
|
||||||
basic_format_args<
|
basic_format_args<basic_printf_context_t<Char>> args) {
|
||||||
typename basic_printf_context_t<internal::buffer<Char>>::type>
|
|
||||||
args) {
|
|
||||||
basic_memory_buffer<Char> buffer;
|
basic_memory_buffer<Char> buffer;
|
||||||
printf(buffer, to_string_view(format), args);
|
printf(buffer, to_string_view(format), args);
|
||||||
std::size_t size = buffer.size();
|
std::size_t size = buffer.size();
|
||||||
@ -653,17 +646,15 @@ inline int vfprintf(
|
|||||||
template <typename S, typename... Args,
|
template <typename S, typename... Args,
|
||||||
typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
|
typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
|
||||||
inline int fprintf(std::FILE* f, const S& format, const Args&... args) {
|
inline int fprintf(std::FILE* f, const S& format, const Args&... args) {
|
||||||
using context = typename basic_printf_context_t<internal::buffer<Char>>::type;
|
using context = basic_printf_context_t<Char>;
|
||||||
format_arg_store<context, Args...> as{args...};
|
return vfprintf(f, to_string_view(format),
|
||||||
return vfprintf(f, to_string_view(format), basic_format_args<context>(as));
|
{make_format_args<context>(args...)});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename S, typename Char = char_t<S>>
|
template <typename S, typename Char = char_t<S>>
|
||||||
inline int vprintf(
|
inline int vprintf(
|
||||||
const S& format,
|
const S& format,
|
||||||
basic_format_args<
|
basic_format_args<basic_printf_context_t<Char>> args) {
|
||||||
typename basic_printf_context_t<internal::buffer<Char>>::type>
|
|
||||||
args) {
|
|
||||||
return vfprintf(stdout, to_string_view(format), args);
|
return vfprintf(stdout, to_string_view(format), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,18 +670,15 @@ inline int vprintf(
|
|||||||
template <typename S, typename... Args,
|
template <typename S, typename... Args,
|
||||||
FMT_ENABLE_IF(internal::is_string<S>::value)>
|
FMT_ENABLE_IF(internal::is_string<S>::value)>
|
||||||
inline int printf(const S& format_str, const Args&... args) {
|
inline int printf(const S& format_str, const Args&... args) {
|
||||||
using buffer = internal::buffer<char_t<S>>;
|
using context = basic_printf_context_t<char_t<S>>;
|
||||||
using context = typename basic_printf_context_t<buffer>::type;
|
return vprintf(to_string_view(format_str),
|
||||||
format_arg_store<context, Args...> as{args...};
|
{make_format_args<context>(args...)});
|
||||||
return vprintf(to_string_view(format_str), basic_format_args<context>(as));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename S, typename Char = char_t<S>>
|
template <typename S, typename Char = char_t<S>>
|
||||||
inline int vfprintf(
|
inline int vfprintf(
|
||||||
std::basic_ostream<Char>& os, const S& format,
|
std::basic_ostream<Char>& os, const S& format,
|
||||||
basic_format_args<
|
basic_format_args<basic_printf_context_t<Char>> args) {
|
||||||
typename basic_printf_context_t<internal::buffer<Char>>::type>
|
|
||||||
args) {
|
|
||||||
basic_memory_buffer<Char> buffer;
|
basic_memory_buffer<Char> buffer;
|
||||||
printf(buffer, to_string_view(format), args);
|
printf(buffer, to_string_view(format), args);
|
||||||
internal::write(os, buffer);
|
internal::write(os, buffer);
|
||||||
@ -721,10 +709,9 @@ typename ArgFormatter::iterator vprintf(internal::buffer<Char>& out,
|
|||||||
template <typename S, typename... Args, typename Char = char_t<S>>
|
template <typename S, typename... Args, typename Char = char_t<S>>
|
||||||
inline int fprintf(std::basic_ostream<Char>& os, const S& format_str,
|
inline int fprintf(std::basic_ostream<Char>& os, const S& format_str,
|
||||||
const Args&... args) {
|
const Args&... args) {
|
||||||
using context = typename basic_printf_context_t<internal::buffer<Char>>::type;
|
using context = basic_printf_context_t<Char>;
|
||||||
format_arg_store<context, Args...> as{args...};
|
|
||||||
return vfprintf(os, to_string_view(format_str),
|
return vfprintf(os, to_string_view(format_str),
|
||||||
basic_format_args<context>(as));
|
{make_format_args<context>(args...)});
|
||||||
}
|
}
|
||||||
FMT_END_NAMESPACE
|
FMT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ template <std::size_t N>
|
|||||||
using make_index_sequence = std::make_index_sequence<N>;
|
using make_index_sequence = std::make_index_sequence<N>;
|
||||||
#else
|
#else
|
||||||
template <typename T, T... N> struct integer_sequence {
|
template <typename T, T... N> struct integer_sequence {
|
||||||
typedef T value_type;
|
using value_type = T;
|
||||||
|
|
||||||
static FMT_CONSTEXPR std::size_t size() { return sizeof...(N); }
|
static FMT_CONSTEXPR std::size_t size() { return sizeof...(N); }
|
||||||
};
|
};
|
||||||
|
@ -446,7 +446,7 @@ TEST(ScopedMock, Scope) {
|
|||||||
|
|
||||||
#ifdef FMT_LOCALE
|
#ifdef FMT_LOCALE
|
||||||
|
|
||||||
typedef fmt::Locale::Type LocaleType;
|
typedef fmt::Locale::type LocaleType;
|
||||||
|
|
||||||
struct LocaleMock {
|
struct LocaleMock {
|
||||||
static LocaleMock* instance;
|
static LocaleMock* instance;
|
||||||
|
@ -535,11 +535,11 @@ TEST(PrintfTest, VSPrintfMakeArgsExample) {
|
|||||||
fmt::basic_format_args<fmt::printf_context> args2(as2);
|
fmt::basic_format_args<fmt::printf_context> args2(as2);
|
||||||
EXPECT_EQ("[42] something happened",
|
EXPECT_EQ("[42] something happened",
|
||||||
fmt::vsprintf("[%d] %s happened", args2));
|
fmt::vsprintf("[%d] %s happened", args2));
|
||||||
// the older gcc versions can't cast the return value
|
// The older gcc versions can't cast the return value.
|
||||||
#if !defined(__GNUC__) || (__GNUC__ > 4)
|
#if !defined(__GNUC__) || (__GNUC__ > 4)
|
||||||
EXPECT_EQ("[42] something happened",
|
EXPECT_EQ("[42] something happened",
|
||||||
fmt::vsprintf("[%d] %s happened",
|
fmt::vsprintf("[%d] %s happened",
|
||||||
fmt::make_printf_args(42, "something")));
|
{fmt::make_printf_args(42, "something")}));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ TEST(PrintfTest, VSPrintfMakeWArgsExample) {
|
|||||||
#if !defined(__GNUC__) || (__GNUC__ > 4)
|
#if !defined(__GNUC__) || (__GNUC__ > 4)
|
||||||
EXPECT_EQ(L"[42] something happened",
|
EXPECT_EQ(L"[42] something happened",
|
||||||
fmt::vsprintf(L"[%d] %s happened",
|
fmt::vsprintf(L"[%d] %s happened",
|
||||||
fmt::make_wprintf_args(42, L"something")));
|
{fmt::make_wprintf_args(42, L"something")}));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ std::string custom_vformat(fmt::string_view format_str, format_args_t args) {
|
|||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
std::string custom_format(const char* format_str, const Args&... args) {
|
std::string custom_format(const char* format_str, const Args&... args) {
|
||||||
auto va = fmt::make_printf_args(args...);
|
auto va = fmt::make_printf_args(args...);
|
||||||
return custom_vformat(format_str, va);
|
return custom_vformat(format_str, {va});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PrintfTest, CustomFormat) {
|
TEST(PrintfTest, CustomFormat) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user