mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 22:59:47 +08:00
Reduce string flash usage (#1309)
* Remove call to initialise() in constructors.
The constructor execution flows were:
constructor
initialise()
assign()
append_impl()
initialise() does:
- Set current_size to 0
- Null terminate the buffer
- Clear truncation flag
append_impl() does:
- Assign truncation flag
- Set current size to source size
- Copy and null terminate the buffer
All the hard work done by initialise() is immediately overwritten. Removing the
call to initialise() saves 6-8 bytes of flash per constructor invocation when
targeting Cortex M33 with -Os.
* Avoid calling templated assign(iter, iter) with C strings.
Call the single pointer version of assign which ends up in the non-templated
append_impl. This calls the C lib's strlen and memmove rather than etl::strlen
which is a hand rolled loop.
This also reduces the risk of instantiating the iterator version of assign() if
it's not used elsewhere.
* Dispatch pointer iterators to non-template append_impl core.
When append_impl is called with pointer iterators (e.g. begin()/end()), SFINAE
routes them to a non-template core that takes a pointer and length. This
avoids duplicating the function body for each pointer type instantiation,
reducing flash usage on ARM Cortex-M by ~836 bytes at -Os.
* Revert make_string changes.
The original implementation used a bounded strlen which avoided OOB array access.
* Treat start, free_space and count as size_t to avoid casts.
* Ensure that append start is within the buffer.
---------
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
This commit is contained in:
parent
7a8944224b
commit
37aba58965
@ -2757,10 +2757,11 @@ namespace etl
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Common implementation for 'assign' and 'append' for iterators.
|
||||
/// Common implementation for 'assign' and 'append' for non-pointer iterators.
|
||||
//*********************************************************************
|
||||
template <typename TIterator>
|
||||
void append_impl(iterator position, TIterator first, TIterator last, bool truncated, bool secure)
|
||||
typename etl::enable_if<!etl::is_pointer<typename etl::remove_reference<TIterator>::type>::value>::type
|
||||
append_impl(iterator position, TIterator first, TIterator last, bool truncated, bool secure)
|
||||
{
|
||||
difference_type start = etl::distance(p_buffer, position);
|
||||
difference_type count = etl::distance(first, last);
|
||||
@ -2809,20 +2810,29 @@ namespace etl
|
||||
return;
|
||||
}
|
||||
|
||||
difference_type start = etl::distance(p_buffer, position);
|
||||
difference_type free_space = etl::distance(position, p_buffer + CAPACITY);
|
||||
append_impl(position, src, get_string_length(src), truncated, secure);
|
||||
}
|
||||
|
||||
pointer dst = position;
|
||||
size_t length = get_string_length(src);
|
||||
size_t count = (length < size_t(free_space)) ? length : size_t(free_space);
|
||||
etl::mem_move(src, count, dst);
|
||||
//*********************************************************************
|
||||
/// Core non-template implementation for 'assign' and 'append'.
|
||||
//*********************************************************************
|
||||
void append_impl(iterator position, const_pointer src, size_t length, bool truncated, bool secure)
|
||||
{
|
||||
size_t start = static_cast<size_t>(etl::distance(p_buffer, position));
|
||||
size_t free_space = static_cast<size_t>(etl::distance(position, p_buffer + CAPACITY));
|
||||
size_t count = etl::min(length, free_space);
|
||||
|
||||
truncated |= (src[count] != 0);
|
||||
current_size = size_t(start) + count;
|
||||
#if ETL_IS_DEBUG_BUILD
|
||||
ETL_ASSERT(start <= CAPACITY, ETL_ERROR(string_iterator));
|
||||
#endif
|
||||
|
||||
etl::mem_move(src, count, position);
|
||||
|
||||
current_size = start + count;
|
||||
p_buffer[current_size] = 0;
|
||||
|
||||
#if ETL_HAS_STRING_TRUNCATION_CHECKS
|
||||
set_truncated(truncated);
|
||||
set_truncated((length > free_space) || truncated);
|
||||
#if ETL_HAS_ERROR_ON_STRING_TRUNCATION
|
||||
ETL_ASSERT(is_truncated() == false, ETL_ERROR(string_truncation));
|
||||
#endif
|
||||
@ -2842,6 +2852,16 @@ namespace etl
|
||||
cleanup();
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Common implementation for 'assign' and 'append' for pointer iterators.
|
||||
//*********************************************************************
|
||||
template <typename TIterator>
|
||||
typename etl::enable_if<etl::is_pointer<typename etl::remove_reference<TIterator>::type>::value>::type
|
||||
append_impl(iterator position, TIterator first, TIterator last, bool truncated, bool secure)
|
||||
{
|
||||
append_impl(position, first, size_t(etl::distance(first, last)), truncated || is_truncated(), secure);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Common implementation for 'find'.
|
||||
//*************************************************************************
|
||||
|
||||
@ -92,7 +92,6 @@ namespace etl
|
||||
string(const etl::string<MAX_SIZE_>& other)
|
||||
: istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -103,7 +102,6 @@ namespace etl
|
||||
string(const etl::istring& other)
|
||||
: istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -118,7 +116,6 @@ namespace etl
|
||||
{
|
||||
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
|
||||
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
|
||||
@ -129,7 +126,6 @@ namespace etl
|
||||
ETL_EXPLICIT_STRING_FROM_CHAR string(const value_type* text)
|
||||
: istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text);
|
||||
}
|
||||
|
||||
@ -141,7 +137,6 @@ namespace etl
|
||||
string(const value_type* text, size_t count)
|
||||
: istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
|
||||
@ -167,7 +162,6 @@ namespace etl
|
||||
string(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
|
||||
: istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
|
||||
@ -178,7 +172,6 @@ namespace etl
|
||||
string(std::initializer_list<value_type> init)
|
||||
: istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
@ -190,7 +183,6 @@ namespace etl
|
||||
explicit string(const etl::string_view& view)
|
||||
: istring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
|
||||
@ -329,7 +321,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -347,7 +338,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -367,7 +357,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -389,7 +378,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -413,7 +401,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -433,8 +420,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -454,8 +440,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -473,7 +458,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -493,7 +477,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -512,7 +495,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -533,7 +515,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -577,7 +558,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -597,7 +577,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -618,7 +597,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -640,7 +618,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -652,7 +629,6 @@ namespace etl
|
||||
string_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
|
||||
: istring(buffer, buffer_size - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
|
||||
@ -665,7 +641,6 @@ namespace etl
|
||||
string_ext(std::initializer_list<value_type> init, value_type (&buffer)[BufferSize])
|
||||
: istring(buffer, BufferSize - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -89,7 +89,6 @@ namespace etl
|
||||
u16string(const etl::u16string<MAX_SIZE_>& other)
|
||||
: iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -100,7 +99,6 @@ namespace etl
|
||||
u16string(const etl::iu16string& other)
|
||||
: iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -115,7 +113,6 @@ namespace etl
|
||||
{
|
||||
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
|
||||
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
|
||||
@ -126,7 +123,6 @@ namespace etl
|
||||
ETL_EXPLICIT_STRING_FROM_CHAR u16string(const value_type* text)
|
||||
: iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text);
|
||||
}
|
||||
|
||||
@ -138,7 +134,6 @@ namespace etl
|
||||
u16string(const value_type* text, size_type count)
|
||||
: iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
|
||||
@ -164,7 +159,6 @@ namespace etl
|
||||
u16string(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
|
||||
: iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
|
||||
@ -175,7 +169,6 @@ namespace etl
|
||||
u16string(std::initializer_list<value_type> init)
|
||||
: iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
@ -187,7 +180,6 @@ namespace etl
|
||||
explicit u16string(const etl::u16string_view& view)
|
||||
: iu16string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
|
||||
@ -309,7 +301,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -327,7 +318,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -347,7 +337,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -369,7 +358,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -393,7 +381,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -413,8 +400,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,8 +420,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -453,7 +438,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -473,7 +457,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -492,7 +475,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -513,7 +495,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -557,7 +538,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -577,7 +557,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -598,7 +577,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -620,7 +598,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -632,7 +609,6 @@ namespace etl
|
||||
u16string_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
|
||||
: iu16string(buffer, buffer_size - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
|
||||
@ -645,7 +621,6 @@ namespace etl
|
||||
u16string_ext(std::initializer_list<value_type> init, value_type (&buffer)[BufferSize])
|
||||
: iu16string(buffer, BufferSize - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -89,7 +89,6 @@ namespace etl
|
||||
u32string(const etl::u32string<MAX_SIZE_>& other)
|
||||
: iu32string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -100,7 +99,6 @@ namespace etl
|
||||
u32string(const etl::iu32string& other)
|
||||
: iu32string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -115,7 +113,6 @@ namespace etl
|
||||
{
|
||||
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
|
||||
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
|
||||
@ -126,7 +123,6 @@ namespace etl
|
||||
ETL_EXPLICIT_STRING_FROM_CHAR u32string(const value_type* text)
|
||||
: iu32string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text);
|
||||
}
|
||||
|
||||
@ -138,7 +134,6 @@ namespace etl
|
||||
u32string(const value_type* text, size_type count)
|
||||
: iu32string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
|
||||
@ -164,7 +159,6 @@ namespace etl
|
||||
u32string(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
|
||||
: iu32string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
|
||||
@ -175,7 +169,6 @@ namespace etl
|
||||
u32string(std::initializer_list<value_type> init)
|
||||
: iu32string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
@ -187,7 +180,6 @@ namespace etl
|
||||
explicit u32string(const etl::u32string_view& view)
|
||||
: iu32string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
|
||||
@ -309,7 +301,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -327,7 +318,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -347,7 +337,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -369,7 +358,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -393,7 +381,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -413,8 +400,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,8 +420,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -453,7 +438,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -473,7 +457,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -492,7 +475,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -513,7 +495,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -557,7 +538,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -577,7 +557,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -598,7 +577,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -620,7 +598,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -632,7 +609,6 @@ namespace etl
|
||||
u32string_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
|
||||
: iu32string(buffer, buffer_size - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
|
||||
@ -645,7 +621,6 @@ namespace etl
|
||||
u32string_ext(std::initializer_list<value_type> init, value_type (&buffer)[BufferSize])
|
||||
: iu32string(buffer, BufferSize - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -92,7 +92,6 @@ namespace etl
|
||||
u8string(const etl::u8string<MAX_SIZE_>& other)
|
||||
: iu8string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -103,7 +102,6 @@ namespace etl
|
||||
u8string(const etl::iu8string& other)
|
||||
: iu8string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -118,7 +116,6 @@ namespace etl
|
||||
{
|
||||
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
|
||||
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
|
||||
@ -129,7 +126,6 @@ namespace etl
|
||||
ETL_EXPLICIT_STRING_FROM_CHAR u8string(const value_type* text)
|
||||
: iu8string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text);
|
||||
}
|
||||
|
||||
@ -141,7 +137,6 @@ namespace etl
|
||||
u8string(const value_type* text, size_t count)
|
||||
: iu8string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
|
||||
@ -167,7 +162,6 @@ namespace etl
|
||||
u8string(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
|
||||
: iu8string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
|
||||
@ -178,7 +172,6 @@ namespace etl
|
||||
u8string(std::initializer_list<value_type> init)
|
||||
: iu8string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
@ -190,7 +183,6 @@ namespace etl
|
||||
explicit u8string(const etl::u8string_view& view)
|
||||
: iu8string(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
|
||||
@ -329,7 +321,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -347,7 +338,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -367,7 +357,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -389,7 +378,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -413,7 +401,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -433,8 +420,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -454,8 +440,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -473,7 +458,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -493,7 +477,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -512,7 +495,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -533,7 +515,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -577,7 +558,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -597,7 +577,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -618,7 +597,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -640,7 +618,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -652,7 +629,6 @@ namespace etl
|
||||
u8string_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
|
||||
: iu8string(buffer, buffer_size - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
|
||||
@ -665,7 +641,6 @@ namespace etl
|
||||
u8string_ext(std::initializer_list<value_type> init, value_type (&buffer)[BufferSize])
|
||||
: iu8string(buffer, BufferSize - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -89,7 +89,6 @@ namespace etl
|
||||
wstring(const etl::wstring<MAX_SIZE_>& other)
|
||||
: iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -100,7 +99,6 @@ namespace etl
|
||||
wstring(const etl::iwstring& other)
|
||||
: iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
|
||||
@ -115,7 +113,6 @@ namespace etl
|
||||
{
|
||||
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
|
||||
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
|
||||
@ -126,7 +123,6 @@ namespace etl
|
||||
ETL_EXPLICIT_STRING_FROM_CHAR wstring(const value_type* text)
|
||||
: iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text);
|
||||
}
|
||||
|
||||
@ -138,7 +134,6 @@ namespace etl
|
||||
wstring(const value_type* text, size_type count)
|
||||
: iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
|
||||
@ -164,7 +159,6 @@ namespace etl
|
||||
wstring(TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
|
||||
: iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
|
||||
@ -175,7 +169,6 @@ namespace etl
|
||||
wstring(std::initializer_list<value_type> init)
|
||||
: iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
@ -187,7 +180,6 @@ namespace etl
|
||||
explicit wstring(const etl::wstring_view& view)
|
||||
: iwstring(reinterpret_cast<value_type*>(&buffer), MAX_SIZE)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
|
||||
@ -309,7 +301,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -327,7 +318,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -347,7 +337,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other);
|
||||
}
|
||||
}
|
||||
@ -369,7 +358,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -393,7 +381,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(other, position, length);
|
||||
}
|
||||
}
|
||||
@ -413,8 +400,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,8 +420,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + etl::strlen(text));
|
||||
this->assign(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -453,7 +438,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -473,7 +457,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(literal);
|
||||
}
|
||||
}
|
||||
@ -492,7 +475,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -513,7 +495,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(text, text + count);
|
||||
}
|
||||
}
|
||||
@ -557,7 +538,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -577,7 +557,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(view.begin(), view.end());
|
||||
}
|
||||
}
|
||||
@ -598,7 +577,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -620,7 +598,6 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(first, last);
|
||||
}
|
||||
}
|
||||
@ -632,7 +609,6 @@ namespace etl
|
||||
wstring_ext(std::initializer_list<value_type> init, value_type* buffer, size_type buffer_size)
|
||||
: iwstring(buffer, buffer_size - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
|
||||
@ -645,7 +621,6 @@ namespace etl
|
||||
wstring_ext(std::initializer_list<value_type> init, value_type (&buffer)[BufferSize])
|
||||
: iwstring(buffer, BufferSize - 1U)
|
||||
{
|
||||
this->initialise();
|
||||
this->assign(init.begin(), init.end());
|
||||
}
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user