node/convert: relax the check for string_view
in 35b44980, the conversion for `std::string_view` was added, but
it enables it only if C++17 is used. but the availability of
`std::string_view` does not depends on C++17. in this change,
we use the more specific language feature macro to check the
availability of `std::string_view` instead of checking for the
C++ standard.
Refs #1148
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
parent
fcbb8193b9
commit
bad22f4846
@ -17,8 +17,9 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <valarray>
|
#include <valarray>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <version>
|
||||||
|
|
||||||
#if __cplusplus >= 201703L
|
#ifdef __cpp_lib_string_view
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ struct convert<char[N]> {
|
|||||||
static Node encode(const char* rhs) { return Node(rhs); }
|
static Node encode(const char* rhs) { return Node(rhs); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if __cplusplus >= 201703L
|
#ifdef __cpp_lib_string_view
|
||||||
template <>
|
template <>
|
||||||
struct convert<std::string_view> {
|
struct convert<std::string_view> {
|
||||||
static Node encode(std::string_view rhs) { return Node(std::string(rhs)); }
|
static Node encode(std::string_view rhs) { return Node(std::string(rhs)); }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user