tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
basic_inplace_string.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2#ifndef TETL_STRING_BASIC_INPLACE_STRING_HPP
3#define TETL_STRING_BASIC_INPLACE_STRING_HPP
4
11#include <etl/_array/array.hpp>
17#include <etl/_iterator/end.hpp>
27#include <etl/_strings/find.hpp>
32
33namespace etl {
34
40template <typename Char, etl::size_t Capacity, typename Traits = etl::char_traits<Char>>
42 template <typename T>
43 static constexpr bool string_view_like = //
46
47 using internal_size_t = etl::smallest_size_t<Capacity>;
48
49public:
50 using value_type = Char;
53 using traits_type = Traits;
54 using pointer = Char*;
55 using const_pointer = Char const*;
56 using reference = Char&;
57 using const_reference = Char const&;
58 using iterator = Char*;
59 using const_iterator = Char const*;
62
64 constexpr basic_inplace_string() = default;
65
68 constexpr basic_inplace_string(const_pointer str, size_type const len) noexcept
69 {
70 TETL_PRECONDITION(len <= Capacity);
71 unsafe_set_size(len);
72 traits_type::copy(_storage.data(), str, len);
73 }
74
77 constexpr basic_inplace_string(const_pointer str) noexcept
78 : basic_inplace_string(str, traits_type::length(str))
79 {
80 }
81
82 constexpr basic_inplace_string(nullptr_t /*null*/) = delete;
83
86 constexpr basic_inplace_string(size_type count, Char ch) noexcept
87 {
88 TETL_PRECONDITION(count <= Capacity);
89 fill(begin(), begin() + count, ch);
90 unsafe_set_size(count);
91 }
92
95 template <typename InputIt>
96 requires(detail::InputIterator<InputIt>)
97 constexpr basic_inplace_string(InputIt first, InputIt last) noexcept
98 : basic_inplace_string(first, static_cast<size_type>(distance(first, last)))
99 {
100 }
101
104 : basic_inplace_string{other.substr(pos, count)}
105 {
106 }
107
110 : basic_inplace_string{other.substr(pos, other.size())}
111 {
112 }
113
116 template <typename StringView>
118 explicit constexpr basic_inplace_string(StringView const& view) noexcept
119
120 {
122 assign(sv.begin(), sv.end());
123 }
124
127 template <typename StringView>
129 explicit constexpr basic_inplace_string(StringView const& view, size_type pos, size_type n)
130 : basic_inplace_string{basic_string_view<Char, traits_type>{view}.substr(pos, n)}
131 {
132 }
133
135 constexpr basic_inplace_string(basic_inplace_string const& /*str*/) noexcept = default;
136
138 constexpr basic_inplace_string(basic_inplace_string&& /*str*/) noexcept = default;
139
141 constexpr auto operator=(basic_inplace_string const& /*str*/) noexcept -> basic_inplace_string& = default;
142
144 constexpr auto operator=(basic_inplace_string&& /*str*/) noexcept -> basic_inplace_string& = default;
145
148 constexpr auto operator=(const_pointer s) noexcept -> basic_inplace_string&
149 {
150 auto const len = traits_type::length(s);
151 TETL_PRECONDITION(len <= capacity());
152 assign(s, len);
153 return *this;
154 }
155
156 constexpr auto operator=(nullptr_t /*0*/) -> basic_inplace_string& = delete;
157
159 constexpr auto operator=(Char ch) noexcept -> basic_inplace_string&
160 {
161 assign(&ch, 1);
162 return *this;
163 }
164
167 template <typename StringView>
168 requires string_view_like<StringView>
169 constexpr auto operator=(StringView const& view) noexcept -> basic_inplace_string&
170 {
171 assign(view);
172 return *this;
173 }
174
176 constexpr auto assign(size_type count, Char ch) noexcept -> basic_inplace_string&
177 {
179 (*this) = basic_inplace_string{count, ch};
180 return *this;
181 }
182
184 constexpr auto assign(basic_inplace_string const& str) noexcept -> basic_inplace_string&
185 {
186 *this = str;
187 return *this;
188 }
189
192 constexpr auto assign(basic_inplace_string const& str, size_type pos, size_type count = npos) noexcept
194 {
195 *this = str.substr(pos, count);
196 return *this;
197 }
198
202 {
204 *this = basic_inplace_string{s, count};
205 return *this;
206 }
207
210 constexpr auto assign(const_pointer s) noexcept -> basic_inplace_string&
211 {
212 *this = basic_inplace_string{s, traits_type::length(s)};
213 return *this;
214 }
215
218 template <typename InputIt>
219 requires(detail::InputIterator<InputIt>)
220 constexpr auto assign(InputIt first, InputIt last) noexcept -> basic_inplace_string&
221 {
222 *this = basic_inplace_string{first, last};
223 return *this;
224 }
225
228 template <typename StringView>
229 requires string_view_like<StringView>
230 constexpr auto assign(StringView const& view) noexcept -> basic_inplace_string&
231 {
232 auto tmp = basic_inplace_string{view};
233 *this = tmp;
234 return *this;
235 }
236
240 template <typename StringView>
241 requires string_view_like<StringView>
242 constexpr auto assign(StringView const& view, size_type pos, size_type count = npos) noexcept
244 {
245 auto tmp = basic_inplace_string{view, pos, count};
246 *this = tmp;
247 return *this;
248 }
249
251 constexpr auto operator[](size_type index) noexcept -> reference { return unsafe_at(index); }
252
254 constexpr auto operator[](size_type index) const noexcept -> const_reference { return unsafe_at(index); }
255
257 constexpr auto begin() noexcept -> iterator { return data(); }
258
260 [[nodiscard]] constexpr auto begin() const noexcept -> const_iterator { return data(); }
261
263 [[nodiscard]] constexpr auto cbegin() const noexcept -> const_iterator { return begin(); }
264
266 constexpr auto end() noexcept -> iterator { return etl::next(begin(), static_cast<ptrdiff_t>(size())); }
267
269 [[nodiscard]] constexpr auto end() const noexcept -> const_iterator
270 {
271 return etl::next(begin(), static_cast<ptrdiff_t>(size()));
272 }
273
275 [[nodiscard]] constexpr auto cend() const noexcept -> const_iterator { return end(); }
276
279 [[nodiscard]] constexpr auto rbegin() noexcept -> reverse_iterator { return reverse_iterator(end()); }
280
283 [[nodiscard]] constexpr auto rbegin() const noexcept -> const_reverse_iterator
284 {
285 return const_reverse_iterator(end());
286 }
287
290 [[nodiscard]] constexpr auto crbegin() const noexcept -> const_reverse_iterator { return rbegin(); }
291
294 [[nodiscard]] constexpr auto rend() noexcept -> reverse_iterator { return reverse_iterator(begin()); }
295
298 [[nodiscard]] constexpr auto rend() const noexcept -> const_reverse_iterator
299 {
301 }
302
305 [[nodiscard]] constexpr auto crend() const noexcept -> const_reverse_iterator { return rend(); }
306
308 [[nodiscard]] constexpr auto front() noexcept -> reference
309 {
311 return *begin();
312 }
313
315 [[nodiscard]] constexpr auto front() const noexcept -> const_reference
316 {
318 return *begin();
319 }
320
322 [[nodiscard]] constexpr auto back() noexcept -> reference
323 {
325 return *etl::prev(end());
326 }
327
329 [[nodiscard]] constexpr auto back() const noexcept -> const_reference
330 {
332 return *etl::prev(end());
333 }
334
336 [[nodiscard]] constexpr auto empty() const noexcept -> bool { return size() == 0; }
337
339 [[nodiscard]] constexpr auto full() const noexcept -> bool { return size() == capacity(); }
340
342 [[nodiscard]] constexpr auto size() const noexcept -> size_type { return _storage.get_size(); }
343
345 [[nodiscard]] constexpr auto length() const noexcept -> size_type { return size(); }
346
349 [[nodiscard]] constexpr auto capacity() const noexcept -> size_type { return Capacity; }
350
353 [[nodiscard]] constexpr auto max_size() const noexcept -> size_type { return Capacity; }
354
356 static constexpr auto reserve(size_type /*newCap*/) -> void { }
357
359 static constexpr auto shrink_to_fit() -> void { }
360
367 [[nodiscard]] constexpr auto data() noexcept -> pointer { return _storage.data(); }
368
375 [[nodiscard]] constexpr auto data() const noexcept -> const_pointer { return _storage.data(); }
376
383 [[nodiscard]] constexpr auto c_str() const noexcept -> const_pointer { return data(); }
384
386 [[nodiscard]] constexpr operator basic_string_view<Char, traits_type>() const noexcept
387 {
389 }
390
393 constexpr auto clear() noexcept -> void
394 {
395 *begin() = Char(0);
396 unsafe_set_size(0);
397 }
398
402 constexpr auto erase(size_type index = 0, size_type count = npos) noexcept -> basic_inplace_string&
403 {
404 auto safeCount = etl::min(count, size() - index);
405 erase(begin() + index, begin() + index + safeCount);
406 return *this;
407 }
408
413 constexpr auto erase(const_iterator position) noexcept -> iterator { return erase(position, position + 1); }
414
419 constexpr auto erase(const_iterator first, const_iterator last) noexcept -> iterator
420 {
421 auto const start = static_cast<size_type>(etl::distance(cbegin(), first));
422 auto const distance = static_cast<size_type>(etl::distance(first, last));
424 etl::rotate(begin() + start, begin() + start + distance, end());
425 unsafe_set_size(size() - distance);
426 return begin() + start;
427 }
428
431 constexpr auto push_back(Char ch) noexcept -> void
432 {
434 append(1, ch);
435 }
436
439 constexpr auto pop_back() noexcept -> void
440 {
442 unsafe_set_size(size() - 1);
443 }
444
446 constexpr auto append(size_type const count, Char const s) noexcept -> basic_inplace_string&
447 {
448 auto const safeCount = etl::min(count, capacity() - size());
449 auto const newSize = size() + safeCount;
450 etl::fill(end(), etl::next(begin(), static_cast<ptrdiff_t>(newSize)), s);
451 unsafe_set_size(newSize);
452 return *this;
453 }
454
457 constexpr auto append(const_pointer s) noexcept -> basic_inplace_string&
458 {
459 auto const len = traits_type::length(s);
460 return append(s, len);
461 }
462
465 constexpr auto append(const_pointer str, size_type count) noexcept -> basic_inplace_string&
466 {
467 auto const safeCount = etl::min(count, capacity() - size());
468 etl::copy(str, etl::next(str, static_cast<ptrdiff_t>(safeCount)), end());
469 unsafe_set_size(size() + safeCount);
470 return *this;
471 }
472
474 template <typename InputIt>
475 requires(detail::InputIterator<InputIt>)
476 constexpr auto append(InputIt first, InputIt last) noexcept -> basic_inplace_string&
477 {
478 for (; first != last; ++first) {
479 push_back(*first);
480 }
481 return *this;
482 }
483
485 constexpr auto append(basic_inplace_string const& str) noexcept -> basic_inplace_string&
486 {
487 return append(str.begin(), str.end());
488 }
489
491 constexpr auto append(basic_inplace_string const& str, size_type pos, size_type count = npos) noexcept
493 {
494 return append(str.substr(pos, count));
495 }
496
499 template <typename StringView>
500 requires string_view_like<StringView>
501 constexpr auto append(StringView const& view) -> basic_inplace_string&
502 {
504 return append(sv.data(), sv.size());
505 }
506
509 template <typename StringView>
510 requires string_view_like<StringView>
511 constexpr auto append(StringView const& view, size_type pos, size_type count = npos) -> basic_inplace_string&
512 {
514 return append(sv.substr(pos, count));
515 }
516
518 constexpr auto operator+=(basic_inplace_string const& str) noexcept -> basic_inplace_string& { return append(str); }
519
521 constexpr auto operator+=(Char ch) noexcept -> basic_inplace_string& { return append(1, ch); }
522
524 constexpr auto operator+=(const_pointer s) noexcept -> basic_inplace_string& { return append(s); }
525
528 template <typename StringView>
529 requires string_view_like<StringView>
530 constexpr auto operator+=(StringView const& view) noexcept -> basic_inplace_string&
531 {
532 return append(view);
533 }
534
536 constexpr auto insert(size_type const index, size_type const count, Char const ch) noexcept -> basic_inplace_string&
537 {
538 for (size_type i = 0; i < count; ++i) {
539 insert_impl(begin() + index, &ch, 1);
540 }
541 return *this;
542 }
543
546 constexpr auto insert(size_type const index, const_pointer s) noexcept -> basic_inplace_string&
547 {
548 insert_impl(begin() + index, s, traits_type::length(s));
549 return *this;
550 }
551
554 constexpr auto insert(size_type const index, const_pointer s, size_type const count) noexcept
556 {
557 insert_impl(begin() + index, s, count);
558 return *this;
559 }
560
562 constexpr auto insert(size_type const index, basic_inplace_string const& str) noexcept -> basic_inplace_string&
563 {
564 insert_impl(begin() + index, str.data(), str.size());
565 return *this;
566 }
567
570 constexpr auto insert(
571 size_type const index,
572 basic_inplace_string const& str,
573 size_type const indexStr,
574 size_type const count = npos
575 ) noexcept -> basic_inplace_string&
576 {
577 using view_type = basic_string_view<Char, traits_type>;
578 auto sv = view_type(str).substr(indexStr, count);
579 insert_impl(begin() + index, sv.data(), sv.size());
580 return *this;
581 }
582
583 //
584 // * \brief Inserts character ch before the character pointed by pos.
585 // constexpr auto insert(const_iterator pos, Char const ch) noexcept
586 // -> iterator
587 // {
588 // }
589
590 //
591 // * \brief Inserts count copies of character ch before the element (if
592 // any) pointed by
593 // * pos.
594 // constexpr auto insert(const_iterator pos, size_type count,
595 // Char const ch) noexcept -> iterator
596 // {
597 // }
598
599 //
600 // * \brief Inserts characters from the range [first, last) before the
601 // element (if any)
602 // * pointed by pos.
603 // template <typename InputIter>
604 // requires(detail::InputIterator<T>)
605 // constexpr auto insert(const_iterator pos, InputIter first, InputIter
606 // last) noexcept
607 // -> iterator
608 // {
609 // }
610
613 template <typename StringView>
614 requires string_view_like<StringView>
615 constexpr auto insert(size_type const pos, StringView const& view) noexcept -> basic_inplace_string&
616 {
618 insert_impl(begin() + pos, sv.data(), sv.size());
619 return *this;
620 }
621
625 template <typename StringView>
626 requires string_view_like<StringView>
627 constexpr auto
628 insert(size_type const index, StringView const& view, size_type const indexStr, size_type const count = npos)
629 noexcept -> basic_inplace_string&
630 {
632
633 auto sub = sv.substr(indexStr, count);
634 insert_impl(begin() + index, sub.data(), sub.size());
635 return *this;
636 }
637
639 [[nodiscard]] constexpr auto compare(basic_inplace_string const& str) const noexcept -> int
640 {
641 return basic_string_view<Char, Traits>{*this}.compare({str.data(), str.size()});
642 }
643
645 template <size_type OtherCapacity>
647 ) const noexcept -> int
648 {
649 return basic_string_view<Char, Traits>{*this}.compare({str.data(), str.size()});
650 }
651
654 [[nodiscard]] constexpr auto
655 compare(size_type const pos, size_type const count, basic_inplace_string const& str) const -> int
656 {
657 auto const sz = count > size() - pos ? size() : count;
658 auto const sub = basic_string_view<Char, Traits>(*this).substr(pos, sz);
659 return sub.compare(str);
660 }
661
666 [[nodiscard]] constexpr auto compare(
667 size_type const pos1,
668 size_type const count1,
669 basic_inplace_string const& str,
670 size_type const pos2,
671 size_type const count2 = npos
672 ) const -> int
673 {
674 auto const sz1 = count1 > size() - pos1 ? size() : count1;
675 auto const sub1 = basic_string_view<Char, Traits>(*this).substr(pos1, sz1);
676
677 auto const sz2 = count2 > str.size() - pos2 ? size() : count2;
678 auto const sub2 = basic_string_view<Char, Traits>(str).substr(pos2, sz2);
679
680 return sub1.compare(sub2);
681 }
682
686 [[nodiscard]] constexpr auto compare(const_pointer s) const -> int
687 {
688 return basic_string_view<Char, Traits>{*this}.compare({s, traits_type::length(s)});
689 }
690
695 [[nodiscard]] constexpr auto compare(size_type const pos, size_type const count, const_pointer s) const -> int
696 {
697 auto const sz = count > size() - pos ? size() : count;
698 auto const sub = basic_string_view<Char, Traits>(*this).substr(pos, sz);
699 return sub.compare({s, traits_type::length(s)});
700 }
701
706 [[nodiscard]] constexpr auto
707 compare(size_type const pos1, size_type const count1, const_pointer s, size_type const count2) const -> int
708 {
709 auto const sz = count1 > size() - pos1 ? size() : count1;
710 auto const sub = basic_string_view<Char, Traits>(*this).substr(pos1, sz);
711 return sub.compare({s, count2});
712 }
713
716 template <typename StringView>
717 requires string_view_like<StringView>
718 [[nodiscard]] constexpr auto compare(StringView const& view) const noexcept -> int
719 {
720 using view_type = basic_string_view<Char, Traits>;
721 view_type const sv = view;
722 return view_type(*this).compare(sv);
723 }
724
727 template <typename StringView>
728 requires string_view_like<StringView>
729 [[nodiscard]] constexpr auto compare(size_type pos1, size_type count1, StringView const& view) const noexcept -> int
730 {
731 using view_type = basic_string_view<Char, Traits>;
732 view_type const sv = view;
733 return view_type(*this).substr(pos1, count1).compare(sv);
734 }
735
739 template <typename StringView>
740 requires string_view_like<StringView>
741 [[nodiscard]] constexpr auto
742 compare(size_type pos1, size_type count1, StringView const& view, size_type pos2, size_type count2 = npos)
743 const noexcept -> int
744 {
745 using view_type = basic_string_view<Char, Traits>;
746 view_type const sv = view;
747 return view_type(*this).substr(pos1, count1).compare(sv.substr(pos2, count2));
748 }
749
751 [[nodiscard]] constexpr auto starts_with(basic_string_view<Char, Traits> sv) const noexcept -> bool
752 {
754 }
755
757 [[nodiscard]] constexpr auto starts_with(Char c) const noexcept -> bool
758 {
760 }
761
763 [[nodiscard]] constexpr auto starts_with(const_pointer s) const -> bool
764 {
766 }
767
769 [[nodiscard]] constexpr auto ends_with(basic_string_view<Char, Traits> sv) const noexcept -> bool
770 {
772 }
773
775 [[nodiscard]] constexpr auto ends_with(Char c) const noexcept -> bool
776 {
778 }
779
781 [[nodiscard]] constexpr auto ends_with(const_pointer str) const -> bool
782 {
784 }
785
789 {
790 TETL_PRECONDITION(pos < size());
791 TETL_PRECONDITION(pos + count < size());
792
793 auto* f = data() + pos;
794 auto* l = data() + pos + count;
795 detail::str_replace(f, l, str.begin(), str.end());
796 return *this;
797 }
798
801 constexpr auto replace(const_iterator first, const_iterator last, basic_inplace_string const& str)
803 {
804 auto* f = to_mutable_iterator(first);
805 auto* l = to_mutable_iterator(last);
806 detail::str_replace(f, l, str.begin(), str.end());
807 return *this;
808 }
809
810 constexpr auto
813 {
814 TETL_PRECONDITION(pos < size());
815 TETL_PRECONDITION(pos2 < str.size());
816
817 auto* f = data() + etl::min(pos, size());
818 auto* l = data() + etl::min(pos + count, size());
819 auto const* sf = etl::next(str.begin(), static_cast<etl::ptrdiff_t>(etl::min(pos2, str.size())));
820 auto const* sl = etl::next(str.begin(), static_cast<etl::ptrdiff_t>(etl::min(pos2 + count2, str.size())));
821 detail::str_replace(f, l, sf, sl);
822 return *this;
823 }
824
825 constexpr auto replace(size_type pos, size_type count, Char const* str, size_type count2) -> basic_inplace_string&
826 {
827 TETL_PRECONDITION(pos < size());
828 TETL_PRECONDITION(pos + count < size());
829
830 auto* f = next(data(), min(pos, size()));
831 auto* l = next(data(), min(pos + count, size()));
832 detail::str_replace(f, l, str, next(str, count2));
833 return *this;
834 }
835
836 constexpr auto replace(const_iterator first, const_iterator last, Char const* str, size_type count2)
838 {
839 auto* f = to_mutable_iterator(first);
840 auto* l = to_mutable_iterator(last);
841 detail::str_replace(f, l, str, next(str, count2));
842 return *this;
843 }
844
845 constexpr auto replace(size_type pos, size_type count, Char const* str) -> basic_inplace_string&
846 {
847 TETL_PRECONDITION(pos < size());
848 TETL_PRECONDITION(pos + count < size());
849
850 auto* f = next(data(), min(pos, size()));
851 auto* l = next(data(), min(pos + count, size()));
852 detail::str_replace(f, l, str, next(str, strlen(str)));
853 return *this;
854 }
855
856 constexpr auto replace(const_iterator first, const_iterator last, Char const* str) -> basic_inplace_string&
857 {
858 auto* f = to_mutable_iterator(first);
859 auto* l = to_mutable_iterator(last);
860 detail::str_replace(f, l, str, next(str, strlen(str)));
861 return *this;
862 }
863
864 // constexpr auto replace(size_type pos, size_type count, size_type count2,
865 // Char ch) -> basic_inplace_string&
866 //{
867 // TETL_ASSERT(pos < size());
868 // TETL_ASSERT(pos + count < size());
869 //
870 // auto* f = next(data(), min(pos, size()));
871 // auto* l = next(data(), min(pos + count, size()));
872 // detail::str_replace(f, l, ch);
873 // return *this;
874 //}
875
876 constexpr auto replace(const_iterator first, const_iterator last, size_type count2, Char ch)
878 {
879 auto* f = to_mutable_iterator(first);
880 auto* l = etl::min(to_mutable_iterator(last), f + count2);
881 detail::str_replace(f, l, ch);
882 return *this;
883 }
884
890 [[nodiscard]] constexpr auto substr(size_type pos = 0, size_type count = npos) const -> basic_inplace_string
891 {
892 if (pos > size()) {
893 return {};
894 }
895 return basic_inplace_string(data() + pos, etl::min(count, size() - pos));
896 }
897
906 constexpr auto copy(pointer destination, size_type count, size_type pos = 0) const -> size_type
907 {
908 if (pos > size()) {
909 return 0;
910 }
911 auto const* first = data() + pos;
912 auto const* last = first + etl::min(count, size() - pos);
913 auto const* dest = destination;
914 auto const* res = etl::copy(first, last, destination);
915 return static_cast<size_type>(res - dest);
916 }
917
923 constexpr auto resize(size_type count, Char ch) noexcept -> void
924 {
925 if (size() > count) {
926 unsafe_set_size(count);
927 }
928 if (size() < count) {
929 append(count, ch);
930 }
931 }
932
938 constexpr auto resize(size_type count) noexcept -> void { resize(count, Char()); }
939
942 constexpr auto swap(basic_inplace_string& other) noexcept -> void
943 {
944 auto const thisSize = size();
945 auto const maxSize = static_cast<etl::ptrdiff_t>(etl::max(thisSize, other.size()));
946
947 etl::swap_ranges(begin(), etl::next(begin(), maxSize + 1), other.begin()); // includes null-terminator
948 unsafe_set_size(other.size());
949 other.unsafe_set_size(thisSize);
950 }
951
960 [[nodiscard]] constexpr auto find(basic_inplace_string const& str, size_type pos = 0) const noexcept -> size_type
961 {
962 return etl::strings::find<Char, Traits>(*this, str, pos);
963 }
964
973 [[nodiscard]] constexpr auto find(const_pointer s, size_type pos, size_type count) const noexcept -> size_type
974 {
976 }
977
986 [[nodiscard]] constexpr auto find(const_pointer s, size_type pos = 0) const noexcept -> size_type
987 {
988 return etl::strings::find<Char, Traits>(*this, s, pos);
989 }
990
999 [[nodiscard]] constexpr auto find(Char ch, size_type pos = 0) const noexcept -> size_type
1000 {
1002 }
1003
1014 [[nodiscard]] constexpr auto rfind(basic_inplace_string const& str, size_type pos = 0) const noexcept -> size_type
1015 {
1016 return etl::strings::rfind<Char, Traits>(*this, str, pos);
1017 }
1018
1031 [[nodiscard]] constexpr auto rfind(const_pointer s, size_type pos, size_type count) const noexcept -> size_type
1032 {
1033 return etl::strings::rfind<Char, Traits>(*this, s, count, pos);
1034 }
1035
1046 [[nodiscard]] constexpr auto rfind(const_pointer s, size_type pos = 0) const noexcept -> size_type
1047 {
1048 return etl::strings::rfind<Char, Traits>(*this, s, pos);
1049 }
1050
1061 [[nodiscard]] constexpr auto rfind(Char ch, size_type pos = 0) const noexcept -> size_type
1062 {
1063 return etl::strings::rfind<Char, Traits>(*this, ch, pos);
1064 }
1065
1070 [[nodiscard]] constexpr auto find_first_of(basic_inplace_string const& str, size_type pos = 0) const noexcept
1071 -> size_type
1072 {
1073 return find_first_of(str.c_str(), pos, str.size());
1074 }
1075
1080 [[nodiscard]] constexpr auto find_first_of(const_pointer s, size_type pos, size_type count) const -> size_type
1081 {
1082 if (pos < size()) {
1084 }
1085
1086 return npos;
1087 }
1088
1093 [[nodiscard]] constexpr auto find_first_of(const_pointer s, size_type pos = 0) const -> size_type
1094 {
1095 return find_first_of(s, pos, traits_type::length(s));
1096 }
1097
1102 [[nodiscard]] constexpr auto find_first_of(Char ch, size_type pos = 0) const noexcept -> size_type
1103 {
1104 return find_first_of(&ch, pos, 1);
1105 }
1106
1111 [[nodiscard]] constexpr auto
1113 {
1114 return find_first_of(str.data(), pos, str.size());
1115 }
1116
1122 [[nodiscard]] constexpr auto find_first_not_of(basic_inplace_string const& str, size_type pos = 0) const noexcept
1123 -> size_type
1124 {
1125 return basic_string_view<Char, Traits>{*this}.find_first_not_of(str, pos);
1126 }
1127
1133 [[nodiscard]] constexpr auto find_first_not_of(Char ch, size_type pos = 0) const noexcept -> size_type
1134 {
1136 }
1137
1143 [[nodiscard]] constexpr auto find_first_not_of(Char const* s, size_type pos) const -> size_type
1144 {
1146 }
1147
1153 [[nodiscard]] constexpr auto find_first_not_of(Char const* s, size_type pos, size_type count) const -> size_type
1154 {
1156 }
1157
1162 [[nodiscard]] constexpr auto find_last_of(basic_inplace_string const& str, size_type pos = 0) const noexcept
1163 -> size_type
1164 {
1165 return basic_string_view<Char, Traits>{*this}.find_last_of(str, pos);
1166 }
1167
1172 [[nodiscard]] constexpr auto find_last_of(Char c, size_type pos = 0) const noexcept -> size_type
1173 {
1174 return basic_string_view<Char, Traits>{*this}.find_last_of(c, pos);
1175 }
1176
1181 [[nodiscard]] constexpr auto find_last_of(Char const* s, size_type pos, size_type count) const -> size_type
1182 {
1183 return basic_string_view<Char, Traits>{*this}.find_last_of(s, pos, count);
1184 }
1185
1190 [[nodiscard]] constexpr auto find_last_of(Char const* s, size_type pos = 0) const -> size_type
1191 {
1192 return basic_string_view<Char, Traits>{*this}.find_last_of(s, pos);
1193 }
1194
1199 [[nodiscard]] constexpr auto find_last_not_of(basic_inplace_string const& str, size_type pos = 0) const noexcept
1200 -> size_type
1201 {
1202 return basic_string_view<Char, Traits>{*this}.find_last_not_of(str, pos);
1203 }
1204
1209 [[nodiscard]] constexpr auto find_last_not_of(Char c, size_type pos = 0) const noexcept -> size_type
1210 {
1212 }
1213
1218 [[nodiscard]] constexpr auto find_last_not_of(Char const* s, size_type pos, size_type count) const -> size_type
1219 {
1221 }
1222
1227 [[nodiscard]] constexpr auto find_last_not_of(Char const* s, size_type pos = 0) const -> size_type
1228 {
1230 }
1231
1233 [[nodiscard]] constexpr auto contains(etl::basic_string_view<Char, Traits> sv) const noexcept -> bool
1234 {
1235 return basic_string_view<Char, Traits>{*this}.contains(sv);
1236 }
1237
1239 [[nodiscard]] constexpr auto contains(Char c) const noexcept -> bool
1240 {
1242 }
1243
1245 [[nodiscard]] constexpr auto contains(Char const* s) const -> bool
1246 {
1248 }
1249
1256
1257private:
1258 [[nodiscard]] constexpr auto to_mutable_iterator(const_iterator it) -> iterator
1259 {
1260 auto const dist = etl::distance(cbegin(), it);
1261 return etl::next(begin(), static_cast<etl::ptrdiff_t>(dist));
1262 }
1263
1264 [[nodiscard]] constexpr auto unsafe_at(size_type index) noexcept -> reference
1265 {
1266 TETL_PRECONDITION(index < size() + 1);
1267 return *etl::next(_storage.data(), static_cast<etl::ptrdiff_t>(index));
1268 }
1269
1270 [[nodiscard]] constexpr auto unsafe_at(size_type index) const noexcept -> const_reference
1271 {
1272 TETL_PRECONDITION(index < size() + 1);
1273 return *etl::next(_storage.data(), static_cast<etl::ptrdiff_t>(index));
1274 }
1275
1276 constexpr auto unsafe_set_size(size_type const newSize) noexcept -> void
1277 {
1278 TETL_PRECONDITION(newSize <= Capacity);
1279 _storage.set_size(newSize);
1280 unsafe_at(newSize) = Char(0);
1281 }
1282
1283 constexpr auto insert_impl(iterator pos, const_pointer text, size_type count) -> void
1284 {
1285 // Insert text at end.
1286 auto* currentEnd = end();
1287 append(text, count);
1288
1289 // Rotate to correct position
1290 etl::rotate(pos, currentEnd, end());
1291 }
1292
1293 struct tiny_layout {
1294 constexpr tiny_layout() noexcept { _buffer[Capacity] = Capacity; }
1295
1296 [[nodiscard]] constexpr auto data() noexcept { return _buffer.data(); }
1297
1298 [[nodiscard]] constexpr auto data() const noexcept { return _buffer.data(); }
1299
1300 [[nodiscard]] constexpr auto get_size() const noexcept { return Capacity - size_type(_buffer[Capacity]); }
1301
1302 constexpr auto set_size(size_t size) noexcept { return _buffer[Capacity] = Char(Capacity - size); }
1303
1304 private:
1305 etl::array<Char, Capacity + 1> _buffer{};
1306 };
1307
1308 struct normal_layout {
1309 constexpr normal_layout() noexcept = default;
1310
1311 [[nodiscard]] constexpr auto data() noexcept { return _buffer.data(); }
1312
1313 [[nodiscard]] constexpr auto data() const noexcept { return _buffer.data(); }
1314
1315 [[nodiscard]] constexpr auto get_size() const noexcept { return size_t(_size); }
1316
1317 constexpr auto set_size(size_t size) noexcept { return _size = internal_size_t(size); }
1318
1319 private:
1320 internal_size_t _size{};
1321 etl::array<Char, Capacity + 1> _buffer{};
1322 };
1323
1324 using layout_type = etl::conditional_t<(Capacity < 16), tiny_layout, normal_layout>;
1325 layout_type _storage{};
1326};
1327
1329template <etl::size_t Capacity>
1331
1333template <etl::size_t Capacity>
1335
1337template <etl::size_t Capacity>
1339
1341template <etl::size_t Capacity>
1343
1345template <etl::size_t Capacity>
1347
1350template <typename Char, typename Traits, size_t Capacity1, size_t Capacity2>
1351[[nodiscard]] constexpr auto operator+(
1355{
1357 str.append(rhs);
1358 return str;
1359}
1360
1363template <typename Char, typename Traits, size_t Capacity>
1364[[nodiscard]] constexpr auto
1365operator+(basic_inplace_string<Char, Capacity, Traits> const& lhs, Char const* rhs) noexcept
1367{
1369 str.append(rhs);
1370 return str;
1371}
1372
1375template <typename Char, typename Traits, size_t Capacity>
1376[[nodiscard]] constexpr auto operator+(basic_inplace_string<Char, Capacity, Traits> const& lhs, Char rhs) noexcept
1378{
1380 str.append(1, rhs);
1381 return str;
1382}
1383
1386template <typename Char, typename Traits, size_t Capacity>
1387[[nodiscard]] constexpr auto
1388operator+(Char const* lhs, basic_inplace_string<Char, Capacity, Traits> const& rhs) noexcept
1390{
1392 str.append(rhs);
1393 return str;
1394}
1395
1398template <typename Char, typename Traits, size_t Capacity>
1399[[nodiscard]] constexpr auto operator+(Char lhs, basic_inplace_string<Char, Capacity, Traits> const& rhs) noexcept
1401{
1403 str.append(rhs);
1404 return str;
1405}
1406
1412template <typename Char, typename Traits, etl::size_t Capacity1, etl::size_t Capacity2>
1413[[nodiscard]] constexpr auto operator==(
1416) noexcept -> bool
1417{
1418 return lhs.compare(rhs) == 0;
1419}
1420
1426template <typename Char, typename Traits, etl::size_t Capacity>
1427[[nodiscard]] constexpr auto
1428operator==(etl::basic_inplace_string<Char, Capacity, Traits> const& lhs, Char const* rhs) noexcept -> bool
1429{
1430 return lhs.compare(rhs) == 0;
1431}
1432
1438template <typename Char, typename Traits, etl::size_t Capacity>
1439[[nodiscard]] constexpr auto
1440operator==(Char const* lhs, etl::basic_inplace_string<Char, Capacity, Traits> const& rhs) noexcept -> bool
1441{
1442 return rhs.compare(lhs) == 0;
1443}
1444
1450template <typename Char, typename Traits, etl::size_t Capacity1, etl::size_t Capacity2>
1451[[nodiscard]] constexpr auto operator!=(
1454) noexcept -> bool
1455{
1456 return lhs.compare(rhs) != 0;
1457}
1458
1464template <typename Char, typename Traits, etl::size_t Capacity1>
1465[[nodiscard]] constexpr auto
1466operator!=(etl::basic_inplace_string<Char, Capacity1, Traits> const& lhs, Char const* rhs) noexcept -> bool
1467{
1468 return lhs.compare(rhs) != 0;
1469}
1470
1476template <typename Char, typename Traits, etl::size_t Capacity>
1477[[nodiscard]] constexpr auto
1478operator!=(Char const* lhs, etl::basic_inplace_string<Char, Capacity, Traits> const& rhs) noexcept -> bool
1479{
1480 return rhs.compare(lhs) != 0;
1481}
1482
1487template <typename Char, typename Traits, etl::size_t Capacity1, etl::size_t Capacity2>
1488[[nodiscard]] constexpr auto operator<(
1491) noexcept
1492{
1493 return lhs.compare(rhs) < 0;
1494}
1495
1500template <typename Char, typename Traits, etl::size_t Capacity1>
1501[[nodiscard]] constexpr auto
1502operator<(etl::basic_inplace_string<Char, Capacity1, Traits> const& lhs, Char const* rhs) noexcept -> bool
1503{
1504 return lhs.compare(rhs) < 0;
1505}
1506
1511template <typename Char, typename Traits, etl::size_t Capacity1>
1512[[nodiscard]] constexpr auto
1513operator<(Char const* lhs, etl::basic_inplace_string<Char, Capacity1, Traits> const& rhs) noexcept -> bool
1514{
1515 return rhs.compare(lhs) > 0;
1516}
1517
1522template <typename Char, typename Traits, etl::size_t Capacity1, etl::size_t Capacity2>
1523[[nodiscard]] constexpr auto operator<=(
1526) noexcept
1527{
1528 return lhs.compare(rhs) <= 0;
1529}
1530
1535template <typename Char, typename Traits, etl::size_t Capacity1>
1536[[nodiscard]] constexpr auto
1537operator<=(etl::basic_inplace_string<Char, Capacity1, Traits> const& lhs, Char const* rhs) noexcept -> bool
1538{
1539 return lhs.compare(rhs) <= 0;
1540}
1541
1546template <typename Char, typename Traits, etl::size_t Capacity1>
1547[[nodiscard]] constexpr auto
1548operator<=(Char const* lhs, etl::basic_inplace_string<Char, Capacity1, Traits> const& rhs) noexcept -> bool
1549{
1550 return rhs.compare(lhs) >= 0;
1551}
1552
1557template <typename Char, typename Traits, etl::size_t Capacity1, etl::size_t Capacity2>
1558[[nodiscard]] constexpr auto operator>(
1561) noexcept
1562{
1563 return lhs.compare(rhs) > 0;
1564}
1565
1570template <typename Char, typename Traits, etl::size_t Capacity1>
1571[[nodiscard]] constexpr auto
1572operator>(etl::basic_inplace_string<Char, Capacity1, Traits> const& lhs, Char const* rhs) noexcept -> bool
1573{
1574 return lhs.compare(rhs) > 0;
1575}
1576
1581template <typename Char, typename Traits, etl::size_t Capacity1>
1582[[nodiscard]] constexpr auto
1583operator>(Char const* lhs, etl::basic_inplace_string<Char, Capacity1, Traits> const& rhs) noexcept -> bool
1584{
1585 return rhs.compare(lhs) < 0;
1586}
1587
1592template <typename Char, typename Traits, etl::size_t Capacity1, etl::size_t Capacity2>
1593[[nodiscard]] constexpr auto operator>=(
1596) noexcept
1597{
1598 return lhs.compare(rhs) >= 0;
1599}
1600
1605template <typename Char, typename Traits, etl::size_t Capacity>
1606[[nodiscard]] constexpr auto
1607operator>=(etl::basic_inplace_string<Char, Capacity, Traits> const& lhs, Char const* rhs) noexcept -> bool
1608{
1609 return lhs.compare(rhs) >= 0;
1610}
1611
1616template <typename Char, typename Traits, etl::size_t Capacity>
1617[[nodiscard]] constexpr auto
1618operator>=(Char const* lhs, etl::basic_inplace_string<Char, Capacity, Traits> const& rhs) noexcept -> bool
1619{
1620 return rhs.compare(lhs) <= 0;
1621}
1622
1625template <typename Char, typename Traits, etl::size_t Capacity>
1626constexpr auto
1628 noexcept(noexcept(lhs.swap(rhs))) -> void
1629{
1630 lhs.swap(rhs);
1631}
1632
1634template <typename Char, typename Traits, etl::size_t Capacity, typename U>
1635constexpr auto erase(basic_inplace_string<Char, Capacity, Traits>& c, U const& value) noexcept ->
1637{
1639
1640 auto it = etl::remove(begin(c), end(c), value);
1641 auto r = etl::distance(it, end(c));
1642 c.erase(it, end(c));
1643 return static_cast<return_type>(r);
1644}
1645
1648template <typename Char, typename Traits, etl::size_t Capacity, typename Predicate>
1649constexpr auto erase_if(basic_inplace_string<Char, Capacity, Traits>& c, Predicate pred) noexcept ->
1651{
1653
1654 auto it = etl::remove_if(begin(c), end(c), pred);
1655 auto r = etl::distance(it, end(c));
1656 c.erase(it, end(c));
1657 return static_cast<return_type>(r);
1658}
1659
1660} // namespace etl
1661
1662#endif // TETL_STRING_BASIC_INPLACE_STRING_HPP
#define TETL_PRECONDITION(...)
Definition check.hpp:16
constexpr auto remove(ForwardIt first, ForwardIt last, T const &value) -> ForwardIt
Removes all elements satisfying specific criteria from the range [first, last) and returns a past-the...
Definition remove.hpp:15
constexpr auto remove_if(ForwardIt first, ForwardIt last, Predicate pred) -> ForwardIt
Removes all elements satisfying specific criteria from the range [first, last) and returns a past-the...
Definition remove_if.hpp:16
constexpr auto min(Type const &a, Type const &b, Compare comp) noexcept -> Type const &
Returns the smaller of a and b, using a compare function.
Definition min.hpp:13
constexpr auto rotate(ForwardIt first, ForwardIt nFirst, ForwardIt last) -> ForwardIt
Performs a left rotation on a range of elements.
Definition rotate.hpp:17
constexpr auto copy(InputIt first, InputIt last, OutputIt destination) -> OutputIt
Copies the elements in the range, defined by [first, last), to another range beginning at destination...
Definition copy.hpp:18
constexpr auto swap_ranges(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2) -> ForwardIt2
Exchanges elements between range [first1 ,last1) and another range starting at first2.
Definition swap_ranges.hpp:24
constexpr auto find_first_of(InputIt first, InputIt last, ForwardIt sFirst, ForwardIt sLast, Predicate pred) -> InputIt
Searches the range [first, last) for any of the elements in the range [sFirst, sLast)....
Definition find_first_of.hpp:26
constexpr auto max(Type const &a, Type const &b, Compare comp) noexcept -> Type const &
Returns the greater of a and b, using a compare function.
Definition max.hpp:13
constexpr auto count(InputIt first, InputIt last, T const &value) -> typename iterator_traits< InputIt >::difference_type
Returns the number of elements in the range [first, last) satisfying specific criteria....
Definition count.hpp:21
constexpr auto fill(ForwardIt first, ForwardIt last, T const &value) -> void
Assigns the given value to the elements in the range [first, last).
Definition fill.hpp:11
constexpr auto strlen(char const *str) -> etl::size_t
Returns the length of the C string str.
Definition strlen.hpp:13
constexpr auto empty(C const &c) noexcept(noexcept(c.empty())) -> decltype(c.empty())
Returns whether the given container is empty.
Definition empty.hpp:15
constexpr auto prev(BidirIt it, typename iterator_traits< BidirIt >::difference_type n=1) -> BidirIt
Return the nth predecessor of iterator it.
Definition prev.hpp:14
constexpr auto end(C &c) -> decltype(c.end())
Returns an iterator to the end (i.e. the element after the last element) of the given container c or ...
Definition end.hpp:14
constexpr auto rend(Container &c) -> decltype(c.rend())
Returns an iterator to the reverse-end of the given container.
Definition rend.hpp:16
constexpr auto next(InputIt it, typename iterator_traits< InputIt >::difference_type n=1) -> InputIt
Return the nth successor of iterator it.
Definition next.hpp:14
constexpr auto cbegin(C const &c) noexcept(noexcept(begin(c))) -> decltype(begin(c))
Definition begin.hpp:41
constexpr auto distance(It first, It last) -> typename iterator_traits< It >::difference_type
Returns the number of hops from first to last.
Definition distance.hpp:16
constexpr auto data(C &c) noexcept(noexcept(c.data())) -> decltype(c.data())
Returns a pointer to the block of memory containing the elements of the container.
Definition data.hpp:11
constexpr auto size(C const &c) noexcept(noexcept(c.size())) -> decltype(c.size())
Returns the size of the given container c or array array. Returns c.size(), converted to the return t...
Definition size.hpp:18
constexpr auto begin(C &c) -> decltype(c.begin())
Returns an iterator to the beginning of the given container c or array array. These templates rely on...
Definition begin.hpp:20
constexpr auto rbegin(Container &c) -> decltype(c.rbegin())
Returns an iterator to the reverse-beginning of the given container.
Definition rbegin.hpp:16
conditional_t<(N< static_cast< unsigned char >(-1)), unsigned char, conditional_t<(N< static_cast< unsigned short >(-1)), unsigned short, conditional_t<(N< static_cast< unsigned int >(-1)), unsigned int, conditional_t<(N< static_cast< unsigned long >(-1)), unsigned long, unsigned long long > > > > smallest_size_t
Smallest unsigned integer type that can represent values in the range [0, N].
Definition smallest_size_t.hpp:13
constexpr auto find(basic_string_view< Char, Traits > haystack, basic_string_view< Char, Traits > needle, typename basic_string_view< Char, Traits >::size_type pos=0) noexcept -> typename basic_string_view< Char, Traits >::size_type
Definition find.hpp:11
constexpr auto rfind(basic_string_view< CharT, Traits > haystack, CharT character, typename basic_string_view< CharT, Traits >::size_type pos) noexcept -> typename basic_string_view< CharT, Traits >::size_type
Definition rfind.hpp:12
Definition adjacent_find.hpp:8
constexpr auto operator==(inplace_function< R(Args...), Capacity, Alignment > const &f, nullptr_t) noexcept -> bool
Compares a etl::inplace_function with a null pointer. Empty functions (that is, functions without a c...
Definition inplace_function.hpp:262
typename conditional< B, T, F >::type conditional_t
Definition conditional.hpp:21
basic_inplace_string< char8_t, Capacity > inplace_u8string
Typedef for a basic_inplace_string using 'char8_t'.
Definition basic_inplace_string.hpp:1338
constexpr auto operator!=(inplace_function< R(Args...), Capacity, Alignment > const &f, nullptr_t) noexcept -> bool
Compares a etl::inplace_function with a null pointer. Empty functions (that is, functions without a c...
Definition inplace_function.hpp:272
basic_inplace_string< char32_t, Capacity > inplace_u32string
Typedef for a basic_inplace_string using 'char32_t'.
Definition basic_inplace_string.hpp:1346
basic_inplace_string< char16_t, Capacity > inplace_u16string
Typedef for a basic_inplace_string using 'char16_t'.
Definition basic_inplace_string.hpp:1342
constexpr auto operator<(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:167
constexpr auto operator+(complex< T > const &val) -> complex< T >
Definition complex.hpp:256
constexpr auto erase(basic_inplace_string< Char, Capacity, Traits > &c, U const &value) noexcept -> typename basic_inplace_string< Char, Capacity, Traits >::size_type
Erases all elements that compare equal to value from the container.
Definition basic_inplace_string.hpp:1635
basic_inplace_string< wchar_t, Capacity > inplace_wstring
Typedef for a basic_inplace_string using 'wchar_t'.
Definition basic_inplace_string.hpp:1334
TETL_BUILTIN_PTRDIFF ptrdiff_t
etl::ptrdiff_t is the signed integer type of the result of subtracting two pointers.
Definition ptrdiff_t.hpp:14
constexpr auto operator<=(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:177
auto swap(inplace_function< R(Args...), Capacity, Alignment > &lhs, inplace_function< R(Args...), Capacity, Alignment > &rhs) noexcept -> void
Overloads the etl::swap algorithm for etl::inplace_function. Exchanges the state of lhs with that of ...
Definition inplace_function.hpp:249
constexpr auto operator>(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:185
constexpr auto erase_if(etl::flat_set< Key, Container, Compare > &c, Pred pred) -> typename etl::flat_set< Key, Container, Compare >::size_type
Definition flat_set.hpp:385
basic_inplace_string< char, Capacity > inplace_string
Typedef for a basic_inplace_string using 'char'.
Definition basic_inplace_string.hpp:1330
constexpr auto operator>=(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:195
constexpr bool is_convertible_v
Definition is_convertible.hpp:46
TETL_BUILTIN_SIZET size_t
etl::size_t is the unsigned integer type of the result of the sizeof operator.
Definition size_t.hpp:14
decltype(nullptr) nullptr_t
etl::nullptr_t is the type of the null pointer literal, nullptr. It is a distinct type that is not it...
Definition nullptr_t.hpp:13
basic_inplace_string class with fixed size capacity.
Definition basic_inplace_string.hpp:41
constexpr auto operator[](size_type index) const noexcept -> const_reference
Accesses the specified character without bounds checking.
Definition basic_inplace_string.hpp:254
constexpr auto rfind(basic_inplace_string const &str, size_type pos=0) const noexcept -> size_type
Finds the last substring equal to the given character sequence. Search begins at pos,...
Definition basic_inplace_string.hpp:1014
Char * pointer
Definition basic_inplace_string.hpp:54
Char * iterator
Definition basic_inplace_string.hpp:58
constexpr basic_inplace_string(const_pointer str, size_type const len) noexcept
Character pointer constructor.
Definition basic_inplace_string.hpp:68
constexpr auto operator[](size_type index) noexcept -> reference
Accesses the specified character without bounds checking.
Definition basic_inplace_string.hpp:251
constexpr auto assign(size_type count, Char ch) noexcept -> basic_inplace_string &
Replaces the contents with count copies of character ch.
Definition basic_inplace_string.hpp:176
constexpr auto find_first_not_of(basic_inplace_string const &str, size_type pos=0) const noexcept -> size_type
Finds the first character not equal to any of the characters in the given character sequence.
Definition basic_inplace_string.hpp:1122
constexpr auto erase(const_iterator position) noexcept -> iterator
Removes the character at position.
Definition basic_inplace_string.hpp:413
constexpr auto insert(size_type const pos, StringView const &view) noexcept -> basic_inplace_string &
Implicitly converts view to a string view sv, then inserts the elements from sv before the element (i...
Definition basic_inplace_string.hpp:615
constexpr auto find_last_not_of(Char c, size_type pos=0) const noexcept -> size_type
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_inplace_string.hpp:1209
constexpr basic_inplace_string(size_type count, Char ch) noexcept
Constructs the string with count copies of character ch.
Definition basic_inplace_string.hpp:86
constexpr auto c_str() const noexcept -> const_pointer
Returns a pointer to a null-terminated character array.
Definition basic_inplace_string.hpp:383
constexpr auto operator+=(basic_inplace_string const &str) noexcept -> basic_inplace_string &
Appends string str.
Definition basic_inplace_string.hpp:518
constexpr auto operator=(Char ch) noexcept -> basic_inplace_string &
Replaces the contents with character ch.
Definition basic_inplace_string.hpp:159
constexpr auto rfind(const_pointer s, size_type pos, size_type count) const noexcept -> size_type
Finds the last substring equal to the given character sequence. Search begins at pos,...
Definition basic_inplace_string.hpp:1031
static constexpr size_type npos
Definition basic_inplace_string.hpp:1255
etl::ptrdiff_t difference_type
Definition basic_inplace_string.hpp:52
constexpr auto find_first_of(const_pointer s, size_type pos=0) const -> size_type
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_inplace_string.hpp:1093
constexpr auto find_first_not_of(Char ch, size_type pos=0) const noexcept -> size_type
Finds the first character not equal to any of the characters in the given character sequence.
Definition basic_inplace_string.hpp:1133
constexpr auto front() const noexcept -> const_reference
Accesses the first character.
Definition basic_inplace_string.hpp:315
constexpr auto find_last_of(Char c, size_type pos=0) const noexcept -> size_type
Finds the last character equal to one of characters in the given character sequence....
Definition basic_inplace_string.hpp:1172
constexpr basic_inplace_string(basic_inplace_string const &) noexcept=default
Defaulted copy constructor.
constexpr auto insert(size_type const index, StringView const &view, size_type const indexStr, size_type const count=npos) noexcept -> basic_inplace_string &
Implicitly converts view to a string view sv, then inserts, before the element (if any) pointed by po...
Definition basic_inplace_string.hpp:628
etl::size_t size_type
Definition basic_inplace_string.hpp:51
constexpr auto operator=(StringView const &view) noexcept -> basic_inplace_string &
Implicitly converts view to a string view sv, then replaces the contents with those of the sv.
Definition basic_inplace_string.hpp:169
constexpr auto replace(const_iterator first, const_iterator last, basic_inplace_string const &str) -> basic_inplace_string &
Replaces the part of the string indicated [first, last) with a new string.
Definition basic_inplace_string.hpp:801
constexpr auto crbegin() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the first character of the reversed string. It corresponds to the last ...
Definition basic_inplace_string.hpp:290
constexpr auto find_last_of(basic_inplace_string const &str, size_type pos=0) const noexcept -> size_type
Finds the last character equal to one of characters in the given character sequence....
Definition basic_inplace_string.hpp:1162
etl::reverse_iterator< const_iterator > const_reverse_iterator
Definition basic_inplace_string.hpp:61
constexpr auto replace(const_iterator first, const_iterator last, size_type count2, Char ch) -> basic_inplace_string &
Definition basic_inplace_string.hpp:876
constexpr auto starts_with(basic_string_view< Char, Traits > sv) const noexcept -> bool
Checks if the string begins with the given prefix.
Definition basic_inplace_string.hpp:751
Char const & const_reference
Definition basic_inplace_string.hpp:57
constexpr auto compare(size_type const pos, size_type const count, const_pointer s) const -> int
Compares a [pos1, pos1+count1) substring of this string to the null-terminated character sequence beg...
Definition basic_inplace_string.hpp:695
constexpr auto find_last_not_of(basic_inplace_string const &str, size_type pos=0) const noexcept -> size_type
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_inplace_string.hpp:1199
constexpr auto rfind(const_pointer s, size_type pos=0) const noexcept -> size_type
Finds the last substring equal to the given character sequence. Search begins at pos,...
Definition basic_inplace_string.hpp:1046
constexpr auto insert(size_type const index, const_pointer s) noexcept -> basic_inplace_string &
Inserts null-terminated character string pointed to by s at the position index.
Definition basic_inplace_string.hpp:546
constexpr auto rbegin() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the first character of the reversed string. It corresponds to the last ...
Definition basic_inplace_string.hpp:283
constexpr auto find_last_of(Char const *s, size_type pos, size_type count) const -> size_type
Finds the last character equal to one of characters in the given character sequence....
Definition basic_inplace_string.hpp:1181
constexpr auto find(Char ch, size_type pos=0) const noexcept -> size_type
Finds the first substring equal to the given character sequence. Search begins at pos,...
Definition basic_inplace_string.hpp:999
constexpr auto replace(size_type pos, size_type count, basic_inplace_string const &str) -> basic_inplace_string &
Replaces the part of the string indicated [pos, pos + count) with a new string.
Definition basic_inplace_string.hpp:788
static constexpr auto reserve(size_type) -> void
Reserve is a nop, since the capacity is fixed.
Definition basic_inplace_string.hpp:356
constexpr auto resize(size_type count) noexcept -> void
Resizes the string to contain count characters.
Definition basic_inplace_string.hpp:938
constexpr auto compare(size_type const pos, size_type const count, basic_inplace_string const &str) const -> int
Compares a [pos, pos+count) substring of this string to str. If count > size() - pos the substring is...
Definition basic_inplace_string.hpp:655
constexpr auto operator+=(StringView const &view) noexcept -> basic_inplace_string &
Implicitly converts view to a string view sv, then appends characters in the string view sv.
Definition basic_inplace_string.hpp:530
constexpr auto append(basic_inplace_string const &str, size_type pos, size_type count=npos) noexcept -> basic_inplace_string &
Appends a substring [ pos, pos + count ) of str.
Definition basic_inplace_string.hpp:491
constexpr auto substr(size_type pos=0, size_type count=npos) const -> basic_inplace_string
Definition basic_inplace_string.hpp:890
constexpr auto find_first_of(const_pointer s, size_type pos, size_type count) const -> size_type
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_inplace_string.hpp:1080
constexpr auto assign(InputIt first, InputIt last) noexcept -> basic_inplace_string &
Replaces the contents with copies of the characters in the range [ first , last ).
Definition basic_inplace_string.hpp:220
constexpr basic_inplace_string(const_pointer str) noexcept
Character pointer constructor. Calls traits_type::length.
Definition basic_inplace_string.hpp:77
constexpr auto find_first_not_of(Char const *s, size_type pos, size_type count) const -> size_type
Finds the first character not equal to any of the characters in the given character sequence.
Definition basic_inplace_string.hpp:1153
constexpr auto assign(basic_inplace_string const &str) noexcept -> basic_inplace_string &
Replaces the contents with a copy of str.
Definition basic_inplace_string.hpp:184
constexpr auto assign(StringView const &view) noexcept -> basic_inplace_string &
Implicitly converts view to a string view sv, then replaces the contents with the characters from sv.
Definition basic_inplace_string.hpp:230
constexpr auto back() noexcept -> reference
Accesses the last character.
Definition basic_inplace_string.hpp:322
constexpr auto append(InputIt first, InputIt last) noexcept -> basic_inplace_string &
Appends characters in the range [ first , last ).
Definition basic_inplace_string.hpp:476
constexpr auto ends_with(Char c) const noexcept -> bool
Checks if the string ends with the given prefix.
Definition basic_inplace_string.hpp:775
constexpr auto assign(StringView const &view, size_type pos, size_type count=npos) noexcept -> basic_inplace_string &
Implicitly converts view to a string view sv, then replaces the contents with the characters from the...
Definition basic_inplace_string.hpp:242
constexpr auto operator+=(const_pointer s) noexcept -> basic_inplace_string &
Appends the null-terminated character string pointed to by s.
Definition basic_inplace_string.hpp:524
constexpr auto find_last_of(Char const *s, size_type pos=0) const -> size_type
Finds the last character equal to one of characters in the given character sequence....
Definition basic_inplace_string.hpp:1190
constexpr auto find_last_not_of(Char const *s, size_type pos, size_type count) const -> size_type
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_inplace_string.hpp:1218
constexpr auto rend() noexcept -> reverse_iterator
Returns a reverse iterator to the first character of the reversed string. It corresponds to the last ...
Definition basic_inplace_string.hpp:294
constexpr auto begin() noexcept -> iterator
Returns an iterator to the beginning.
Definition basic_inplace_string.hpp:257
Traits traits_type
Definition basic_inplace_string.hpp:53
constexpr auto erase(size_type index=0, size_type count=npos) noexcept -> basic_inplace_string &
Removes min(count, size() - index) characters starting at index.
Definition basic_inplace_string.hpp:402
constexpr auto insert(size_type const index, const_pointer s, size_type const count) noexcept -> basic_inplace_string &
Inserts the characters in the range [s, s+count) at the position index. The range can contain null ch...
Definition basic_inplace_string.hpp:554
constexpr auto assign(basic_inplace_string const &str, size_type pos, size_type count=npos) noexcept -> basic_inplace_string &
Replaces the contents with a substring [ pos, pos + count ) of str.
Definition basic_inplace_string.hpp:192
constexpr auto ends_with(const_pointer str) const -> bool
Checks if the string ends with the given prefix.
Definition basic_inplace_string.hpp:781
constexpr auto end() noexcept -> iterator
Returns an iterator to the end.
Definition basic_inplace_string.hpp:266
constexpr auto begin() const noexcept -> const_iterator
Returns an const iterator to the beginning.
Definition basic_inplace_string.hpp:260
constexpr auto starts_with(const_pointer s) const -> bool
Checks if the string begins with the given prefix.
Definition basic_inplace_string.hpp:763
constexpr auto cbegin() const noexcept -> const_iterator
Returns an const iterator to the beginning.
Definition basic_inplace_string.hpp:263
constexpr auto append(const_pointer s) noexcept -> basic_inplace_string &
Appends the null-terminated character string pointed to by s. The length of the string is determined ...
Definition basic_inplace_string.hpp:457
constexpr auto contains(Char c) const noexcept -> bool
Checks if the string contains the given substring.
Definition basic_inplace_string.hpp:1239
constexpr auto append(const_pointer str, size_type count) noexcept -> basic_inplace_string &
Appends characters in the range [ str, str + count ). This range can contain null characters.
Definition basic_inplace_string.hpp:465
constexpr auto find(const_pointer s, size_type pos, size_type count) const noexcept -> size_type
Finds the first substring equal to the given character sequence. Search begins at pos,...
Definition basic_inplace_string.hpp:973
Char const * const_pointer
Definition basic_inplace_string.hpp:55
constexpr auto compare(size_type pos1, size_type count1, StringView const &view) const noexcept -> int
Implicitly converts view to a string view sv, then compares a [pos1, pos1+count1) substring of this s...
Definition basic_inplace_string.hpp:729
constexpr auto compare(basic_inplace_string const &str) const noexcept -> int
Compares this string to str.
Definition basic_inplace_string.hpp:639
constexpr auto rfind(Char ch, size_type pos=0) const noexcept -> size_type
Finds the last substring equal to the given character sequence. Search begins at pos,...
Definition basic_inplace_string.hpp:1061
constexpr auto contains(Char const *s) const -> bool
Checks if the string contains the given substring.
Definition basic_inplace_string.hpp:1245
constexpr auto push_back(Char ch) noexcept -> void
Appends the given character ch to the end of the string.
Definition basic_inplace_string.hpp:431
constexpr auto append(size_type const count, char const s) noexcept -> basic_inplace_string &
Definition basic_inplace_string.hpp:446
constexpr auto find_first_of(basic_string_view< Char, traits_type > str, size_type pos=0) const noexcept -> size_type
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_inplace_string.hpp:1112
constexpr auto replace(size_type pos, size_type count, Char const *str) -> basic_inplace_string &
Definition basic_inplace_string.hpp:845
constexpr auto append(StringView const &view) -> basic_inplace_string &
Implicitly converts view to a string_view sv, then appends all characters from sv.
Definition basic_inplace_string.hpp:501
constexpr auto empty() const noexcept -> bool
Checks whether the string is empty.
Definition basic_inplace_string.hpp:336
constexpr auto compare(const_pointer s) const -> int
Compares this string to the null-terminated character sequence beginning at the character pointed to ...
Definition basic_inplace_string.hpp:686
constexpr auto clear() noexcept -> void
Removes all characters from the string. Sets size to 0 and overrides the buffer with zeros.
Definition basic_inplace_string.hpp:393
Char & reference
Definition basic_inplace_string.hpp:56
constexpr auto pop_back() noexcept -> void
Removes the last character from the string.
Definition basic_inplace_string.hpp:439
constexpr auto find_first_of(Char ch, size_type pos=0) const noexcept -> size_type
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_inplace_string.hpp:1102
constexpr auto find_first_of(basic_inplace_string const &str, size_type pos=0) const noexcept -> size_type
Finds the first character equal to one of the characters in the given character sequence....
Definition basic_inplace_string.hpp:1070
constexpr auto data() noexcept -> pointer
Returns a pointer to the underlying array serving as character storage. The pointer is such that the ...
Definition basic_inplace_string.hpp:367
constexpr auto back() const noexcept -> const_reference
Accesses the last character.
Definition basic_inplace_string.hpp:329
etl::reverse_iterator< iterator > reverse_iterator
Definition basic_inplace_string.hpp:60
static constexpr bool string_view_like
Definition basic_inplace_string.hpp:43
constexpr auto length() const noexcept -> size_type
Returns the number of characters.
Definition basic_inplace_string.hpp:345
constexpr auto front() noexcept -> reference
Accesses the first character.
Definition basic_inplace_string.hpp:308
Char const * const_iterator
Definition basic_inplace_string.hpp:59
constexpr auto find(const_pointer s, size_type pos=0) const noexcept -> size_type
Finds the first substring equal to the given character sequence. Search begins at pos,...
Definition basic_inplace_string.hpp:986
constexpr basic_inplace_string(basic_inplace_string const &other, size_type pos, size_type count)
Constructs the string with a substring [pos, pos+count) of other.
Definition basic_inplace_string.hpp:103
constexpr auto append(StringView const &view, size_type pos, size_type count=npos) -> basic_inplace_string &
Implicitly converts view to a string_view sv then appends the characters from the subview [ pos,...
Definition basic_inplace_string.hpp:511
constexpr auto swap(basic_inplace_string &other) noexcept -> void
Exchanges the contents of the string with those of other. All iterators and references may be invalid...
Definition basic_inplace_string.hpp:942
constexpr auto insert(size_type const index, basic_inplace_string const &str, size_type const indexStr, size_type const count=npos) noexcept -> basic_inplace_string &
Inserts a string, obtained by str.substr(index_str, count) at the position index.
Definition basic_inplace_string.hpp:570
constexpr auto full() const noexcept -> bool
Checks whether the string is full. i.e. size() == capacity()
Definition basic_inplace_string.hpp:339
constexpr auto assign(const_pointer s) noexcept -> basic_inplace_string &
Replaces the contents with those of null-terminated character string pointed to by s.
Definition basic_inplace_string.hpp:210
static constexpr auto shrink_to_fit() -> void
Shrink to fit is a nop, since the capacity is fixed.
Definition basic_inplace_string.hpp:359
constexpr auto ends_with(basic_string_view< Char, Traits > sv) const noexcept -> bool
Checks if the string ends with the given prefix.
Definition basic_inplace_string.hpp:769
constexpr auto max_size() const noexcept -> size_type
Returns the number of characters that can be held in allocated storage, NOT including the null termin...
Definition basic_inplace_string.hpp:353
constexpr auto operator+=(Char ch) noexcept -> basic_inplace_string &
Appends character ch.
Definition basic_inplace_string.hpp:521
constexpr auto compare(size_type pos1, size_type count1, StringView const &view, size_type pos2, size_type count2=npos) const noexcept -> int
Implicitly converts view to a string view sv, then compares a [pos1, pos1+count1) substring of this s...
Definition basic_inplace_string.hpp:742
constexpr auto end() const noexcept -> const_iterator
Returns an const iterator to the end.
Definition basic_inplace_string.hpp:269
constexpr auto starts_with(Char c) const noexcept -> bool
Checks if the string begins with the given prefix.
Definition basic_inplace_string.hpp:757
constexpr auto find_first_not_of(Char const *s, size_type pos) const -> size_type
Finds the first character not equal to any of the characters in the given character sequence.
Definition basic_inplace_string.hpp:1143
constexpr auto replace(const_iterator first, const_iterator last, Char const *str, size_type count2) -> basic_inplace_string &
Definition basic_inplace_string.hpp:836
constexpr auto replace(size_type pos, size_type count, Char const *str, size_type count2) -> basic_inplace_string &
Definition basic_inplace_string.hpp:825
constexpr basic_inplace_string()=default
Default constructor.
constexpr auto assign(const_pointer s, size_type count) noexcept -> basic_inplace_string &
Replaces the contents with copies of the characters in the range [ s, s + count )....
Definition basic_inplace_string.hpp:201
constexpr basic_inplace_string(basic_inplace_string const &other, size_type pos)
Constructs the string with a substring [pos, other.size()).
Definition basic_inplace_string.hpp:109
constexpr basic_inplace_string(StringView const &view, size_type pos, size_type n)
Implicitly converts view to a string view sv, then initializes the string with the subrange [ pos,...
Definition basic_inplace_string.hpp:129
constexpr auto compare(size_type const pos1, size_type const count1, basic_inplace_string const &str, size_type const pos2, size_type const count2=npos) const -> int
Compares a [pos1, pos1+count1) substring of this string to a substring [pos2, pos2+count2) of str....
Definition basic_inplace_string.hpp:666
constexpr auto compare(basic_inplace_string< Char, OtherCapacity, traits_type > const &str) const noexcept -> int
Compares this string to str with other capacity.
Definition basic_inplace_string.hpp:646
constexpr auto crend() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the first character of the reversed string. It corresponds to the last ...
Definition basic_inplace_string.hpp:305
constexpr auto erase(const_iterator first, const_iterator last) noexcept -> iterator
Removes the characters in the range [first, last).
Definition basic_inplace_string.hpp:419
constexpr auto insert(size_type const index, basic_inplace_string const &str) noexcept -> basic_inplace_string &
Inserts string str at the position index.
Definition basic_inplace_string.hpp:562
constexpr auto replace(size_type pos, size_type count, basic_inplace_string const &str, size_type pos2, size_type count2=npos) -> basic_inplace_string &
Definition basic_inplace_string.hpp:811
constexpr auto resize(size_type count, Char ch) noexcept -> void
Resizes the string to contain count characters.
Definition basic_inplace_string.hpp:923
constexpr auto insert(size_type const index, size_type const count, Char const ch) noexcept -> basic_inplace_string &
Inserts count copies of character ch at the position index.
Definition basic_inplace_string.hpp:536
constexpr auto data() const noexcept -> const_pointer
Returns a pointer to the underlying array serving as character storage. The pointer is such that the ...
Definition basic_inplace_string.hpp:375
constexpr auto compare(size_type const pos1, size_type const count1, const_pointer s, size_type const count2) const -> int
Compares a [pos1, pos1+count1) substring of this string to the characters in the range [s,...
Definition basic_inplace_string.hpp:707
constexpr auto compare(StringView const &view) const noexcept -> int
Implicitly converts view to a string view sv, then compares the content of this string to sv.
Definition basic_inplace_string.hpp:718
constexpr basic_inplace_string(StringView const &view) noexcept
Implicitly converts view to a string view sv, then initializes the string with the contents of sv.
Definition basic_inplace_string.hpp:118
constexpr auto contains(etl::basic_string_view< Char, Traits > sv) const noexcept -> bool
Checks if the string contains the given substring.
Definition basic_inplace_string.hpp:1233
constexpr auto rend() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the first character of the reversed string. It corresponds to the last ...
Definition basic_inplace_string.hpp:298
Char value_type
Definition basic_inplace_string.hpp:50
constexpr auto find_last_not_of(Char const *s, size_type pos=0) const -> size_type
Finds the last character equal to none of the characters in the given character sequence....
Definition basic_inplace_string.hpp:1227
constexpr auto append(basic_inplace_string const &str) noexcept -> basic_inplace_string &
Appends string str.
Definition basic_inplace_string.hpp:485
constexpr auto size() const noexcept -> size_type
Definition basic_inplace_string.hpp:342
constexpr auto cend() const noexcept -> const_iterator
Returns an const iterator to the end.
Definition basic_inplace_string.hpp:275
constexpr auto capacity() const noexcept -> size_type
Definition basic_inplace_string.hpp:349
constexpr basic_inplace_string(nullptr_t)=delete
constexpr auto copy(pointer destination, size_type count, size_type pos=0) const -> size_type
Copies a substring [pos, pos+count) to character string pointed to by dest. If the requested substrin...
Definition basic_inplace_string.hpp:906
constexpr auto replace(const_iterator first, const_iterator last, Char const *str) -> basic_inplace_string &
Definition basic_inplace_string.hpp:856
constexpr basic_inplace_string(InputIt first, InputIt last) noexcept
Constructs the string with the contents of the range [ first, last). Fails silently if input length i...
Definition basic_inplace_string.hpp:97
constexpr auto rbegin() noexcept -> reverse_iterator
Returns a reverse iterator to the first character of the reversed string. It corresponds to the last ...
Definition basic_inplace_string.hpp:279
constexpr basic_inplace_string(basic_inplace_string &&) noexcept=default
Defaulted move constructor.
constexpr auto operator=(nullptr_t) -> basic_inplace_string &=delete
constexpr auto find(basic_inplace_string const &str, size_type pos=0) const noexcept -> size_type
Finds the first substring equal to the given character sequence. Search begins at pos,...
Definition basic_inplace_string.hpp:960
The class template basic_string_view describes an object that can refer to a constant contiguous sequ...
Definition basic_string_view.hpp:34
constexpr auto find_first_not_of(basic_string_view sv, size_type pos=0) const noexcept -> size_type
Finds the first character not equal to any of the characters in the given character sequence.
Definition basic_string_view.hpp:512
constexpr auto contains(basic_string_view sv) const noexcept -> bool
Checks if the string contains the given substring.
Definition basic_string_view.hpp:678
constexpr auto compare(basic_string_view v) const noexcept -> int
Compares two character sequences.
Definition basic_string_view.hpp:233
constexpr auto begin() const noexcept -> const_iterator
Returns an iterator to the first character of the view.
Definition basic_string_view.hpp:99
constexpr auto starts_with(basic_string_view sv) const noexcept -> bool
Checks if the string view begins with the given prefix, where the prefix is a string view.
Definition basic_string_view.hpp:286
constexpr auto substr(size_type pos=0, size_type count=npos) const -> basic_string_view
Returns a view of the substring [pos, pos + rcount), where rcount is the smaller of count and size() ...
Definition basic_string_view.hpp:223
constexpr auto find_last_of(basic_string_view v, size_type pos=npos) const noexcept -> size_type
Finds the last character equal to one of characters in the given character sequence....
Definition basic_string_view.hpp:572
constexpr auto end() const noexcept -> const_iterator
Returns an iterator to the character following the last character of the view. This character acts as...
Definition basic_string_view.hpp:107
constexpr auto find_last_not_of(basic_string_view v, size_type pos=npos) const noexcept -> size_type
Finds the last character not equal to any of the characters of v in this view, starting at position p...
Definition basic_string_view.hpp:631
constexpr auto ends_with(basic_string_view sv) const noexcept -> bool
Checks if the string view ends with the given suffix, where the prefix is a string view.
Definition basic_string_view.hpp:313
constexpr auto find_first_of(basic_string_view v, size_type pos=0) const noexcept -> size_type
Finds the first character equal to any of the characters in the given character sequence....
Definition basic_string_view.hpp:461
constexpr auto data() const noexcept -> const_pointer
Returns a pointer to the underlying character array. The pointer is such that the range [data(); data...
Definition basic_string_view.hpp:171
constexpr auto size() const noexcept -> size_type
Returns the number of Char elements in the view, i.e. etl::distance(begin(), end()).
Definition basic_string_view.hpp:174
static constexpr auto max() noexcept
Definition numeric_limits.hpp:21
reverse_iterator is an iterator adaptor that reverses the direction of a given iterator....
Definition reverse_iterator.hpp:22