Merge remote-tracking branch 'upstream/master'
Updating my fork with the main
This commit is contained in:
commit
2138cb8c0b
@ -155,8 +155,10 @@
|
|||||||
Type(const Type &) FMT_DELETED; \
|
Type(const Type &) FMT_DELETED; \
|
||||||
void operator=(const Type &) FMT_DELETED
|
void operator=(const Type &) FMT_DELETED
|
||||||
|
|
||||||
#if (FMT_HAS_INCLUDE(<string_view>) && __cplusplus > 201402L) || \
|
// libc++ supports string_view in pre-c++17.
|
||||||
(defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910)
|
#if (FMT_HAS_INCLUDE(<string_view>) && \
|
||||||
|
(__cplusplus > 201402L || _LIBCPP_VERSION)) || \
|
||||||
|
(defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910)
|
||||||
# include <string_view>
|
# include <string_view>
|
||||||
# define FMT_USE_STD_STRING_VIEW
|
# define FMT_USE_STD_STRING_VIEW
|
||||||
// std::experimental::basic_string_view::remove_prefix isn't constexpr until
|
// std::experimental::basic_string_view::remove_prefix isn't constexpr until
|
||||||
|
|||||||
@ -540,6 +540,10 @@ struct printf_context {
|
|||||||
std::back_insert_iterator<Buffer>, typename Buffer::value_type> type;
|
std::back_insert_iterator<Buffer>, typename Buffer::value_type> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename ...Args>
|
||||||
|
inline arg_store<printf_context<internal::buffer>::type, Args...> make_printf_args(const Args & ... args) {
|
||||||
|
return arg_store<printf_context<internal::buffer>::type, Args...>(args...);
|
||||||
|
}
|
||||||
typedef basic_format_args<printf_context<internal::buffer>::type> printf_args;
|
typedef basic_format_args<printf_context<internal::buffer>::type> printf_args;
|
||||||
|
|
||||||
inline std::string vsprintf(string_view format, printf_args args) {
|
inline std::string vsprintf(string_view format, printf_args args) {
|
||||||
|
|||||||
@ -48,10 +48,10 @@ endfunction ()
|
|||||||
expect_compile("")
|
expect_compile("")
|
||||||
|
|
||||||
# Formatting a wide character with a narrow format string is forbidden.
|
# Formatting a wide character with a narrow format string is forbidden.
|
||||||
expect_compile_error("fmt::format(\"{}\", L'a';")
|
expect_compile_error("fmt::format(\"{}\", L'a');")
|
||||||
|
|
||||||
# Formatting a wide string with a narrow format string is forbidden.
|
# Formatting a wide string with a narrow format string is forbidden.
|
||||||
expect_compile_error("fmt::format(\"{}\", L\"foo\";")
|
expect_compile_error("fmt::format(\"{}\", L\"foo\");")
|
||||||
|
|
||||||
# Make sure that compiler features detected in the header
|
# Make sure that compiler features detected in the header
|
||||||
# match the features detected in CMake.
|
# match the features detected in CMake.
|
||||||
|
|||||||
@ -1201,7 +1201,7 @@ TEST(FormatterTest, FormatStringView) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FMT_USE_STD_STRING_VIEW
|
#ifdef FMT_USE_STD_STRING_VIEW
|
||||||
TEST(FormatterTest, FormatStringView) {
|
TEST(FormatterTest, FormatStdStringView) {
|
||||||
EXPECT_EQ("test", format("{0}", std::string_view("test")));
|
EXPECT_EQ("test", format("{0}", std::string_view("test")));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user