Commit b1175acb authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

util/StringView: hard-code C++17

parent 672278e5
...@@ -32,14 +32,10 @@ ...@@ -32,14 +32,10 @@
#include "ConstBuffer.hxx" #include "ConstBuffer.hxx"
#include "StringAPI.hxx" #include "StringAPI.hxx"
#include "Compiler.h"
#include <utility>
#include <cstddef> #include <cstddef>
#if __cplusplus >= 201703L && !GCC_OLDER_THAN(7,0)
#include <string_view> #include <string_view>
#endif #include <utility>
template<typename T> template<typename T>
struct BasicStringView : ConstBuffer<T> { struct BasicStringView : ConstBuffer<T> {
...@@ -72,14 +68,12 @@ struct BasicStringView : ConstBuffer<T> { ...@@ -72,14 +68,12 @@ struct BasicStringView : ConstBuffer<T> {
constexpr BasicStringView(std::nullptr_t n) noexcept constexpr BasicStringView(std::nullptr_t n) noexcept
:ConstBuffer<T>(n) {} :ConstBuffer<T>(n) {}
#if __cplusplus >= 201703L && !GCC_OLDER_THAN(7,0)
constexpr BasicStringView(std::basic_string_view<T> src) noexcept constexpr BasicStringView(std::basic_string_view<T> src) noexcept
:ConstBuffer<T>(src.data(), src.size()) {} :ConstBuffer<T>(src.data(), src.size()) {}
constexpr operator std::basic_string_view<T>() const noexcept { constexpr operator std::basic_string_view<T>() const noexcept {
return {data, size}; return {data, size};
} }
#endif
using ConstBuffer<T>::empty; using ConstBuffer<T>::empty;
using ConstBuffer<T>::begin; using ConstBuffer<T>::begin;
......
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