Use std::string_view whenever possible

std::string_view is available with libcxx, even in C++11 mode. Use the proper macro to check it.
This commit is contained in:
Rosen Penev 2020-06-06 10:56:46 -07:00 committed by Martchus
parent 91920e7c3b
commit bd72fce0a7
1 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,9 @@
#include <limits>
// apple compiler somehow has string_view even in c++11!
#if __cplusplus < 201703L && !defined(__APPLE__)
#ifdef __cpp_lib_string_view
using std::string_view;
#else
#include <boost/version.hpp>
#if BOOST_VERSION > 105400
#include <boost/utility/string_view.hpp>
@ -23,8 +25,6 @@ using boost::string_view;
#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;
#endif
#else // C++17
using std::string_view;
#endif