Range formatter (#2983)
* Implement range_formatter and format_kind * Attempted gcc 4.8 fix * gcc 4.8 interprets inaccessible as a hard error (instead of... not available) * Attempting to delete set_debug_format. * clang-format * Different implementation of FMT_STATICALLY_WIDEN * Renaming copy_str_range to copy_str. * I guess I need a definition * Forgot to delete these. * Other PR comments.
This commit is contained in:
+16
-1
@@ -1667,6 +1667,11 @@ auto copy_str(InputIt begin, InputIt end, appender out) -> appender {
|
||||
return out;
|
||||
}
|
||||
|
||||
template <typename Char, typename R, typename OutputIt>
|
||||
FMT_CONSTEXPR auto copy_str(R&& rng, OutputIt out) -> OutputIt {
|
||||
return detail::copy_str<Char>(rng.begin(), rng.end(), out);
|
||||
}
|
||||
|
||||
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 500
|
||||
// A workaround for gcc 4.8 to make void_t work in a SFINAE context.
|
||||
template <typename... Ts> struct void_t_impl { using type = void; };
|
||||
@@ -2824,7 +2829,8 @@ FMT_CONSTEXPR auto parse_float_type_spec(const basic_format_specs<Char>& specs,
|
||||
template <typename ErrorHandler = error_handler>
|
||||
FMT_CONSTEXPR auto check_cstring_type_spec(presentation_type type,
|
||||
ErrorHandler&& eh = {}) -> bool {
|
||||
if (type == presentation_type::none || type == presentation_type::string)
|
||||
if (type == presentation_type::none || type == presentation_type::string ||
|
||||
type == presentation_type::debug)
|
||||
return true;
|
||||
if (type != presentation_type::pointer) eh.on_error("invalid type specifier");
|
||||
return false;
|
||||
@@ -3086,6 +3092,15 @@ struct formatter<T, Char,
|
||||
return it;
|
||||
}
|
||||
|
||||
template <detail::type U = detail::type_constant<T, Char>::value,
|
||||
enable_if_t<(U == detail::type::string_type ||
|
||||
U == detail::type::cstring_type ||
|
||||
U == detail::type::char_type),
|
||||
int> = 0>
|
||||
FMT_CONSTEXPR void set_debug_format() {
|
||||
specs_.type = presentation_type::debug;
|
||||
}
|
||||
|
||||
template <typename FormatContext>
|
||||
FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const
|
||||
-> decltype(ctx.out());
|
||||
|
||||
Reference in New Issue
Block a user