30 #ifndef BPSTD_STRING_VIEW_HPP
31 #define BPSTD_STRING_VIEW_HPP
33 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
35 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
37 #include "detail/config.hpp"
48 BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE
60 template <
typename CharT,
typename Traits = std::
char_traits<CharT>>
68 using char_type = CharT;
69 using traits_type = Traits;
70 using size_type = std::size_t;
72 using value_type = CharT;
73 using reference = value_type&;
74 using const_reference =
const value_type&;
75 using pointer = value_type*;
76 using const_pointer =
const value_type*;
78 using iterator =
const CharT*;
79 using const_iterator =
const CharT*;
80 using reverse_iterator = std::reverse_iterator<iterator>;
81 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
88 static constexpr size_type npos = size_type(-1);
111 template <
typename Allocator>
113 basic_string_view(
const std::basic_string<CharT,Traits,Allocator>& str) noexcept;
147 constexpr size_type
size()
const noexcept;
148 constexpr size_type
length()
const noexcept;
154 constexpr size_type
max_size()
const noexcept;
160 constexpr
bool empty()
const noexcept;
172 constexpr
const char_type*
data()
const noexcept;
178 constexpr const_reference
operator[](size_type pos)
const noexcept;
184 constexpr const_reference
at(size_type pos)
const;
191 constexpr const_reference
front()
const noexcept;
198 constexpr const_reference
back()
const noexcept;
210 BPSTD_CPP14_CONSTEXPR
void remove_prefix(size_type n) noexcept;
217 BPSTD_CPP14_CONSTEXPR
void remove_suffix(size_type n) noexcept;
234 template <
typename Allocator>
235 explicit constexpr
operator std::basic_string<CharT, Traits, Allocator>()
const;
248 BPSTD_CPP14_CONSTEXPR size_type
copy(char_type* dest,
249 size_type count = npos,
250 size_type pos = 0)
const;
258 size_t len = npos)
const;
290 BPSTD_CPP14_CONSTEXPR
int compare(size_type pos1,
294 size_type count2)
const;
302 BPSTD_CPP14_CONSTEXPR
int compare(
const char_type* s)
const;
312 BPSTD_CPP14_CONSTEXPR
int compare(size_type pos,
314 const char_type* s)
const;
325 BPSTD_CPP14_CONSTEXPR
int compare(size_type pos,
328 size_type count2)
const;
333 size_type pos = 0)
const;
334 BPSTD_CPP14_CONSTEXPR size_type find(char_type c,
335 size_type pos = 0)
const;
336 BPSTD_CPP14_CONSTEXPR size_type find(
const char_type* s,
338 size_type count)
const;
339 BPSTD_CPP14_CONSTEXPR size_type find(
const char_type* s,
340 size_type pos = 0)
const;
345 size_type pos = npos)
const;
346 BPSTD_CPP14_CONSTEXPR size_type rfind(char_type c,
347 size_type pos = npos)
const;
348 BPSTD_CPP14_CONSTEXPR size_type rfind(
const char_type* s,
350 size_type count)
const;
351 BPSTD_CPP14_CONSTEXPR size_type rfind(
const char_type* s,
352 size_type pos = npos)
const;
357 size_type pos = 0)
const;
358 BPSTD_CPP14_CONSTEXPR size_type find_first_of(char_type c,
359 size_type pos = 0)
const;
360 BPSTD_CPP14_CONSTEXPR size_type find_first_of(
const char_type* s,
362 size_type count)
const;
363 BPSTD_CPP14_CONSTEXPR size_type find_first_of(
const char_type* s,
364 size_type pos = 0)
const;
369 size_type pos = npos)
const;
370 BPSTD_CPP14_CONSTEXPR size_type find_last_of(char_type c,
371 size_type pos = npos)
const;
372 BPSTD_CPP14_CONSTEXPR size_type find_last_of(
const char_type* s,
373 size_type pos, size_type count)
const;
374 BPSTD_CPP14_CONSTEXPR size_type find_last_of(
const char_type* s,
375 size_type pos = npos)
const;
380 size_type pos = 0)
const;
381 BPSTD_CPP14_CONSTEXPR size_type find_first_not_of(char_type c,
382 size_type pos = 0)
const;
383 BPSTD_CPP14_CONSTEXPR size_type find_first_not_of(
const char_type* s,
385 size_type count)
const;
386 BPSTD_CPP14_CONSTEXPR size_type find_first_not_of(
const char_type* s,
387 size_type pos = 0)
const;
392 size_type pos = npos)
const;
393 BPSTD_CPP14_CONSTEXPR size_type find_last_not_of(char_type c,
394 size_type pos = npos)
const;
395 BPSTD_CPP14_CONSTEXPR size_type find_last_not_of(
const char_type* s,
397 size_type count)
const;
398 BPSTD_CPP14_CONSTEXPR size_type find_last_not_of(
const char_type* s,
399 size_type pos = npos)
const;
410 BPSTD_CPP14_CONSTEXPR const_iterator
begin()
const noexcept;
411 BPSTD_CPP14_CONSTEXPR const_iterator
cbegin()
const noexcept;
418 BPSTD_CPP14_CONSTEXPR const_iterator
end()
const noexcept;
419 BPSTD_CPP14_CONSTEXPR const_iterator
cend()
const noexcept;
426 BPSTD_CPP14_CONSTEXPR const_reverse_iterator
rbegin()
const noexcept;
427 BPSTD_CPP14_CONSTEXPR const_reverse_iterator
rend()
const noexcept;
434 BPSTD_CPP14_CONSTEXPR const_reverse_iterator
crbegin()
const noexcept;
435 BPSTD_CPP14_CONSTEXPR const_reverse_iterator
crend()
const noexcept;
443 const char_type* m_str;
454 template <
typename CharT,
typename Traits>
455 constexpr
typename bpstd::basic_string_view<CharT,Traits>::size_type
467 template <
typename CharT,
typename Traits>
468 std::basic_ostream<CharT,Traits>& operator<<(std::basic_ostream<CharT,Traits>& o,
471 template <
typename CharT,
typename Traits>
479 template <
typename CharT,
typename Traits>
480 BPSTD_CPP14_CONSTEXPR
bool
483 template <
typename CharT,
typename Traits>
484 BPSTD_CPP14_CONSTEXPR
bool
487 template <
typename CharT,
typename Traits>
488 BPSTD_CPP14_CONSTEXPR
bool
491 template <
typename CharT,
typename Traits>
492 BPSTD_CPP14_CONSTEXPR
bool
495 template <
typename CharT,
typename Traits>
496 BPSTD_CPP14_CONSTEXPR
bool
499 template <
typename CharT,
typename Traits>
500 BPSTD_CPP14_CONSTEXPR
bool
523 template <
typename CharT,
typename Traits>
524 inline BPSTD_INLINE_VISIBILITY constexpr
533 template <
typename CharT,
typename Traits>
534 template <
typename Allocator>
535 inline BPSTD_INLINE_VISIBILITY
539 : m_str{str.c_str()},
545 template <
typename CharT,
typename Traits>
546 inline BPSTD_INLINE_VISIBILITY constexpr
551 m_size{traits_type::length(str)}
556 template <
typename CharT,
typename Traits>
557 inline BPSTD_INLINE_VISIBILITY constexpr
571 template <
typename CharT,
typename Traits>
572 inline BPSTD_INLINE_VISIBILITY constexpr
573 typename bpstd::basic_string_view<CharT,Traits>::size_type
580 template <
typename CharT,
typename Traits>
581 inline BPSTD_INLINE_VISIBILITY constexpr
582 typename bpstd::basic_string_view<CharT,Traits>::size_type
589 template <
typename CharT,
typename Traits>
590 inline BPSTD_INLINE_VISIBILITY constexpr
591 typename bpstd::basic_string_view<CharT,Traits>::size_type
598 template <
typename CharT,
typename Traits>
599 inline BPSTD_INLINE_VISIBILITY constexpr
610 template <
typename CharT,
typename Traits>
611 inline BPSTD_INLINE_VISIBILITY constexpr
612 const typename bpstd::basic_string_view<CharT,Traits>::char_type*
619 template <
typename CharT,
typename Traits>
620 inline BPSTD_INLINE_VISIBILITY constexpr
621 typename bpstd::basic_string_view<CharT,Traits>::const_reference
628 template <
typename CharT,
typename Traits>
629 inline BPSTD_INLINE_VISIBILITY constexpr
630 typename bpstd::basic_string_view<CharT,Traits>::const_reference
634 return (pos < m_size)
636 : (
throw std::out_of_range{
"Input out of range in basic_string_view::at"}), m_str[pos];
639 template <
typename CharT,
typename Traits>
640 inline BPSTD_INLINE_VISIBILITY constexpr
641 typename bpstd::basic_string_view<CharT,Traits>::const_reference
648 template <
typename CharT,
typename Traits>
649 inline BPSTD_INLINE_VISIBILITY constexpr
650 typename bpstd::basic_string_view<CharT,Traits>::const_reference
654 return m_str[m_size-1];
661 template <
typename CharT,
typename Traits>
662 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
666 m_str += n, m_size -= n;
669 template <
typename CharT,
typename Traits>
670 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
677 template <
typename CharT,
typename Traits>
678 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
683 swap(m_size,v.m_size);
691 template <
typename CharT,
typename Traits>
692 template <
class Allocator>
693 inline BPSTD_INLINE_VISIBILITY constexpr
695 std::basic_string<CharT, Traits, Allocator>()
698 return std::basic_string<CharT,Traits,Allocator>(m_str, m_size);
705 template <
typename CharT,
typename Traits>
706 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
707 typename bpstd::basic_string_view<CharT,Traits>::size_type
714 throw std::out_of_range(
"Index out of range in basic_string_view::copy");
717 const auto rcount = std::min(m_size - pos,count+1);
718 auto*
const begin = m_str + pos;
719 auto*
const end = m_str + pos + rcount;
720 for (
auto it = begin; it != end; ++it) {
727 template <
typename CharT,
typename Traits>
728 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
734 const size_type max_length = pos > m_size ? 0 : m_size - pos;
737 throw std::out_of_range(
"Index out of range in basic_string_view::substr");
745 template <
typename CharT,
typename Traits>
746 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
751 const size_type rlen = std::min(m_size,v.m_size);
752 const int compare = Traits::compare(m_str,v.m_str,rlen);
757 if (m_size < v.m_size) {
760 if (m_size > v.m_size) {
766 template <
typename CharT,
typename Traits>
767 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
774 return substr(pos,count).compare(v);
777 template <
typename CharT,
typename Traits>
778 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
787 return substr(pos1,count1).compare(v.
substr(pos2,count2));
790 template <
typename CharT,
typename Traits>
791 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
799 template <
typename CharT,
typename Traits>
800 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
810 template <
typename CharT,
typename Traits>
811 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
824 template <
typename CharT,
typename Traits>
825 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
826 typename bpstd::basic_string_view<CharT,Traits>::size_type
835 if ((pos + v.
size()) > size()) {
839 const auto offset = pos;
840 const auto increments =
size() - v.
size();
842 for (
auto i = 0u; i <= increments; ++i) {
843 const auto j = i + offset;
844 if (substr(j, v.
size()) == v) {
851 template <
typename CharT,
typename Traits>
852 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
853 typename bpstd::basic_string_view<CharT,Traits>::size_type
858 return find(basic_string_view<CharT,Traits>(&c, 1), pos);
861 template <
typename CharT,
typename Traits>
862 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
863 typename bpstd::basic_string_view<CharT,Traits>::size_type
868 return find(basic_string_view<CharT,Traits>(s, count), pos);
871 template <
typename CharT,
typename Traits>
872 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
873 typename bpstd::basic_string_view<CharT,Traits>::size_type
878 return find(basic_string_view<CharT,Traits>(s), pos);
883 template <
typename CharT,
typename Traits>
884 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
885 typename bpstd::basic_string_view<CharT,Traits>::size_type
891 return v.
empty() ? 0u : npos;
894 return std::min(
size() - 1, pos);
896 if (v.size() >
size()) {
900 auto i = std::min(pos, (
size() - v.size()));
902 if (substr(i, v.size()) == v) {
911 template <
typename CharT,
typename Traits>
912 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
913 typename bpstd::basic_string_view<CharT,Traits>::size_type
918 return rfind(basic_string_view<CharT,Traits>(&c, 1), pos);
921 template <
typename CharT,
typename Traits>
922 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
923 typename bpstd::basic_string_view<CharT,Traits>::size_type
929 return rfind(basic_string_view<CharT,Traits>(s, count), pos);
932 template <
typename CharT,
typename Traits>
933 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
934 typename bpstd::basic_string_view<CharT,Traits>::size_type
939 return rfind(basic_string_view<CharT,Traits>(s), pos);
944 template <
typename CharT,
typename Traits>
945 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
946 typename bpstd::basic_string_view<CharT,Traits>::size_type
951 const auto max_index =
size();
952 for (
auto i = pos; i < max_index; ++i) {
953 if (is_one_of(m_str[i],v)) {
961 template <
typename CharT,
typename Traits>
962 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
963 typename bpstd::basic_string_view<CharT,Traits>::size_type
968 return find_first_of(basic_string_view<CharT,Traits>(&c, 1), pos);
971 template <
typename CharT,
typename Traits>
972 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
973 typename bpstd::basic_string_view<CharT,Traits>::size_type
979 return find_first_of(basic_string_view<CharT,Traits>(s, count), pos);
982 template <
typename CharT,
typename Traits>
983 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
984 typename bpstd::basic_string_view<CharT,Traits>::size_type
989 return find_first_of(basic_string_view<CharT,Traits>(s), pos);
994 template <
typename CharT,
typename Traits>
995 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
996 typename bpstd::basic_string_view<CharT,Traits>::size_type
1004 const auto max_index = std::min(
size() - 1, pos);
1005 for (
auto i = 0u; i <= max_index; ++i) {
1006 const auto j = max_index - i;
1008 if (is_one_of(m_str[j],v)) {
1016 template <
typename CharT,
typename Traits>
1017 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1018 typename bpstd::basic_string_view<CharT,Traits>::size_type
1023 return find_last_of(basic_string_view<CharT,Traits>(&c, 1), pos);
1026 template <
typename CharT,
typename Traits>
1027 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1028 typename bpstd::basic_string_view<CharT,Traits>::size_type
1034 return find_last_of(basic_string_view<CharT,Traits>(s, count), pos);
1037 template <
typename CharT,
typename Traits>
1038 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1039 typename bpstd::basic_string_view<CharT,Traits>::size_type
1044 return find_last_of(basic_string_view<CharT,Traits>(s), pos);
1049 template <
typename CharT,
typename Traits>
1050 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1051 typename bpstd::basic_string_view<CharT,Traits>::size_type
1056 const auto max_index =
size();
1057 for (
auto i = pos; i < max_index; ++i) {
1058 if (!is_one_of(m_str[i],v)) {
1066 template <
typename CharT,
typename Traits>
1067 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1068 typename bpstd::basic_string_view<CharT,Traits>::size_type
1073 return find_first_not_of(basic_string_view<CharT,Traits>(&c, 1), pos);
1076 template <
typename CharT,
typename Traits>
1077 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1078 typename bpstd::basic_string_view<CharT,Traits>::size_type
1084 return find_first_not_of(basic_string_view<CharT,Traits>(s, count), pos);
1087 template <
typename CharT,
typename Traits>
1088 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1089 typename bpstd::basic_string_view<CharT,Traits>::size_type
1094 return find_first_not_of(basic_string_view<CharT,Traits>(s), pos);
1099 template <
typename CharT,
typename Traits>
1100 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1101 typename bpstd::basic_string_view<CharT,Traits>::size_type
1109 const auto max_index = std::min(
size() - 1, pos);
1110 for (
auto i = 0u; i <= max_index; ++i) {
1111 const auto j = max_index - i;
1113 if (!is_one_of(m_str[j],v)) {
1121 template <
typename CharT,
typename Traits>
1122 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1123 typename bpstd::basic_string_view<CharT,Traits>::size_type
1128 return find_last_not_of(basic_string_view<CharT,Traits>(&c, 1), pos);
1131 template <
typename CharT,
typename Traits>
1132 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1133 typename bpstd::basic_string_view<CharT,Traits>::size_type
1139 return find_last_not_of(basic_string_view<CharT,Traits>(s, count), pos);
1142 template <
typename CharT,
typename Traits>
1143 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1144 typename bpstd::basic_string_view<CharT,Traits>::size_type
1149 return find_last_not_of(basic_string_view<CharT,Traits>(s), pos);
1156 template <
typename CharT,
typename Traits>
1157 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1158 typename bpstd::basic_string_view<CharT,Traits>::const_iterator
1165 template <
typename CharT,
typename Traits>
1166 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1167 typename bpstd::basic_string_view<CharT,Traits>::const_iterator
1174 template <
typename CharT,
typename Traits>
1175 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1176 typename bpstd::basic_string_view<CharT,Traits>::const_iterator
1180 return m_str + m_size;
1183 template <
typename CharT,
typename Traits>
1184 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1185 typename bpstd::basic_string_view<CharT,Traits>::const_iterator
1192 template <
typename CharT,
typename Traits>
1193 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1194 typename bpstd::basic_string_view<CharT,Traits>::const_reverse_iterator
1198 return const_reverse_iterator{end()};
1201 template <
typename CharT,
typename Traits>
1202 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1203 typename bpstd::basic_string_view<CharT,Traits>::const_reverse_iterator
1210 template <
typename CharT,
typename Traits>
1211 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1212 typename bpstd::basic_string_view<CharT,Traits>::const_reverse_iterator
1216 return const_reverse_iterator{begin()};
1219 template <
typename CharT,
typename Traits>
1220 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1221 typename bpstd::basic_string_view<CharT,Traits>::const_reverse_iterator
1228 template <
typename CharT,
typename Traits>
1229 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1233 for (
auto s : str) {
1234 if (Traits::eq(c,s)) {
1245 template <
typename CharT,
typename Traits>
1246 inline BPSTD_INLINE_VISIBILITY
1247 std::basic_ostream<CharT,Traits>&
1249 const basic_string_view<CharT,Traits>& str)
1251 o.write(str.data(),
static_cast<std::streamsize
>(str.size()));
1255 template <
typename CharT,
typename Traits>
1256 inline BPSTD_INLINE_VISIBILITY
1257 void bpstd::swap(basic_string_view<CharT,Traits>& lhs,
1258 basic_string_view<CharT,Traits>& rhs)
1270 template <
typename CharT,
typename Traits>
1271 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1272 bool operator==(
const basic_string_view<CharT,Traits>& lhs,
1273 const basic_string_view<CharT,Traits>& rhs)
1276 return lhs.compare(rhs) == 0;
1279 template <
typename CharT,
typename Traits>
1280 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1281 bool operator==(basic_string_view<CharT,Traits> lhs,
const CharT* rhs)
1284 return lhs == basic_string_view<CharT,Traits>(rhs);
1287 template <
typename CharT,
typename Traits>
1288 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1289 bool operator==(
const CharT* lhs,
const basic_string_view<CharT,Traits>& rhs)
1292 return basic_string_view<CharT,Traits>(lhs) == rhs;
1295 template <
typename CharT,
typename Traits,
typename Allocator>
1296 inline BPSTD_INLINE_VISIBILITY
1297 bool operator==(
const std::basic_string<CharT,Traits,Allocator>& lhs,
1298 const basic_string_view<CharT,Traits>& rhs)
1300 return basic_string_view<CharT,Traits>(lhs) == rhs;
1303 template <
typename CharT,
typename Traits,
typename Allocator>
1304 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1305 bool operator==(
const basic_string_view<CharT,Traits>& lhs,
1306 const std::basic_string<CharT,Traits,Allocator>& rhs)
1308 return lhs == basic_string_view<CharT,Traits>(rhs);
1313 template <
typename CharT,
typename Traits>
1314 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1315 bool operator!=(
const basic_string_view<CharT,Traits>& lhs,
1316 const basic_string_view<CharT,Traits>& rhs)
1319 return lhs.compare(rhs) != 0;
1322 template <
typename CharT,
typename Traits>
1323 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1324 bool operator!=(
const basic_string_view<CharT,Traits>& lhs,
const CharT* rhs)
1327 return lhs != basic_string_view<CharT,Traits>(rhs);
1330 template <
typename CharT,
typename Traits>
1331 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1332 bool operator!=(
const CharT* lhs,
const basic_string_view<CharT,Traits>& rhs)
1335 return basic_string_view<CharT,Traits>(lhs) != rhs;
1338 template <
typename CharT,
typename Traits,
typename Allocator>
1339 inline BPSTD_INLINE_VISIBILITY
1340 bool operator!=(
const std::basic_string<CharT,Traits,Allocator>& lhs,
1341 const basic_string_view<CharT,Traits>& rhs)
1343 return basic_string_view<CharT,Traits>(lhs) != rhs;
1346 template <
typename CharT,
typename Traits,
typename Allocator>
1347 inline BPSTD_INLINE_VISIBILITY
1348 bool operator!=(
const basic_string_view<CharT,Traits>& lhs,
1349 const std::basic_string<CharT,Traits,Allocator>& rhs)
1351 return lhs != basic_string_view<CharT,Traits>(rhs);
1355 template <
typename CharT,
typename Traits>
1356 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1357 bool operator<(
const basic_string_view<CharT,Traits>& lhs,
1358 const basic_string_view<CharT,Traits>& rhs)
1361 return lhs.compare(rhs) < 0;
1364 template <
typename CharT,
typename Traits>
1365 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1366 bool operator<(
const basic_string_view<CharT,Traits>& lhs,
const CharT* rhs)
1369 return lhs < basic_string_view<CharT,Traits>(rhs);
1372 template <
typename CharT,
typename Traits>
1373 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1374 bool operator<(
const CharT* lhs,
const basic_string_view<CharT,Traits>& rhs)
1377 return basic_string_view<CharT,Traits>(lhs) < rhs;
1380 template <
typename CharT,
typename Traits,
typename Allocator>
1381 inline BPSTD_INLINE_VISIBILITY
1382 bool operator<(
const std::basic_string<CharT,Traits,Allocator>& lhs,
1383 const basic_string_view<CharT,Traits>& rhs)
1385 return basic_string_view<CharT,Traits>(lhs) < rhs;
1388 template <
typename CharT,
typename Traits,
typename Allocator>
1389 inline BPSTD_INLINE_VISIBILITY
1390 bool operator<(
const basic_string_view<CharT,Traits>& lhs,
1391 const std::basic_string<CharT,Traits,Allocator>& rhs)
1393 return lhs < basic_string_view<CharT,Traits>(rhs);
1398 template <
typename CharT,
typename Traits>
1399 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1400 bool operator>(
const basic_string_view<CharT,Traits>& lhs,
1401 const basic_string_view<CharT,Traits>& rhs)
1404 return lhs.compare(rhs) > 0;
1407 template <
typename CharT,
typename Traits>
1408 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1409 bool operator>(
const basic_string_view<CharT,Traits>& lhs,
const CharT* rhs)
1412 return lhs > basic_string_view<CharT,Traits>(rhs);
1415 template <
typename CharT,
typename Traits>
1416 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1417 bool operator>(
const CharT* lhs,
const basic_string_view<CharT,Traits>& rhs)
1420 return basic_string_view<CharT,Traits>(lhs) > rhs;
1423 template <
typename CharT,
typename Traits,
typename Allocator>
1424 inline BPSTD_INLINE_VISIBILITY
1425 bool operator>(
const std::basic_string<CharT,Traits,Allocator>& lhs,
1426 const basic_string_view<CharT,Traits>& rhs)
1428 return basic_string_view<CharT,Traits>(lhs) > rhs;
1431 template <
typename CharT,
typename Traits,
typename Allocator>
1432 inline BPSTD_INLINE_VISIBILITY
1433 bool operator>(
const basic_string_view<CharT,Traits>& lhs,
1434 const std::basic_string<CharT,Traits,Allocator>& rhs)
1436 return lhs > basic_string_view<CharT,Traits>(rhs);
1441 template <
typename CharT,
typename Traits>
1442 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1443 bool operator<=(
const basic_string_view<CharT,Traits>& lhs,
1444 const basic_string_view<CharT,Traits>& rhs)
1447 return lhs.compare(rhs) <= 0;
1450 template <
typename CharT,
typename Traits>
1451 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1452 bool operator<=(
const basic_string_view<CharT,Traits>& lhs,
const CharT* rhs)
1455 return lhs <= basic_string_view<CharT,Traits>(rhs);
1458 template <
typename CharT,
typename Traits>
1459 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1460 bool operator<=(
const CharT* lhs,
const basic_string_view<CharT,Traits>& rhs)
1463 return basic_string_view<CharT,Traits>(lhs) <= rhs;
1466 template <
typename CharT,
typename Traits,
typename Allocator>
1467 inline BPSTD_INLINE_VISIBILITY
1468 bool operator<=(
const std::basic_string<CharT,Traits,Allocator>& lhs,
1469 const basic_string_view<CharT,Traits>& rhs)
1471 return basic_string_view<CharT,Traits>(lhs) <= rhs;
1474 template <
typename CharT,
typename Traits,
typename Allocator>
1475 inline BPSTD_INLINE_VISIBILITY
1476 bool operator<=(
const basic_string_view<CharT,Traits>& lhs,
1477 const std::basic_string<CharT,Traits,Allocator>& rhs)
1479 return lhs <= basic_string_view<CharT,Traits>(rhs);
1484 template <
typename CharT,
typename Traits>
1485 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1486 bool operator>=(
const basic_string_view<CharT,Traits>& lhs,
1487 const basic_string_view<CharT,Traits>& rhs)
1490 return lhs.compare(rhs) >= 0;
1493 template <
typename CharT,
typename Traits>
1494 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1495 bool operator>=(
const basic_string_view<CharT,Traits>& lhs,
const CharT* rhs)
1498 return lhs >= basic_string_view<CharT,Traits>(rhs);
1501 template <
typename CharT,
typename Traits>
1502 inline BPSTD_INLINE_VISIBILITY BPSTD_CPP14_CONSTEXPR
1503 bool operator>=(
const CharT* lhs,
const basic_string_view<CharT,Traits>& rhs)
1506 return basic_string_view<CharT,Traits>(lhs) >= rhs;
1509 template <
typename CharT,
typename Traits,
typename Allocator>
1510 inline BPSTD_INLINE_VISIBILITY
1511 bool operator>=(
const std::basic_string<CharT,Traits,Allocator>& lhs,
1512 const basic_string_view<CharT,Traits>& rhs)
1514 return basic_string_view<CharT,Traits>(lhs) >= rhs;
1517 template <
typename CharT,
typename Traits,
typename Allocator>
1518 inline BPSTD_INLINE_VISIBILITY
1519 bool operator>=(
const basic_string_view<CharT,Traits>& lhs,
1520 const std::basic_string<CharT,Traits,Allocator>& rhs)
1522 return lhs >= basic_string_view<CharT,Traits>(rhs);
1527 BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE