Improve compile time by using extern template (#1452)

This commit is contained in:
Victor Zverovich 2020-04-23 14:52:50 -07:00
parent cb475cb884
commit 6f435f55c8
2 changed files with 8 additions and 3 deletions

View File

@ -1779,7 +1779,7 @@ inline std::back_insert_iterator<Container> format_to(
}
template <typename S, typename Char = char_t<S>>
inline std::basic_string<Char> vformat(
FMT_INLINE std::basic_string<Char> vformat(
const S& format_str,
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
return internal::vformat(to_string_view(format_str), args);
@ -1798,7 +1798,7 @@ inline std::basic_string<Char> vformat(
// Pass char_t as a default template parameter instead of using
// std::basic_string<char_t<S>> to reduce the symbol size.
template <typename S, typename... Args, typename Char = char_t<S>>
inline std::basic_string<Char> format(const S& format_str, Args&&... args) {
FMT_INLINE std::basic_string<Char> format(const S& format_str, Args&&... args) {
const auto& vargs = internal::make_args_checked<Args...>(format_str, args...);
return internal::vformat(to_string_view(format_str), vargs);
}

View File

@ -3402,6 +3402,11 @@ typename buffer_context<Char>::iterator internal::vformat_to(
args);
}
#ifndef FMT_HEADER_ONLY
extern template format_context::iterator internal::vformat_to(
internal::buffer<char>&, string_view, basic_format_args<format_context>);
#endif
template <typename S, typename Char = char_t<S>,
FMT_ENABLE_IF(internal::is_string<S>::value)>
inline typename buffer_context<Char>::iterator vformat_to(
@ -3512,7 +3517,7 @@ inline format_to_n_result<OutputIt> format_to_n(OutputIt out, std::size_t n,
}
template <typename Char>
inline std::basic_string<Char> internal::vformat(
std::basic_string<Char> internal::vformat(
basic_string_view<Char> format_str,
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
basic_memory_buffer<Char> buffer;