String View: use std::string_view on C++17 (untested)

This commit is contained in:
Charles Dang 2018-04-14 16:04:03 +11:00
parent 17fc9d71db
commit 00d87f8fe4

View file

@ -19,10 +19,20 @@ that class. */
#pragma once #pragma once
#include "global.hpp"
#include <boost/version.hpp> #include <boost/version.hpp>
#include <cstdint> #include <cstdint>
#if BOOST_VERSION > 106100 /** Use the standard library string_view if building with C++17. */
#ifdef HAVE_CXX17
namespace utils {
using string_view = std::string_view;
typedef std::basic_string_view<uint8_t, std::char_traits<uint8_t>> byte_string_view;
}
#elif BOOST_VERSION > 106100
/* Boost string_view is available, so we can just use it. */ /* Boost string_view is available, so we can just use it. */
#include <boost/utility/string_view.hpp> #include <boost/utility/string_view.hpp>