diff --git a/include/fmt/core.h b/include/fmt/core.h index 8f50b533..d828a190 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -9,6 +9,7 @@ #define FMT_CORE_H_ #include +#include // std::FILE #include #include #include @@ -204,6 +205,16 @@ namespace internal { template typename std::add_rvalue_reference::type declval() FMT_NOEXCEPT; +template +struct result_of; + +template +struct result_of { + // A workaround for gcc 4.4 that doesn't allow F to be a reference. + typedef typename std::result_of< + typename std::remove_reference::type(Args...)>::type type; +}; + // Casts nonnegative integer to unsigned. template FMT_CONSTEXPR typename std::make_unsigned::type to_unsigned(Int value) { @@ -692,16 +703,6 @@ enum { max_packed_args = 15 }; template class arg_map; - -template -struct result_of; - -template -struct result_of { - // A workaround for gcc 4.4 that doesn't allow F to be a reference. - typedef typename std::result_of< - typename std::remove_reference::type(Args...)>::type type; -}; } // namespace internal // A formatting argument. It is a trivially copyable/constructible type to @@ -1320,10 +1321,9 @@ typename std::enable_if< is_contiguous::value, std::back_insert_iterator>::type vformat_to(std::back_insert_iterator out, string_view format_str, format_args args) { - auto& container = internal::get_container(out); - internal::container_buffer buf(container); + internal::container_buffer buf(internal::get_container(out)); vformat_to(buf, format_str, args); - return std::back_inserter(container); + return out; } template @@ -1331,10 +1331,9 @@ typename std::enable_if< is_contiguous::value, std::back_insert_iterator>::type vformat_to(std::back_insert_iterator out, wstring_view format_str, wformat_args args) { - auto& container = internal::get_container(out); - internal::container_buffer buf(container); + internal::container_buffer buf(internal::get_container(out)); vformat_to(buf, format_str, args); - return std::back_inserter(container); + return out; } std::string vformat(string_view format_str, format_args args); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1a8c900a..893cc4d2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -85,13 +85,13 @@ function(add_fmt_test name) endfunction() add_fmt_test(assert-test) +add_fmt_test(core-test mock-allocator.h) add_fmt_test(gtest-extra-test) add_fmt_test(format-test) add_fmt_test(format-impl-test) add_fmt_test(ostream-test) add_fmt_test(printf-test) add_fmt_test(time-test) -add_fmt_test(util-test mock-allocator.h) add_fmt_test(custom-formatter-test) add_fmt_test(ranges-test) diff --git a/test/util-test.cc b/test/core-test.cc similarity index 100% rename from test/util-test.cc rename to test/core-test.cc