Skip to content

Commit d046eea

Browse files
authored
node/convert: Enable the template specialization for std::string_view properly when the library is compiled by MSVC on Windows. (#1227)
1 parent 9f31491 commit d046eea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/yaml-cpp/node/convert.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <valarray>
1919
#include <vector>
2020

21-
#if __cplusplus >= 201703L
21+
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
2222
#include <string_view>
2323
#endif
2424

@@ -93,7 +93,7 @@ struct convert<char[N]> {
9393
static Node encode(const char* rhs) { return Node(rhs); }
9494
};
9595

96-
#if __cplusplus >= 201703L
96+
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
9797
template <>
9898
struct convert<std::string_view> {
9999
static Node encode(std::string_view rhs) { return Node(std::string(rhs)); }

0 commit comments

Comments
 (0)