mirror of
https://github.com/fmtlib/fmt.git
synced 2024-09-15 15:13:22 +00:00
Apply coding conventions
This commit is contained in:
parent
2a8a694466
commit
8f83ee2ad1
@ -1449,7 +1449,8 @@ template <typename Context> struct arg_mapper {
|
||||
// Only map owning types because mapping views can be unsafe.
|
||||
template <typename T, typename U = format_as_t<T>,
|
||||
FMT_ENABLE_IF(std::is_arithmetic<U>::value)>
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(const T& val) -> decltype(FMT_DECLTYPE_THIS map(U())) {
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(const T& val)
|
||||
-> decltype(FMT_DECLTYPE_THIS map(U())) {
|
||||
return map(format_as(val));
|
||||
}
|
||||
|
||||
@ -1473,7 +1474,8 @@ template <typename Context> struct arg_mapper {
|
||||
!is_string<U>::value && !is_char<U>::value &&
|
||||
!is_named_arg<U>::value &&
|
||||
!std::is_arithmetic<format_as_t<U>>::value)>
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(T& val) -> decltype(FMT_DECLTYPE_THIS do_map(val)) {
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(T& val)
|
||||
-> decltype(FMT_DECLTYPE_THIS do_map(val)) {
|
||||
return do_map(val);
|
||||
}
|
||||
|
||||
|
@ -793,15 +793,14 @@ inline auto code_point_index(basic_string_view<Char> s, size_t n) -> size_t {
|
||||
inline auto code_point_index(string_view s, size_t n) -> size_t {
|
||||
size_t result = s.size();
|
||||
const char* begin = s.begin();
|
||||
for_each_codepoint(
|
||||
s, [begin, &n, &result](uint32_t, string_view sv) {
|
||||
if (n != 0) {
|
||||
--n;
|
||||
return true;
|
||||
}
|
||||
result = to_unsigned(sv.begin() - begin);
|
||||
return false;
|
||||
});
|
||||
for_each_codepoint(s, [begin, &n, &result](uint32_t, string_view sv) {
|
||||
if (n != 0) {
|
||||
--n;
|
||||
return true;
|
||||
}
|
||||
result = to_unsigned(sv.begin() - begin);
|
||||
return false;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1162,10 +1161,10 @@ using uint32_or_64_or_128_t =
|
||||
template <typename T>
|
||||
using uint64_or_128_t = conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>;
|
||||
|
||||
#define FMT_POWERS_OF_10(factor) \
|
||||
factor * 10, (factor)*100, (factor)*1000, (factor)*10000, (factor)*100000, \
|
||||
(factor)*1000000, (factor)*10000000, (factor)*100000000, \
|
||||
(factor)*1000000000
|
||||
#define FMT_POWERS_OF_10(factor) \
|
||||
factor * 10, (factor) * 100, (factor) * 1000, (factor) * 10000, \
|
||||
(factor) * 100000, (factor) * 1000000, (factor) * 10000000, \
|
||||
(factor) * 100000000, (factor) * 1000000000
|
||||
|
||||
// Converts value in the range [0, 100) to a string.
|
||||
constexpr const char* digits2(size_t value) {
|
||||
|
@ -225,7 +225,7 @@ struct formatter<std::optional<T>, Char,
|
||||
}
|
||||
|
||||
template <typename FormatContext>
|
||||
auto format(std::optional<T> const& opt, FormatContext& ctx) const
|
||||
auto format(const std::optional<T>& opt, FormatContext& ctx) const
|
||||
-> decltype(ctx.out()) {
|
||||
if (!opt) return detail::write<Char>(ctx.out(), none);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user