forked from fmtlib/fmt
Simplify compile
This commit is contained in:
@@ -676,26 +676,12 @@ auto do_compile(const Format& format)
|
|||||||
return preparator<Format, Args...>::prepare(format);
|
return preparator<Format, Args...>::prepare(format);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
template <typename... Args> using prepared_format_t =
|
||||||
|
typename basic_prepared_format<
|
||||||
|
std::string, parts_container<char>, Args...>::type;
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
template <typename... Args> struct prepared_format {
|
|
||||||
typedef typename internal::basic_prepared_format<
|
|
||||||
std::string, internal::parts_container<char>, Args...>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename... Args> struct wprepared_format {
|
|
||||||
typedef typename internal::basic_prepared_format<
|
|
||||||
std::wstring, internal::parts_container<wchar_t>, Args...>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
using prepared_format_t = typename internal::basic_prepared_format<
|
|
||||||
std::string, internal::parts_container<char>, Args...>::type;
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
using wprepared_format_t = typename internal::basic_prepared_format<
|
|
||||||
std::wstring, internal::parts_container<wchar_t>, Args...>::type;
|
|
||||||
|
|
||||||
#if FMT_USE_CONSTEXPR
|
#if FMT_USE_CONSTEXPR
|
||||||
|
|
||||||
template <typename... Args, typename S>
|
template <typename... Args, typename S>
|
||||||
|
@@ -476,7 +476,7 @@ TEST(PrepareTest, CopyPreparedFormat_InternalStringViewsAreNotInvalidated) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(PrepareTest, ReusedPreparedFormatType) {
|
TEST(PrepareTest, ReusedPreparedFormatType) {
|
||||||
typedef fmt::prepared_format<std::string, int>::type prepared_format;
|
using prepared_format = fmt::internal::prepared_format_t<std::string, int>;
|
||||||
|
|
||||||
prepared_format prepared = fmt::compile<prepared_format>("The {} is {}.");
|
prepared_format prepared = fmt::compile<prepared_format>("The {} is {}.");
|
||||||
EXPECT_EQ("The answer is 42.", prepared.format("answer", 42));
|
EXPECT_EQ("The answer is 42.", prepared.format("answer", 42));
|
||||||
|
Reference in New Issue
Block a user