diff --git a/include/fmt/core.h b/include/fmt/core.h index 443e918d..339a273b 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1216,7 +1216,24 @@ struct wformat_args : basic_format_args { : basic_format_args(std::forward(args)...) {} }; +template struct is_contiguous : std::false_type {}; + +template +struct is_contiguous> : std::true_type {}; + +template +struct is_contiguous> : std::true_type {}; + namespace internal { + +// Workaround for a SFINAE issue in gcc < 9: +// https://stackoverflow.com/q/56436995/471164 +template +struct is_contiguous_back_insert_iterator : std::false_type {}; +template +struct is_contiguous_back_insert_iterator> + : is_contiguous {}; + template struct named_arg_base { basic_string_view name; @@ -1286,26 +1303,12 @@ inline internal::named_arg arg(const S& name, const T& arg) { template void arg(S, internal::named_arg) = delete; -template struct is_contiguous : std::false_type {}; - -template -struct is_contiguous> : std::true_type {}; - -template -struct is_contiguous> : std::true_type {}; - -template -struct is_contiguous_back_insert_iterator : std::false_type {}; - -template -struct is_contiguous_back_insert_iterator> - : is_contiguous {}; - /** Formats a string and writes the output to ``out``. */ // GCC 8 and earlier cannot handle std::back_insert_iterator with // vformat_to(...) overload, so SFINAE on iterator type instead. template , - FMT_ENABLE_IF(is_contiguous_back_insert_iterator::value)> + FMT_ENABLE_IF( + internal::is_contiguous_back_insert_iterator::value)> OutputIt vformat_to(OutputIt out, const S& format_str, basic_format_args> args) { using container = typename std::remove_reference::value && - !is_contiguous_back_insert_iterator::value)> + FMT_ENABLE_IF( + internal::is_output_iterator::value && + !internal::is_contiguous_back_insert_iterator::value)> inline OutputIt vformat_to( OutputIt out, const S& format_str, typename format_args_t>::type args) {