aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Loading...
Searching...
No Matches
StringView.h
Go to the documentation of this file.
1#pragma once
11#include <algorithm>
12#include <cassert>
13#include <iterator>
14#include <limits>
15#include <stddef.h>
16#include <string>
17#include <type_traits>
18
19#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
20# include <string_view>
21#endif
22
23namespace Aws
24{
25 namespace Crt
26 {
32 template <typename CharT, typename Traits = std::char_traits<CharT>> class basic_string_view
33 {
34 public:
35 // types
39 using const_pointer = const value_type *;
41 using const_reference = const value_type &;
42 using const_iterator = const value_type *;
44 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
48 static constexpr size_type npos = static_cast<size_type>(-1);
49
50 // constructors and assignment
51
52 constexpr basic_string_view() noexcept : m_size{0}, m_data{nullptr} {}
53
54 constexpr basic_string_view(const basic_string_view &) noexcept = default;
55
56 constexpr basic_string_view(const CharT *s) noexcept : m_size{traits_type::length(s)}, m_data{s} {}
57
58 constexpr basic_string_view(const CharT *s, size_type count) noexcept : m_size{count}, m_data{s} {}
59
60 basic_string_view &operator=(const basic_string_view &) noexcept = default;
61
62#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
63 constexpr basic_string_view(const std::basic_string_view<CharT, Traits> &other) noexcept
64 : m_size(other.size()), m_data(other.data())
65 {
66 }
67
68 basic_string_view &operator=(const std::basic_string_view<CharT, Traits> &other) noexcept
69 {
70 m_data = other->data();
71 m_size = other->size();
72 return *this;
73 }
74#endif
75 // iterators
76
77 constexpr const_iterator begin() const noexcept { return this->m_data; }
78
79 constexpr const_iterator end() const noexcept { return this->m_data + this->m_size; }
80
81 constexpr const_iterator cbegin() const noexcept { return this->m_data; }
82
83 constexpr const_iterator cend() const noexcept { return this->m_data + this->m_size; }
84
86
88
90
92
93 constexpr size_type size() const noexcept { return this->m_size; }
94
95 constexpr size_type length() const noexcept { return this->m_size; }
96
97 constexpr size_type max_size() const noexcept { return (std::numeric_limits<size_type>::max)(); }
98
99 constexpr bool empty() const noexcept { return this->m_size == 0; }
100
101 // element accessors
102
104 {
105 assert(pos < m_size);
106 return *(this->m_data + pos);
107 }
108
110 {
111 assert(pos < m_size);
112 return *(this->m_data + pos);
113 }
114
116 {
117 assert(m_size > 0);
118 return *this->m_data;
119 }
120
122 {
123 assert(m_size > 0);
124 return *(this->m_data + this->m_size - 1);
125 }
126
127 constexpr const_pointer data() const noexcept { return this->m_data; }
128
129 // modifiers
130 void remove_prefix(size_type n) noexcept
131 {
132 assert(this->m_size >= n);
133 this->m_data += n;
134 this->m_size -= n;
135 }
136
137 void remove_suffix(size_type n) noexcept { this->m_size -= n; }
138
139 void swap(basic_string_view &other) noexcept
140 {
141 auto tmp = *this;
142 *this = other;
143 other = tmp;
144 }
145
146 // string operations
148 {
149 assert(pos <= size());
150 const size_type copyLen = (std::min)(n, m_size - pos);
151 traits_type::copy(s, data() + pos, copyLen);
152 return copyLen;
153 }
154
155 basic_string_view substr(size_type pos = 0, size_type n = npos) const noexcept(false)
156 {
157 assert(pos <= size());
158 const size_type copyLen = (std::min)(n, m_size - pos);
159 return basic_string_view{m_data + pos, copyLen};
160 }
161
162 int compare(const basic_string_view &s) const noexcept
163 {
164 const size_type compareLen = (std::min)(this->m_size, s.m_size);
165 int ret = traits_type::compare(this->m_data, s.m_data, compareLen);
166 if (ret == 0)
167 {
168 ret = _s_compare(this->m_size, s.m_size);
169 }
170 return ret;
171 }
172
173 constexpr int compare(size_type pos1, size_type n1, const basic_string_view &s) const
174 {
175 return this->substr(pos1, n1).compare(s);
176 }
177
178 constexpr int compare(
181 const basic_string_view &s,
183 size_type n2) const
184 {
185 return this->substr(pos1, n1).compare(s.substr(pos2, n2));
186 }
187
188 constexpr int compare(const CharT *s) const noexcept { return this->compare(basic_string_view{s}); }
189
190 constexpr int compare(size_type pos1, size_type n1, const CharT *s) const
191 {
192 return this->substr(pos1, n1).compare(basic_string_view{s});
193 }
194
195 constexpr int compare(size_type pos1, size_type n1, const CharT *s, size_type n2) const noexcept(false)
196 {
197 return this->substr(pos1, n1).compare(basic_string_view(s, n2));
198 }
199
200 constexpr bool starts_with(const basic_string_view &other) const noexcept
201 {
202 return this->substr(0, other.size()) == other;
203 }
204
205 constexpr bool starts_with(CharT c) const noexcept
206 {
207 return !this->empty() && traits_type::eq(this->front(), c);
208 }
209
210 constexpr bool starts_with(const CharT *s) const noexcept
211 {
212 return this->starts_with(basic_string_view(s));
213 }
214
215 constexpr bool ends_with(const basic_string_view &other) const noexcept
216 {
217 return this->m_size >= other.m_size && this->compare(this->m_size - other.m_size, npos, other) == 0;
218 }
219
220 constexpr bool ends_with(CharT c) const noexcept
221 {
222 return !this->empty() && traits_type::eq(this->back(), c);
223 }
224
225 constexpr bool ends_with(const CharT *s) const noexcept { return this->ends_with(basic_string_view(s)); }
226
227 // find utilities
229 {
230 return this->find(s.m_data, pos, s.m_size);
231 }
232
234 {
235 if (pos >= m_size)
236 {
237 return npos;
238 }
239 const CharT *r = Traits::find(m_data + pos, m_size - pos, c);
240 if (r == nullptr)
241 {
242 return npos;
243 }
244 return static_cast<size_type>(r - m_data);
245 }
246
247 size_type find(const CharT *s, size_type pos, size_type n) const noexcept
248 {
249 if (n && !s)
250 {
251 return npos;
252 }
253
254 if (pos > m_size)
255 {
256 return npos;
257 }
258
259 if (n == 0)
260 {
261 return pos;
262 }
263
264 const CharT *r = _s_search_substr(m_data + pos, m_data + m_size, s, s + n);
265
266 if (r == m_data + m_size)
267 {
268 return npos;
269 }
270 return static_cast<size_type>(r - m_data);
271 }
272
274 {
275 return this->find(s, pos, traits_type::length(s));
276 }
277
279 {
280 if (s.m_size && !s.m_data)
281 {
282 return npos;
283 }
284 return this->rfind(s.m_data, pos, s.m_size);
285 }
286
288 {
289 if (m_size <= 0)
290 {
291 return npos;
292 }
293
294 if (pos < m_size)
295 {
296 ++pos;
297 }
298 else
299 {
300 pos = m_size;
301 }
302
303 for (const CharT *ptr = m_data + pos; ptr != m_data;)
304 {
305 if (Traits::eq(*--ptr, c))
306 {
307 return static_cast<size_type>(ptr - m_data);
308 }
309 }
310 return npos;
311 }
312
313 size_type rfind(const CharT *s, size_type pos, size_type n) const noexcept
314 {
315 if (n && !s)
316 {
317 return npos;
318 }
319
320 pos = (std::min)(pos, m_size);
321 if (n < m_size - pos)
322 {
323 pos += n;
324 }
325 else
326 {
327 pos = m_size;
328 }
329 const CharT *r = _s_find_end(m_data, m_data + pos, s, s + n);
330 if (n > 0 && r == m_data + pos)
331 {
332 return npos;
333 }
334 return static_cast<size_type>(r - m_data);
335 }
336
337 constexpr size_type rfind(const CharT *s, size_type pos = npos) const noexcept
338 {
339 return this->rfind(s, pos, traits_type::length(s));
340 }
341
343 {
344 return this->find_first_of(s.m_data, pos, s.m_size);
345 }
346
347 constexpr size_type find_first_of(CharT c, size_type pos = 0) const noexcept { return this->find(c, pos); }
348
350 {
351 if (pos >= m_size || !n || !s)
352 {
353 return npos;
354 }
355
356 const CharT *r = _s_find_first_of_ce(m_data + pos, m_data + m_size, s, s + n);
357
358 if (r == m_data + m_size)
359 {
360 return npos;
361 }
362
363 return static_cast<size_type>(r - m_data);
364 }
365
367 {
368 return this->find_first_of(s, pos, traits_type::length(s));
369 }
370
372 {
373 return this->find_last_of(s.m_data, pos, s.m_size);
374 }
375
376 constexpr size_type find_last_of(CharT c, size_type pos = npos) const noexcept
377 {
378 return this->rfind(c, pos);
379 }
380
382 {
383 if (!n || s == nullptr)
384 {
385 return npos;
386 }
387
388 if (pos < m_size)
389 {
390 ++pos;
391 }
392 else
393 {
394 pos = m_size;
395 }
396
397 for (const CharT *ptr = m_data + pos; ptr != m_data;)
398 {
399 const CharT *r = Traits::find(s, n, *--ptr);
400 if (r)
401 {
402 return static_cast<size_type>(ptr - m_data);
403 }
404 }
405
406 return npos;
407 }
408
409 constexpr size_type find_last_of(const CharT *s, size_type pos = npos) const noexcept
410 {
411 return this->find_last_of(s, pos, traits_type::length(s));
412 }
413
415 {
416 if (s.m_size && !s.m_data)
417 {
418 return npos;
419 }
420 return this->find_first_not_of(s.m_data, pos, s.m_size);
421 }
422
424 {
425 if (!m_data || pos >= m_size)
426 {
427 return npos;
428 }
429
430 const CharT *pend = m_data + m_size;
431 for (const CharT *ptr = m_data + pos; ptr != pend; ++ptr)
432 {
433 if (!Traits::eq(*ptr, c))
434 {
435 return static_cast<size_type>(ptr - m_data);
436 }
437 }
438
439 return npos;
440 }
441
443 {
444 if (n && s == nullptr)
445 {
446 return npos;
447 }
448
449 if (m_data == nullptr || pos >= m_size)
450 {
451 return npos;
452 }
453
454 const CharT *pend = m_data + m_size;
455 for (const CharT *ptr = m_data + pos; ptr != pend; ++ptr)
456 {
457 if (Traits::find(s, n, *ptr) == 0)
458 {
459 return static_cast<size_type>(ptr - m_data);
460 }
461 }
462
463 return npos;
464 }
465
467 {
468 return this->find_first_not_of(s, pos, traits_type::length(s));
469 }
470
472 {
473 if (s.m_size && !s.m_data)
474 {
475 return npos;
476 }
477 return this->find_last_not_of(s.m_data, pos, s.m_size);
478 }
479
481 {
482 if (pos < m_size)
483 {
484 ++pos;
485 }
486 else
487 {
488 pos = m_size;
489 }
490
491 for (const CharT *ptr = m_data + pos; ptr != m_data;)
492 {
493 if (!Traits::eq(*--ptr, c))
494 {
495 return static_cast<size_type>(ptr - m_data);
496 }
497 }
498 return npos;
499 }
500
502 {
503 if (n && !s)
504 {
505 return npos;
506 }
507
508 if (pos < m_size)
509 {
510 ++pos;
511 }
512 else
513 {
514 pos = m_size;
515 }
516
517 for (const CharT *ptr = m_data + pos; ptr != m_data;)
518 {
519 if (Traits::find(s, n, *--ptr) == 0)
520 {
521 return static_cast<size_type>(ptr - m_data);
522 }
523 }
524 return npos;
525 }
526
527 constexpr size_type find_last_not_of(const CharT *s, size_type pos = npos) const noexcept
528 {
529 return this->find_last_not_of(s, pos, traits_type::length(s));
530 }
531
532 private:
533 static int _s_compare(size_type n1, size_type n2) noexcept
534 {
535 const difference_type diff = n1 - n2;
536
537 if (diff > (std::numeric_limits<int>::max)())
538 {
539 return (std::numeric_limits<int>::max)();
540 }
541
542 if (diff < (std::numeric_limits<int>::min)())
543 {
544 return (std::numeric_limits<int>::min)();
545 }
546
547 return static_cast<int>(diff);
548 }
549
550 static const CharT *_s_search_substr(
551 const CharT *first1,
552 const CharT *last1,
553 const CharT *first2,
554 const CharT *last2)
555 {
556 const ptrdiff_t length2 = last2 - first2;
557 if (length2 == 0)
558 {
559 return first1;
560 }
561
563 if (length1 < length2)
564 {
565 return last1;
566 }
567
568 while (true)
569 {
570 length1 = last1 - first1;
571 if (length1 < length2)
572 {
573 return last1;
574 }
575
576 first1 = Traits::find(first1, length1 - length2 + 1, *first2);
577 if (first1 == 0)
578 {
579 return last1;
580 }
581
582 if (Traits::compare(first1, first2, length2) == 0)
583 {
584 return first1;
585 }
586
587 ++first1;
588 }
589 }
590
591 static const CharT *_s_find_end(
592 const CharT *first1,
593 const CharT *last1,
594 const CharT *first2,
595 const CharT *last2)
596 {
597 const CharT *r = last1;
598 if (first2 == last2)
599 {
600 return r;
601 }
602
603 while (true)
604 {
605 while (true)
606 {
607 if (first1 == last1)
608 {
609 return r;
610 }
611 if (Traits::eq(*first1, *first2))
612 {
613 break;
614 }
615 ++first1;
616 }
617
618 const CharT *m1 = first1;
619 const CharT *m2 = first2;
620 while (true)
621 {
622 if (++m2 == last2)
623 {
624 r = first1;
625 ++first1;
626 break;
627 }
628 if (++m1 == last1)
629 {
630 return r;
631 }
632 if (!Traits::eq(*m1, *m2))
633 {
634 ++first1;
635 break;
636 }
637 }
638 }
639 }
640
641 static const CharT *_s_find_first_of_ce(
642 const CharT *first1,
643 const CharT *last1,
644 const CharT *first2,
645 const CharT *last2)
646 {
647 for (; first1 != last1; ++first1)
648 {
649 for (const CharT *ptr = first2; ptr != last2; ++ptr)
650 {
651 if (Traits::eq(*first1, *ptr))
652 {
653 return first1;
654 }
655 }
656 }
657 return last1;
658 }
659
660 size_type m_size;
661 const CharT *m_data;
662 };
663
664 // operator ==
665 template <class CharT, class Traits>
669 {
670 return (lhs.size() != rhs.size()) ? false : lhs.compare(rhs) == 0;
671 }
672
673 template <class CharT, class Traits>
676 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
677 {
678 return (lhs.size() != rhs.size()) ? false : lhs.compare(rhs) == 0;
679 }
680
681 template <class CharT, class Traits>
683 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
685 {
686 return (lhs.size() != rhs.size()) ? false : lhs.compare(rhs) == 0;
687 }
688
689 // operator !=
690 template <class CharT, class Traits>
694 {
695 return (lhs.size() != rhs.size()) ? true : lhs.compare(rhs) != 0;
696 }
697
698 template <class CharT, class Traits>
701 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
702 {
703 return (lhs.size() != rhs.size()) ? true : lhs.compare(rhs) != 0;
704 }
705
706 template <class CharT, class Traits>
708 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
710 {
711 return (lhs.size() != rhs.size()) ? true : lhs.compare(rhs) != 0;
712 }
713
714 // operator <
715 template <class CharT, class Traits>
719 {
720 return lhs.compare(rhs) < 0;
721 }
722
723 template <class CharT, class Traits>
724 constexpr bool operator<(
726 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
727 {
728 return lhs.compare(rhs) < 0;
729 }
730
731 template <class CharT, class Traits>
732 constexpr bool operator<(
733 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
735 {
736 return lhs.compare(rhs) < 0;
737 }
738
739 // operator >
740 template <class CharT, class Traits>
741 constexpr bool operator>(
744 {
745 return lhs.compare(rhs) > 0;
746 }
747
748 template <class CharT, class Traits>
749 constexpr bool operator>(
751 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
752 {
753 return lhs.compare(rhs) > 0;
754 }
755
756 template <class CharT, class Traits>
757 constexpr bool operator>(
758 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
760 {
761 return lhs.compare(rhs) > 0;
762 }
763
764 // operator <=
765 template <class CharT, class Traits>
766 constexpr bool operator<=(
769 {
770 return lhs.compare(rhs) <= 0;
771 }
772
773 template <class CharT, class Traits>
774 constexpr bool operator<=(
776 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
777 {
778 return lhs.compare(rhs) <= 0;
779 }
780
781 template <class CharT, class Traits>
782 constexpr bool operator<=(
783 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
785 {
786 return lhs.compare(rhs) <= 0;
787 }
788
789 // operator >=
790 template <class CharT, class Traits>
791 constexpr bool operator>=(
794 {
795 return lhs.compare(rhs) >= 0;
796 }
797
798 template <class CharT, class Traits>
799 constexpr bool operator>=(
801 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
802 {
803 return lhs.compare(rhs) >= 0;
804 }
805
806 template <class CharT, class Traits>
807 constexpr bool operator>=(
808 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
810 {
811 return lhs.compare(rhs) >= 0;
812 }
813
818
819 inline namespace literals
820 {
821 inline namespace string_view_literals
822 {
823#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ <= 8)
824/* On GCC <= 4.8, use old syntax for literal operator (with space after ""). It can't do the modern syntax */
825# define OPERATOR_LITERAL_SV operator"" _sv
826#else
827/* else use modern syntax (no space after "") to avoid -Wdeprecated-literal-operator warning on Clang 16+ */
828# define OPERATOR_LITERAL_SV operator""_sv
829#endif
830
831 inline basic_string_view<char> OPERATOR_LITERAL_SV(const char *s, size_t length) noexcept
832 {
833 return basic_string_view<char>(s, length);
834 }
835
836 inline basic_string_view<wchar_t> OPERATOR_LITERAL_SV(const wchar_t *s, size_t length) noexcept
837 {
838 return basic_string_view<wchar_t>(s, length);
839 }
840
841 inline basic_string_view<char16_t> OPERATOR_LITERAL_SV(const char16_t *s, size_t length) noexcept
842 {
843 return basic_string_view<char16_t>(s, length);
844 }
845
846 inline basic_string_view<char32_t> OPERATOR_LITERAL_SV(const char32_t *s, size_t length) noexcept
847 {
848 return basic_string_view<char32_t>(s, length);
849 }
850
851#undef OPERATOR_LITERAL_SV
852 } // namespace string_view_literals
853
854 } // namespace literals
855
857 } // namespace Crt
858} // namespace Aws
859
860// hash
861namespace std
862{
863 template <class CharT, class Traits> struct hash<Aws::Crt::basic_string_view<CharT, Traits>>
864 {
865 size_t operator()(const Aws::Crt::basic_string_view<CharT, Traits> &val) const noexcept;
866 };
867
868 template <class CharT, class Traits>
869 size_t hash<Aws::Crt::basic_string_view<CharT, Traits>>::operator()(
870 const Aws::Crt::basic_string_view<CharT, Traits> &val) const noexcept
871 {
872 auto str = std::basic_string<CharT, Traits>(val.data(), val.size());
873 return std::hash<std::basic_string<CharT, Traits>>{}(str);
874 }
875} // namespace std
#define OPERATOR_LITERAL_SV
Definition StringView.h:828
Definition StringView.h:33
constexpr const_iterator begin() const noexcept
Definition StringView.h:77
constexpr size_type find(const CharT *s, size_type pos=0) const noexcept
Definition StringView.h:273
constexpr size_type rfind(const CharT *s, size_type pos=npos) const noexcept
Definition StringView.h:337
size_type find(CharT c, size_type pos=0) const noexcept
Definition StringView.h:233
size_type find_first_not_of(CharT c, size_type pos=0) const noexcept
Definition StringView.h:423
constexpr int compare(size_type pos1, size_type n1, const CharT *s) const
Definition StringView.h:190
constexpr basic_string_view(const basic_string_view &) noexcept=default
constexpr int compare(size_type pos1, size_type n1, const basic_string_view &s) const
Definition StringView.h:173
constexpr int compare(size_type pos1, size_type n1, const CharT *s, size_type n2) const noexcept(false)
Definition StringView.h:195
constexpr const_iterator end() const noexcept
Definition StringView.h:79
value_type * pointer
Definition StringView.h:38
Traits traits_type
Definition StringView.h:36
constexpr basic_string_view(const CharT *s, size_type count) noexcept
Definition StringView.h:58
void remove_suffix(size_type n) noexcept
Definition StringView.h:137
constexpr size_type find(const basic_string_view &s, size_type pos=0) const noexcept
Definition StringView.h:228
constexpr size_type find_first_of(basic_string_view s, size_type pos=0) const noexcept
Definition StringView.h:342
constexpr const_iterator cbegin() const noexcept
Definition StringView.h:81
const_reference front() const noexcept
Definition StringView.h:115
size_type copy(CharT *s, size_type n, size_type pos=0) const
Definition StringView.h:147
constexpr const_reverse_iterator rend() const noexcept
Definition StringView.h:87
size_type find_last_of(const CharT *s, size_type pos, size_type n) const noexcept
Definition StringView.h:381
const_reference operator[](size_type pos) const noexcept
Definition StringView.h:103
constexpr size_type find_last_of(basic_string_view s, size_type pos=npos) const noexcept
Definition StringView.h:371
constexpr const_reverse_iterator crbegin() const noexcept
Definition StringView.h:89
ptrdiff_t difference_type
Definition StringView.h:47
size_t size_type
Definition StringView.h:46
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition StringView.h:44
constexpr const_reverse_iterator crend() const noexcept
Definition StringView.h:91
constexpr bool ends_with(const CharT *s) const noexcept
Definition StringView.h:225
value_type & reference
Definition StringView.h:40
size_type find_first_not_of(const CharT *s, size_type pos, size_type n) const noexcept
Definition StringView.h:442
size_type rfind(const CharT *s, size_type pos, size_type n) const noexcept
Definition StringView.h:313
constexpr size_type find_first_not_of(const CharT *s, size_type pos=0) const noexcept
Definition StringView.h:466
constexpr const_iterator cend() const noexcept
Definition StringView.h:83
const_reference at(size_type pos) const
Definition StringView.h:109
static constexpr size_type npos
Definition StringView.h:48
constexpr bool empty() const noexcept
Definition StringView.h:99
constexpr size_type size() const noexcept
Definition StringView.h:93
constexpr basic_string_view(const CharT *s) noexcept
Definition StringView.h:56
const_reverse_iterator reverse_iterator
Definition StringView.h:45
size_type find_last_not_of(CharT c, size_type pos=npos) const noexcept
Definition StringView.h:480
basic_string_view & operator=(const basic_string_view &) noexcept=default
constexpr bool ends_with(const basic_string_view &other) const noexcept
Definition StringView.h:215
constexpr bool starts_with(const CharT *s) const noexcept
Definition StringView.h:210
size_type find(const CharT *s, size_type pos, size_type n) const noexcept
Definition StringView.h:247
size_type find_last_not_of(const CharT *s, size_type pos, size_type n) const noexcept
Definition StringView.h:501
void remove_prefix(size_type n) noexcept
Definition StringView.h:130
size_type find_last_not_of(basic_string_view s, size_type pos=npos) const noexcept
Definition StringView.h:471
size_type find_first_not_of(basic_string_view s, size_type pos=0) const noexcept
Definition StringView.h:414
basic_string_view substr(size_type pos=0, size_type n=npos) const noexcept(false)
Definition StringView.h:155
size_type rfind(basic_string_view s, size_type pos=npos) const noexcept
Definition StringView.h:278
int compare(const basic_string_view &s) const noexcept
Definition StringView.h:162
constexpr bool ends_with(CharT c) const noexcept
Definition StringView.h:220
constexpr int compare(size_type pos1, size_type n1, const basic_string_view &s, size_type pos2, size_type n2) const
Definition StringView.h:178
const_iterator iterator
Definition StringView.h:43
constexpr size_type find_last_of(const CharT *s, size_type pos=npos) const noexcept
Definition StringView.h:409
constexpr const_reverse_iterator rbegin() const noexcept
Definition StringView.h:85
constexpr size_type max_size() const noexcept
Definition StringView.h:97
constexpr size_type find_last_of(CharT c, size_type pos=npos) const noexcept
Definition StringView.h:376
constexpr size_type find_first_of(const CharT *s, size_type pos=0) const noexcept
Definition StringView.h:366
size_type rfind(CharT c, size_type pos=npos) const noexcept
Definition StringView.h:287
const value_type & const_reference
Definition StringView.h:41
constexpr bool starts_with(CharT c) const noexcept
Definition StringView.h:205
const value_type * const_pointer
Definition StringView.h:39
constexpr size_type find_last_not_of(const CharT *s, size_type pos=npos) const noexcept
Definition StringView.h:527
const value_type * const_iterator
Definition StringView.h:42
constexpr basic_string_view() noexcept
Definition StringView.h:52
CharT value_type
Definition StringView.h:37
constexpr size_type find_first_of(CharT c, size_type pos=0) const noexcept
Definition StringView.h:347
const_reference back() const noexcept
Definition StringView.h:121
constexpr const_pointer data() const noexcept
Definition StringView.h:127
constexpr size_type length() const noexcept
Definition StringView.h:95
constexpr int compare(const CharT *s) const noexcept
Definition StringView.h:188
void swap(basic_string_view &other) noexcept
Definition StringView.h:139
constexpr bool starts_with(const basic_string_view &other) const noexcept
Definition StringView.h:200
size_type find_first_of(const CharT *s, size_type pos, size_type n) const noexcept
Definition StringView.h:349
basic_string_view< char32_t > u32string_view
Definition StringView.h:816
basic_string_view< char > string_view
Definition StringView.h:814
constexpr bool operator<=(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition StringView.h:766
bool operator<(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition StringView.h:716
constexpr bool operator>=(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition StringView.h:791
constexpr bool operator>(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition StringView.h:741
basic_string_view< wchar_t > wstring_view
Definition StringView.h:817
std::unique_ptr< T, std::function< void(T *)> > ScopedResource
Definition Types.h:163
basic_string_view< char16_t > u16string_view
Definition StringView.h:815
bool operator==(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition StringView.h:666
bool operator!=(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition StringView.h:691
Definition Allocator.h:11
Definition StringView.h:862