mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-06 23:30:29 +00:00
Workaround bugs in gcc 8
This commit is contained in:
parent
4fe0b11195
commit
236fea1f00
@ -589,10 +589,11 @@ OutputIt vformat_to(
|
|||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
template <typename OutputIt, typename S, typename... Args,
|
template <typename OutputIt, typename S, typename... Args,
|
||||||
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char_t<S>>::value&&
|
bool enable = (detail::is_output_iterator<OutputIt, char_t<S>>::value&&
|
||||||
detail::is_string<S>::value)>
|
detail::is_string<S>::value)>
|
||||||
inline OutputIt format_to(OutputIt out, const text_style& ts,
|
inline auto format_to(OutputIt out, const text_style& ts,
|
||||||
const S& format_str, Args&&... args) {
|
const S& format_str, Args&&... args) ->
|
||||||
|
typename std::enable_if<enable, OutputIt>::type {
|
||||||
return vformat_to(out, ts, to_string_view(format_str),
|
return vformat_to(out, ts, to_string_view(format_str),
|
||||||
fmt::make_args_checked<Args...>(format_str, args...));
|
fmt::make_args_checked<Args...>(format_str, args...));
|
||||||
}
|
}
|
||||||
|
@ -667,14 +667,14 @@ OutputIt format_to(OutputIt out, const S&, const Args&... args) {
|
|||||||
return format_to(out, compiled, args...);
|
return format_to(out, compiled, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename OutputIt, typename CompiledFormat, typename... Args,
|
template <typename OutputIt, typename CompiledFormat, typename... Args>
|
||||||
FMT_ENABLE_IF(detail::is_output_iterator<
|
typename std::enable_if<(detail::is_output_iterator<
|
||||||
OutputIt, typename CompiledFormat::char_type>::value&&
|
OutputIt, typename CompiledFormat::char_type>::value&&
|
||||||
std::is_base_of<detail::basic_compiled_format,
|
std::is_base_of<detail::basic_compiled_format,
|
||||||
CompiledFormat>::value)>
|
CompiledFormat>::value),
|
||||||
format_to_n_result<OutputIt> format_to_n(OutputIt out, size_t n,
|
format_to_n_result<OutputIt>
|
||||||
const CompiledFormat& cf,
|
>::type format_to_n(OutputIt out, size_t n,
|
||||||
const Args&... args) {
|
const CompiledFormat& cf, const Args&... args) {
|
||||||
auto it =
|
auto it =
|
||||||
format_to(detail::truncating_iterator<OutputIt>(out, n), cf, args...);
|
format_to(detail::truncating_iterator<OutputIt>(out, n), cf, args...);
|
||||||
return {it.base(), it.count()};
|
return {it.base(), it.count()};
|
||||||
|
@ -1968,10 +1968,11 @@ inline void vprint_mojibake(std::FILE*, string_view, format_args) {}
|
|||||||
// GCC 8 and earlier cannot handle std::back_insert_iterator<Container> with
|
// GCC 8 and earlier cannot handle std::back_insert_iterator<Container> with
|
||||||
// vformat_to<ArgFormatter>(...) overload, so SFINAE on iterator type instead.
|
// vformat_to<ArgFormatter>(...) overload, so SFINAE on iterator type instead.
|
||||||
template <typename OutputIt, typename S, typename Char = char_t<S>,
|
template <typename OutputIt, typename S, typename Char = char_t<S>,
|
||||||
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, Char>::value)>
|
bool enable = detail::is_output_iterator<OutputIt, Char>::value>
|
||||||
OutputIt vformat_to(
|
auto vformat_to(
|
||||||
OutputIt out, const S& format_str,
|
OutputIt out, const S& format_str,
|
||||||
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
basic_format_args<buffer_context<type_identity_t<Char>>> args) ->
|
||||||
|
typename std::enable_if<enable, OutputIt>::type {
|
||||||
decltype(detail::get_buffer<Char>(out)) buf(detail::get_buffer_init(out));
|
decltype(detail::get_buffer<Char>(out)) buf(detail::get_buffer_init(out));
|
||||||
detail::vformat_to(buf, to_string_view(format_str), args);
|
detail::vformat_to(buf, to_string_view(format_str), args);
|
||||||
return detail::get_iterator(buf);
|
return detail::get_iterator(buf);
|
||||||
@ -2023,10 +2024,10 @@ inline format_to_n_result<OutputIt> vformat_to_n(
|
|||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
template <typename OutputIt, typename S, typename... Args,
|
template <typename OutputIt, typename S, typename... Args,
|
||||||
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char_t<S>>::value)>
|
bool enable = detail::is_output_iterator<OutputIt, char_t<S>>::value>
|
||||||
inline format_to_n_result<OutputIt> format_to_n(OutputIt out, size_t n,
|
inline auto format_to_n(OutputIt out, size_t n,
|
||||||
const S& format_str,
|
const S& format_str, const Args&... args) ->
|
||||||
const Args&... args) {
|
typename std::enable_if<enable, format_to_n_result<OutputIt>>::type {
|
||||||
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
|
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
|
||||||
return vformat_to_n(out, n, to_string_view(format_str), vargs);
|
return vformat_to_n(out, n, to_string_view(format_str), vargs);
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,10 @@ inline OutputIt vformat_to(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename OutputIt, typename S, typename... Args,
|
template <typename OutputIt, typename S, typename... Args,
|
||||||
typename Char = char_t<S>,
|
bool enable = detail::is_output_iterator<OutputIt, char_t<S>>::value>
|
||||||
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, Char>::value)>
|
inline auto format_to(OutputIt out, const std::locale& loc,
|
||||||
inline OutputIt format_to(OutputIt out, const std::locale& loc,
|
const S& format_str, Args&&... args) ->
|
||||||
const S& format_str, Args&&... args) {
|
typename std::enable_if<enable, OutputIt>::type {
|
||||||
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
|
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
|
||||||
return vformat_to(out, loc, to_string_view(format_str), vargs);
|
return vformat_to(out, loc, to_string_view(format_str), vargs);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user