node/convert: relax the check for string_view (#1222)

This commit is contained in:
Kefu Chai 2023-09-06 20:57:12 +08:00 committed by GitHub
parent fcbb8193b9
commit 6262201182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,8 +17,9 @@
#include <type_traits>
#include <valarray>
#include <vector>
#include <version>
#if __cplusplus >= 201703L
#ifdef __cpp_lib_string_view
#include <string_view>
#endif
@ -93,7 +94,7 @@ struct convert<char[N]> {
static Node encode(const char* rhs) { return Node(rhs); }
};
#if __cplusplus >= 201703L
#ifdef __cpp_lib_string_view
template <>
struct convert<std::string_view> {
static Node encode(std::string_view rhs) { return Node(std::string(rhs)); }