Detect string_view on libc++ (#686)

This commit is contained in:
Victor Zverovich 2018-03-26 06:50:22 -10:00
parent 0ea70defbe
commit 6957d28cfb
2 changed files with 3 additions and 2 deletions

View File

@ -156,7 +156,8 @@
void operator=(const Type &) FMT_DELETED void operator=(const Type &) FMT_DELETED
#if (FMT_HAS_INCLUDE(<string_view>) && __cplusplus > 201402L) || \ #if (FMT_HAS_INCLUDE(<string_view>) && __cplusplus > 201402L) || \
(defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910) (defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910) || \
_LIBCPP_VERSION // libc++ supports string_view in pre-c++17
# 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

View File

@ -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