"images/git@developer.sourcefind.cn:cnjsdfcy/simbricks.git" did not exist on "a2efdf39d935ffd1de8e34a00fdc48c49f4a4cc3"
Unverified Commit 2383e6d0 authored by Kefu Chai's avatar Kefu Chai Committed by GitHub
Browse files

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

This reverts commit 62622011.

in 62622011, we wanted address the needs to use the `string_view`
converter in C++98, but that requirement was based on wrong
preconditions. `std::string_view` was introduced in C++17, and
popular standard libraries like libstdc++ and libc++ both provide
`std::string_view` when the source is built with C++17.

furthermore 62622011 is buggy. because it uses `<version>` to tell
the feature set provided by the standard library. but `<version>`
is a part of C++20. so this defeats the purpose of the change of
62622011.

Fixes #1223
parent 62622011
...@@ -17,9 +17,8 @@ ...@@ -17,9 +17,8 @@
#include <type_traits> #include <type_traits>
#include <valarray> #include <valarray>
#include <vector> #include <vector>
#include <version>
#ifdef __cpp_lib_string_view #if __cplusplus >= 201703L
#include <string_view> #include <string_view>
#endif #endif
...@@ -94,7 +93,7 @@ struct convert<char[N]> { ...@@ -94,7 +93,7 @@ struct convert<char[N]> {
static Node encode(const char* rhs) { return Node(rhs); } static Node encode(const char* rhs) { return Node(rhs); }
}; };
#ifdef __cpp_lib_string_view #if __cplusplus >= 201703L
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)); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment