Skip to content

Commit 3b7cac2

Browse files
committed
fix: rename typename U to typename UT to avoid cpprest conflicts
1 parent c90bc91 commit 3b7cac2

File tree

4 files changed

+77
-76
lines changed

4 files changed

+77
-76
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ build/
1818
cmake_install.cmake
1919
fmt-*.cmake
2020
fmt.pc
21+
.gradle/

include/fmt/base.h

+35-37
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ template <typename T> constexpr const char* narrow(const T*) { return nullptr; }
448448
constexpr FMT_ALWAYS_INLINE const char* narrow(const char* s) { return s; }
449449

450450
template <typename Char>
451-
FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n)
452-
-> int {
451+
FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2,
452+
std::size_t n) -> int {
453453
if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n);
454454
for (; n != 0; ++s1, ++s2, --n) {
455455
if (*s1 < *s2) return -1;
@@ -1088,16 +1088,16 @@ struct use_format_as_member<
10881088
T, bool_constant<std::is_arithmetic<format_as_member_result<T>>::value>>
10891089
: std::true_type {};
10901090

1091-
template <typename T, typename U = remove_const_t<T>>
1091+
template <typename T, typename UT = remove_const_t<T>>
10921092
using use_formatter =
10931093
bool_constant<(std::is_class<T>::value || std::is_enum<T>::value ||
10941094
std::is_union<T>::value || std::is_array<T>::value) &&
10951095
!has_to_string_view<T>::value && !is_named_arg<T>::value &&
10961096
!use_format_as<T>::value && !use_format_as_member<T>::value>;
10971097

1098-
template <typename Char, typename T, typename U = remove_const_t<T>>
1098+
template <typename Char, typename T, typename UT = remove_const_t<T>>
10991099
auto has_formatter_impl(T* p, buffered_context<Char>* ctx = nullptr)
1100-
-> decltype(formatter<U, Char>().format(*p, *ctx), std::true_type());
1100+
-> decltype(formatter<UT, Char>().format(*p, *ctx), std::true_type());
11011101
template <typename Char> auto has_formatter_impl(...) -> std::false_type;
11021102

11031103
// T can be const-qualified to check if it is const-formattable.
@@ -1129,8 +1129,9 @@ template <typename Char> struct type_mapper {
11291129
-> conditional_t<N <= 64, unsigned long long, void>;
11301130

11311131
template <typename T, FMT_ENABLE_IF(is_char<T>::value)>
1132-
static auto map(T) -> conditional_t<
1133-
std::is_same<T, char>::value || std::is_same<T, Char>::value, Char, void>;
1132+
static auto map(T) -> conditional_t<std::is_same<T, char>::value ||
1133+
std::is_same<T, Char>::value,
1134+
Char, void>;
11341135

11351136
static auto map(float) -> float;
11361137
static auto map(double) -> double;
@@ -1336,10 +1337,9 @@ template <typename Char> struct parse_dynamic_spec_result {
13361337

13371338
// Parses integer | "{" [arg_id] "}".
13381339
template <typename Char>
1339-
FMT_CONSTEXPR auto parse_dynamic_spec(const Char* begin, const Char* end,
1340-
int& value, arg_ref<Char>& ref,
1341-
parse_context<Char>& ctx)
1342-
-> parse_dynamic_spec_result<Char> {
1340+
FMT_CONSTEXPR auto parse_dynamic_spec(
1341+
const Char* begin, const Char* end, int& value, arg_ref<Char>& ref,
1342+
parse_context<Char>& ctx) -> parse_dynamic_spec_result<Char> {
13431343
FMT_ASSERT(begin != end, "");
13441344
auto kind = arg_id_kind::none;
13451345
if ('0' <= *begin && *begin <= '9') {
@@ -1399,8 +1399,8 @@ enum class state { start, align, sign, hash, zero, width, precision, locale };
13991399
template <typename Char>
14001400
FMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end,
14011401
dynamic_format_specs<Char>& specs,
1402-
parse_context<Char>& ctx, type arg_type)
1403-
-> const Char* {
1402+
parse_context<Char>& ctx,
1403+
type arg_type) -> const Char* {
14041404
auto c = '\0';
14051405
if (end - begin > 1) {
14061406
auto next = to_ascii(begin[1]);
@@ -1535,10 +1535,8 @@ FMT_CONSTEXPR auto parse_format_specs(const Char* begin, const Char* end,
15351535
}
15361536

15371537
template <typename Char, typename Handler>
1538-
FMT_CONSTEXPR FMT_INLINE auto parse_replacement_field(const Char* begin,
1539-
const Char* end,
1540-
Handler&& handler)
1541-
-> const Char* {
1538+
FMT_CONSTEXPR FMT_INLINE auto parse_replacement_field(
1539+
const Char* begin, const Char* end, Handler&& handler) -> const Char* {
15421540
++begin;
15431541
if (begin == end) {
15441542
handler.on_error("invalid format string");
@@ -1674,8 +1672,8 @@ class format_string_checker {
16741672
on_format_specs(id, begin, begin); // Call parse() on empty specs.
16751673
}
16761674

1677-
FMT_CONSTEXPR auto on_format_specs(int id, const Char* begin, const Char* end)
1678-
-> const Char* {
1675+
FMT_CONSTEXPR auto on_format_specs(int id, const Char* begin,
1676+
const Char* end) -> const Char* {
16791677
context_.advance_to(begin);
16801678
if (id >= 0 && id < NUM_ARGS) return parse_funcs_[id](context_);
16811679
while (begin != end && *begin != '}') ++begin;
@@ -1764,14 +1762,14 @@ template <typename T> class buffer {
17641762
}
17651763

17661764
/// Appends data to the end of the buffer.
1767-
template <typename U>
1765+
template <typename UT>
17681766
// Workaround for MSVC2019 to fix error C2893: Failed to specialize function
17691767
// template 'void fmt::v11::detail::buffer<T>::append(const U *,const U *)'.
17701768
#if !FMT_MSC_VERSION || FMT_MSC_VERSION >= 1940
17711769
FMT_CONSTEXPR20
17721770
#endif
17731771
void
1774-
append(const U* begin, const U* end) {
1772+
append(const UT* begin, const UT* end) {
17751773
while (begin != end) {
17761774
auto count = to_unsigned(end - begin);
17771775
try_reserve(size_ + count);
@@ -1972,8 +1970,8 @@ struct is_back_insert_iterator<basic_appender<T>> : std::true_type {};
19721970
// An optimized version of std::copy with the output value type (T).
19731971
template <typename T, typename InputIt, typename OutputIt,
19741972
FMT_ENABLE_IF(is_back_insert_iterator<OutputIt>::value)>
1975-
FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out)
1976-
-> OutputIt {
1973+
FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end,
1974+
OutputIt out) -> OutputIt {
19771975
get_container(out).append(begin, end);
19781976
return out;
19791977
}
@@ -2325,8 +2323,8 @@ template <typename T, typename Char, type TYPE> struct native_formatter {
23252323

23262324
FMT_PRAGMA_CLANG(diagnostic ignored "-Wundefined-inline")
23272325
template <typename FormatContext>
2328-
FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const
2329-
-> decltype(ctx.out());
2326+
FMT_CONSTEXPR auto format(const T& val,
2327+
FormatContext& ctx) const -> decltype(ctx.out());
23302328
};
23312329

23322330
template <typename T, typename Enable = void>
@@ -2466,8 +2464,8 @@ template <typename Context> class basic_format_arg {
24662464
}
24672465

24682466
auto format_custom(const char_type* parse_begin,
2469-
parse_context<char_type>& parse_ctx, Context& ctx)
2470-
-> bool {
2467+
parse_context<char_type>& parse_ctx,
2468+
Context& ctx) -> bool {
24712469
if (type_ != detail::type::custom_type) return false;
24722470
parse_ctx.advance_to(parse_begin);
24732471
value_.custom.format(value_.custom.value, parse_ctx, ctx);
@@ -2755,8 +2753,8 @@ inline auto arg(const Char* name, const T& arg) -> detail::named_arg<Char, T> {
27552753
template <typename OutputIt,
27562754
FMT_ENABLE_IF(detail::is_output_iterator<remove_cvref_t<OutputIt>,
27572755
char>::value)>
2758-
auto vformat_to(OutputIt&& out, string_view fmt, format_args args)
2759-
-> remove_cvref_t<OutputIt> {
2756+
auto vformat_to(OutputIt&& out, string_view fmt,
2757+
format_args args) -> remove_cvref_t<OutputIt> {
27602758
auto&& buf = detail::get_buffer<char>(out);
27612759
detail::vformat_to(buf, fmt, args, {});
27622760
return detail::get_iterator(buf, out);
@@ -2775,8 +2773,8 @@ auto vformat_to(OutputIt&& out, string_view fmt, format_args args)
27752773
template <typename OutputIt, typename... T,
27762774
FMT_ENABLE_IF(detail::is_output_iterator<remove_cvref_t<OutputIt>,
27772775
char>::value)>
2778-
FMT_INLINE auto format_to(OutputIt&& out, format_string<T...> fmt, T&&... args)
2779-
-> remove_cvref_t<OutputIt> {
2776+
FMT_INLINE auto format_to(OutputIt&& out, format_string<T...> fmt,
2777+
T&&... args) -> remove_cvref_t<OutputIt> {
27802778
return vformat_to(out, fmt.str, vargs<T...>{{args...}});
27812779
}
27822780

@@ -2789,8 +2787,8 @@ template <typename OutputIt> struct format_to_n_result {
27892787

27902788
template <typename OutputIt, typename... T,
27912789
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)>
2792-
auto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args)
2793-
-> format_to_n_result<OutputIt> {
2790+
auto vformat_to_n(OutputIt out, size_t n, string_view fmt,
2791+
format_args args) -> format_to_n_result<OutputIt> {
27942792
using traits = detail::fixed_buffer_traits;
27952793
auto buf = detail::iterator_buffer<OutputIt, char, traits>(out, n);
27962794
detail::vformat_to(buf, fmt, args, {});
@@ -2824,15 +2822,15 @@ struct format_to_result {
28242822
};
28252823

28262824
template <size_t N>
2827-
auto vformat_to(char (&out)[N], string_view fmt, format_args args)
2828-
-> format_to_result {
2825+
auto vformat_to(char (&out)[N], string_view fmt,
2826+
format_args args) -> format_to_result {
28292827
auto result = vformat_to_n(out, N, fmt, args);
28302828
return {result.out, result.size > N};
28312829
}
28322830

28332831
template <size_t N, typename... T>
2834-
FMT_INLINE auto format_to(char (&out)[N], format_string<T...> fmt, T&&... args)
2835-
-> format_to_result {
2832+
FMT_INLINE auto format_to(char (&out)[N], format_string<T...> fmt,
2833+
T&&... args) -> format_to_result {
28362834
auto result = vformat_to_n(out, N, fmt.str, vargs<T...>{{args...}});
28372835
return {result.out, result.size > N};
28382836
}

include/fmt/printf.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ template <typename T, typename Context> class arg_converter {
139139
if (type_ != 's') operator()<bool>(value);
140140
}
141141

142-
template <typename U, FMT_ENABLE_IF(std::is_integral<U>::value)>
143-
void operator()(U value) {
142+
template <typename UT, FMT_ENABLE_IF(std::is_integral<UT>::value)>
143+
void operator()(UT value) {
144144
bool is_signed = type_ == 'd' || type_ == 'i';
145-
using target_type = conditional_t<std::is_same<T, void>::value, U, T>;
145+
using target_type = conditional_t<std::is_same<T, void>::value, UT, T>;
146146
if (const_check(sizeof(target_type) <= sizeof(int))) {
147147
// Extra casts are used to silence warnings.
148148
using unsigned_type = typename make_unsigned_or_bool<target_type>::type;
@@ -157,12 +157,12 @@ template <typename T, typename Context> class arg_converter {
157157
if (is_signed)
158158
arg_ = static_cast<long long>(value);
159159
else
160-
arg_ = static_cast<typename make_unsigned_or_bool<U>::type>(value);
160+
arg_ = static_cast<typename make_unsigned_or_bool<UT>::type>(value);
161161
}
162162
}
163163

164-
template <typename U, FMT_ENABLE_IF(!std::is_integral<U>::value)>
165-
void operator()(U) {} // No conversion needed for non-integral types.
164+
template <typename UT, FMT_ENABLE_IF(!std::is_integral<UT>::value)>
165+
void operator()(UT) {} // No conversion needed for non-integral types.
166166
};
167167

168168
// Converts an integer argument to T for printf, if T is an integral type.
@@ -229,8 +229,8 @@ class printf_width_handler {
229229
// Workaround for a bug with the XL compiler when initializing
230230
// printf_arg_formatter's base class.
231231
template <typename Char>
232-
auto make_arg_formatter(basic_appender<Char> iter, format_specs& s)
233-
-> arg_formatter<Char> {
232+
auto make_arg_formatter(basic_appender<Char> iter,
233+
format_specs& s) -> arg_formatter<Char> {
234234
return {iter, s, locale_ref()};
235235
}
236236

@@ -371,8 +371,8 @@ auto parse_header(const Char*& it, const Char* end, format_specs& specs,
371371
return arg_index;
372372
}
373373

374-
inline auto parse_printf_presentation_type(char c, type t, bool& upper)
375-
-> presentation_type {
374+
inline auto parse_printf_presentation_type(char c, type t,
375+
bool& upper) -> presentation_type {
376376
using pt = presentation_type;
377377
constexpr auto integral_set = sint_set | uint_set | bool_set | char_set;
378378
switch (c) {

0 commit comments

Comments
 (0)