2#ifndef TETL_STRING_BASIC_INPLACE_STRING_HPP
3#define TETL_STRING_BASIC_INPLACE_STRING_HPP
40template <
typename Char, etl::
size_t Capacity,
typename Traits = etl::
char_traits<Char>>
72 traits_type::copy(_storage.data(), str, len);
90 unsafe_set_size(
count);
95 template <
typename InputIt>
96 requires(detail::InputIterator<InputIt>)
116 template <
typename StringView>
127 template <
typename StringView>
150 auto const len = traits_type::length(s);
167 template <
typename StringView>
168 requires string_view_like<StringView>
195 *
this = str.substr(pos,
count);
218 template <
typename InputIt>
219 requires(detail::InputIterator<InputIt>)
228 template <
typename StringView>
229 requires string_view_like<StringView>
240 template <
typename StringView>
241 requires string_view_like<StringView>
336 [[nodiscard]]
constexpr auto empty() const noexcept ->
bool {
return size() == 0; }
339 [[nodiscard]]
constexpr auto full() const noexcept ->
bool {
return size() ==
capacity(); }
342 [[nodiscard]]
constexpr auto size() const noexcept ->
size_type {
return _storage.get_size(); }
367 [[nodiscard]]
constexpr auto data() noexcept ->
pointer {
return _storage.data(); }
393 constexpr auto clear() noexcept ->
void
426 return begin() + start;
442 unsafe_set_size(
size() - 1);
449 auto const newSize =
size() + safeCount;
451 unsafe_set_size(newSize);
459 auto const len = traits_type::length(s);
469 unsafe_set_size(
size() + safeCount);
474 template <
typename InputIt>
475 requires(detail::InputIterator<InputIt>)
478 for (; first != last; ++first) {
487 return append(str.begin(), str.end());
499 template <
typename StringView>
500 requires string_view_like<StringView>
509 template <
typename StringView>
510 requires string_view_like<StringView>
528 template <
typename StringView>
529 requires string_view_like<StringView>
539 insert_impl(
begin() + index, &ch, 1);
548 insert_impl(
begin() + index, s, traits_type::length(s));
564 insert_impl(
begin() + index, str.data(), str.size());
579 insert_impl(
begin() + index, sv.data(), sv.size());
613 template <
typename StringView>
614 requires string_view_like<StringView>
625 template <
typename StringView>
626 requires string_view_like<StringView>
634 insert_impl(
begin() + index, sub.data(), sub.size());
645 template <
size_type OtherCapacity>
647 )
const noexcept ->
int
654 [[nodiscard]]
constexpr auto
659 return sub.compare(str);
674 auto const sz1 = count1 >
size() - pos1 ?
size() : count1;
677 auto const sz2 = count2 > str.size() - pos2 ?
size() : count2;
680 return sub1.compare(sub2);
699 return sub.compare({s, traits_type::length(s)});
706 [[nodiscard]]
constexpr auto
709 auto const sz = count1 >
size() - pos1 ?
size() : count1;
711 return sub.compare({s, count2});
716 template <
typename StringView>
717 requires string_view_like<StringView>
718 [[nodiscard]]
constexpr auto compare(StringView
const& view)
const noexcept ->
int
721 view_type
const sv = view;
722 return view_type(*this).
compare(sv);
727 template <
typename StringView>
728 requires string_view_like<StringView>
732 view_type
const sv = view;
733 return view_type(*this).
substr(pos1, count1).compare(sv);
739 template <
typename StringView>
740 requires string_view_like<StringView>
741 [[nodiscard]]
constexpr auto
743 const noexcept ->
int
746 view_type
const sv = view;
747 return view_type(*this).
substr(pos1, count1).compare(sv.substr(pos2, count2));
757 [[nodiscard]]
constexpr auto starts_with(Char c)
const noexcept ->
bool
775 [[nodiscard]]
constexpr auto ends_with(Char c)
const noexcept ->
bool
793 auto* f =
data() + pos;
795 detail::str_replace(f, l, str.begin(), str.end());
804 auto* f = to_mutable_iterator(first);
805 auto* l = to_mutable_iterator(last);
806 detail::str_replace(f, l, str.begin(), str.end());
821 detail::str_replace(f, l, sf, sl);
832 detail::str_replace(f, l, str,
next(str, count2));
839 auto* f = to_mutable_iterator(first);
840 auto* l = to_mutable_iterator(last);
841 detail::str_replace(f, l, str,
next(str, count2));
852 detail::str_replace(f, l, str,
next(str,
strlen(str)));
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)));
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);
911 auto const* first =
data() + pos;
913 auto const* dest = destination;
914 auto const* res =
etl::copy(first, last, destination);
915 return static_cast<size_type>(res - dest);
926 unsafe_set_size(
count);
944 auto const thisSize =
size();
948 unsafe_set_size(other.size());
949 other.unsafe_set_size(thisSize);
1111 [[nodiscard]]
constexpr auto
1239 [[nodiscard]]
constexpr auto contains(Char c)
const noexcept ->
bool
1245 [[nodiscard]]
constexpr auto contains(Char
const* s)
const ->
bool
1264 [[nodiscard]]
constexpr auto unsafe_at(size_type index)
noexcept -> reference
1270 [[nodiscard]]
constexpr auto unsafe_at(size_type index)
const noexcept -> const_reference
1276 constexpr auto unsafe_set_size(size_type
const newSize)
noexcept ->
void
1279 _storage.set_size(newSize);
1280 unsafe_at(newSize) = Char(0);
1283 constexpr auto insert_impl(iterator pos, const_pointer text, size_type
count) ->
void
1286 auto* currentEnd =
end();
1287 append(text,
count);
1293 struct tiny_layout {
1294 constexpr tiny_layout() noexcept { _buffer[Capacity] = Capacity; }
1296 [[nodiscard]]
constexpr auto data() noexcept {
return _buffer.data(); }
1298 [[nodiscard]]
constexpr auto data() const noexcept {
return _buffer.data(); }
1300 [[nodiscard]]
constexpr auto get_size() const noexcept {
return Capacity - size_type(_buffer[Capacity]); }
1302 constexpr auto set_size(
size_t size)
noexcept {
return _buffer[Capacity] = Char(Capacity - size); }
1305 etl::array<Char, Capacity + 1> _buffer{};
1308 struct normal_layout {
1309 constexpr normal_layout() noexcept = default;
1311 [[nodiscard]] constexpr auto data() noexcept {
return _buffer.data(); }
1313 [[nodiscard]]
constexpr auto data() const noexcept {
return _buffer.data(); }
1315 [[nodiscard]]
constexpr auto get_size() const noexcept {
return size_t(_size); }
1317 constexpr auto set_size(
size_t size)
noexcept {
return _size = internal_size_t(size); }
1320 internal_size_t _size{};
1321 etl::array<Char, Capacity + 1> _buffer{};
1325 layout_type _storage{};
1329template <etl::
size_t Capacity>
1333template <etl::
size_t Capacity>
1337template <etl::
size_t Capacity>
1341template <etl::
size_t Capacity>
1345template <etl::
size_t Capacity>
1350template <
typename Char,
typename Traits,
size_t Capacity1,
size_t Capacity2>
1363template <
typename Char,
typename Traits,
size_t Capacity>
1364[[nodiscard]]
constexpr auto
1375template <
typename Char,
typename Traits,
size_t Capacity>
1386template <
typename Char,
typename Traits,
size_t Capacity>
1387[[nodiscard]]
constexpr auto
1398template <
typename Char,
typename Traits,
size_t Capacity>
1412template <
typename Char,
typename Traits, etl::
size_t Capacity1, etl::
size_t Capacity2>
1418 return lhs.compare(rhs) == 0;
1426template <
typename Char,
typename Traits, etl::
size_t Capacity>
1427[[nodiscard]]
constexpr auto
1430 return lhs.compare(rhs) == 0;
1438template <
typename Char,
typename Traits, etl::
size_t Capacity>
1439[[nodiscard]]
constexpr auto
1442 return rhs.compare(lhs) == 0;
1450template <
typename Char,
typename Traits, etl::
size_t Capacity1, etl::
size_t Capacity2>
1456 return lhs.compare(rhs) != 0;
1464template <
typename Char,
typename Traits, etl::
size_t Capacity1>
1465[[nodiscard]]
constexpr auto
1468 return lhs.compare(rhs) != 0;
1476template <
typename Char,
typename Traits, etl::
size_t Capacity>
1477[[nodiscard]]
constexpr auto
1480 return rhs.compare(lhs) != 0;
1487template <
typename Char,
typename Traits, etl::
size_t Capacity1, etl::
size_t Capacity2>
1493 return lhs.compare(rhs) < 0;
1500template <
typename Char,
typename Traits, etl::
size_t Capacity1>
1501[[nodiscard]]
constexpr auto
1504 return lhs.compare(rhs) < 0;
1511template <
typename Char,
typename Traits, etl::
size_t Capacity1>
1512[[nodiscard]]
constexpr auto
1515 return rhs.compare(lhs) > 0;
1522template <
typename Char,
typename Traits, etl::
size_t Capacity1, etl::
size_t Capacity2>
1528 return lhs.compare(rhs) <= 0;
1535template <
typename Char,
typename Traits, etl::
size_t Capacity1>
1536[[nodiscard]]
constexpr auto
1539 return lhs.compare(rhs) <= 0;
1546template <
typename Char,
typename Traits, etl::
size_t Capacity1>
1547[[nodiscard]]
constexpr auto
1550 return rhs.compare(lhs) >= 0;
1557template <
typename Char,
typename Traits, etl::
size_t Capacity1, etl::
size_t Capacity2>
1563 return lhs.compare(rhs) > 0;
1570template <
typename Char,
typename Traits, etl::
size_t Capacity1>
1571[[nodiscard]]
constexpr auto
1574 return lhs.compare(rhs) > 0;
1581template <
typename Char,
typename Traits, etl::
size_t Capacity1>
1582[[nodiscard]]
constexpr auto
1585 return rhs.compare(lhs) < 0;
1592template <
typename Char,
typename Traits, etl::
size_t Capacity1, etl::
size_t Capacity2>
1598 return lhs.compare(rhs) >= 0;
1605template <
typename Char,
typename Traits, etl::
size_t Capacity>
1606[[nodiscard]]
constexpr auto
1609 return lhs.compare(rhs) >= 0;
1616template <
typename Char,
typename Traits, etl::
size_t Capacity>
1617[[nodiscard]]
constexpr auto
1620 return rhs.compare(lhs) <= 0;
1625template <
typename Char,
typename Traits, etl::
size_t Capacity>
1628 noexcept(
noexcept(lhs.swap(rhs))) ->
void
1634template <
typename Char,
typename Traits, etl::
size_t Capacity,
typename U>
1642 c.erase(it,
end(c));
1643 return static_cast<return_type
>(r);
1648template <
typename Char,
typename Traits, etl::
size_t Capacity,
typename Predicate>
1656 c.erase(it,
end(c));
1657 return static_cast<return_type
>(r);
#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