1414#include < iterator>
1515#include < cstdint>
1616#include < cstring>
17- #include < limits>
1817#include < algorithm>
1918#include < ostream>
2019
21- #include " lcf/string_view.h"
2220#include " lcf/dbarrayalloc.h"
2321
2422namespace lcf {
@@ -43,17 +41,17 @@ class DBString {
4341 static constexpr size_type npos = size_type(-1 );
4442
4543 constexpr DBString () = default;
46- explicit DBString (StringView s) : _storage(construct_sv(s.data(), s.size())) {}
44+ explicit DBString (std::string_view s) : _storage(construct_sv(s.data(), s.size())) {}
4745 explicit DBString (const std::string& s) : _storage(construct_z(s.c_str(), s.size())) {}
4846
4947 // Explicit construct for general const char*
50- explicit DBString (const char * s) : DBString(StringView (s)) {}
48+ explicit DBString (const char * s) : DBString(std::string_view (s)) {}
5149 // Implicit constructor to capture string literals
5250 template <size_t N>
5351 DBString (const char (&literal)[N]) : _storage(construct_z(literal, N - 1 )) {}
54- DBString (const char * s, size_t len) : DBString(StringView (s, len)) {}
52+ DBString (const char * s, size_t len) : DBString(std::string_view (s, len)) {}
5553
56- DBString (const DBString& o) : DBString(StringView (o)) {}
54+ DBString (const DBString& o) : DBString(std::string_view (o)) {}
5755 DBString (DBString&& o) noexcept { swap (o); }
5856
5957 DBString& operator =(const DBString&);
@@ -66,7 +64,7 @@ class DBString {
6664 ~DBString () { destroy (); }
6765
6866 explicit operator std::string () const { return std::string (data (), size ()); }
69- operator StringView () const { return StringView (data (), size ()); }
67+ operator std::string_view () const { return std::string_view (data (), size ()); }
7068
7169 char & operator [](size_type i) { return data ()[i]; }
7270 char operator [](size_type i) const { return data ()[i]; }
@@ -123,21 +121,21 @@ inline std::string ToString(const DBString& s) {
123121}
124122
125123#define LCF_DBSTRING_MAKE_CMP_OPS (LTYPE, RTYPE ) \
126- inline bool operator ==(LTYPE l, RTYPE r) { return StringView (l) == StringView (r); }\
127- inline bool operator !=(LTYPE l, RTYPE r) { return StringView (l) != StringView (r); }\
128- inline bool operator <(LTYPE l, RTYPE r) { return StringView (l) < StringView (r); }\
129- inline bool operator >(LTYPE l, RTYPE r) { return StringView (l) > StringView (r); }\
130- inline bool operator <=(LTYPE l, RTYPE r) { return StringView (l) <= StringView (r); }\
131- inline bool operator >=(LTYPE l, RTYPE r) { return StringView (l) >= StringView (r); }\
124+ inline bool operator ==(LTYPE l, RTYPE r) { return std::string_view (l) == std::string_view (r); }\
125+ inline bool operator !=(LTYPE l, RTYPE r) { return std::string_view (l) != std::string_view (r); }\
126+ inline bool operator <(LTYPE l, RTYPE r) { return std::string_view (l) < std::string_view (r); }\
127+ inline bool operator >(LTYPE l, RTYPE r) { return std::string_view (l) > std::string_view (r); }\
128+ inline bool operator <=(LTYPE l, RTYPE r) { return std::string_view (l) <= std::string_view (r); }\
129+ inline bool operator >=(LTYPE l, RTYPE r) { return std::string_view (l) >= std::string_view (r); }\
132130
133131LCF_DBSTRING_MAKE_CMP_OPS (const DBString&, const DBString&);
134- LCF_DBSTRING_MAKE_CMP_OPS (StringView , const DBString&);
135- LCF_DBSTRING_MAKE_CMP_OPS (const DBString&, StringView );
132+ LCF_DBSTRING_MAKE_CMP_OPS (std::string_view , const DBString&);
133+ LCF_DBSTRING_MAKE_CMP_OPS (const DBString&, std::string_view );
136134LCF_DBSTRING_MAKE_CMP_OPS (const char *, const DBString&);
137135LCF_DBSTRING_MAKE_CMP_OPS (const DBString&, const char *);
138136
139137inline std::ostream& operator <<(std::ostream& os, const DBString& s) {
140- os << StringView (s);
138+ os << std::string_view (s);
141139 return os;
142140}
143141
@@ -147,7 +145,7 @@ namespace std {
147145
148146template <> struct hash <lcf::DBString> {
149147 size_t operator ()(const lcf::DBString& s) const {
150- return std::hash<lcf::StringView >()(lcf::StringView (s));
148+ return std::hash<std::string_view >()(std::string_view (s));
151149 }
152150};
153151
0 commit comments