5#ifndef TABLEAU_HYPER_STRING_VIEW_HPP
6#define TABLEAU_HYPER_STRING_VIEW_HPP
8#if !defined(__cplusplus) || (__cplusplus < 201703L)
9#define hyper_use_own_string_view
12#ifdef hyper_use_own_string_view
21#ifdef hyper_use_own_string_view
30 : data_(
data), length_(length) {
35 : data_(c), length_(std::strlen(c)) {
40 : data_(s.
data()), length_(s.
size()) {
46 size_t size() const noexcept {
return length_; }
55 const char*
data() const noexcept {
return data_; }
68 operator std::string()
const {
return std::string(
data(),
size()); }
99 bool empty() {
return length_ == 0; }
103 const char* data_ =
nullptr;
120using string_view = std::string_view;
124#ifdef hyper_use_own_string_view
125#include <hyperapi/impl/string_view.impl.hpp>
Describes an object that can refer to a constant, contiguous sequence of char-like objects.
friend bool operator>=(const string_view &a, const string_view &b) noexcept
Greater or equal operator.
friend bool operator!=(const string_view &a, const string_view &b) noexcept
Not equal operator.
string_view(const char *c)
Constructor, implicit conversion from a null terminated character array.
friend bool operator<=(const string_view &a, const string_view &b) noexcept
Smaller or equal operator.
friend bool operator<(const string_view &a, const string_view &b) noexcept
Smaller operator.
const char * data() const noexcept
Returns a pointer to the underlying character array.
string_view(const std::string &s)
Constructor, implicit conversion from a std::string.
friend std::ostream & operator<<(std::ostream &os, const string_view &v)
Stream output operator.
friend bool operator==(const string_view &a, const string_view &b) noexcept
Equality operator.
friend bool operator>(const string_view &a, const string_view &b) noexcept
Greater operator.
string_view(const char *data, size_t length) noexcept
Constructor.
int compare(const string_view &other) const noexcept
Compares two character sequences.
bool empty()
Returns whether the view is empty.
size_t size() const noexcept
Returns the number of elements in the view.
The primary namespace of the Hyper API for C++.
size_t operator()(const hyperapi::string_view &sv) const noexcept
Calculates the hash value of the given string view.