From d046eea3313f25ee20d1cfc5dc9a107bab35af96 Mon Sep 17 00:00:00 2001 From: FireWolf <10460478+0xFireWolf@users.noreply.github.com> Date: Sun, 17 Sep 2023 08:58:31 -0700 Subject: [PATCH] node/convert: Enable the template specialization for `std::string_view` properly when the library is compiled by MSVC on Windows. (#1227) --- include/yaml-cpp/node/convert.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index d0eb450f7..d49702f82 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -18,7 +18,7 @@ #include #include -#if __cplusplus >= 201703L +#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #include #endif @@ -93,7 +93,7 @@ struct convert { static Node encode(const char* rhs) { return Node(rhs); } }; -#if __cplusplus >= 201703L +#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) template <> struct convert { static Node encode(std::string_view rhs) { return Node(std::string(rhs)); }