Merge remote-tracking branch 'origin/feature/refactor_type_traits' into development

This commit is contained in:
John Wellbelove 2020-01-10 14:09:54 +00:00
commit c2ddf72e65
256 changed files with 10627 additions and 8374 deletions

View File

@ -11,7 +11,7 @@
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6130001::V6.13.1::.\ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STM32F401RETx</Device>
@ -312,7 +312,7 @@
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>7</Optim>
<Optim>1</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
@ -321,7 +321,7 @@
<PlainCh>1</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>3</wLevel>
<wLevel>2</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>1</uC99>

File diff suppressed because it is too large Load Diff

View File

@ -35,9 +35,9 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "exception.h"
#include "type_traits.h"
@ -107,8 +107,8 @@ namespace etl
typedef const T* const_pointer;
typedef T* iterator;
typedef const T* const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
//*************************************************************************
// Element access
@ -342,7 +342,7 @@ namespace etl
//*************************************************************************
void fill(parameter_t value)
{
ETL_STD::fill(begin(), end(), value);
etl::fill(begin(), end(), value);
}
//*************************************************************************
@ -351,9 +351,11 @@ namespace etl
//*************************************************************************
void swap(array& other)
{
using ETL_OR_STD::swap; // Allow ADL
for (size_t i = 0; i < SIZE; ++i)
{
ETL_STD::swap(_buffer[i], other._buffer[i]);
swap(_buffer[i], other._buffer[i]);
}
}
@ -367,7 +369,7 @@ namespace etl
template <typename TIterator>
void assign(TIterator first, const TIterator last)
{
etl::copy(first, last, begin(), end());
etl::copy_s(first, last, begin(), end());
}
//*************************************************************************
@ -381,10 +383,10 @@ namespace etl
void assign(TIterator first, const TIterator last, parameter_t value)
{
// Copy from the range.
iterator p = etl::copy(first, last, begin(), end());
iterator p = etl::copy_s(first, last, begin(), end());
// Default initialise any that are left.
ETL_STD::fill(p, end(), value);
etl::fill(p, end(), value);
}
//*************************************************************************
@ -406,7 +408,7 @@ namespace etl
{
iterator p = const_cast<iterator>(position);
ETL_STD::copy_backward(p, end() - 1, end());
etl::copy_backward(p, end() - 1, end());
*p = value;
return p;
@ -436,18 +438,18 @@ namespace etl
iterator p = const_cast<iterator>(position);
iterator result(p);
size_t source_size = ETL_STD::distance(first, last);
size_t destination_space = ETL_STD::distance(position, cend());
size_t source_size = etl::distance(first, last);
size_t destination_space = etl::distance(position, cend());
// Do we need to move anything?
if (source_size < destination_space)
{
size_t length = SIZE - (ETL_STD::distance(begin(), p) + source_size);
ETL_STD::copy_backward(p, p + length, end());
size_t length = SIZE - (etl::distance(begin(), p) + source_size);
etl::copy_backward(p, p + length, end());
}
// Copy from the range.
etl::copy(first, last, p, end());
etl::copy_s(first, last, p, end());
return result;
}
@ -470,7 +472,7 @@ namespace etl
iterator erase(const_iterator position)
{
iterator p = const_cast<iterator>(position);
ETL_STD::copy(p + 1, end(), p);
etl::copy(p + 1, end(), p);
return p;
}
@ -495,7 +497,7 @@ namespace etl
iterator erase(const_iterator first, const_iterator last)
{
iterator p = const_cast<iterator>(first);
ETL_STD::copy(last, cend(), p);
etl::copy(last, cend(), p);
return p;
}
@ -518,7 +520,7 @@ namespace etl
{
iterator p = const_cast<iterator>(position);
ETL_STD::copy(p + 1, end(), p);
etl::copy(p + 1, end(), p);
back() = value;
return p;
@ -544,8 +546,8 @@ namespace etl
{
iterator p = const_cast<iterator>(first);
p = ETL_STD::copy(last, cend(), p);
ETL_STD::fill(p, end(), value);
p = etl::copy(last, cend(), p);
etl::fill(p, end(), value);
return const_cast<iterator>(first);
}
@ -574,7 +576,7 @@ namespace etl
template <typename T, size_t SIZE>
bool operator ==(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
{
return ETL_STD::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin());
return etl::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin());
}
//*************************************************************************
@ -598,7 +600,7 @@ namespace etl
template <typename T, size_t SIZE>
bool operator <(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.cbegin(),
return etl::lexicographical_compare(lhs.cbegin(),
lhs.cend(),
rhs.cbegin(),
rhs.cend());

View File

@ -40,7 +40,7 @@ SOFTWARE.
#include "hash.h"
#include "algorithm.h"
#include "stl/algorithm.h"
#include "algorithm.h"
///\defgroup array array
/// A wrapper for arrays
@ -108,8 +108,8 @@ namespace etl
typedef const T* const_pointer;
typedef T* iterator;
typedef const T* const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
//*************************************************************************
/// Default constructor.
@ -137,7 +137,7 @@ namespace etl
template <typename TIterator>
ETL_CONSTEXPR array_view(const TIterator begin_, const TIterator end_)
: mbegin(etl::addressof(*begin_)),
mend(etl::addressof(*begin_) + ETL_STD::distance(begin_, end_))
mend(etl::addressof(*begin_) + etl::distance(begin_, end_))
{
}
@ -356,7 +356,7 @@ namespace etl
void assign(const TIterator begin_, const TIterator end_)
{
mbegin = etl::addressof(*begin_);
mend = etl::addressof(*begin_) + ETL_STD::distance(begin_, end_);
mend = etl::addressof(*begin_) + etl::distance(begin_, end_);
}
//*************************************************************************
@ -411,8 +411,10 @@ namespace etl
//*************************************************************************
void swap(array_view& other)
{
ETL_STD::swap(mbegin, other.mbegin);
ETL_STD::swap(mend, other.mend);
using ETL_OR_STD::swap; // Allow ADL
swap(mbegin, other.mbegin);
swap(mend, other.mend);
}
//*************************************************************************
@ -437,7 +439,7 @@ namespace etl
friend bool operator == (const array_view<T>& lhs, const array_view<T>& rhs)
{
return (lhs.size() == rhs.size()) &&
ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
@ -453,7 +455,7 @@ namespace etl
//*************************************************************************
friend bool operator < (const array_view<T>& lhs, const array_view<T>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//*************************************************************************

View File

@ -93,8 +93,8 @@ namespace etl
typedef const T* const_pointer;
typedef T* iterator;
typedef const T* const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename etl::parameter_type<T>::type parameter_t;
@ -310,7 +310,7 @@ namespace etl
//*************************************************************************
void fill(parameter_t value)
{
ETL_STD::fill(begin(), end(), value);
etl::fill(begin(), end(), value);
}
//*************************************************************************
@ -320,9 +320,11 @@ namespace etl
typename etl::enable_if<etl::is_same<T, U>::value, void>::type
swap(etl::array_wrapper<U, SIZE_, ARRAYOTHER>& other)
{
using ETL_OR_STD::swap; // Allow ADL
for (size_t i = 0; i < SIZE; ++i)
{
ETL_STD::swap(ARRAY_[i], other.begin()[i]);
swap(ARRAY_[i], other.begin()[i]);
}
}
};
@ -334,7 +336,7 @@ namespace etl
bool operator == (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
return (SIZEL == SIZER) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (SIZEL == SIZER) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
@ -354,7 +356,7 @@ namespace etl
bool operator < (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//*************************************************************************

View File

@ -37,10 +37,9 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "char_traits.h"
#include "container.h"
#include "alignment.h"
@ -282,11 +281,11 @@ namespace etl
typedef const T* const_pointer;
typedef T* iterator;
typedef const T* const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef size_t size_type;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*********************************************************************
/// Returns an iterator to the beginning of the string.
@ -418,12 +417,12 @@ namespace etl
is_truncated = true;
}
new_size = ETL_STD::min(new_size, CAPACITY);
new_size = etl::min(new_size, CAPACITY);
// Size up?
if (new_size > current_size)
{
ETL_STD::fill(p_buffer + current_size, p_buffer + new_size, value);
etl::fill(p_buffer + current_size, p_buffer + new_size, value);
}
current_size = new_size;
@ -596,7 +595,7 @@ namespace etl
is_truncated = (length_ > CAPACITY);
length_ = ETL_STD::min(length_, CAPACITY);
length_ = etl::min(length_, CAPACITY);
etl::copy_n(other, length_, begin());
@ -615,7 +614,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d >= 0, ETL_ERROR(string_iterator));
#endif
@ -643,9 +642,9 @@ namespace etl
is_truncated = (n > CAPACITY);
n = ETL_STD::min(n, CAPACITY);
n = etl::min(n, CAPACITY);
ETL_STD::fill_n(begin(), n, value);
etl::fill_n(begin(), n, value);
current_size = n;
p_buffer[current_size] = 0;
}
@ -780,7 +779,7 @@ namespace etl
{
// Insert in the middle.
++current_size;
ETL_STD::copy_backward(insert_position, end() - 1, end());
etl::copy_backward(insert_position, end() - 1, end());
*insert_position = value;
}
else
@ -796,7 +795,7 @@ namespace etl
if (position != end())
{
// Insert in the middle.
ETL_STD::copy_backward(insert_position, end() - 1, end());
etl::copy_backward(insert_position, end() - 1, end());
*insert_position = value;
}
@ -823,7 +822,7 @@ namespace etl
// Quick hack, as iterators are pointers.
iterator insert_position = const_cast<iterator>(position);
const size_t start = ETL_STD::distance(cbegin(), position);
const size_t start = etl::distance(cbegin(), position);
// No effect.
if (start >= CAPACITY)
@ -841,7 +840,7 @@ namespace etl
}
current_size = CAPACITY;
ETL_STD::fill(insert_position, end(), value);
etl::fill(insert_position, end(), value);
}
else
{
@ -850,7 +849,7 @@ namespace etl
const size_t to_position = start + shift_amount;
const size_t remaining_characters = current_size - start;
const size_t max_shift_characters = CAPACITY - start - shift_amount;
const size_t characters_to_shift = ETL_STD::min(max_shift_characters, remaining_characters);
const size_t characters_to_shift = etl::min(max_shift_characters, remaining_characters);
// Will the string truncate?
if ((start + shift_amount + remaining_characters) > CAPACITY)
@ -863,8 +862,8 @@ namespace etl
current_size += shift_amount;
}
ETL_STD::copy_backward(insert_position, insert_position + characters_to_shift, begin() + to_position + characters_to_shift);
ETL_STD::fill(insert_position, insert_position + shift_amount, value);
etl::copy_backward(insert_position, insert_position + characters_to_shift, begin() + to_position + characters_to_shift);
etl::fill(insert_position, insert_position + shift_amount, value);
}
p_buffer[current_size] = 0;
@ -885,8 +884,8 @@ namespace etl
return;
}
const size_t start = ETL_STD::distance(begin(), position);
const size_t n = ETL_STD::distance(first, last);
const size_t start = etl::distance(begin(), position);
const size_t n = etl::distance(first, last);
// No effect.
if (start >= CAPACITY)
@ -917,7 +916,7 @@ namespace etl
const size_t to_position = start + shift_amount;
const size_t remaining_characters = current_size - start;
const size_t max_shift_characters = CAPACITY - start - shift_amount;
const size_t characters_to_shift = ETL_STD::min(max_shift_characters, remaining_characters);
const size_t characters_to_shift = etl::min(max_shift_characters, remaining_characters);
// Will the string truncate?
if ((start + shift_amount + remaining_characters) > CAPACITY)
@ -930,7 +929,7 @@ namespace etl
current_size += shift_amount;
}
ETL_STD::copy_backward(position, position + characters_to_shift, begin() + to_position + characters_to_shift);
etl::copy_backward(position, position + characters_to_shift, begin() + to_position + characters_to_shift);
while (first != last)
{
@ -1037,7 +1036,7 @@ namespace etl
etl::ibasic_string<T>& erase(size_t position, size_t length_ = npos)
{
// Limit the length.
length_ = ETL_STD::min(length_, size() - position);
length_ = etl::min(length_, size() - position);
erase(begin() + position, begin() + position + length_);
@ -1051,7 +1050,7 @@ namespace etl
//*********************************************************************
iterator erase(iterator i_element)
{
ETL_STD::copy(i_element + 1, end(), i_element);
etl::copy(i_element + 1, end(), i_element);
p_buffer[--current_size] = 0;
return i_element;
@ -1067,8 +1066,8 @@ namespace etl
//*********************************************************************
iterator erase(iterator first, iterator last)
{
ETL_STD::copy(last, end(), first);
size_t n_delete = ETL_STD::distance(first, last);
etl::copy(last, end(), first);
size_t n_delete = etl::distance(first, last);
current_size -= n_delete;
p_buffer[current_size] = 0;
@ -1098,7 +1097,7 @@ namespace etl
is_truncated = true;
}
size_t endpos = ETL_STD::min(pos + len, size());
size_t endpos = etl::min(pos + len, size());
for (size_t i = pos; i < endpos; ++i)
{
@ -1120,7 +1119,7 @@ namespace etl
return npos;
}
const_iterator iposition = ETL_STD::search(begin() + pos, end(), str.begin(), str.end());
const_iterator iposition = etl::search(begin() + pos, end(), str.begin(), str.end());
if (iposition == end())
{
@ -1128,7 +1127,7 @@ namespace etl
}
else
{
return ETL_STD::distance(begin(), iposition);
return etl::distance(begin(), iposition);
}
}
@ -1146,7 +1145,7 @@ namespace etl
}
#endif
const_iterator iposition = ETL_STD::search(begin() + pos, end(), s, s + etl::strlen(s));
const_iterator iposition = etl::search(begin() + pos, end(), s, s + etl::strlen(s));
if (iposition == end())
{
@ -1154,7 +1153,7 @@ namespace etl
}
else
{
return ETL_STD::distance(begin(), iposition);
return etl::distance(begin(), iposition);
}
}
@ -1173,7 +1172,7 @@ namespace etl
}
#endif
const_iterator iposition = ETL_STD::search(begin() + pos, end(), s, s + n);
const_iterator iposition = etl::search(begin() + pos, end(), s, s + n);
if (iposition == end())
{
@ -1181,7 +1180,7 @@ namespace etl
}
else
{
return ETL_STD::distance(begin(), iposition);
return etl::distance(begin(), iposition);
}
}
@ -1192,11 +1191,11 @@ namespace etl
//*********************************************************************
size_t find(T c, size_t position = 0) const
{
const_iterator i = ETL_STD::find(begin() + position, end(), c);
const_iterator i = etl::find(begin() + position, end(), c);
if (i != end())
{
return ETL_STD::distance(begin(), i);
return etl::distance(begin(), i);
}
else
{
@ -1223,7 +1222,7 @@ namespace etl
position = size() - position;
const_reverse_iterator iposition = ETL_STD::search(rbegin() + position, rend(), str.rbegin(), str.rend());
const_reverse_iterator iposition = etl::search(rbegin() + position, rend(), str.rbegin(), str.rend());
if (iposition == rend())
{
@ -1231,7 +1230,7 @@ namespace etl
}
else
{
return size() - str.size() - ETL_STD::distance(rbegin(), iposition);
return size() - str.size() - etl::distance(rbegin(), iposition);
}
}
@ -1259,7 +1258,7 @@ namespace etl
const_reverse_iterator srbegin(s + len);
const_reverse_iterator srend(s);
const_reverse_iterator iposition = ETL_STD::search(rbegin() + position, rend(), srbegin, srend);
const_reverse_iterator iposition = etl::search(rbegin() + position, rend(), srbegin, srend);
if (iposition == rend())
{
@ -1267,7 +1266,7 @@ namespace etl
}
else
{
return size() - len - ETL_STD::distance(rbegin(), iposition);
return size() - len - etl::distance(rbegin(), iposition);
}
}
@ -1293,7 +1292,7 @@ namespace etl
const_reverse_iterator srbegin(s + length_);
const_reverse_iterator srend(s);
const_reverse_iterator iposition = ETL_STD::search(rbegin() + position, rend(), srbegin, srend);
const_reverse_iterator iposition = etl::search(rbegin() + position, rend(), srbegin, srend);
if (iposition == rend())
{
@ -1301,7 +1300,7 @@ namespace etl
}
else
{
return size() - length_ - ETL_STD::distance(rbegin(), iposition);
return size() - length_ - etl::distance(rbegin(), iposition);
}
}
@ -1319,11 +1318,11 @@ namespace etl
position = size() - position;
const_reverse_iterator i = ETL_STD::find(rbegin() + position, rend(), c);
const_reverse_iterator i = etl::find(rbegin() + position, rend(), c);
if (i != rend())
{
return size() - ETL_STD::distance(rbegin(), i) - 1;
return size() - etl::distance(rbegin(), i) - 1;
}
else
{
@ -1342,7 +1341,7 @@ namespace etl
ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds));
// Limit the length.
length_ = ETL_STD::min(length_, size() - position);
length_ = etl::min(length_, size() - position);
// Erase the bit we want to replace.
erase(position, length_);
@ -1388,8 +1387,8 @@ namespace etl
ETL_ASSERT(subposition <= str.size(), ETL_ERROR(string_out_of_bounds));
// Limit the lengths.
length_ = ETL_STD::min(length_, size() - position);
sublength = ETL_STD::min(sublength, str.size() - subposition);
length_ = etl::min(length_, size() - position);
sublength = etl::min(sublength, str.size() - subposition);
// Erase the bit we want to replace.
erase(position, length_);
@ -1413,7 +1412,7 @@ namespace etl
ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds));
// Limit the length.
length_ = ETL_STD::min(length_, size() - position);
length_ = etl::min(length_, size() - position);
// Erase the bit we want to replace.
erase(position, length_);
@ -1450,7 +1449,7 @@ namespace etl
ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds));
// Limit the length.
length_ = ETL_STD::min(length_, size() - position);
length_ = etl::min(length_, size() - position);
// Erase the bit we want to replace.
erase(position, length_);
@ -1487,7 +1486,7 @@ namespace etl
ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds));
// Limit the length.
length_ = ETL_STD::min(length_, size() - position);
length_ = etl::min(length_, size() - position);
// Erase the bit we want to replace.
erase(position, length_);
@ -1554,7 +1553,7 @@ namespace etl
ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds));
// Limit the length.
length_ = ETL_STD::min(length_, size() - position);
length_ = etl::min(length_, size() - position);
return compare(p_buffer + position,
p_buffer + position + length_,
@ -1571,8 +1570,8 @@ namespace etl
ETL_ASSERT(subposition <= str.size(), ETL_ERROR(string_out_of_bounds));
// Limit the lengths.
length_ = ETL_STD::min(length_, size() - position);
sublength = ETL_STD::min(sublength, str.size() - subposition);
length_ = etl::min(length_, size() - position);
sublength = etl::min(sublength, str.size() - subposition);
return compare(p_buffer + position,
p_buffer + position + length_,
@ -1712,7 +1711,7 @@ namespace etl
return npos;
}
position = ETL_STD::min(position, size() - 1);
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
@ -1745,7 +1744,7 @@ namespace etl
return npos;
}
position = ETL_STD::min(position, size() - 1);
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
@ -1869,7 +1868,7 @@ namespace etl
return npos;
}
position = ETL_STD::min(position, size() - 1);
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
@ -1907,7 +1906,7 @@ namespace etl
return npos;
}
position = ETL_STD::min(position, size() - 1);
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
@ -2106,7 +2105,7 @@ namespace etl
template <typename T>
bool operator ==(const etl::ibasic_string<T>& lhs, const etl::ibasic_string<T>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -2119,7 +2118,7 @@ namespace etl
template <typename T>
bool operator ==(const etl::ibasic_string<T>& lhs, const T* rhs)
{
return (lhs.size() == etl::strlen(rhs)) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs);
return (lhs.size() == etl::strlen(rhs)) && etl::equal(lhs.begin(), lhs.end(), rhs);
}
//***************************************************************************
@ -2132,7 +2131,7 @@ namespace etl
template <typename T>
bool operator ==(const T* lhs, const etl::ibasic_string<T>& rhs)
{
return (rhs.size() == etl::strlen(lhs)) && ETL_STD::equal(rhs.begin(), rhs.end(), lhs);
return (rhs.size() == etl::strlen(lhs)) && etl::equal(rhs.begin(), rhs.end(), lhs);
}
@ -2185,7 +2184,7 @@ namespace etl
template <typename T>
bool operator <(const etl::ibasic_string<T>& lhs, const etl::ibasic_string<T>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//***************************************************************************
@ -2198,7 +2197,7 @@ namespace etl
template <typename T>
bool operator <(const etl::ibasic_string<T>& lhs, const T* rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs, rhs + etl::strlen(rhs));
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs, rhs + etl::strlen(rhs));
}
//***************************************************************************
@ -2211,7 +2210,7 @@ namespace etl
template <typename T>
bool operator <(const T* lhs, const etl::ibasic_string<T>& rhs)
{
return ETL_STD::lexicographical_compare(lhs, lhs + etl::strlen(lhs), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs, lhs + etl::strlen(lhs), rhs.begin(), rhs.end());
}

View File

@ -45,7 +45,7 @@ SOFTWARE.
#include "exception.h"
#include "error_handler.h"
#include "stl/limits.h"
#include "limits.h"
#undef ETL_FILE
#define ETL_FILE "50"
@ -238,7 +238,7 @@ namespace etl
ETL_STATIC_ASSERT(etl::is_integral<TValue>::value, "TValue not an integral type");
ETL_STATIC_ASSERT(etl::is_integral<TReturn>::value, "TReturn not an integral type");
ETL_STATIC_ASSERT(etl::is_signed<TReturn>::value, "TReturn not a signed type");
ETL_STATIC_ASSERT(NBITS <= ETL_STD::numeric_limits<TReturn>::digits, "NBITS too large for return type");
ETL_STATIC_ASSERT(NBITS <= etl::numeric_limits<TReturn>::digits, "NBITS too large for return type");
struct S
{
@ -260,8 +260,8 @@ namespace etl
ETL_STATIC_ASSERT(etl::is_integral<TValue>::value, "TValue not an integral type");
ETL_STATIC_ASSERT(etl::is_integral<TReturn>::value, "TReturn not an integral type");
ETL_STATIC_ASSERT(etl::is_signed<TReturn>::value, "TReturn not a signed type");
ETL_STATIC_ASSERT(NBITS <= ETL_STD::numeric_limits<TReturn>::digits, "NBITS too large for return type");
ETL_STATIC_ASSERT(SHIFT <= ETL_STD::numeric_limits<TReturn>::digits, "SHIFT too large");
ETL_STATIC_ASSERT(NBITS <= etl::numeric_limits<TReturn>::digits, "NBITS too large for return type");
ETL_STATIC_ASSERT(SHIFT <= etl::numeric_limits<TReturn>::digits, "SHIFT too large");
struct S
{
@ -283,7 +283,7 @@ namespace etl
ETL_STATIC_ASSERT(etl::is_integral<TReturn>::value, "TReturn not an integral type");
ETL_STATIC_ASSERT(etl::is_signed<TReturn>::value, "TReturn not a signed type");
ETL_ASSERT((NBITS <= ETL_STD::numeric_limits<TReturn>::digits), ETL_ERROR(binary_out_of_range));
ETL_ASSERT((NBITS <= etl::numeric_limits<TReturn>::digits), ETL_ERROR(binary_out_of_range));
TReturn mask = TReturn(1) << (NBITS - 1);
value = value & static_cast<TValue>((TReturn(1) << NBITS) - 1);
@ -304,7 +304,7 @@ namespace etl
ETL_STATIC_ASSERT(etl::is_integral<TReturn>::value, "TReturn not an integral type");
ETL_STATIC_ASSERT(etl::is_signed<TReturn>::value, "TReturn not a signed type");
ETL_ASSERT((NBITS <= ETL_STD::numeric_limits<TReturn>::digits), ETL_ERROR(binary_out_of_range));
ETL_ASSERT((NBITS <= etl::numeric_limits<TReturn>::digits), ETL_ERROR(binary_out_of_range));
TReturn mask = TReturn(1) << (NBITS - 1);
value = (value >> SHIFT) & static_cast<TValue>((TReturn(1) << NBITS) - 1);

View File

@ -35,9 +35,8 @@ SOFTWARE.
#include "etl/endianness.h"
#include "etl/integral_limits.h"
#include "etl/binary.h"
#include "etl/stl/algorithm.h"
#include "etl/stl/iterator.h"
#include "etl/algorithm.h"
#include "etl/iterator.h"
#include "private/minmax_push.h"
@ -68,7 +67,7 @@ namespace etl
//***************************************************************************
bit_stream(char* begin_, char* end_)
: pdata(reinterpret_cast<unsigned char*>(begin_)),
length(ETL_STD::distance(begin_, end_))
length(etl::distance(begin_, end_))
{
restart();
}
@ -78,7 +77,7 @@ namespace etl
//***************************************************************************
bit_stream(unsigned char* begin_, unsigned char* end_)
: pdata(begin_),
length(ETL_STD::distance(begin_, end_))
length(etl::distance(begin_, end_))
{
restart();
}
@ -128,7 +127,7 @@ namespace etl
//***************************************************************************
void set_stream(char* begin_, char* end_)
{
set_stream(begin_, ETL_STD::distance(begin_, end_));
set_stream(begin_, etl::distance(begin_, end_));
}
//***************************************************************************
@ -136,7 +135,7 @@ namespace etl
//***************************************************************************
void set_stream(unsigned char* begin_, unsigned char* end_)
{
set_stream(begin_, ETL_STD::distance(begin_, end_));
set_stream(begin_, etl::distance(begin_, end_));
}
//***************************************************************************
@ -266,7 +265,7 @@ namespace etl
// Get the bits from the stream.
while (width != 0)
{
unsigned char mask_width = static_cast<unsigned char>(ETL_STD::min(width, bits_in_byte));
unsigned char mask_width = static_cast<unsigned char>(etl::min(width, bits_in_byte));
unsigned char chunk = get_chunk(mask_width);
width -= mask_width;
@ -379,7 +378,7 @@ namespace etl
// Send the bits to the stream.
while (width != 0)
{
unsigned char mask_width = static_cast<unsigned char>(ETL_STD::min(width, bits_in_byte));
unsigned char mask_width = static_cast<unsigned char>(etl::min(width, bits_in_byte));
width -= mask_width;
uint32_t mask = ((uint32_t(1U) << mask_width) - 1U) << width;
@ -412,7 +411,7 @@ namespace etl
// Send the bits to the stream.
while (width != 0)
{
unsigned char mask_width = static_cast<unsigned char>(ETL_STD::min(width, bits_in_byte));
unsigned char mask_width = static_cast<unsigned char>(etl::min(width, bits_in_byte));
width -= mask_width;
uint64_t mask = ((uint64_t(1U) << mask_width) - 1U) << width;
@ -495,11 +494,11 @@ namespace etl
// Network to host.
if (etl::endianness::value() == etl::endian::little)
{
ETL_STD::reverse_copy(data, data + sizeof(T), temp);
etl::reverse_copy(data, data + sizeof(T), temp);
}
else
{
ETL_STD::copy(data, data + sizeof(T), temp);
etl::copy(data, data + sizeof(T), temp);
}
value = *reinterpret_cast<T*>(temp);
@ -516,11 +515,11 @@ namespace etl
// Host to network.
if (etl::endianness::value() == etl::endian::little)
{
ETL_STD::reverse_copy(pf, pf + sizeof(T), data);
etl::reverse_copy(pf, pf + sizeof(T), data);
}
else
{
ETL_STD::copy(pf, pf + sizeof(T), data);
etl::copy(pf, pf + sizeof(T), data);
}
}

View File

@ -37,8 +37,8 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "algorithm.h"
#include "iterator.h"
#include "integral_limits.h"
#include "algorithm.h"
@ -312,7 +312,7 @@ namespace etl
{
reset();
size_t i = ETL_STD::min(NBITS, etl::strlen(text));
size_t i = etl::min(NBITS, etl::strlen(text));
while (i > 0)
{
@ -329,7 +329,7 @@ namespace etl
{
reset();
size_t i = ETL_STD::min(NBITS, etl::strlen(text));
size_t i = etl::min(NBITS, etl::strlen(text));
while (i > 0)
{
@ -346,7 +346,7 @@ namespace etl
{
reset();
size_t i = ETL_STD::min(NBITS, etl::strlen(text));
size_t i = etl::min(NBITS, etl::strlen(text));
while (i > 0)
{
@ -363,7 +363,7 @@ namespace etl
{
reset();
size_t i = ETL_STD::min(NBITS, etl::strlen(text));
size_t i = etl::min(NBITS, etl::strlen(text));
while (i > 0)
{
@ -380,7 +380,7 @@ namespace etl
{
reset();
size_t i = ETL_STD::min(NBITS, etl::strlen(text));
size_t i = etl::min(NBITS, etl::strlen(text));
while (i > 0)
{
@ -746,7 +746,7 @@ namespace etl
//*************************************************************************
void swap(ibitset& other)
{
ETL_STD::swap_ranges(pdata, pdata + SIZE, other.pdata);
etl::swap_ranges(pdata, pdata + SIZE, other.pdata);
}
protected:
@ -818,7 +818,7 @@ namespace etl
//*************************************************************************
static bool is_equal(const ibitset& lhs, const ibitset&rhs)
{
return ETL_STD::equal(lhs.pdata, lhs.pdata + lhs.SIZE, rhs.pdata);
return etl::equal(lhs.pdata, lhs.pdata + lhs.SIZE, rhs.pdata);
}
element_t TOP_MASK;

View File

@ -31,12 +31,11 @@ SOFTWARE.
#ifndef ETL_CHAR_TRAITS_INCLUDED
#define ETL_CHAR_TRAITS_INCLUDED
#include "platform.h"
#include "stdint.h"
#include "algorithm.h"
#include <stdint.h>
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "platform.h"
#include "algorithm.h"
#include "iterator.h"
//*****************************************************************************
///\defgroup char_traits char_traits
@ -141,7 +140,7 @@ namespace etl
{
if (p != 0)
{
ETL_STD::fill_n(p, n, c);
etl::fill_n(p, n, c);
}
return p;
@ -156,9 +155,9 @@ namespace etl
}
else
{
etl::copy_n(ETL_STD::reverse_iterator<char_type*>(src + count),
etl::copy_n(ETL_OR_STD::reverse_iterator<char_type*>(src + count),
count,
ETL_STD::reverse_iterator<char_type*>(dest + count));
ETL_OR_STD::reverse_iterator<char_type*>(dest + count));
}
return dest;

View File

@ -33,8 +33,7 @@ SOFTWARE.
#include "platform.h"
#include "parameter_type.h"
#include "stl/functional.h"
#include "functional.h"
//*****************************************************************************
///\defgroup compare compare
@ -48,7 +47,7 @@ namespace etl
/// Defines <=, >, >= interms of <
/// Default
//***************************************************************************
template <typename T, typename TLess = ETL_STD::less<T> >
template <typename T, typename TLess = etl::less<T> >
struct compare
{
typedef typename etl::parameter_type<T>::type first_argument_type;

View File

@ -34,8 +34,7 @@ SOFTWARE.
#include <stddef.h>
#include "platform.h"
#include "stl/iterator.h"
#include "iterator.h"
///\defgroup container container
///\ingroup utilities
@ -177,9 +176,9 @@ namespace etl
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_STD::reverse_iterator<TValue*> rbegin(const TValue(&data)[ARRAY_SIZE])
ETL_OR_STD::reverse_iterator<TValue*> rbegin(const TValue(&data)[ARRAY_SIZE])
{
return ETL_STD::reverse_iterator<TValue*>(&data[ARRAY_SIZE]);
return ETL_OR_STD::reverse_iterator<TValue*>(&data[ARRAY_SIZE]);
}
//*****************************************************************************
@ -187,9 +186,9 @@ namespace etl
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_STD::reverse_iterator<const TValue*> crbegin(const TValue(&data)[ARRAY_SIZE])
ETL_CONSTEXPR ETL_OR_STD::reverse_iterator<const TValue*> crbegin(const TValue(&data)[ARRAY_SIZE])
{
return ETL_STD::reverse_iterator<const TValue*>(&data[ARRAY_SIZE]);
return ETL_OR_STD::reverse_iterator<const TValue*>(&data[ARRAY_SIZE]);
}
//*****************************************************************************
@ -227,9 +226,9 @@ namespace etl
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_STD::reverse_iterator<TValue*> rend(const TValue(&data)[ARRAY_SIZE])
ETL_CONSTEXPR ETL_OR_STD::reverse_iterator<TValue*> rend(const TValue(&data)[ARRAY_SIZE])
{
return ETL_STD::reverse_iterator<TValue*>(&data[0]);
return ETL_OR_STD::reverse_iterator<TValue*>(&data[0]);
}
//*****************************************************************************
@ -237,31 +236,9 @@ namespace etl
///\ingroup container
//*****************************************************************************
template<typename TValue, const size_t ARRAY_SIZE>
ETL_CONSTEXPR ETL_STD::reverse_iterator<const TValue*> crend(const TValue(&data)[ARRAY_SIZE])
ETL_CONSTEXPR ETL_OR_STD::reverse_iterator<const TValue*> crend(const TValue(&data)[ARRAY_SIZE])
{
return ETL_STD::reverse_iterator<const TValue*>(&data[0]);
}
//*****************************************************************************
/// Get the next iterator.
///\ingroup container
//*****************************************************************************
template<class TIterator>
TIterator next(TIterator iterator, ptrdiff_t n = 1)
{
ETL_STD::advance(iterator, n);
return iterator;
}
//*****************************************************************************
/// Get the previous iterator.
///\ingroup container
//*****************************************************************************
template<class TIterator>
TIterator prev(TIterator iterator, ptrdiff_t n = 1)
{
ETL_STD::advance(iterator, -n);
return iterator;
return ETL_OR_STD::reverse_iterator<const TValue*>(&data[0]);
}
///**************************************************************************
@ -296,7 +273,7 @@ namespace etl
char(&array_size(T(&array)[ARRAY_SIZE]))[ARRAY_SIZE];
}
#if ETL_CPP11_SUPPORTED
#if ETL_CPP11_SUPPORTED && !defined(ETL_FORCE_NO_ADVANCED_CPP)
#define ETL_ARRAY_SIZE(a) (etl::size(a))
#else
#define ETL_ARRAY_SIZE(a) sizeof(etl::array_size(a))

View File

@ -191,7 +191,7 @@ namespace etl
{
ETL_ASSERT(position < this->size(), ETL_ERROR(string_out_of_bounds));
length_ = ETL_STD::min(length_, this->size() - position);
length_ = etl::min(length_, this->size() - position);
new_string.assign(buffer + position, buffer + position + length_);
}

View File

@ -43,7 +43,7 @@ SOFTWARE.
#include "static_assert.h"
#include "type_traits.h"
#include "stl/algorithm.h"
#include "algorithm.h"
namespace etl
{
@ -257,7 +257,9 @@ namespace etl
//*************************************************************************
void swap(cyclic_value<T, FIRST, LAST>& other)
{
ETL_STD::swap(value, other.value);
using ETL_OR_STD::swap; // Allow ADL
swap(value, other.value);
}
//*************************************************************************
@ -531,9 +533,11 @@ namespace etl
//*************************************************************************
void swap(cyclic_value<T, FIRST, LAST>& other)
{
ETL_STD::swap(first_value, other.first_value);
ETL_STD::swap(last_value, other.last_value);
ETL_STD::swap(value, other.value);
using ETL_OR_STD::swap; // Allow ADL
swap(first_value, other.first_value);
swap(last_value, other.last_value);
swap(value, other.value);
}
//*************************************************************************

View File

@ -38,9 +38,9 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/utility.h"
#include "algorithm.h"
#include "iterator.h"
#include "utility.h"
#include "container.h"
#include "alignment.h"
@ -239,7 +239,7 @@ namespace etl
#endif
typedef T* pointer;
typedef const T* const_pointer;
typedef typename ETL_STD::iterator_traits<pointer>::difference_type difference_type;
typedef typename etl::iterator_traits<pointer>::difference_type difference_type;
protected:
@ -256,7 +256,7 @@ namespace etl
//*************************************************************************
/// Iterator
//*************************************************************************
struct iterator : public etl::iterator<ETL_RANDOM_ACCESS_ITERATOR_TAG, T>
struct iterator : public etl::iterator<ETL_OR_STD::random_access_iterator_tag, T>
{
friend class ideque;
@ -421,7 +421,9 @@ namespace etl
//***************************************************
void swap(iterator& other)
{
ETL_STD::swap(index, other.index);
using ETL_OR_STD::swap; // Allow ADL
swap(index, other.index);
}
private:
@ -442,7 +444,7 @@ namespace etl
//*************************************************************************
/// Const Iterator
//*************************************************************************
struct const_iterator : public etl::iterator<ETL_RANDOM_ACCESS_ITERATOR_TAG, const T>
struct const_iterator : public etl::iterator<ETL_OR_STD::random_access_iterator_tag, const T>
{
friend class ideque;
@ -603,7 +605,7 @@ namespace etl
//***************************************************
void swap(const_iterator& other)
{
ETL_STD::swap(index, other.index);
swap(index, other.index);
}
private:
@ -634,8 +636,8 @@ namespace etl
pointer p_buffer;
};
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
//*************************************************************************
/// Assigns a range to the deque.
@ -893,13 +895,13 @@ namespace etl
else
{
// Are we closer to the front?
if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1))
if (etl::distance(_begin, position) < etl::distance(position, _end - 1))
{
// Construct the _begin.
create_element_front(*_begin);
// Move the values.
ETL_STD::copy(_begin + 1, position, _begin);
etl::copy(_begin + 1, position, _begin);
// Write the new value.
*--position = value;
@ -910,7 +912,7 @@ namespace etl
create_element_back(*(_end - 1));
// Move the values.
ETL_STD::copy_backward(position, _end - 2, _end - 1);
etl::copy_backward(position, _end - 2, _end - 1);
// Write the new value.
*position = value;
@ -935,38 +937,38 @@ namespace etl
if (insert_position == begin())
{
create_element_front(ETL_STD::move(value));
create_element_front(etl::move(value));
position = _begin;
}
else if (insert_position == end())
{
create_element_back(ETL_STD::move(value));
create_element_back(etl::move(value));
position = _end - 1;
}
else
{
// Are we closer to the front?
if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1))
if (etl::distance(_begin, position) < etl::distance(position, _end - 1))
{
// Construct the _begin.
create_element_front(ETL_STD::move(*_begin));
create_element_front(etl::move(*_begin));
// Move the values.
ETL_STD::move(_begin + 1, position, _begin);
etl::move(_begin + 1, position, _begin);
// Write the new value.
*--position = ETL_STD::move(value);
*--position = etl::move(value);
}
else
{
// Construct the _end.
create_element_back(ETL_STD::move(*(_end - 1)));
create_element_back(etl::move(*(_end - 1)));
// Move the values.
ETL_STD::move_backward(position, _end - 2, _end - 1);
etl::move_backward(position, _end - 2, _end - 1);
// Write the new value.
*position = ETL_STD::move(value);
*position = etl::move(value);
}
}
@ -1008,13 +1010,13 @@ namespace etl
else
{
// Are we closer to the front?
if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1))
if (etl::distance(_begin, position) < etl::distance(position, _end - 1))
{
// Construct the _begin.
create_element_front(*_begin);
// Move the values.
ETL_STD::copy(_begin + 1, position, _begin);
etl::copy(_begin + 1, position, _begin);
// Write the new value.
--position;
@ -1027,7 +1029,7 @@ namespace etl
create_element_back(*(_end - 1));
// Move the values.
ETL_STD::copy_backward(position, _end - 2, _end - 1);
etl::copy_backward(position, _end - 2, _end - 1);
// Write the new value.
(*position).~T();
@ -1035,7 +1037,7 @@ namespace etl
}
}
::new (p) T(ETL_STD::forward<Args>(args)...);
::new (p) T(etl::forward<Args>(args)...);
return position;
}
@ -1075,13 +1077,13 @@ namespace etl
else
{
// Are we closer to the front?
if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1))
if (etl::distance(_begin, position) < etl::distance(position, _end - 1))
{
// Construct the _begin.
create_element_front(*_begin);
// Move the values.
ETL_STD::copy(_begin + 1, position, _begin);
etl::copy(_begin + 1, position, _begin);
// Write the new value.
--position;
@ -1094,7 +1096,7 @@ namespace etl
create_element_back(*(_end - 1));
// Move the values.
ETL_STD::copy_backward(position, _end - 2, _end - 1);
etl::copy_backward(position, _end - 2, _end - 1);
// Write the new value.
(*position).~T();
@ -1140,13 +1142,13 @@ namespace etl
else
{
// Are we closer to the front?
if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1))
if (etl::distance(_begin, position) < etl::distance(position, _end - 1))
{
// Construct the _begin.
create_element_front(*_begin);
// Move the values.
ETL_STD::copy(_begin + 1, position, _begin);
etl::copy(_begin + 1, position, _begin);
// Write the new value.
--position;
@ -1159,7 +1161,7 @@ namespace etl
create_element_back(*(_end - 1));
// Move the values.
ETL_STD::copy_backward(position, _end - 2, _end - 1);
etl::copy_backward(position, _end - 2, _end - 1);
// Write the new value.
(*position).~T();
@ -1205,13 +1207,13 @@ namespace etl
else
{
// Are we closer to the front?
if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1))
if (etl::distance(_begin, position) < etl::distance(position, _end - 1))
{
// Construct the _begin.
create_element_front(*_begin);
// Move the values.
ETL_STD::copy(_begin + 1, position, _begin);
etl::copy(_begin + 1, position, _begin);
// Write the new value.
--position;
@ -1224,7 +1226,7 @@ namespace etl
create_element_back(*(_end - 1));
// Move the values.
ETL_STD::copy_backward(position, _end - 2, _end - 1);
etl::copy_backward(position, _end - 2, _end - 1);
// Write the new value.
(*position).~T();
@ -1270,13 +1272,13 @@ namespace etl
else
{
// Are we closer to the front?
if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1))
if (etl::distance(_begin, position) < etl::distance(position, _end - 1))
{
// Construct the _begin.
create_element_front(*_begin);
// Move the values.
ETL_STD::copy(_begin + 1, position, _begin);
etl::copy(_begin + 1, position, _begin);
// Write the new value.
--position;
@ -1289,7 +1291,7 @@ namespace etl
create_element_back(*(_end - 1));
// Move the values.
ETL_STD::copy_backward(position, _end - 2, _end - 1);
etl::copy_backward(position, _end - 2, _end - 1);
// Write the new value.
(*position).~T();
@ -1343,8 +1345,8 @@ namespace etl
if (distance(_begin, insert_position) <= difference_type(current_size / 2))
{
size_t n_insert = n;
size_t n_move = ETL_STD::distance(begin(), position);
size_t n_create_copy = ETL_STD::min(n_insert, n_move);
size_t n_move = etl::distance(begin(), position);
size_t n_create_copy = etl::min(n_insert, n_move);
size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0;
size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0;
size_t n_copy_old = n_move - n_create_copy;
@ -1372,15 +1374,15 @@ namespace etl
// Copy new.
to = position - n_create_copy;
ETL_STD::fill_n(to, n_copy_new, value);
etl::fill_n(to, n_copy_new, value);
position = _begin + n_move;
}
else
{
size_t n_insert = n;
size_t n_move = ETL_STD::distance(position, end());
size_t n_create_copy = ETL_STD::min(n_insert, n_move);
size_t n_move = etl::distance(position, end());
size_t n_create_copy = etl::min(n_insert, n_move);
size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0;
size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0;
size_t n_copy_old = n_move - n_create_copy;
@ -1400,10 +1402,10 @@ namespace etl
}
// Copy old.
ETL_STD::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old);
etl::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old);
// Copy new.
ETL_STD::fill_n(position, n_copy_new, value);
etl::fill_n(position, n_copy_new, value);
}
}
@ -1423,7 +1425,7 @@ namespace etl
{
iterator position;
difference_type n = ETL_STD::distance(range_begin, range_end);
difference_type n = etl::distance(range_begin, range_end);
ETL_ASSERT((current_size + n) <= CAPACITY, ETL_ERROR(deque_full));
@ -1451,8 +1453,8 @@ namespace etl
if (distance(_begin, insert_position) < difference_type(current_size / 2))
{
size_t n_insert = n;
size_t n_move = ETL_STD::distance(begin(), position);
size_t n_create_copy = ETL_STD::min(n_insert, n_move);
size_t n_move = etl::distance(begin(), position);
size_t n_create_copy = etl::min(n_insert, n_move);
size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0;
size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0;
size_t n_copy_old = n_move - n_create_copy;
@ -1482,8 +1484,8 @@ namespace etl
else
{
size_t n_insert = n;
size_t n_move = ETL_STD::distance(position, end());
size_t n_create_copy = ETL_STD::min(n_insert, n_move);
size_t n_move = etl::distance(position, end());
size_t n_create_copy = etl::min(n_insert, n_move);
size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0;
size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0;
size_t n_copy_old = n_move - n_create_copy;
@ -1504,7 +1506,7 @@ namespace etl
}
// Copy old.
ETL_STD::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old);
etl::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old);
// Copy new.
item = range_begin;
@ -1541,13 +1543,13 @@ namespace etl
// Are we closer to the front?
if (distance(_begin, position) < difference_type(current_size / 2))
{
ETL_STD::copy_backward(_begin, position, position + 1);
etl::copy_backward(_begin, position, position + 1);
destroy_element_front();
++position;
}
else
{
ETL_STD::copy(position + 1, _end, position);
etl::copy(position + 1, _end, position);
destroy_element_back();
}
}
@ -1568,7 +1570,7 @@ namespace etl
ETL_ASSERT((distance(range_begin) <= difference_type(current_size)) && (distance(range_end) <= difference_type(current_size)), ETL_ERROR(deque_out_of_bounds));
// How many to erase?
size_t length = ETL_STD::distance(range_begin, range_end);
size_t length = etl::distance(range_begin, range_end);
// At the beginning?
if (position == _begin)
@ -1597,7 +1599,7 @@ namespace etl
if (distance(_begin, position) < difference_type(current_size / 2))
{
// Move the items.
ETL_STD::copy_backward(_begin, position, position + length);
etl::copy_backward(_begin, position, position + length);
for (size_t i = 0; i < length; ++i)
{
@ -1610,7 +1612,7 @@ namespace etl
// Must be closer to the back.
{
// Move the items.
ETL_STD::copy(position + length, _end, position);
etl::copy(position + length, _end, position);
for (size_t i = 0; i < length; ++i)
{
@ -1646,7 +1648,7 @@ namespace etl
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
create_element_back(ETL_STD::move(item));
create_element_back(etl::move(item));
}
#endif
@ -1662,7 +1664,7 @@ namespace etl
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
::new (&(*_end)) T(ETL_STD::forward<Args>(args)...);
::new (&(*_end)) T(etl::forward<Args>(args)...);
++_end;
++current_size;
ETL_INCREMENT_DEBUG_COUNT
@ -1774,7 +1776,7 @@ namespace etl
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
create_element_front(ETL_STD::move(item));
create_element_front(etl::move(item));
}
#endif
@ -1791,7 +1793,7 @@ namespace etl
#endif
--_begin;
::new (&(*_begin)) T(ETL_STD::forward<Args>(args)...);
::new (&(*_begin)) T(etl::forward<Args>(args)...);
++current_size;
ETL_INCREMENT_DEBUG_COUNT
}
@ -1965,7 +1967,7 @@ namespace etl
iterator itr = rhs.begin();
while (itr != rhs.end())
{
push_back(ETL_STD::move(*itr));
push_back(etl::move(*itr));
++itr;
}
@ -2117,7 +2119,7 @@ namespace etl
void create_element_front(rvalue_reference value)
{
--_begin;
::new (&(*_begin)) T(ETL_STD::move(value));
::new (&(*_begin)) T(etl::move(value));
++current_size;
ETL_INCREMENT_DEBUG_COUNT
}
@ -2127,7 +2129,7 @@ namespace etl
//*********************************************************************
void create_element_back(rvalue_reference value)
{
::new (&(*_end)) T(ETL_STD::move(value));
::new (&(*_end)) T(etl::move(value));
++_end;
++current_size;
ETL_INCREMENT_DEBUG_COUNT
@ -2233,7 +2235,7 @@ namespace etl
typedef T& reference;
typedef const T& const_reference;
typedef size_t size_type;
typedef typename ETL_STD::iterator_traits<pointer>::difference_type difference_type;
typedef typename etl::iterator_traits<pointer>::difference_type difference_type;
//*************************************************************************
/// Default constructor.
@ -2278,7 +2280,7 @@ namespace etl
typename etl::ideque<T>::iterator itr = other.begin();
while (itr != other.end())
{
this->push_back(ETL_STD::move(*itr));
this->push_back(etl::move(*itr));
++itr;
}
@ -2342,7 +2344,7 @@ namespace etl
typename etl::ideque<T>::iterator itr = rhs.begin();
while (itr != rhs.end())
{
this->push_back(ETL_STD::move(*itr));
this->push_back(etl::move(*itr));
++itr;
}
@ -2384,7 +2386,7 @@ namespace etl
template <typename T>
bool operator ==(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -2410,10 +2412,10 @@ namespace etl
template <typename T>
bool operator <(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
return etl::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//***************************************************************************

View File

@ -34,7 +34,7 @@ SOFTWARE.
#include "platform.h"
#include "iterator.h"
#include "stl/iterator.h"
#include "iterator.h"
///\defgroup iterator Iterator types
@ -45,7 +45,7 @@ namespace etl
/// This can be useful when using STL algorithms to interact with fixed memory locations such as registers.
///\ingroup iterator
template <typename TIterator>
class fixed_iterator : etl::iterator<typename ETL_STD::iterator_traits<TIterator>::iterator_category, typename ETL_STD::iterator_traits<TIterator>::value_type>
class fixed_iterator : etl::iterator<typename etl::iterator_traits<TIterator>::iterator_category, typename etl::iterator_traits<TIterator>::value_type>
{
public:
@ -100,7 +100,7 @@ namespace etl
//***************************************************************************
/// Dereference operator.
//***************************************************************************
typename ETL_STD::iterator_traits<TIterator>::value_type operator *()
typename etl::iterator_traits<TIterator>::value_type operator *()
{
return *it;
}
@ -108,7 +108,7 @@ namespace etl
//***************************************************************************
/// Dereference operator.
//***************************************************************************
const typename ETL_STD::iterator_traits<TIterator>::value_type operator *() const
const typename etl::iterator_traits<TIterator>::value_type operator *() const
{
return *it;
}
@ -140,7 +140,7 @@ namespace etl
//***************************************************************************
/// += operator.
//***************************************************************************
fixed_iterator& operator +=(typename ETL_STD::iterator_traits<TIterator>::difference_type /*offset*/)
fixed_iterator& operator +=(typename etl::iterator_traits<TIterator>::difference_type /*offset*/)
{
return *this;
}
@ -148,7 +148,7 @@ namespace etl
//***************************************************************************
/// -= operator.
//***************************************************************************
fixed_iterator& operator -=(typename ETL_STD::iterator_traits<TIterator>::difference_type /*offset*/)
fixed_iterator& operator -=(typename etl::iterator_traits<TIterator>::difference_type /*offset*/)
{
return *this;
}
@ -181,7 +181,7 @@ namespace etl
//*****************************************************************************
template <typename TIterator>
etl::fixed_iterator<TIterator>& operator +(etl::fixed_iterator<TIterator>& lhs,
typename ETL_STD::iterator_traits<TIterator>::difference_type /*rhs*/)
typename etl::iterator_traits<TIterator>::difference_type /*rhs*/)
{
return lhs;
}
@ -191,7 +191,7 @@ namespace etl
//*****************************************************************************
template <typename TIterator>
etl::fixed_iterator<TIterator>& operator -(etl::fixed_iterator<TIterator>& lhs,
typename ETL_STD::iterator_traits<TIterator>::difference_type /*rhs*/)
typename etl::iterator_traits<TIterator>::difference_type /*rhs*/)
{
return lhs;
}
@ -200,7 +200,7 @@ namespace etl
/// - fixed_iterator operator.
//*****************************************************************************
template <typename TIterator>
typename ETL_STD::iterator_traits<TIterator>::difference_type operator -(etl::fixed_iterator<TIterator>& lhs,
typename etl::iterator_traits<TIterator>::difference_type operator -(etl::fixed_iterator<TIterator>& lhs,
etl::fixed_iterator<TIterator>& rhs)
{
return TIterator(lhs) - TIterator(rhs);

View File

@ -40,7 +40,7 @@ SOFTWARE.
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
#include "stl/utility.h"
#include "utility.h"
#undef ETL_FILE
#define ETL_FILE "2"
@ -60,7 +60,7 @@ namespace etl
/// Can be used as a reference type for all flat_maps containing a specific type.
///\ingroup flat_map
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TMapped, typename TKeyCompare = etl::less<TKey> >
class iflat_map : private etl::ireference_flat_map<TKey, TMapped, TKeyCompare>
{
private:
@ -72,7 +72,7 @@ namespace etl
public:
typedef ETL_PAIR<const TKey, TMapped> value_type;
typedef ETL_OR_STD::pair<const TKey, TMapped> value_type;
typedef TKey key_type;
typedef TMapped mapped_type;
typedef TKeyCompare key_compare;
@ -85,9 +85,9 @@ namespace etl
typedef typename refmap_t::iterator iterator;
typedef typename refmap_t::const_iterator const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
protected:
@ -232,7 +232,7 @@ namespace etl
//*********************************************************************
mapped_type& operator [](key_parameter_t key)
{
return insert(ETL_MAKE_PAIR(key, mapped_type())).first->second;
return insert(ETL_OR_STD::make_pair(key, mapped_type())).first->second;
}
//*********************************************************************
@ -268,7 +268,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_map_full));
#endif
@ -285,11 +285,11 @@ namespace etl
/// If asserts or exceptions are enabled, emits flat_map_full if the flat_map is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(const_reference value)
ETL_OR_STD::pair<iterator, bool> insert(const_reference value)
{
iterator i_element = lower_bound(value.first);
ETL_PAIR<iterator, bool> result(i_element, false);
ETL_OR_STD::pair<iterator, bool> result(i_element, false);
// Doesn't already exist?
if ((i_element == end()) || compare(value.first, i_element->first))
@ -335,7 +335,7 @@ namespace etl
//*************************************************************************
/// Emplaces a value to the map.
//*************************************************************************
ETL_PAIR<iterator, bool> emplace(const value_type& value)
ETL_OR_STD::pair<iterator, bool> emplace(const value_type& value)
{
return emplace(value.first, value.second);
}
@ -345,18 +345,18 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename ... Args>
ETL_PAIR<iterator, bool> emplace(const key_type& key, Args && ... args)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, Args && ... args)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_map_full));
// Create it.
value_type* pvalue = storage.allocate<value_type>();
::new ((void*)etl::addressof(pvalue->first)) key_type(key);
::new ((void*)etl::addressof(pvalue->second)) mapped_type(ETL_STD::forward<Args>(args)...);
::new ((void*)etl::addressof(pvalue->second)) mapped_type(etl::forward<Args>(args)...);
iterator i_element = lower_bound(key);
ETL_PAIR<iterator, bool> result(i_element, false);
ETL_OR_STD::pair<iterator, bool> result(i_element, false);
// Doesn't already exist?
if ((i_element == end()) || compare(key, i_element->first))
@ -379,7 +379,7 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename T1>
ETL_PAIR<iterator, bool> emplace(const key_type& key, const T1& value1)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_map_full));
@ -390,7 +390,7 @@ namespace etl
iterator i_element = lower_bound(key);
ETL_PAIR<iterator, bool> result(i_element, false);
ETL_OR_STD::pair<iterator, bool> result(i_element, false);
// Doesn't already exist?
if ((i_element == end()) || compare(key, i_element->first))
@ -411,7 +411,7 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename T1, typename T2>
ETL_PAIR<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_map_full));
@ -422,7 +422,7 @@ namespace etl
iterator i_element = lower_bound(key);
ETL_PAIR<iterator, bool> result(i_element, false);
ETL_OR_STD::pair<iterator, bool> result(i_element, false);
// Doesn't already exist?
if ((i_element == end()) || compare(key, i_element->first))
@ -443,7 +443,7 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename T1, typename T2, typename T3>
ETL_PAIR<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_map_full));
@ -454,7 +454,7 @@ namespace etl
iterator i_element = lower_bound(key);
ETL_PAIR<iterator, bool> result(i_element, false);
ETL_OR_STD::pair<iterator, bool> result(i_element, false);
// Doesn't already exist?
if ((i_element == end()) || compare(key, i_element->first))
@ -475,7 +475,7 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
ETL_PAIR<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3, const T4& value4)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_map_full));
@ -486,7 +486,7 @@ namespace etl
iterator i_element = lower_bound(key);
ETL_PAIR<iterator, bool> result(i_element, false);
ETL_OR_STD::pair<iterator, bool> result(i_element, false);
// Doesn't already exist?
if ((i_element == end()) || compare(key, i_element->first))
@ -662,7 +662,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
return refmap_t::equal_range(key);
}
@ -672,7 +672,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
return refmap_t::equal_range(key);
}
@ -793,7 +793,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::iflat_map<TKey, TMapped, TKeyCompare>& lhs, const etl::iflat_map<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -813,11 +813,11 @@ namespace etl
/// A flat_map implementation that uses a fixed size buffer.
///\tparam TKey The key type.
///\tparam TValue The value type.
///\tparam TCompare The type to compare keys. Default = ETL_STD::less<TKey>
///\tparam TCompare The type to compare keys. Default = etl::less<TKey>
///\tparam MAX_SIZE_ The maximum number of elements that can be stored.
///\ingroup flat_map
//***************************************************************************
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = etl::less<TKey> >
class flat_map : public etl::iflat_map<TKey, TValue, TCompare>
{
public:

View File

@ -59,12 +59,12 @@ namespace etl
/// Can be used as a reference type for all flat_multimaps containing a specific type.
///\ingroup flat_multimap
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TMapped, typename TKeyCompare = etl::less<TKey> >
class iflat_multimap : public etl::ireference_flat_multimap<TKey, TMapped, TKeyCompare>
{
public:
typedef ETL_PAIR<const TKey, TMapped> value_type;
typedef ETL_OR_STD::pair<const TKey, TMapped> value_type;
private:
@ -86,9 +86,9 @@ namespace etl
typedef typename refmap_t::iterator iterator;
typedef typename refmap_t::const_iterator const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
protected:
@ -237,7 +237,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multimap_full));
#endif
@ -254,11 +254,11 @@ namespace etl
/// If asserts or exceptions are enabled, emits flat_multimap_full if the flat_multimap is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(const value_type& value)
ETL_OR_STD::pair<iterator, bool> insert(const value_type& value)
{
ETL_ASSERT(!refmap_t::full(), ETL_ERROR(flat_multimap_full));
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
iterator i_element = lower_bound(value.first);
@ -300,7 +300,7 @@ namespace etl
//*************************************************************************
/// Emplaces a value to the map.
//*************************************************************************
ETL_PAIR<iterator, bool> emplace(const value_type& value)
ETL_OR_STD::pair<iterator, bool> emplace(const value_type& value)
{
return insert(value);
}
@ -308,7 +308,7 @@ namespace etl
//*************************************************************************
/// Emplaces a value to the map.
//*************************************************************************
ETL_PAIR<iterator, bool> emplace(const key_type& key, const mapped_type& value)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const mapped_type& value)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
@ -327,14 +327,14 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename ... Args>
ETL_PAIR<iterator, bool> emplace(const key_type& key, Args && ... args)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, Args && ... args)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
// Create it.
value_type* pvalue = storage.allocate<value_type>();
::new ((void*)etl::addressof(pvalue->first)) key_type(key);
::new ((void*)etl::addressof(pvalue->second)) mapped_type(ETL_STD::forward<Args>(args)...);
::new ((void*)etl::addressof(pvalue->second)) mapped_type(etl::forward<Args>(args)...);
iterator i_element = lower_bound(key);
ETL_INCREMENT_DEBUG_COUNT
@ -346,7 +346,7 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename T1>
ETL_PAIR<iterator, bool> emplace(const key_type& key, const T1& value1)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
@ -364,7 +364,7 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename T1, typename T2>
ETL_PAIR<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
@ -382,7 +382,7 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename T1, typename T2, typename T3>
ETL_PAIR<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
@ -400,7 +400,7 @@ namespace etl
/// Emplaces a value to the map.
//*************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
ETL_PAIR<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3, const T4& value4)
ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
@ -423,7 +423,7 @@ namespace etl
//*********************************************************************
size_t erase(key_parameter_t key)
{
ETL_PAIR<iterator, iterator> range = equal_range(key);
ETL_OR_STD::pair<iterator, iterator> range = equal_range(key);
if (range.first == end())
{
@ -431,7 +431,7 @@ namespace etl
}
else
{
size_t d = ETL_STD::distance(range.first, range.second);
size_t d = etl::distance(range.first, range.second);
erase(range.first, range.second);
return d;
}
@ -571,7 +571,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
return refmap_t::equal_range(key);
}
@ -581,7 +581,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
return refmap_t::equal_range(key);
}
@ -700,7 +700,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::iflat_multimap<TKey, TMapped, TKeyCompare>& lhs, const etl::iflat_multimap<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -720,11 +720,11 @@ namespace etl
/// A flat_multimap implementation that uses a fixed size buffer.
///\tparam TKey The key type.
///\tparam TValue The value type.
///\tparam TCompare The type to compare keys. Default = ETL_STD::less<TKey>
///\tparam TCompare The type to compare keys. Default = etl::less<TKey>
///\tparam MAX_SIZE_ The maximum number of elements that can be stored.
///\ingroup flat_multimap
//***************************************************************************
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = etl::less<TKey> >
class flat_multimap : public etl::iflat_multimap<TKey, TValue, TCompare>
{
public:

View File

@ -57,7 +57,7 @@ namespace etl
/// Can be used as a reference type for all flat_multisets containing a specific type.
///\ingroup flat_multiset
//***************************************************************************
template <typename T, typename TKeyCompare = ETL_STD::less<T> >
template <typename T, typename TKeyCompare = etl::less<T> >
class iflat_multiset : private etl::ireference_flat_multiset<T, TKeyCompare>
{
private:
@ -80,9 +80,9 @@ namespace etl
typedef typename refset_t::iterator iterator;
typedef typename refset_t::const_iterator const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
protected:
@ -209,7 +209,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multiset_full));
#endif
@ -226,13 +226,13 @@ namespace etl
/// If asserts or exceptions are enabled, emits flat_multiset_full if the flat_multiset is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(parameter_t value)
ETL_OR_STD::pair<iterator, bool> insert(parameter_t value)
{
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
iterator i_element = ETL_STD::lower_bound(begin(), end(), value, compare);
iterator i_element = etl::lower_bound(begin(), end(), value, compare);
value_type* pvalue = storage.allocate<value_type>();
::new (pvalue) value_type(value);
@ -273,7 +273,7 @@ namespace etl
/// Emplaces a value to the set.
//*************************************************************************
template <typename T1>
ETL_PAIR<iterator, bool> emplace(parameter_t value)
ETL_OR_STD::pair<iterator, bool> emplace(parameter_t value)
{
return insert(value);
}
@ -283,25 +283,25 @@ namespace etl
//*************************************************************************
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
template <typename ... Args>
ETL_PAIR<iterator, bool> emplace(Args && ... args)
ETL_OR_STD::pair<iterator, bool> emplace(Args && ... args)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
// Create it.
value_type* pvalue = storage.allocate<value_type>();
::new (pvalue) value_type(ETL_STD::forward<Args>(args)...);
::new (pvalue) value_type(etl::forward<Args>(args)...);
iterator i_element = lower_bound(*pvalue);
ETL_INCREMENT_DEBUG_COUNT
return ETL_PAIR<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
}
#else
//*************************************************************************
/// Emplaces a value to the set.
//*************************************************************************
template <typename T1>
ETL_PAIR<iterator, bool> emplace(const T1& value1)
ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
@ -312,14 +312,14 @@ namespace etl
iterator i_element = lower_bound(*pvalue);
ETL_INCREMENT_DEBUG_COUNT
return ETL_PAIR<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
}
//*************************************************************************
/// Emplaces a value to the set.
//*************************************************************************
template <typename T1, typename T2>
ETL_PAIR<iterator, bool> emplace(const T1& value1, const T2& value2)
ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1, const T2& value2)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
@ -330,14 +330,14 @@ namespace etl
iterator i_element = lower_bound(*pvalue);
ETL_INCREMENT_DEBUG_COUNT
return ETL_PAIR<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
}
//*************************************************************************
/// Emplaces a value to the set.
//*************************************************************************
template <typename T1, typename T2, typename T3>
ETL_PAIR<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3)
ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
@ -348,14 +348,14 @@ namespace etl
iterator i_element = lower_bound(*pvalue);
ETL_INCREMENT_DEBUG_COUNT
return ETL_PAIR<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
}
//*************************************************************************
/// Emplaces a value to the set.
//*************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
ETL_PAIR<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
@ -366,7 +366,7 @@ namespace etl
iterator i_element = lower_bound(*pvalue);
ETL_INCREMENT_DEBUG_COUNT
return ETL_PAIR<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
}
#endif
@ -377,7 +377,7 @@ namespace etl
//*********************************************************************
size_t erase(parameter_t key)
{
ETL_PAIR<iterator, iterator> range = equal_range(key);
ETL_OR_STD::pair<iterator, iterator> range = equal_range(key);
if (range.first == end())
{
@ -385,7 +385,7 @@ namespace etl
}
else
{
size_t d = ETL_STD::distance(range.first, range.second);
size_t d = etl::distance(range.first, range.second);
erase(range.first, range.second);
return d;
}
@ -525,7 +525,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(parameter_t key)
{
return refset_t::equal_range(key);
}
@ -535,7 +535,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(parameter_t key) const
{
return refset_t::equal_range(key);
}
@ -656,7 +656,7 @@ namespace etl
template <typename T, typename TKeyCompare>
bool operator ==(const etl::iflat_multiset<T, TKeyCompare>& lhs, const etl::iflat_multiset<T, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -675,11 +675,11 @@ namespace etl
//***************************************************************************
/// A flat_multiset implementation that uses a fixed size buffer.
///\tparam T The value type.
///\tparam TCompare The type to compare keys. Default = ETL_STD::less<T>
///\tparam TCompare The type to compare keys. Default = etl::less<T>
///\tparam MAX_SIZE_ The maximum number of elements that can be stored.
///\ingroup flat_multiset
//***************************************************************************
template <typename T, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<T> >
template <typename T, const size_t MAX_SIZE_, typename TCompare = etl::less<T> >
class flat_multiset : public etl::iflat_multiset<T, TCompare>
{
public:

View File

@ -59,7 +59,7 @@ namespace etl
/// Can be used as a reference type for all flat_sets containing a specific type.
///\ingroup flat_set
//***************************************************************************
template <typename T, typename TKeyCompare = ETL_STD::less<T> >
template <typename T, typename TKeyCompare = etl::less<T> >
class iflat_set : private etl::ireference_flat_set<T, TKeyCompare>
{
private:
@ -82,9 +82,9 @@ namespace etl
typedef typename refset_t::iterator iterator;
typedef typename refset_t::const_iterator const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
protected:
@ -211,7 +211,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_set_full));
#endif
@ -228,11 +228,11 @@ namespace etl
/// If asserts or exceptions are enabled, emits flat_set_full if the flat_set is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(parameter_t value)
ETL_OR_STD::pair<iterator, bool> insert(parameter_t value)
{
iterator i_element = lower_bound(value);
ETL_PAIR<iterator, bool> result(i_element, false);
ETL_OR_STD::pair<iterator, bool> result(i_element, false);
// Doesn't already exist?
if ((i_element == end()) || compare(value, *i_element))
@ -278,7 +278,7 @@ namespace etl
//*************************************************************************
/// Emplaces a value to the set.
//*************************************************************************
ETL_PAIR<iterator, bool> emplace(parameter_t value)
ETL_OR_STD::pair<iterator, bool> emplace(parameter_t value)
{
return insert(value);
}
@ -288,15 +288,15 @@ namespace etl
//*************************************************************************
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
template <typename ... Args>
ETL_PAIR<iterator, bool> emplace(Args && ... args)
ETL_OR_STD::pair<iterator, bool> emplace(Args && ... args)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_set_full));
ETL_PAIR<iterator, bool> result;
ETL_OR_STD::pair<iterator, bool> result;
// Create it.
value_type* pvalue = storage.allocate<value_type>();
::new (pvalue) value_type(ETL_STD::forward<Args>(args)...);
::new (pvalue) value_type(etl::forward<Args>(args)...);
iterator i_element = lower_bound(*pvalue);
@ -311,7 +311,7 @@ namespace etl
// Destroy it.
pvalue->~value_type();
storage.release(pvalue);
result = ETL_PAIR<iterator, bool>(end(), false);
result = ETL_OR_STD::pair<iterator, bool>(end(), false);
}
return result;
@ -321,11 +321,11 @@ namespace etl
/// Emplaces a value to the set.
//*************************************************************************
template <typename T1>
ETL_PAIR<iterator, bool> emplace(const T1& value1)
ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_set_full));
ETL_PAIR<iterator, bool> result;
ETL_OR_STD::pair<iterator, bool> result;
// Create it.
value_type* pvalue = storage.allocate<value_type>();
@ -344,7 +344,7 @@ namespace etl
// Destroy it.
pvalue->~value_type();
storage.release(pvalue);
result = ETL_PAIR<iterator, bool>(end(), false);
result = ETL_OR_STD::pair<iterator, bool>(end(), false);
}
return result;
@ -354,11 +354,11 @@ namespace etl
/// Emplaces a value to the set.
//*************************************************************************
template <typename T1, typename T2>
ETL_PAIR<iterator, bool> emplace(const T1& value1, const T2& value2)
ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1, const T2& value2)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_set_full));
ETL_PAIR<iterator, bool> result;
ETL_OR_STD::pair<iterator, bool> result;
// Create it.
value_type* pvalue = storage.allocate<value_type>();
@ -377,7 +377,7 @@ namespace etl
// Destroy it.
pvalue->~value_type();
storage.release(pvalue);
result = ETL_PAIR<iterator, bool>(end(), false);
result = ETL_OR_STD::pair<iterator, bool>(end(), false);
}
return result;
@ -387,11 +387,11 @@ namespace etl
/// Emplaces a value to the set.
//*************************************************************************
template <typename T1, typename T2, typename T3>
ETL_PAIR<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3)
ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_set_full));
ETL_PAIR<iterator, bool> result;
ETL_OR_STD::pair<iterator, bool> result;
// Create it.
value_type* pvalue = storage.allocate<value_type>();
@ -410,7 +410,7 @@ namespace etl
// Destroy it.
pvalue->~value_type();
storage.release(pvalue);
result = ETL_PAIR<iterator, bool>(end(), false);
result = ETL_OR_STD::pair<iterator, bool>(end(), false);
}
return result;
@ -420,11 +420,11 @@ namespace etl
/// Emplaces a value to the set.
//*************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
ETL_PAIR<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
ETL_ASSERT(!full(), ETL_ERROR(flat_set_full));
ETL_PAIR<iterator, bool> result;
ETL_OR_STD::pair<iterator, bool> result;
// Create it.
value_type* pvalue = storage.allocate<value_type>();
@ -443,7 +443,7 @@ namespace etl
// Destroy it.
pvalue->~value_type();
storage.release(pvalue);
result = ETL_PAIR<iterator, bool>(end(), false);
result = ETL_OR_STD::pair<iterator, bool>(end(), false);
}
return result;
@ -608,7 +608,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(parameter_t key)
{
return refset_t::equal_range(key);
}
@ -618,7 +618,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(parameter_t key) const
{
return refset_t::upper_bound(key);
}
@ -739,7 +739,7 @@ namespace etl
template <typename T, typename TKeyCompare>
bool operator ==(const etl::iflat_set<T, TKeyCompare>& lhs, const etl::iflat_set<T, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -758,11 +758,11 @@ namespace etl
//***************************************************************************
/// A flat_set implementation that uses a fixed size buffer.
///\tparam T The value type.
///\tparam TCompare The type to compare keys. Default = ETL_STD::less<T>
///\tparam TCompare The type to compare keys. Default = etl::less<T>
///\tparam MAX_SIZE_ The maximum number of elements that can be stored.
///\ingroup flat_set
//***************************************************************************
template <typename T, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<T> >
template <typename T, const size_t MAX_SIZE_, typename TCompare = etl::less<T> >
class flat_set : public etl::iflat_set<T, TCompare>
{
public:

View File

@ -37,10 +37,10 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "pool.h"
#include "container.h"
@ -404,7 +404,7 @@ namespace etl
//*************************************************************************
/// iterator.
//*************************************************************************
class iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, T>
class iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, T>
{
public:
@ -492,7 +492,7 @@ namespace etl
//*************************************************************************
/// const_iterator
//*************************************************************************
class const_iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, const T>
class const_iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, const T>
{
public:
@ -572,7 +572,7 @@ namespace etl
const node_t* p_node;
};
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*************************************************************************
/// Gets the beginning of the forward_list.
@ -671,7 +671,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d >= 0, ETL_ERROR(forward_list_iterator));
#endif
@ -735,7 +735,7 @@ namespace etl
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
data_node_t& data_node = allocate_data_node(ETL_STD::move(value));
data_node_t& data_node = allocate_data_node(etl::move(value));
insert_node_after(start_node, data_node);
}
#endif
@ -751,7 +751,7 @@ namespace etl
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
data_node_t* p_data_node = p_node_pool->allocate<data_node_t>();
::new (&(p_data_node->value)) T(ETL_STD::forward<Args>(args)...);
::new (&(p_data_node->value)) T(etl::forward<Args>(args)...);
ETL_INCREMENT_DEBUG_COUNT
insert_node_after(start_node, *p_data_node);
}
@ -907,7 +907,7 @@ namespace etl
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
data_node_t* p_data_node = p_node_pool->allocate<data_node_t>();
::new (&(p_data_node->value)) T(ETL_STD::forward<Args>(args)...);
::new (&(p_data_node->value)) T(etl::forward<Args>(args)...);
ETL_INCREMENT_DEBUG_COUNT
insert_node_after(*position.p_node, *p_data_node);
@ -1001,7 +1001,7 @@ namespace etl
void insert_after(iterator position, TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT((d + size()) <= MAX_SIZE, ETL_ERROR(forward_list_full));
#endif
@ -1141,7 +1141,7 @@ namespace etl
//*************************************************************************
void unique()
{
unique(ETL_STD::equal_to<T>());
unique(etl::equal_to<T>());
}
//*************************************************************************
@ -1182,7 +1182,7 @@ namespace etl
//*************************************************************************
void sort()
{
sort(ETL_STD::less<T>());
sort(etl::less<T>());
}
//*************************************************************************
@ -1386,7 +1386,7 @@ namespace etl
//*************************************************************************
iforward_list& operator = (iforward_list&& rhs)
{
move_container(ETL_STD::move(rhs));
move_container(etl::move(rhs));
return *this;
}
@ -1460,7 +1460,7 @@ namespace etl
data_node_t& allocate_data_node(rvalue_reference value)
{
data_node_t* p_node = p_node_pool->allocate<data_node_t>();
::new (&(p_node->value)) T(ETL_STD::move(value));
::new (&(p_node->value)) T(etl::move(value));
ETL_INCREMENT_DEBUG_COUNT
return *p_node;
@ -1487,7 +1487,7 @@ namespace etl
{
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
data_node_t& data_node = this->allocate_data_node(ETL_STD::move(*first++));
data_node_t& data_node = this->allocate_data_node(etl::move(*first++));
join(p_last_node, &data_node);
data_node.next = nullptr;
p_last_node = &data_node;
@ -1633,7 +1633,7 @@ namespace etl
forward_list(forward_list&& other)
: etl::iforward_list<T>(node_pool, MAX_SIZE, false)
{
this->move_container(ETL_STD::move(other));
this->move_container(etl::move(other));
}
#endif
@ -1686,7 +1686,7 @@ namespace etl
forward_list& operator = (forward_list&& rhs)
{
this->move_container(ETL_STD::move(rhs));
this->move_container(etl::move(rhs));
return *this;
}
@ -1774,7 +1774,7 @@ namespace etl
typename etl::iforward_list<T>::iterator itr = other.begin();
while (itr != other.end())
{
this->push_back(ETL_STD::move(*itr));
this->push_back(etl::move(*itr));
++itr;
}
@ -1831,7 +1831,7 @@ namespace etl
//*************************************************************************
forward_list& operator = (forward_list&& rhs)
{
this->move_container(ETL_STD::move(rhs));
this->move_container(etl::move(rhs));
return *this;
}
@ -1862,7 +1862,7 @@ namespace etl
bool operator ==(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return (lhs.size() == rhs.size()) &&
ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
@ -1887,10 +1887,7 @@ namespace etl
template <typename T>
bool operator <(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//*************************************************************************

View File

@ -34,7 +34,7 @@ SOFTWARE.
#include "type_traits.h"
#include "binary.h"
#include "stl/iterator.h"
#include "iterator.h"
ETL_STATIC_ASSERT(ETL_8BIT_SUPPORT, "This file does not currently support targets with no 8bit type");
@ -74,7 +74,7 @@ namespace etl
template<typename TIterator>
frame_check_sequence(TIterator begin, const TIterator end)
{
ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits<TIterator>::value_type) == 1, "Type not supported");
ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits<TIterator>::value_type) == 1, "Type not supported");
reset();
add(begin, end);
@ -96,7 +96,7 @@ namespace etl
template<typename TIterator>
void add(TIterator begin, const TIterator end)
{
ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits<TIterator>::value_type) == 1, "Type not supported");
ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits<TIterator>::value_type) == 1, "Type not supported");
while (begin != end)
{

View File

@ -105,6 +105,138 @@ namespace etl
{
return reference_wrapper<const T>(t.get());
}
//***************************************************************************
template <typename T = void>
struct less
{
typedef T value_type;
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs < rhs;
}
};
//***************************************************************************
template <typename T = void>
struct greater
{
typedef T value_type;
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs > rhs;
}
};
//***************************************************************************
template <typename T = void>
struct equal_to
{
typedef T value_type;
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs == rhs;
}
};
//***************************************************************************
template <typename T = void>
struct not_equal_to
{
typedef T value_type;
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs != rhs;
}
};
//***************************************************************************
template <typename TArgumentType, typename TResultType>
struct unary_function
{
typedef TArgumentType argument_type;
typedef TResultType result_type;
};
//***************************************************************************
template <typename TFirstArgumentType, typename TSecondArgumentType, typename TResultType>
struct binary_function
{
typedef TFirstArgumentType first_argument_type;
typedef TSecondArgumentType second_argument_type;
typedef TResultType result_type;
};
//***************************************************************************
template <typename TFunction>
class binder1st : public etl::unary_function<typename TFunction::second_argument_type, typename TFunction::result_type>
{
protected:
TFunction operation;
typename TFunction::first_argument_type value;
public:
binder1st(const TFunction& f, const typename TFunction::first_argument_type& v)
: operation(f), value(v)
{
}
typename TFunction::result_type operator()(typename TFunction::second_argument_type& x) const
{
return operation(value, x);
}
typename TFunction::result_type operator()(const typename TFunction::second_argument_type& x) const
{
return operation(value, x);
}
};
template <typename F, typename T>
binder1st<F> bind1st(const F& f, const T& x)
{
return binder1st<F>(f, x);
}
//***************************************************************************
template <typename TFunction >
class binder2nd : public etl::unary_function<typename TFunction::first_argument_type, typename TFunction::result_type>
{
protected:
TFunction operation;
typename TFunction::second_argument_type value;
public:
binder2nd(const TFunction& f, const typename TFunction::second_argument_type& v)
: operation(f), value(v)
{
}
typename TFunction::result_type operator()(typename TFunction::first_argument_type& x) const
{
return operation(x, value);
}
typename TFunction::result_type operator()(const typename TFunction::first_argument_type& x) const
{
return operation(x, value);
}
};
template <typename F, typename T>
binder2nd<F> bind2nd(const F& f, const T& x)
{
return binder2nd<F>(f, x);
}
}
#endif

View File

@ -1 +1 @@
python -m cogapp -d -e -otype_traits.h -DIsOneOf=17 type_traits_generator.h
python -m cogapp -d -e -otype_traits.h -DIsOneOf=16 type_traits_generator.h

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "platform.h"
#include "stl/utility.h"
#include "utility.h"
#include "exception.h"
#include "error_handler.h"

View File

@ -35,9 +35,8 @@ SOFTWARE.
#include "vector.h"
#include "pool.h"
#include "iterator.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "iterator.h"
#include "functional.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
@ -183,7 +182,7 @@ namespace etl
//*************************************************************************
/// iterator.
//*************************************************************************
class iterator : public etl::iterator<ETL_RANDOM_ACCESS_ITERATOR_TAG, T>
class iterator : public etl::iterator<ETL_OR_STD::random_access_iterator_tag, T>
{
public:
@ -329,7 +328,7 @@ namespace etl
//*************************************************************************
/// const_iterator.
//*************************************************************************
class const_iterator : public etl::iterator<ETL_RANDOM_ACCESS_ITERATOR_TAG, const T>
class const_iterator : public etl::iterator<ETL_OR_STD::random_access_iterator_tag, const T>
{
public:
@ -459,8 +458,8 @@ namespace etl
indirect_const_iterator lookup_itr;
};
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
protected:
@ -717,10 +716,10 @@ namespace etl
template <typename TIterator>
void assign(TIterator first, TIterator last)
{
ETL_STATIC_ASSERT((etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<typename ETL_STD::iterator_traits<TIterator>::value_type>::type>::value), "Iterator type does not match container type");
ETL_STATIC_ASSERT((etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<typename etl::iterator_traits<TIterator>::value_type>::type>::value), "Iterator type does not match container type");
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(static_cast<size_t>(d) <= capacity(), ETL_ERROR(vector_full));
#endif
@ -786,7 +785,7 @@ namespace etl
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(size() != capacity(), ETL_ERROR(vector_full));
#endif
T* p = storage.create<T>(ETL_STD::move(value));
T* p = storage.create<T>(etl::move(value));
lookup.push_back(p);
}
#endif
@ -800,7 +799,7 @@ namespace etl
template <typename ... Args>
void emplace_back(Args && ... args)
{
T* p = storage.create<T>(ETL_STD::forward<Args>(args)...);
T* p = storage.create<T>(etl::forward<Args>(args)...);
lookup.push_back(p);
}
#else
@ -892,7 +891,7 @@ namespace etl
{
ETL_ASSERT(size() + 1 <= capacity(), ETL_ERROR(vector_full));
T* p = storage.create<T>(T(ETL_STD::move(value)));
T* p = storage.create<T>(T(etl::move(value)));
position = iterator(lookup.insert(position.lookup_itr, p));
return position;
@ -908,7 +907,7 @@ namespace etl
{
ETL_ASSERT(!full(), ETL_ERROR(vector_full));
T* p = storage.create<T>(T(ETL_STD::forward<Args>(args)...));
T* p = storage.create<T>(T(etl::forward<Args>(args)...));
position = iterator(lookup.insert(position.lookup_itr, p));
return position;
@ -991,7 +990,7 @@ namespace etl
template <class TIterator>
void insert(iterator position, TIterator first, TIterator last)
{
size_t count = size_t(ETL_STD::distance(first, last));
size_t count = size_t(etl::distance(first, last));
ETL_ASSERT((size() + count) <= capacity(), ETL_ERROR(vector_full));
@ -1067,7 +1066,7 @@ namespace etl
iterator itr = rhs.begin();
while (itr != rhs.end())
{
push_back(ETL_STD::move(*itr));
push_back(etl::move(*itr));
++itr;
}
@ -1172,7 +1171,7 @@ namespace etl
while (itr != other.end())
{
push_back(ETL_STD::move(*itr));
push_back(etl::move(*itr));
++itr;
}
@ -1213,7 +1212,7 @@ namespace etl
template <typename T>
bool operator ==(const etl::iindirect_vector<T>& lhs, const etl::iindirect_vector<T>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -1239,7 +1238,7 @@ namespace etl
template <typename T>
bool operator <(const etl::iindirect_vector<T>& lhs, const etl::iindirect_vector<T>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//***************************************************************************
@ -1376,7 +1375,7 @@ namespace etl
indirect_vector(indirect_vector&& other)
: etl::iindirect_vector<T>(lookup_vector, storage_pool)
{
this->move_container(ETL_STD::move(other));
this->move_container(etl::move(other));
}
//*************************************************************************
@ -1384,7 +1383,7 @@ namespace etl
//*************************************************************************
indirect_vector& operator = (indirect_vector&& rhs)
{
this->move_container(ETL_STD::move(rhs));
this->move_container(etl::move(rhs));
return *this;
}
@ -1504,7 +1503,7 @@ namespace etl
: etl::iindirect_vector<T>(lookup_, pool_)
{
ETL_ASSERT(lookup_.capacity() <= pool_.capacity(), ETL_ERROR(indirect_vector_buffer_missmatch));
this->move_container(ETL_STD::move(other));
this->move_container(etl::move(other));
}
//*************************************************************************
@ -1512,7 +1511,7 @@ namespace etl
//*************************************************************************
indirect_vector& operator = (indirect_vector&& rhs)
{
this->move_container(ETL_STD::move(rhs));
this->move_container(etl::move(rhs));
return *this;
}

View File

@ -31,7 +31,6 @@ SOFTWARE.
#ifndef ETL_INTEGRAL_LIMITS_INCLUDED
#define ETL_INTEGRAL_LIMITS_INCLUDED
#include <limits.h>
#include <stddef.h>
#include "platform.h"

View File

@ -33,9 +33,9 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "private/minmax_push.h"
@ -153,7 +153,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
intmax_t d = ETL_STD::distance(first, last);
intmax_t d = etl::distance(first, last);
ETL_ASSERT(d >= 0, ETL_ERROR(intrusive_forward_list_iterator_exception));
#endif
@ -328,7 +328,7 @@ namespace etl
//*************************************************************************
/// iterator.
//*************************************************************************
class iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, value_type>
{
public:
@ -418,7 +418,7 @@ namespace etl
//*************************************************************************
/// const_iterator
//*************************************************************************
class const_iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, const value_type>
{
public:
@ -495,7 +495,7 @@ namespace etl
const value_type* p_value;
};
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*************************************************************************
/// Constructor.
@ -651,7 +651,7 @@ namespace etl
{
if (first != end() && (first != last))
{
this->current_size -= ETL_STD::distance(first, last) - 1;
this->current_size -= etl::distance(first, last) - 1;
link_type* p_first = first.p_value;
link_type* p_last = last.p_value;
@ -712,7 +712,7 @@ namespace etl
//*************************************************************************
void sort()
{
sort(ETL_STD::less<value_type>());
sort(etl::less<value_type>());
}
//*************************************************************************
@ -958,7 +958,7 @@ namespace etl
{
if (&other != this)
{
size_t n = ETL_STD::distance(begin_, end_) - 1;
size_t n = etl::distance(begin_, end_) - 1;
this->current_size += n;
other.current_size -= n;
}
@ -987,7 +987,7 @@ namespace etl
//*************************************************************************
void merge(list_type& other)
{
merge(other, ETL_STD::less<value_type>());
merge(other, etl::less<value_type>());
}
//*************************************************************************

View File

@ -39,8 +39,8 @@ SOFTWARE.
#include "exception.h"
#include "error_handler.h"
#include "stl/utility.h"
#include "stl/algorithm.h"
#include "utility.h"
#include "algorithm.h"
#undef ETL_FILE
#define ETL_FILE "22"
@ -265,7 +265,9 @@ namespace etl
void reverse()
{
ETL_STD::swap(etl_previous, etl_next);
using ETL_OR_STD::swap; // Allow ADL
swap(etl_previous, etl_next);
}
bidirectional_link* etl_previous;

View File

@ -47,9 +47,9 @@ SOFTWARE.
#include "algorithm.h"
#include "iterator.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#undef ETL_FILE
#define ETL_FILE "21"
@ -133,7 +133,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
intmax_t d = ETL_STD::distance(first, last);
intmax_t d = etl::distance(first, last);
ETL_ASSERT(d >= 0, ETL_ERROR(intrusive_list_iterator_exception));
#endif
@ -383,7 +383,7 @@ namespace etl
//*************************************************************************
/// iterator.
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
{
public:
@ -488,7 +488,7 @@ namespace etl
//*************************************************************************
/// const_iterator
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
{
public:
@ -580,7 +580,7 @@ namespace etl
const value_type* p_value;
};
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*************************************************************************
/// Constructor.
@ -734,7 +734,7 @@ namespace etl
// Join the ends.
etl::link<link_type>(p_first->etl_previous, p_last);
this->current_size -= ETL_STD::distance(first, last);
this->current_size -= etl::distance(first, last);
if (p_last == &this->terminal_link)
{
@ -781,7 +781,7 @@ namespace etl
//*************************************************************************
void sort()
{
sort(ETL_STD::less<value_type>());
sort(etl::less<value_type>());
}
//*************************************************************************
@ -1013,7 +1013,7 @@ namespace etl
{
if (&other != this)
{
size_t n = ETL_STD::distance(begin_, end_);
size_t n = etl::distance(begin_, end_);
this->current_size += n;
other.current_size -= n;
}
@ -1036,7 +1036,7 @@ namespace etl
//*************************************************************************
void merge(list_type& other)
{
merge(other, ETL_STD::less<value_type>());
merge(other, etl::less<value_type>());
}
//*************************************************************************

View File

@ -41,7 +41,7 @@ SOFTWARE.
#include "nullptr.h"
#include "iterator.h"
#include "stl/iterator.h"
#include "iterator.h"
namespace etl
{
@ -49,7 +49,7 @@ namespace etl
/// Read write port.
//***************************************************************************
template <typename T, uintptr_t ADDRESS = 0>
class io_port_rw : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, T>
class io_port_rw : public etl::iterator<ETL_OR_STD::forward_iterator_tag, T>
{
public:
@ -129,7 +129,7 @@ namespace etl
/// Read only port.
//***************************************************************************
template <typename T, uintptr_t ADDRESS = 0>
class io_port_ro : public etl::iterator<ETL_INPUT_ITERATOR_TAG, T>
class io_port_ro : public etl::iterator<ETL_OR_STD::input_iterator_tag, T>
{
public:
@ -193,7 +193,7 @@ namespace etl
/// Write only port.
//***************************************************************************
template <typename T, uintptr_t ADDRESS = 0>
class io_port_wo : public etl::iterator<ETL_OUTPUT_ITERATOR_TAG, T>
class io_port_wo : public etl::iterator<ETL_OR_STD::output_iterator_tag, T>
{
public:
@ -257,7 +257,7 @@ namespace etl
/// Write only port with shadow register.
//***************************************************************************
template <typename T, uintptr_t ADDRESS = 0>
class io_port_wos : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, T>
class io_port_wos : public etl::iterator<ETL_OR_STD::forward_iterator_tag, T>
{
public:
@ -336,7 +336,7 @@ namespace etl
/// Specialisation for dynamic addresses.
//***************************************************************************
template <typename T>
class io_port_rw<T, 0> : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, T>
class io_port_rw<T, 0> : public etl::iterator<ETL_OR_STD::forward_iterator_tag, T>
{
public:
@ -447,7 +447,7 @@ namespace etl
/// Specialisation for dynamic addresses.
//***************************************************************************
template <typename T>
class io_port_ro<T, 0> : public etl::iterator<ETL_INPUT_ITERATOR_TAG, T>
class io_port_ro<T, 0> : public etl::iterator<ETL_OR_STD::input_iterator_tag, T>
{
public:
@ -536,7 +536,7 @@ namespace etl
/// Specialisation for dynamic addresses.
//***************************************************************************
template <typename T>
class io_port_wo<T, 0> : public etl::iterator<ETL_OUTPUT_ITERATOR_TAG, T>
class io_port_wo<T, 0> : public etl::iterator<ETL_OR_STD::output_iterator_tag, T>
{
public:
@ -631,7 +631,7 @@ namespace etl
/// Specialisation for dynamic addresses.
//***************************************************************************
template <typename T>
class io_port_wos<T, 0> : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, T>
class io_port_wos<T, 0> : public etl::iterator<ETL_OR_STD::forward_iterator_tag, T>
{
public:
@ -640,7 +640,7 @@ namespace etl
typedef volatile T& reference;
typedef volatile const T& const_reference;
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, T>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, T>
{
typedef io_port_wos<T, 0> iop_t;

View File

@ -32,16 +32,387 @@ SOFTWARE.
#define ETL_ITERATOR_INCLUDED
#include "platform.h"
#include "stl/iterator.h"
#include "type_traits.h"
#if !defined(ETL_NO_STL)
#include <iterator>
#endif
///\defgroup iterator iterator
///\ingroup utilities
namespace etl
{
//***************************************************************************
// iterator tags
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
//***************************************************************************
// iterator_traits
template <typename TIterator>
struct iterator_traits
{
typedef typename TIterator::iterator_category iterator_category;
typedef typename TIterator::value_type value_type;
typedef typename TIterator::difference_type difference_type;
typedef typename TIterator::pointer pointer;
typedef typename TIterator::reference reference;
};
template <typename T>
struct iterator_traits<T*>
{
typedef ETL_OR_STD::random_access_iterator_tag iterator_category;
typedef T value_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef T& reference;
};
template <typename T>
struct iterator_traits<const T*>
{
typedef ETL_OR_STD::random_access_iterator_tag iterator_category;
typedef T value_type;
typedef ptrdiff_t difference_type;
typedef const T* pointer;
typedef const T& reference;
};
//***************************************************************************
// advance
#if defined(ETL_NO_STL)
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OR_STD::output_iterator_tag)
{
while (n--)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OR_STD::forward_iterator_tag)
{
while (n--)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OR_STD::bidirectional_iterator_tag)
{
if (n > 0)
{
while (n--)
{
++itr;
}
}
else
{
while (n++)
{
--itr;
}
}
}
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OR_STD::random_access_iterator_tag)
{
itr += n;
}
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance(TIterator& itr, TDistance n)
{
typedef typename etl::iterator_traits<TIterator>::iterator_category tag;
advance_helper(itr, n, tag());
}
#else
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance(TIterator& itr, TDistance n)
{
std::advance(itr, n);
}
#endif
//***************************************************************************
// distance
#if defined(ETL_NO_STL)
template<typename TIterator>
ETL_CONSTEXPR17 typename etl::iterator_traits<TIterator>::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::input_iterator_tag)
{
typename etl::iterator_traits<TIterator>::difference_type d = 0;
while (first != last)
{
++d;
++first;
}
return d;
}
template<typename TIterator>
ETL_CONSTEXPR17 typename etl::iterator_traits<TIterator>::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::forward_iterator_tag)
{
typename etl::iterator_traits<TIterator>::difference_type d = 0;
while (first != last)
{
++d;
++first;
}
return d;
}
template<typename TIterator>
ETL_CONSTEXPR17 typename etl::iterator_traits<TIterator>::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::bidirectional_iterator_tag)
{
typename etl::iterator_traits<TIterator>::difference_type d = 0;
while (first != last)
{
++d;
++first;
}
return d;
}
template<typename TIterator>
ETL_CONSTEXPR17 typename etl::iterator_traits<TIterator>::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::random_access_iterator_tag)
{
return last - first;
}
template<typename TIterator>
ETL_CONSTEXPR17 typename etl::iterator_traits<TIterator>::difference_type distance(TIterator first, TIterator last)
{
typedef typename etl::iterator_traits<TIterator>::iterator_category tag;
return distance_helper(first, last, tag());
}
#else
template<typename TIterator>
ETL_CONSTEXPR17 typename std::iterator_traits<TIterator>::difference_type distance(TIterator first, TIterator last)
{
return std::distance(first, last);
}
#endif
//***************************************************************************
// Previous
template<typename TIterator>
ETL_CONSTEXPR17 TIterator prev(TIterator itr, typename etl::iterator_traits<TIterator>::difference_type n = 1)
{
#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED
etl::advance(itr, -n);
#else
std::advance(itr, -n);
#endif
return itr;
}
//***************************************************************************
// Next
template<typename TIterator>
ETL_CONSTEXPR17 TIterator next(TIterator itr, typename etl::iterator_traits<TIterator>::difference_type n = 1)
{
#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED
etl::advance(itr, n);
#else
std::advance(itr, n);
#endif
return itr;
}
//***************************************************************************
// reverse_iterator
template <typename TIterator>
class reverse_iterator
{
public:
typedef typename iterator_traits<TIterator>::iterator_category iterator_category;
typedef typename iterator_traits<TIterator>::value_type value_type;
typedef typename iterator_traits<TIterator>::difference_type difference_type;
typedef typename iterator_traits<TIterator>::pointer pointer;
typedef typename iterator_traits<TIterator>::reference reference;
typedef TIterator iterator_type;
ETL_CONSTEXPR17 reverse_iterator()
: current()
{
}
ETL_CONSTEXPR17 explicit reverse_iterator(TIterator itr)
: current(itr)
{
}
template <typename TOther>
ETL_CONSTEXPR17 reverse_iterator(const reverse_iterator<TOther>& other)
: current(other.base())
{
}
template<class TOther>
ETL_CONSTEXPR17 reverse_iterator& operator=(const reverse_iterator<TOther>& other)
{
current = other.base();
return (*this);
}
ETL_CONSTEXPR17 TIterator base() const
{
return current;
}
ETL_NODISCARD ETL_CONSTEXPR17 reference operator*() const
{
TIterator temp = current;
return *(--temp);
}
ETL_NODISCARD ETL_CONSTEXPR17 pointer operator->() const
{
TIterator temp = current;
return &(*--temp);
}
ETL_CONSTEXPR17 reverse_iterator& operator++()
{
--current;
return *this;
}
ETL_CONSTEXPR17 reverse_iterator operator++(int)
{
reverse_iterator temp = *this;
--current;
return temp;
}
ETL_CONSTEXPR17 reverse_iterator& operator--()
{
++current;
return (*this);
}
ETL_CONSTEXPR17 reverse_iterator operator--(int)
{
reverse_iterator temp = *this;
++current;
return temp;
}
ETL_CONSTEXPR17 reverse_iterator& operator+=(const difference_type offset)
{
current -= offset;
return (*this);
}
ETL_CONSTEXPR17 reverse_iterator& operator-=(const difference_type offset)
{
current += offset;
return (*this);
}
ETL_NODISCARD ETL_CONSTEXPR17 reverse_iterator operator+(const difference_type offset) const
{
return reverse_iterator(current - offset);
}
ETL_NODISCARD ETL_CONSTEXPR17 reverse_iterator operator-(const difference_type offset) const
{
return (reverse_iterator(current + offset));
}
ETL_NODISCARD ETL_CONSTEXPR17 reference operator[](const difference_type offset) const
{
return (*(*this + offset));
}
protected:
TIterator current;
};
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator ==(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return lhs.base() == rhs.base();
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator !=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return !(lhs == rhs);
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator <(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return rhs.base() < lhs.base();
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator >(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return rhs < lhs;
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator <=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return !(rhs < lhs);
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator >=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return !(lhs < rhs);
}
template <class TIterator>
inline ETL_CONSTEXPR17 typename reverse_iterator<TIterator>::difference_type operator -(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return rhs.base() - lhs.base();
}
template <class TIterator, class TDifference>
inline ETL_CONSTEXPR17 reverse_iterator<TIterator> operator +(TDifference n, const reverse_iterator<TIterator>& itr)
{
return itr.operator +(n);
}
//***************************************************************************
/// iterator
//***************************************************************************
@ -55,78 +426,81 @@ namespace etl
typedef TCategory iterator_category;
};
}
namespace etl
{
//***************************************************************************
// Helper templates.
//***************************************************************************
// Helper templates.
//***************************************************************************
template <typename T>
struct is_input_iterator
{
static const bool value = etl::is_same<typename ETL_STD::iterator_traits<T>::iterator_category, ETL_INPUT_ITERATOR_TAG>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same<typename etl::iterator_traits<T>::iterator_category, ETL_OR_STD::input_iterator_tag>::value;
};
template <typename T>
struct is_output_iterator
{
static const bool value = etl::is_same<typename ETL_STD::iterator_traits<T>::iterator_category, ETL_OUTPUT_ITERATOR_TAG>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same<typename etl::iterator_traits<T>::iterator_category, ETL_OR_STD::output_iterator_tag>::value;
};
template <typename T>
struct is_forward_iterator
{
static const bool value = etl::is_same<typename ETL_STD::iterator_traits<T>::iterator_category, ETL_FORWARD_ITERATOR_TAG>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same<typename etl::iterator_traits<T>::iterator_category, ETL_OR_STD::forward_iterator_tag>::value;
};
template <typename T>
struct is_bidirectional_iterator
{
static const bool value = etl::is_same<typename ETL_STD::iterator_traits<T>::iterator_category, ETL_BIDIRECTIONAL_ITERATOR_TAG>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same<typename etl::iterator_traits<T>::iterator_category, ETL_OR_STD::bidirectional_iterator_tag>::value;
};
template <typename T>
struct is_random_iterator
{
static const bool value = etl::is_same<typename ETL_STD::iterator_traits<T>::iterator_category, ETL_RANDOM_ACCESS_ITERATOR_TAG>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same<typename etl::iterator_traits<T>::iterator_category, ETL_OR_STD::random_access_iterator_tag>::value;
};
template <typename T>
struct is_input_iterator_concept
{
static const bool value = etl::is_input_iterator<T>::value ||
etl::is_forward_iterator<T>::value ||
etl::is_bidirectional_iterator<T>::value ||
etl::is_random_iterator<T>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_input_iterator<T>::value ||
etl::is_forward_iterator<T>::value ||
etl::is_bidirectional_iterator<T>::value ||
etl::is_random_iterator<T>::value;
};
template <typename T>
struct is_output_iterator_concept
{
static const bool value = etl::is_output_iterator<T>::value ||
etl::is_forward_iterator<T>::value ||
etl::is_bidirectional_iterator<T>::value ||
etl::is_random_iterator<T>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_output_iterator<T>::value ||
etl::is_forward_iterator<T>::value ||
etl::is_bidirectional_iterator<T>::value ||
etl::is_random_iterator<T>::value;
};
template <typename T>
struct is_forward_iterator_concept
{
static const bool value = etl::is_forward_iterator<T>::value ||
etl::is_bidirectional_iterator<T>::value ||
etl::is_random_iterator<T>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_forward_iterator<T>::value ||
etl::is_bidirectional_iterator<T>::value ||
etl::is_random_iterator<T>::value;
};
template <typename T>
struct is_bidirectional_iterator_concept
{
static const bool value = etl::is_bidirectional_iterator<T>::value ||
etl::is_random_iterator<T>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_bidirectional_iterator<T>::value ||
etl::is_random_iterator<T>::value;
};
template <typename T>
struct is_random_iterator_concept
{
static const bool value = etl::is_random_iterator<T>::value;
static ETL_CONST_OR_CONSTEXPR bool value = etl::is_random_iterator<T>::value;
};
}
#endif

View File

@ -40,7 +40,7 @@ SOFTWARE.
#include "ihash.h"
#include "frame_check_sequence.h"
#include "stl/iterator.h"
#include "iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300

View File

@ -82,15 +82,15 @@ namespace etl
// Set 'type' to be the largest of the first parameter and any of the others.
// This is recursive.
using type = typename etl::conditional<(etl::size_of<T1>() > etl::size_of<largest_other>()), // Boolean
T1, // TrueType
largest_other> // FalseType
::type; // The largest type of the two.
using type = typename etl::conditional<(etl::size_of<T1>::value > etl::size_of<largest_other>::value), // Boolean
T1, // TrueType
largest_other> // FalseType
::type; // The largest type of the two.
// The size of the largest type.
enum
{
size = etl::size_of<type>()
size = etl::size_of<type>::value
};
};
@ -106,7 +106,7 @@ namespace etl
enum
{
size = etl::size_of<type>()
size = etl::size_of<type>::value
};
};
#else

View File

@ -94,15 +94,15 @@ namespace etl
// Set 'type' to be the largest of the first parameter and any of the others.
// This is recursive.
using type = typename etl::conditional<(etl::size_of<T1>() > etl::size_of<largest_other>()), // Boolean
T1, // TrueType
largest_other> // FalseType
::type; // The largest type of the two.
using type = typename etl::conditional<(etl::size_of<T1>::value > etl::size_of<largest_other>::value), // Boolean
T1, // TrueType
largest_other> // FalseType
::type; // The largest type of the two.
// The size of the largest type.
enum
{
size = etl::size_of<type>()
size = etl::size_of<type>::value
};
};
@ -118,7 +118,7 @@ namespace etl
enum
{
size = etl::size_of<type>()
size = etl::size_of<type>::value
};
};
#else

586
include/etl/limits.h Normal file
View File

@ -0,0 +1,586 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_LIMITS_INCLUDED
#define ETL_LIMITS_INCLUDED
#include "etl/platform.h"
#include "etl/type_traits.h"
#include "etl/char_traits.h"
#include "etl/integral_limits.h"
#include <limits.h>
#include <stdint.h>
#include <float.h>
#include <math.h>
#if defined(ETL_NO_STL)
#define ETL_LOG10_OF_2(x) (((x) * 301) / 1000)
namespace etl
{
enum float_round_style
{
round_indeterminate = -1,
round_toward_zero = 0,
round_to_nearest = 1,
round_toward_infinity = 2,
round_toward_neg_infinity = 3,
};
enum float_denorm_style
{
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
};
class etl_integral_limits
{
public:
static const bool is_specialized = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int max_digits10 = 0;
static const int radix = 2;
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const bool has_denorm_loss = false;
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_denorm_style has_denorm = denorm_absent;
static const float_round_style round_style = round_toward_zero;
};
class etl_floating_point_limits
{
public:
static const bool is_specialized = true;
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 2;
static const bool has_infinity = true;
static const bool has_quiet_NaN = true;
static const bool has_signaling_NaN = true;
static const bool has_denorm_loss = false;
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_denorm_style has_denorm = denorm_indeterminate;
static const float_round_style round_style = round_indeterminate;
static const float round_error() { return float(0.5); }
};
//***************************************************************************
// Default
template <typename T>
class numeric_limits;
template <typename T>
class numeric_limits<const T> : public numeric_limits<T> { };
template <typename T>
class numeric_limits<volatile T> : public numeric_limits<T> { };
template <typename T>
class numeric_limits<const volatile T> : public numeric_limits<T> { };
//***************************************************************************
// bool
template<>
class numeric_limits<bool> : public etl_integral_limits
{
public:
static const int digits = 1;
static const int digits10 = 0;
static const bool is_signed = false;
static const bool is_modulo = false;
static const bool min() { return false; }
static const bool max() { return true; }
static const bool lowest() { return false; }
static const bool epsilon() { return false; }
static const bool round_error() { return false; }
static const bool denorm_min() { return false; }
static const bool infinity() { return false; }
static const bool quiet_NaN() { return false; }
static const bool signaling_NaN() { return false; }
};
//***************************************************************************
// char
template<>
class numeric_limits<char> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(char)) - (etl::is_signed<char>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = etl::is_signed<char>::value;
static const bool is_modulo = false;
static const char min() { return char(CHAR_MIN); }
static const char max() { return char(CHAR_MAX); }
static const char lowest() { return char(CHAR_MIN); }
static const char epsilon() { return 0; }
static const char round_error() { return 0; }
static const char denorm_min() { return 0; }
static const char infinity() { return 0; }
static const char quiet_NaN() { return 0; }
static const char signaling_NaN() { return 0; }
};
//***************************************************************************
// unsigned char
template<>
class numeric_limits<unsigned char> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(unsigned char)) - (etl::is_signed<unsigned char>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = false;
static const bool is_modulo = true;
static const unsigned char min() { return 0U; }
static const unsigned char max() { return UCHAR_MAX; }
static const unsigned char lowest() { return 0U; }
static const unsigned char epsilon() { return 0U; }
static const unsigned char round_error() { return 0U; }
static const unsigned char denorm_min() { return 0U; }
static const unsigned char infinity() { return 0U; }
static const unsigned char quiet_NaN() { return 0U; }
static const unsigned char signaling_NaN() { return 0U; }
};
//***************************************************************************
// signed char
template<>
class numeric_limits<signed char> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(char)) - (etl::is_signed<char>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = true;
static const bool is_modulo = false;
static const signed char min() { return SCHAR_MIN; }
static const signed char max() { return SCHAR_MAX; }
static const signed char lowest() { return SCHAR_MIN; }
static const signed char epsilon() { return 0; }
static const signed char round_error() { return 0; }
static const signed char denorm_min() { return 0; }
static const signed char infinity() { return 0; }
static const signed char quiet_NaN() { return 0; }
static const signed char signaling_NaN() { return 0; }
};
#if (ETL_NO_LARGE_CHAR_SUPPORT == false)
//***************************************************************************
// char16_t
template<>
class numeric_limits<char16_t> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(char16_t)) - (etl::is_signed<char16_t>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = false;
static const bool is_modulo = true;
static const char16_t min() { return 0U; }
static const char16_t max() { return UINT_LEAST16_MAX; }
static const char16_t lowest() { return 0U; }
static const char16_t epsilon() { return 0U; }
static const char16_t round_error() { return 0U; }
static const char16_t denorm_min() { return 0U; }
static const char16_t infinity() { return 0U; }
static const char16_t quiet_NaN() { return 0U; }
static const char16_t signaling_NaN() { return 0U; }
};
//***************************************************************************
// char32_t
template<>
class numeric_limits<char32_t> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(char32_t)) - (etl::is_signed<char32_t>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = false;
static const bool is_modulo = true;
static const char32_t min() { return 0U; }
static const char32_t max() { return UINT_LEAST32_MAX; }
static const char32_t lowest() { return 0U; }
static const char32_t epsilon() { return 0U; }
static const char32_t round_error() { return 0U; }
static const char32_t denorm_min() { return 0U; }
static const char32_t infinity() { return 0U; }
static const char32_t quiet_NaN() { return 0U; }
static const char32_t signaling_NaN() { return 0U; }
};
#endif
//***************************************************************************
// wchar_t
template<>
class numeric_limits<wchar_t> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(wchar_t)) - (etl::is_signed<wchar_t>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = etl::is_signed<wchar_t>::value;
static const bool is_modulo = etl::is_unsigned<wchar_t>::value;
static const wchar_t min() { return WCHAR_MIN; }
static const wchar_t max() { return WCHAR_MAX; }
static const wchar_t lowest() { return WCHAR_MIN; }
static const wchar_t epsilon() { return wchar_t(0); }
static const wchar_t round_error() { return wchar_t(0); }
static const wchar_t denorm_min() { return wchar_t(0); }
static const wchar_t infinity() { return wchar_t(0); }
static const wchar_t quiet_NaN() { return wchar_t(0); }
static const wchar_t signaling_NaN() { return wchar_t(0); }
};
//***************************************************************************
// short
template<>
class numeric_limits<short> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(short)) - (etl::is_signed<short>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = true;
static const bool is_modulo = false;
static const short min() { return SHRT_MIN; }
static const short max() { return SHRT_MAX; }
static const short lowest() { return SHRT_MIN; }
static const short epsilon() { return 0; }
static const short round_error() { return 0; }
static const short denorm_min() { return 0; }
static const short infinity() { return 0; }
static const short quiet_NaN() { return 0; }
static const short signaling_NaN() { return 0; }
};
//***************************************************************************
// unsigned short
template<>
class numeric_limits<unsigned short> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(unsigned short)) - (etl::is_signed<unsigned short>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = false;
static const bool is_modulo = true;
static const unsigned short min() { return 0U; }
static const unsigned short max() { return USHRT_MAX; }
static const unsigned short lowest() { return 0U; }
static const unsigned short epsilon() { return 0U; }
static const unsigned short round_error() { return 0U; }
static const unsigned short denorm_min() { return 0U; }
static const unsigned short infinity() { return 0U; }
static const unsigned short quiet_NaN() { return 0U; }
static const unsigned short signaling_NaN() { return 0U; }
};
//***************************************************************************
// int
template<>
class numeric_limits<int> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(int)) - (etl::is_signed<int>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = true;
static const bool is_modulo = false;
static const int min() { return INT_MIN; }
static const int max() { return INT_MAX; }
static const int lowest() { return INT_MIN; }
static const int epsilon() { return 0; }
static const int round_error() { return 0; }
static const int denorm_min() { return 0; }
static const int infinity() { return 0; }
static const int quiet_NaN() { return 0; }
static const int signaling_NaN() { return 0; }
};
//***************************************************************************
// unsigned int
template<>
class numeric_limits<unsigned int> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(unsigned int)) - (etl::is_signed<unsigned int>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = false;
static const bool is_modulo = true;
static const unsigned int min() { return 0U; }
static const unsigned int max() { return UINT_MAX; }
static const unsigned int lowest() { return 0U; }
static const unsigned int epsilon() { return 0U; }
static const unsigned int round_error() { return 0U; }
static const unsigned int denorm_min() { return 0U; }
static const unsigned int infinity() { return 0U; }
static const unsigned int quiet_NaN() { return 0U; }
static const unsigned int signaling_NaN() { return 0U; }
};
//***************************************************************************
// long
template<>
class numeric_limits<long> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(long)) - (etl::is_signed<long>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = true;
static const bool is_modulo = false;
static const long min() { return LONG_MIN; }
static const long max() { return LONG_MAX; }
static const long lowest() { return LONG_MIN; }
static const long epsilon() { return 0; }
static const long round_error() { return 0; }
static const long denorm_min() { return 0; }
static const long infinity() { return 0; }
static const long quiet_NaN() { return 0; }
static const long signaling_NaN() { return 0; }
};
//***************************************************************************
// unsigned long
template<>
class numeric_limits<unsigned long> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(unsigned long)) - (etl::is_signed<unsigned long>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = false;
static const bool is_modulo = true;
static const unsigned long min() { return 0U; }
static const unsigned long max() { return ULONG_MAX; }
static const unsigned long lowest() { return 0U; }
static const unsigned long epsilon() { return 0U; }
static const unsigned long round_error() { return 0U; }
static const unsigned long denorm_min() { return 0U; }
static const unsigned long infinity() { return 0U; }
static const unsigned long quiet_NaN() { return 0U; }
static const unsigned long signaling_NaN() { return 0U; }
};
//***************************************************************************
// long long
template<>
class numeric_limits<long long> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(long long)) - (etl::is_signed<long long>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = true;
static const bool is_modulo = false;
static const long long min() { return LLONG_MIN; }
static const long long max() { return LLONG_MAX; }
static const long long lowest() { return LLONG_MIN; }
static const long long epsilon() { return 0; }
static const long long round_error() { return 0; }
static const long long denorm_min() { return 0; }
static const long long infinity() { return 0; }
static const long long quiet_NaN() { return 0; }
static const long long signaling_NaN() { return 0; }
};
//***************************************************************************
// unsigned long long
template<>
class numeric_limits<unsigned long long> : public etl_integral_limits
{
public:
static const int digits = (CHAR_BIT * sizeof(unsigned long long)) - (etl::is_signed<unsigned long long>::value ? 1 : 0);
static const int digits10 = ETL_LOG10_OF_2(digits);
static const bool is_signed = false;
static const bool is_modulo = true;
static const unsigned long long min() { return 0U; }
static const unsigned long long max() { return ULLONG_MAX; }
static const unsigned long long lowest() { return 0U; }
static const unsigned long long epsilon() { return 0U; }
static const unsigned long long round_error() { return 0U; }
static const unsigned long long denorm_min() { return 0U; }
static const unsigned long long infinity() { return 0U; }
static const unsigned long long quiet_NaN() { return 0U; }
static const unsigned long long signaling_NaN() { return 0U; }
};
//***************************************************************************
// float
template<>
class numeric_limits<float> : public etl_floating_point_limits
{
public:
static const float min() { return FLT_MIN; }
static const float max() { return FLT_MAX; }
static const float lowest() { return -FLT_MAX; }
static const float epsilon() { return FLT_EPSILON; }
static const float denorm_min() { return FLT_MIN; }
static const float infinity() { return HUGE_VALF; }
static const float quiet_NaN() { return nanf(""); }
static const float signaling_NaN() { return nanf(""); }
static const int digits = FLT_MANT_DIG;
static const int digits10 = FLT_DIG;
static const int max_digits10 = ETL_LOG10_OF_2(FLT_MANT_DIG) + 2;
static const int min_exponent = FLT_MIN_EXP;
static const int min_exponent10 = FLT_MIN_10_EXP;
static const int max_exponent = FLT_MAX_EXP;
static const int max_exponent10 = FLT_MAX_10_EXP;
};
//***************************************************************************
// double
template<>
class numeric_limits<double> : public etl_floating_point_limits
{
public:
static const double min() { return DBL_MIN; }
static const double max() { return DBL_MAX; }
static const double lowest() { return -DBL_MAX; }
static const double epsilon() { return DBL_EPSILON; }
static const double denorm_min() { return DBL_MIN; }
static const double infinity() { return HUGE_VAL; }
static const double quiet_NaN() { return nan(""); }
static const double signaling_NaN() { return nan(""); }
static const int digits = DBL_MANT_DIG;
static const int digits10 = DBL_DIG;
static const int max_digits10 = ETL_LOG10_OF_2(DBL_MANT_DIG) + 2;
static const int min_exponent = DBL_MIN_EXP;
static const int min_exponent10 = DBL_MIN_10_EXP;
static const int max_exponent = DBL_MAX_EXP;
static const int max_exponent10 = DBL_MAX_10_EXP;
};
//***************************************************************************
// long double
template<>
class numeric_limits<long double> : public etl_floating_point_limits
{
public:
static const long double min() { return LDBL_MIN; }
static const long double max() { return LDBL_MAX; }
static const long double lowest() { return -LDBL_MAX; }
static const long double epsilon() { return LDBL_EPSILON; }
static const long double denorm_min() { return LDBL_MIN; }
static const long double infinity() { return HUGE_VALL; }
static const long double quiet_NaN() { return nanl(""); }
static const long double signaling_NaN() { return nanl(""); }
static const int digits = LDBL_MANT_DIG;
static const int digits10 = LDBL_DIG;
static const int max_digits10 = ETL_LOG10_OF_2(LDBL_MANT_DIG) + 2;
static const int min_exponent = LDBL_MIN_EXP;
static const int min_exponent10 = LDBL_MIN_10_EXP;
static const int max_exponent = LDBL_MAX_EXP;
static const int max_exponent10 = LDBL_MAX_10_EXP;
};
}
#else
#include <limits>
namespace etl
{
enum float_round_style
{
round_indeterminate = std::float_round_style::round_indeterminate,
round_toward_zero = std::float_round_style::round_toward_zero,
round_to_nearest = std::float_round_style::round_to_nearest,
round_toward_infinity = std::float_round_style::round_toward_infinity,
round_toward_neg_infinity = std::float_round_style::round_toward_neg_infinity,
};
enum float_denorm_style
{
denorm_indeterminate = std::float_denorm_style::denorm_indeterminate,
denorm_absent = std::float_denorm_style::denorm_absent,
denorm_present = std::float_denorm_style::denorm_present
};
template <typename T>
class numeric_limits : public std::numeric_limits<T>
{
};
}
#endif
#endif

View File

@ -37,9 +37,9 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "container.h"
#include "pool.h"
@ -182,7 +182,9 @@ namespace etl
//***********************************************************************
inline void reverse()
{
ETL_STD::swap(previous, next);
using ETL_OR_STD::swap; // Allow ADL
swap(previous, next);
}
node_t* previous;
@ -482,7 +484,7 @@ namespace etl
//*************************************************************************
/// iterator.
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, T>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, T>
{
public:
@ -583,7 +585,7 @@ namespace etl
//*************************************************************************
/// const_iterator
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const T>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const T>
{
public:
@ -676,10 +678,10 @@ namespace etl
const node_t* p_node;
};
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
//*************************************************************************
/// Gets the beginning of the list.
@ -810,7 +812,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d >= 0, ETL_ERROR(list_iterator));
ETL_ASSERT(size_t(d) <= MAX_SIZE, ETL_ERROR(list_full));
#endif
@ -866,7 +868,7 @@ namespace etl
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
insert_node(get_head(), allocate_data_node(ETL_STD::move(value)));
insert_node(get_head(), allocate_data_node(etl::move(value)));
}
#endif
@ -883,7 +885,7 @@ namespace etl
ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = p_node_pool->allocate<data_node_t>();
::new (&(p_data_node->value)) T(ETL_STD::forward<Args>(args)...);
::new (&(p_data_node->value)) T(etl::forward<Args>(args)...);
ETL_INCREMENT_DEBUG_COUNT
insert_node(get_head(), *p_data_node);
}
@ -989,7 +991,7 @@ namespace etl
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
insert_node(terminal_node, allocate_data_node(ETL_STD::move(value)));
insert_node(terminal_node, allocate_data_node(etl::move(value)));
}
#endif
@ -1006,7 +1008,7 @@ namespace etl
ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = p_node_pool->allocate<data_node_t>();
::new (&(p_data_node->value)) T(ETL_STD::forward<Args>(args)...);
::new (&(p_data_node->value)) T(etl::forward<Args>(args)...);
ETL_INCREMENT_DEBUG_COUNT
insert_node(terminal_node, *p_data_node);
}
@ -1101,7 +1103,7 @@ namespace etl
{
ETL_ASSERT(!full(), ETL_ERROR(list_full));
data_node_t& data_node = allocate_data_node(ETL_STD::move(value));
data_node_t& data_node = allocate_data_node(etl::move(value));
insert_node(*position.p_node, data_node);
return iterator(data_node);
@ -1119,7 +1121,7 @@ namespace etl
ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = p_node_pool->allocate<data_node_t>();
::new (&(p_data_node->value)) T(ETL_STD::forward<Args>(args)...);
::new (&(p_data_node->value)) T(etl::forward<Args>(args)...);
ETL_INCREMENT_DEBUG_COUNT
insert_node(*position.p_node, *p_data_node);
@ -1269,7 +1271,7 @@ namespace etl
else if (n < size())
{
iterator i_start = end();
ETL_STD::advance(i_start, -difference_type(size() - n));
etl::advance(i_start, -difference_type(size() - n));
erase(i_start, end());
}
// Larger?
@ -1334,7 +1336,7 @@ namespace etl
//*************************************************************************
void unique()
{
unique(ETL_STD::equal_to<T>());
unique(etl::equal_to<T>());
}
//*************************************************************************
@ -1390,7 +1392,7 @@ namespace etl
typename ilist<T>::iterator itr = other.begin();
while (itr != other.end())
{
to = insert(to, ETL_STD::move(*itr++));
to = insert(to, etl::move(*itr++));
}
other.erase(other.begin(), other.end());
@ -1430,7 +1432,7 @@ namespace etl
else
{
// From another list.
insert(to, ETL_STD::move(*from));
insert(to, etl::move(*from));
other.erase(from);
}
}
@ -1471,7 +1473,7 @@ namespace etl
ilist::iterator itr = first;
while (itr != last)
{
to = insert(to, ETL_STD::move(*itr++));
to = insert(to, etl::move(*itr++));
++to;
}
@ -1485,7 +1487,7 @@ namespace etl
//*************************************************************************
void merge(ilist& other)
{
merge(other, ETL_STD::less<value_type>());
merge(other, etl::less<value_type>());
}
//*************************************************************************
@ -1542,7 +1544,7 @@ namespace etl
//*************************************************************************
void merge(ilist&& other)
{
merge(ETL_STD::move(other), ETL_STD::less<value_type>());
merge(etl::move(other), etl::less<value_type>());
}
//*************************************************************************
@ -1577,7 +1579,7 @@ namespace etl
{
while ((other_begin != other_end) && (compare(*other_begin, *this_begin)))
{
insert(this_begin, ETL_STD::move(*other_begin));
insert(this_begin, etl::move(*other_begin));
++other_begin;
}
}
@ -1588,7 +1590,7 @@ namespace etl
{
while (other_begin != other_end)
{
insert(this_end, ETL_STD::move(*other_begin++));
insert(this_end, etl::move(*other_begin++));
}
}
@ -1603,7 +1605,7 @@ namespace etl
//*************************************************************************
void sort()
{
sort(ETL_STD::less<T>());
sort(etl::less<T>());
}
//*************************************************************************
@ -1765,7 +1767,7 @@ namespace etl
iterator itr = rhs.begin();
while (itr != rhs.end())
{
push_back(ETL_STD::move(*itr));
push_back(etl::move(*itr));
++itr;
}
@ -1917,7 +1919,7 @@ namespace etl
ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = p_node_pool->allocate<data_node_t>();
::new (&(p_data_node->value)) T(ETL_STD::move(value));
::new (&(p_data_node->value)) T(etl::move(value));
ETL_INCREMENT_DEBUG_COUNT
return *p_data_node;
@ -2033,7 +2035,7 @@ namespace etl
typename etl::ilist<T>::iterator itr = other.begin();
while (itr != other.end())
{
this->push_back(ETL_STD::move(*itr));
this->push_back(etl::move(*itr));
++itr;
}
@ -2089,7 +2091,7 @@ namespace etl
typename etl::ilist<T>::iterator itr = rhs.begin();
while (itr != rhs.end())
{
this->push_back(ETL_STD::move(*itr));
this->push_back(etl::move(*itr));
++itr;
}
@ -2191,7 +2193,7 @@ namespace etl
typename etl::ilist<T>::iterator itr = other.begin();
while (itr != other.end())
{
this->push_back(ETL_STD::move(*itr));
this->push_back(etl::move(*itr));
++itr;
}
@ -2214,7 +2216,7 @@ namespace etl
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************
list(ETL_STD::initializer_list<T> init, etl::ipool& node_pool)
list(std::initializer_list<T> init, etl::ipool& node_pool)
: ilist<T>(node_pool, node_pool.max_size(), true)
{
this->assign(init.begin(), init.end());
@ -2247,7 +2249,7 @@ namespace etl
typename etl::ilist<T>::iterator itr = rhs.begin();
while (itr != rhs.end())
{
this->push_back(ETL_STD::move(*itr));
this->push_back(etl::move(*itr));
++itr;
}
@ -2282,7 +2284,7 @@ namespace etl
template <typename T>
bool operator ==(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
@ -2307,10 +2309,7 @@ namespace etl
template <typename T>
bool operator <(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//*************************************************************************

View File

@ -37,9 +37,9 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "container.h"
#include "pool.h"
@ -462,13 +462,13 @@ namespace etl
/// A templated base for all etl::map types.
///\ingroup map
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TMapped, typename TKeyCompare = etl::less<TKey> >
class imap : public etl::map_base
{
public:
typedef TKey key_type;
typedef ETL_PAIR<const TKey, TMapped> value_type;
typedef ETL_OR_STD::pair<const TKey, TMapped> value_type;
typedef TMapped mapped_type;
typedef TKeyCompare key_compare;
typedef value_type& reference;
@ -575,7 +575,7 @@ namespace etl
//*************************************************************************
/// iterator.
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
{
public:
@ -696,7 +696,7 @@ namespace etl
//*************************************************************************
/// const_iterator
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
{
public:
@ -804,10 +804,10 @@ namespace etl
friend class const_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
//*************************************************************************
/// Gets the beginning of the map.
@ -917,7 +917,7 @@ namespace etl
if (!i_element.p_node)
{
// Doesn't exist, so create a new one.
i_element = insert(ETL_MAKE_PAIR(key, mapped_type())).first;
i_element = insert(ETL_OR_STD::make_pair(key, mapped_type())).first;
}
return i_element->second;
@ -989,9 +989,9 @@ namespace etl
/// Returns two iterators with bounding (lower bound, upper bound) the key
/// provided
//*************************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
return ETL_MAKE_PAIR<iterator, iterator>(
return ETL_OR_STD::make_pair<iterator, iterator>(
iterator(*this, find_lower_node(root_node, key)),
iterator(*this, find_upper_node(root_node, key)));
}
@ -1000,9 +1000,9 @@ namespace etl
/// Returns two const iterators with bounding (lower bound, upper bound)
/// the key provided.
//*************************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
return ETL_MAKE_PAIR<const_iterator, const_iterator>(
return ETL_OR_STD::make_pair<const_iterator, const_iterator>(
const_iterator(*this, find_lower_node(root_node, key)),
const_iterator(*this, find_upper_node(root_node, key)));
}
@ -1093,7 +1093,7 @@ namespace etl
/// If asserts or exceptions are enabled, emits map_full if the map is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(const value_type& value)
ETL_OR_STD::pair<iterator, bool> insert(const value_type& value)
{
// Default to no inserted node
Node* inserted_node = nullptr;
@ -1109,7 +1109,7 @@ namespace etl
inserted = inserted_node == &node;
// Insert node into tree and return iterator to new node location in tree
return ETL_MAKE_PAIR(iterator(*this, inserted_node), inserted);
return ETL_OR_STD::make_pair(iterator(*this, inserted_node), inserted);
}
//*********************************************************************
@ -2042,7 +2042,7 @@ namespace etl
//*************************************************************************
/// A templated map implementation that uses a fixed size buffer.
//*************************************************************************
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = etl::less<TKey> >
class map : public etl::imap<TKey, TValue, TCompare>
{
public:
@ -2129,7 +2129,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -2155,10 +2155,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//*************************************************************************

File diff suppressed because it is too large Load Diff

View File

@ -102,10 +102,10 @@ namespace etl
if (ok)
{
router_list_t::iterator irouter = ETL_STD::upper_bound(router_list.begin(),
router_list.end(),
router.get_message_router_id(),
compare_router_id());
router_list_t::iterator irouter = etl::upper_bound(router_list.begin(),
router_list.end(),
router.get_message_router_id(),
compare_router_id());
router_list.insert(irouter, &router);
}
@ -125,10 +125,10 @@ namespace etl
}
else
{
ETL_PAIR<router_list_t::iterator, router_list_t::iterator> range = ETL_STD::equal_range(router_list.begin(),
router_list.end(),
id,
compare_router_id());
ETL_OR_STD::pair<router_list_t::iterator, router_list_t::iterator> range = etl::equal_range(router_list.begin(),
router_list.end(),
id,
compare_router_id());
router_list.erase(range.first, range.second);
}
@ -137,9 +137,9 @@ namespace etl
//*******************************************
void unsubscribe(etl::imessage_router& router)
{
router_list_t::iterator irouter = ETL_STD::find(router_list.begin(),
router_list.end(),
&router);
router_list_t::iterator irouter = etl::find(router_list.begin(),
router_list.end(),
&router);
if (irouter != router_list.end())
{
@ -212,10 +212,10 @@ namespace etl
router_list_t::iterator irouter = router_list.begin();
// Find routers with the id.
ETL_PAIR<router_list_t::iterator, router_list_t::iterator> range = ETL_STD::equal_range(router_list.begin(),
router_list.end(),
destination_router_id,
compare_router_id());
ETL_OR_STD::pair<router_list_t::iterator, router_list_t::iterator> range = etl::equal_range(router_list.begin(),
router_list.end(),
destination_router_id,
compare_router_id());
// Call all of them.
while (range.first != range.second)
@ -230,10 +230,10 @@ namespace etl
// Do any message buses.
// These are always at the end of the list.
irouter = ETL_STD::lower_bound(router_list.begin(),
router_list.end(),
etl::imessage_bus::MESSAGE_BUS,
compare_router_id());
irouter = etl::lower_bound(router_list.begin(),
router_list.end(),
etl::imessage_bus::MESSAGE_BUS,
compare_router_id());
while (irouter != router_list.end())
{

View File

@ -37,9 +37,9 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "container.h"
#include "pool.h"
@ -624,12 +624,12 @@ namespace etl
/// A templated base for all etl::multimap types.
///\ingroup map
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TMapped, typename TKeyCompare = etl::less<TKey> >
class imultimap : public etl::multimap_base
{
public:
typedef ETL_PAIR<const TKey, TMapped> value_type;
typedef ETL_OR_STD::pair<const TKey, TMapped> value_type;
typedef const TKey key_type;
typedef TMapped mapped_type;
typedef TKeyCompare key_compare;
@ -733,7 +733,7 @@ namespace etl
//*************************************************************************
/// iterator.
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
{
public:
@ -853,7 +853,7 @@ namespace etl
//*************************************************************************
/// const_iterator
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
{
public:
@ -960,10 +960,10 @@ namespace etl
};
friend class const_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
//*************************************************************************
/// Gets the beginning of the multimap.
@ -1097,9 +1097,9 @@ namespace etl
/// Returns two iterators with bounding (lower bound, upper bound) the key
/// provided
//*************************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
return ETL_MAKE_PAIR<iterator, iterator>(
return ETL_OR_STD::make_pair<iterator, iterator>(
iterator(*this, find_lower_node(root_node, key)),
iterator(*this, find_upper_node(root_node, key)));
}
@ -1108,9 +1108,9 @@ namespace etl
/// Returns two const iterators with bounding (lower bound, upper bound)
/// the key provided.
//*************************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
return ETL_MAKE_PAIR<const_iterator, const_iterator>(
return ETL_OR_STD::make_pair<const_iterator, const_iterator>(
const_iterator(*this, find_lower_node(root_node, key)),
const_iterator(*this, find_upper_node(root_node, key)));
}
@ -1931,7 +1931,7 @@ namespace etl
//*************************************************************************
/// A templated multimap implementation that uses a fixed size buffer.
//*************************************************************************
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = etl::less<TKey> >
class multimap : public etl::imultimap<TKey, TValue, TCompare>
{
public:
@ -2018,7 +2018,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -2044,10 +2044,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//*************************************************************************

View File

@ -37,9 +37,9 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "parameter_type.h"
#include "container.h"
@ -623,7 +623,7 @@ namespace etl
/// A templated base for all etl::multiset types.
///\ingroup set
//***************************************************************************
template <typename T, typename TCompare = ETL_STD::less<T> >
template <typename T, typename TCompare = ETL_OR_STD::less<T> >
class imultiset : public etl::multiset_base
{
public:
@ -713,7 +713,7 @@ namespace etl
//*************************************************************************
/// iterator.
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
{
public:
@ -818,7 +818,7 @@ namespace etl
//*************************************************************************
/// const_iterator
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
{
public:
@ -925,10 +925,10 @@ namespace etl
};
friend class const_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
//*************************************************************************
/// Gets the beginning of the multiset.
@ -1062,9 +1062,9 @@ namespace etl
/// Returns two iterators with bounding (lower bound, upper bound) the key
/// provided
//*************************************************************************
ETL_PAIR<iterator, iterator> equal_range(const value_type& key)
ETL_OR_STD::pair<iterator, iterator> equal_range(const value_type& key)
{
return ETL_MAKE_PAIR<iterator, iterator>(
return ETL_OR_STD::make_pair<iterator, iterator>(
iterator(*this, find_lower_node(root_node, key)),
iterator(*this, find_upper_node(root_node, key)));
}
@ -1073,9 +1073,9 @@ namespace etl
/// Returns two const iterators with bounding (lower bound, upper bound)
/// the key provided.
//*************************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(const value_type& key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(const value_type& key) const
{
return ETL_MAKE_PAIR<const_iterator, const_iterator>(
return ETL_OR_STD::make_pair<const_iterator, const_iterator>(
const_iterator(*this, find_lower_node(root_node, key)),
const_iterator(*this, find_upper_node(root_node, key)));
}
@ -1895,7 +1895,7 @@ namespace etl
//*************************************************************************
/// A templated multiset implementation that uses a fixed size buffer.
//*************************************************************************
template <typename T, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<T> >
template <typename T, const size_t MAX_SIZE_, typename TCompare = ETL_OR_STD::less<T> >
class multiset : public etl::imultiset<T, TCompare>
{
public:
@ -1982,7 +1982,7 @@ namespace etl
template <typename T, typename TCompare>
bool operator ==(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && ETL_OR_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -2008,7 +2008,7 @@ namespace etl
template <typename T, typename TCompare>
bool operator <(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(),
return ETL_OR_STD::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());

View File

@ -81,7 +81,7 @@ namespace etl
murmur3(TIterator begin, const TIterator end, value_type seed_ = 0)
: seed(seed_)
{
ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits<TIterator>::value_type) == 1, "Incompatible type");
ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits<TIterator>::value_type) == 1, "Incompatible type");
reset();
while (begin != end)
@ -119,7 +119,7 @@ namespace etl
template<typename TIterator>
void add(TIterator begin, const TIterator end)
{
ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits<TIterator>::value_type) == 1, "Incompatible type");
ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits<TIterator>::value_type) == 1, "Incompatible type");
ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised));
while (begin != end)

View File

@ -115,9 +115,9 @@ namespace etl
void add_observer(TObserver& observer)
{
// See if we already have it in our list.
typename Observer_List::const_iterator i_observer = ETL_STD::find(observer_list.begin(),
observer_list.end(),
&observer);
typename Observer_List::const_iterator i_observer = etl::find(observer_list.begin(),
observer_list.end(),
&observer);
// Not there?
if (i_observer == observer_list.end())
@ -138,9 +138,9 @@ namespace etl
bool remove_observer(TObserver& observer)
{
// See if we have it in our list.
typename Observer_List::iterator i_observer = ETL_STD::find(observer_list.begin(),
observer_list.end(),
&observer);
typename Observer_List::iterator i_observer = etl::find(observer_list.begin(),
observer_list.end(),
&observer);
// Found it?
if (i_observer != observer_list.end())

View File

@ -39,7 +39,7 @@ SOFTWARE.
#include "exception.h"
#include "error_handler.h"
#include "stl/utility.h"
#include "utility.h"
namespace etl
{
@ -343,7 +343,7 @@ namespace etl
storage.template get_reference<T>().~T();
}
::new (storage.template get_address<T>()) T(ETL_STD::forward<Args>(args)...);
::new (storage.template get_address<T>()) T(ETL_OR_STD::forward<Args>(args)...);
valid = true;
}
#else

View File

@ -43,9 +43,9 @@ namespace etl
struct parameter_type
{
/// By default fundamental and pointer types are passed by value.
typedef typename etl::conditional<is_fundamental<T>::value || is_pointer<T>::value,
T,
const T&>::type type;
typedef typename etl::conditional<etl::is_fundamental<T>::value || etl::is_pointer<T>::value,
T,
const T&>::type type;
};
}

View File

@ -81,7 +81,7 @@ namespace etl
pearson(TIterator begin, const TIterator end)
: first(true)
{
ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits<TIterator>::value_type) == 1, "Type not supported");
ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits<TIterator>::value_type) == 1, "Type not supported");
reset();
add(begin, end);
@ -103,7 +103,7 @@ namespace etl
template<typename TIterator>
void add(TIterator begin, const TIterator end)
{
ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits<TIterator>::value_type) == 1, "Type not supported");
ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits<TIterator>::value_type) == 1, "Type not supported");
while (begin != end)
{

View File

@ -72,7 +72,7 @@ SOFTWARE.
#endif
// The macros below are dependent on the profile.
#if ETL_CPP11_SUPPORTED
#if ETL_CPP11_SUPPORTED && !defined(ETL_FORCE_NO_ADVANCED_CPP)
#define ETL_CONSTEXPR constexpr
#define ETL_CONST_OR_CONSTEXPR constexpr
#define ETL_DELETE = delete
@ -86,7 +86,7 @@ SOFTWARE.
#define ETL_NOEXCEPT_EXPR(expression)
#endif
#if ETL_CPP17_SUPPORTED
#if ETL_CPP17_SUPPORTED && !defined(ETL_FORCE_NO_ADVANCED_CPP)
#define ETL_CONSTEXPR17 constexpr
#define ETL_IF_CONSTEXPR constexpr
#define ETL_NODISCARD [[nodiscard]]
@ -102,4 +102,7 @@ SOFTWARE.
#define ETL_EXPLICIT_STRING_FROM_CHAR
#endif
// Sort out namespaces for STL/No STL options.
#include "private/choose_namespace.h"
#endif

View File

@ -35,8 +35,8 @@ SOFTWARE.
#include <new>
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "algorithm.h"
#include "iterator.h"
#include "error_handler.h"
#include "alignment.h"
@ -224,7 +224,7 @@ namespace etl
if (p)
{
::new (p) T(ETL_STD::forward<Args>(args)...);
::new (p) T(etl::forward<Args>(args)...);
}
return p;
@ -571,7 +571,7 @@ namespace etl
{
ETL_STATIC_ASSERT(etl::alignment_of<U>::value <= ALIGNMENT_, "Type has incompatible alignment");
ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool");
return ipool::create<U>(ETL_STD::forward<Args>(args)...);
return ipool::create<U>(etl::forward<Args>(args)...);
}
#endif
@ -724,7 +724,7 @@ namespace etl
{
ETL_STATIC_ASSERT(etl::alignment_of<U>::value <= ALIGNMENT, "Type has incompatible alignment");
ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool");
return base_t::template create<U>(ETL_STD::forward<Args>(args)...);
return base_t::template create<U>(etl::forward<Args>(args)...);
}
#endif

View File

@ -35,8 +35,8 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "functional.h"
#include "container.h"
#include "vector.h"
@ -115,7 +115,7 @@ namespace etl
/// \tparam TContainer to hold the T queue values
/// \tparam TCompare to use in comparing T values
//***************************************************************************
template <typename T, typename TContainer, typename TCompare = ETL_STD::less<T> >
template <typename T, typename TContainer, typename TCompare = etl::less<T> >
class ipriority_queue
{
public:
@ -126,7 +126,7 @@ namespace etl
typedef T& reference; ///< A reference to the type used in the queue.
typedef const T& const_reference; ///< A const reference to the type used in the queue.
typedef typename TContainer::size_type size_type; ///< The type used for determining the size of the queue.
typedef typename ETL_STD::iterator_traits<typename TContainer::iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<typename TContainer::iterator>::difference_type difference_type;
private:
@ -165,7 +165,7 @@ namespace etl
// Put element at end
container.push_back(value);
// Make elements in container into heap
ETL_STD::push_heap(container.begin(), container.end(), compare);
etl::push_heap(container.begin(), container.end(), compare);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_PRIORITY_QUEUE_FORCE_CPP03)
@ -181,9 +181,9 @@ namespace etl
ETL_ASSERT(!full(), ETL_ERROR(etl::priority_queue_full));
// Put element at end
container.emplace_back(ETL_STD::forward<Args>(args)...);
container.emplace_back(etl::forward<Args>(args)...);
// Make elements in container into heap
ETL_STD::push_heap(container.begin(), container.end(), compare);
etl::push_heap(container.begin(), container.end(), compare);
}
#else
//*************************************************************************
@ -200,7 +200,7 @@ namespace etl
// Put element at end
container.emplace_back(value1);
// Make elements in container into heap
ETL_STD::push_heap(container.begin(), container.end(), compare);
etl::push_heap(container.begin(), container.end(), compare);
}
//*************************************************************************
@ -217,7 +217,7 @@ namespace etl
// Put element at end
container.emplace_back(value1, value2);
// Make elements in container into heap
ETL_STD::push_heap(container.begin(), container.end(), compare);
etl::push_heap(container.begin(), container.end(), compare);
}
//*************************************************************************
@ -234,7 +234,7 @@ namespace etl
// Put element at end
container.emplace_back(value1, value2, value3);
// Make elements in container into heap
ETL_STD::push_heap(container.begin(), container.end(), compare);
etl::push_heap(container.begin(), container.end(), compare);
}
//*************************************************************************
@ -251,7 +251,7 @@ namespace etl
// Put element at end
container.emplace_back(value1, value2, value3, value4);
// Make elements in container into heap
ETL_STD::push_heap(container.begin(), container.end(), compare);
etl::push_heap(container.begin(), container.end(), compare);
}
#endif
@ -268,14 +268,14 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d >= 0, ETL_ERROR(etl::priority_queue_iterator));
ETL_ASSERT(static_cast<size_t>(d) <= max_size(), ETL_ERROR(etl::priority_queue_full));
#endif
clear();
container.assign(first, last);
ETL_STD::make_heap(container.begin(), container.end(), compare);
etl::make_heap(container.begin(), container.end(), compare);
}
//*************************************************************************
@ -285,7 +285,7 @@ namespace etl
void pop()
{
// Move largest element to end
ETL_STD::pop_heap(container.begin(), container.end(), compare);
etl::pop_heap(container.begin(), container.end(), compare);
// Actually remove largest element at end
container.pop_back();
}
@ -386,7 +386,7 @@ namespace etl
/// \tparam T The type this queue should support.
/// \tparam SIZE The maximum capacity of the queue.
//***************************************************************************
template <typename T, const size_t SIZE, typename TContainer = etl::vector<T, SIZE>, typename TCompare = ETL_STD::less<typename TContainer::value_type> >
template <typename T, const size_t SIZE, typename TContainer = etl::vector<T, SIZE>, typename TCompare = etl::less<typename TContainer::value_type> >
class priority_queue : public etl::ipriority_queue<T, TContainer, TCompare>
{
public:

View File

@ -28,19 +28,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_CHOOSE_NAMESPACE_INCLUDED
#define ETL_STL_CHOOSE_NAMESPACE_INCLUDED
#ifndef ETL_CHOOSE_NAMESPACE_INCLUDED
#define ETL_CHOOSE_NAMESPACE_INCLUDED
#include "../platform.h"
#if defined(ETL_NO_STL)
#ifndef ETL_STD
#define ETL_STD etlstd /// Namespace for the alternate STL.
#endif
#undef ETL_OR_STD
#if defined(ETL_NO_STL) && !defined(ETL_IN_UNIT_TEST)
// If we're not using the STL and we are not unit testing, then use the ETL's definitions under the etl namespace
#define ETL_OR_STD etl
#else
#ifndef ETL_STD
#define ETL_STD std /// Namespace for conventional STL
#endif
// We will use the STL's definitions under the std namespace
#define ETL_OR_STD std
#endif
#endif

View File

@ -1,46 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_CHOOSE_PAIR_TYPES_INCLUDED
#define ETL_STL_CHOOSE_PAIR_TYPES_INCLUDED
#include "../platform.h"
// When in the unit tests we have to ensure that the STL and ETL are using the same definitions.
#if defined(ETL_IN_UNIT_TEST) || !defined(ETL_NO_STL)
#include <utility>
#define ETL_PAIR std::pair
#define ETL_MAKE_PAIR std::make_pair
#else
#define ETL_PAIR etlstd::pair
#define ETL_MAKE_PAIR etlstd::make_pair
#endif
#endif

View File

@ -1,52 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_CHOOSE_TAG_TYPES_INCLUDED
#define ETL_STL_CHOOSE_TAG_TYPES_INCLUDED
#include "../platform.h"
// When in the unit tests we have to ensure that the STL and ETL are using the same definitions.
#if defined(ETL_IN_UNIT_TEST) || !defined(ETL_NO_STL)
#include <iterator>
#define ETL_INPUT_ITERATOR_TAG std::input_iterator_tag
#define ETL_OUTPUT_ITERATOR_TAG std::output_iterator_tag
#define ETL_FORWARD_ITERATOR_TAG std::forward_iterator_tag
#define ETL_BIDIRECTIONAL_ITERATOR_TAG std::bidirectional_iterator_tag
#define ETL_RANDOM_ACCESS_ITERATOR_TAG std::random_access_iterator_tag
#else
#define ETL_INPUT_ITERATOR_TAG etlstd::input_iterator_tag
#define ETL_OUTPUT_ITERATOR_TAG etlstd::output_iterator_tag
#define ETL_FORWARD_ITERATOR_TAG etlstd::forward_iterator_tag
#define ETL_BIDIRECTIONAL_ITERATOR_TAG etlstd::bidirectional_iterator_tag
#define ETL_RANDOM_ACCESS_ITERATOR_TAG etlstd::random_access_iterator_tag
#endif
#endif

View File

@ -36,8 +36,7 @@ SOFTWARE.
#include "../platform.h"
#include "../frame_check_sequence.h"
#include "../binary.h"
#include "../stl/iterator.h"
#include "../iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300

View File

@ -36,8 +36,7 @@ SOFTWARE.
#include "../platform.h"
#include "../frame_check_sequence.h"
#include "../binary.h"
#include "../stl/iterator.h"
#include "../iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300

View File

@ -36,8 +36,7 @@ SOFTWARE.
#include "../platform.h"
#include "../frame_check_sequence.h"
#include "../binary.h"
#include "../stl/iterator.h"
#include "../iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300

View File

@ -36,8 +36,7 @@ SOFTWARE.
#include "../platform.h"
#include "../frame_check_sequence.h"
#include "../binary.h"
#include "../stl/iterator.h"
#include "../iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300

View File

@ -36,8 +36,7 @@ SOFTWARE.
#include "../platform.h"
#include "../frame_check_sequence.h"
#include "../binary.h"
#include "../stl/iterator.h"
#include "../iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300

View File

@ -36,8 +36,7 @@ SOFTWARE.
#include "../platform.h"
#include "../frame_check_sequence.h"
#include "../binary.h"
#include "../stl/iterator.h"
#include "../iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300

View File

@ -56,10 +56,10 @@ namespace etl
typedef const value_type* const_pointer;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef size_t size_type;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
protected:
@ -441,7 +441,7 @@ namespace etl
//*********************************************************************
void initialise_source_external_buffer_after_move()
{
ETL_SUBTRACT_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end)))
ETL_SUBTRACT_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end)))
p_end = p_buffer;
}
@ -451,7 +451,7 @@ namespace etl
//*********************************************************************
void initialise_destination_external_buffer_after_move()
{
ETL_ADD_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end)))
ETL_ADD_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end)))
}
};
@ -467,10 +467,10 @@ namespace etl
typedef const value_type* const_pointer;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef size_t size_type;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
protected:
@ -852,7 +852,7 @@ namespace etl
//*********************************************************************
void initialise_source_external_buffer_after_move()
{
ETL_SUBTRACT_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end)))
ETL_SUBTRACT_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end)))
p_end = p_buffer;
}
@ -862,7 +862,7 @@ namespace etl
//*********************************************************************
void initialise_destination_external_buffer_after_move()
{
ETL_ADD_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end)))
ETL_ADD_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end)))
}
};

View File

@ -33,7 +33,7 @@ SOFTWARE.
* This file is intended to evaluated multiple times by design.
*/
#ifdef ETL_COMPILER_MICROSOFT
#pragma pop_macro("min")
#pragma pop_macro("max")
#if defined(ETL_COMPILER_MICROSOFT)
#pragma pop_macro("min")
#pragma pop_macro("max")
#endif

View File

@ -33,9 +33,9 @@ SOFTWARE.
* This file is intended to evaluated multiple times by design.
*/
#ifdef ETL_COMPILER_MICROSOFT
#pragma push_macro("min")
#pragma push_macro("max")
#undef min
#undef max
#if defined(ETL_COMPILER_MICROSOFT)
#pragma push_macro("min")
#pragma push_macro("max")
#undef min
#undef max
#endif

View File

@ -41,8 +41,8 @@ SOFTWARE.
#include "../type_traits.h"
#include "../error_handler.h"
#include "../stl/functional.h"
#include "../stl/iterator.h"
#include "../functional.h"
#include "../iterator.h"
#ifdef ETL_COMPILER_GCC
#pragma GCC diagnostic ignored "-Wunused-variable"
@ -67,10 +67,10 @@ namespace etl
typedef const value_type* const_pointer;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef size_t size_type;
typedef ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef etl::iterator_traits<iterator>::difference_type difference_type;
public:
@ -211,7 +211,7 @@ namespace etl
// Size up if necessary.
if (p_end < p_new_end)
{
ETL_STD::fill(p_end, p_new_end, value);
etl::fill(p_end, p_new_end, value);
}
p_end = p_new_end;
@ -326,7 +326,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(static_cast<size_t>(d) <= CAPACITY, ETL_ERROR(vector_full));
#endif
@ -402,7 +402,7 @@ namespace etl
if (position != end())
{
++p_end;
ETL_STD::copy_backward(position, end() - 1, end());
etl::copy_backward(position, end() - 1, end());
*position = value;
}
else
@ -424,8 +424,8 @@ namespace etl
{
ETL_ASSERT((size() + 1) <= CAPACITY, ETL_ERROR(vector_full));
ETL_STD::copy_backward(position, p_end, p_end + n);
ETL_STD::fill_n(position, n, value);
etl::copy_backward(position, p_end, p_end + n);
etl::fill_n(position, n, value);
p_end += n;
}
@ -441,12 +441,12 @@ namespace etl
template <typename TIterator>
void insert(iterator position, TIterator first, TIterator last)
{
size_t count = ETL_STD::distance(first, last);
size_t count = etl::distance(first, last);
ETL_ASSERT((size() + count) <= CAPACITY, ETL_ERROR(vector_full));
ETL_STD::copy_backward(position, p_end, p_end + count);
ETL_STD::copy(first, last, position);
etl::copy_backward(position, p_end, p_end + count);
etl::copy(first, last, position);
p_end += count;
}
@ -457,7 +457,7 @@ namespace etl
//*********************************************************************
iterator erase(iterator i_element)
{
ETL_STD::copy(i_element + 1, end(), i_element);
etl::copy(i_element + 1, end(), i_element);
--p_end;
return i_element;
@ -473,8 +473,8 @@ namespace etl
//*********************************************************************
iterator erase(iterator first, iterator last)
{
ETL_STD::copy(last, end(), first);
size_t n_delete = ETL_STD::distance(first, last);
etl::copy(last, end(), first);
size_t n_delete = etl::distance(first, last);
// Just adjust the count.
p_end -= n_delete;
@ -580,7 +580,7 @@ namespace etl
//***************************************************************************
inline bool operator ==(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -604,7 +604,7 @@ namespace etl
//***************************************************************************
inline bool operator <(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//***************************************************************************

View File

@ -42,10 +42,9 @@ SOFTWARE.
#include "../type_traits.h"
#include "../container.h"
#include "../absolute.h"
#include "../stl/algorithm.h"
#include "../stl/iterator.h"
#include "../stl/limits.h"
#include "../algorithm.h"
#include "../iterator.h"
#include "../limits.h"
namespace etl
{
@ -57,7 +56,7 @@ namespace etl
template <typename TIString>
void add_alignment(TIString& str, typename TIString::iterator position, const etl::basic_format_spec<TIString>& format)
{
uint32_t length = static_cast<uint32_t>(ETL_STD::distance(position, str.end()));
uint32_t length = static_cast<uint32_t>(etl::distance(position, str.end()));
if (length < format.get_width())
{
@ -166,7 +165,7 @@ namespace etl
}
// Reverse the string we appended.
ETL_STD::reverse(start, str.end());
etl::reverse(start, str.end());
}
etl::private_to_string::add_alignment(str, start, format);
@ -242,7 +241,7 @@ namespace etl
else
{
// Make sure we format the two halves correctly.
uint32_t max_precision = ETL_STD::numeric_limits<T>::digits10;
uint32_t max_precision = etl::numeric_limits<T>::digits10;
etl::basic_format_spec<TIString> integral_format = format;
integral_format.decimal().width(0).precision(format.get_precision() > max_precision ? max_precision : format.get_precision());

View File

@ -330,7 +330,7 @@ namespace etl
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
#endif
::new (&p_buffer[in]) T(ETL_STD::forward<Args>(args)...);
::new (&p_buffer[in]) T(etl::forward<Args>(args)...);
add_in();
}
#else

View File

@ -46,7 +46,7 @@ SOFTWARE.
#include "memory_model.h"
#include "integral_limits.h"
#include "stl/utility.h"
#include "utility.h"
#undef ETL_FILE
#define ETL_FILE "48"
@ -179,7 +179,7 @@ namespace etl
{
access.lock();
bool result = emplace_implementation(ETL_STD::forward<Args>(args)...);
bool result = emplace_implementation(etl::forward<Args>(args)...);
access.unlock();
@ -392,7 +392,7 @@ namespace etl
{
if (current_size != MAX_SIZE)
{
::new (&p_buffer[write_index]) T(ETL_STD::forward<Args>(args)...);
::new (&p_buffer[write_index]) T(etl::forward<Args>(args)...);
write_index = get_next_index(write_index, MAX_SIZE);

View File

@ -239,7 +239,7 @@ namespace etl
if (next_index != read.load(etl::memory_order_acquire))
{
::new (&p_buffer[write_index]) T(ETL_STD::forward<Args>(args)...);
::new (&p_buffer[write_index]) T(etl::forward<Args>(args)...);
write.store(next_index, etl::memory_order_release);

View File

@ -42,7 +42,7 @@ SOFTWARE.
#include "memory_model.h"
#include "integral_limits.h"
#include "stl/utility.h"
#include "utility.h"
#undef ETL_FILE
#define ETL_FILE "46"
@ -82,7 +82,7 @@ namespace etl
template <typename ... Args>
bool emplace_from_isr(Args&&... args)
{
return emplace_implementation(ETL_STD::forward<Args>(args)...);
return emplace_implementation(etl::forward<Args>(args)...);
}
#endif
@ -207,7 +207,7 @@ namespace etl
{
if (current_size != MAX_SIZE)
{
::new (&p_buffer[write_index]) T(ETL_STD::forward<Args>(args)...);
::new (&p_buffer[write_index]) T(etl::forward<Args>(args)...);
write_index = get_next_index(write_index, MAX_SIZE);
@ -440,7 +440,7 @@ namespace etl
{
TAccess::lock();
bool result = this->emplace_implementation(ETL_STD::forward<Args>(args)...);
bool result = this->emplace_implementation(etl::forward<Args>(args)...);
TAccess::unlock();

View File

@ -43,7 +43,7 @@ SOFTWARE.
#include "integral_limits.h"
#include "function.h"
#include "stl/utility.h"
#include "utility.h"
#undef ETL_FILE
#define ETL_FILE "46"
@ -83,7 +83,7 @@ namespace etl
template <typename ... Args>
bool emplace_from_unlocked(Args&&... args)
{
return emplace_implementation(ETL_STD::forward<Args>(args)...);
return emplace_implementation(etl::forward<Args>(args)...);
}
#endif
@ -208,7 +208,7 @@ namespace etl
{
if (current_size != MAX_SIZE)
{
::new (&p_buffer[write_index]) T(ETL_STD::forward<Args>(args)...);
::new (&p_buffer[write_index]) T(etl::forward<Args>(args)...);
write_index = get_next_index(write_index, MAX_SIZE);
@ -437,7 +437,7 @@ namespace etl
{
lock();
bool result = this->emplace_implementation(ETL_STD::forward<Args>(args)...);
bool result = this->emplace_implementation(etl::forward<Args>(args)...);
unlock();

View File

@ -103,12 +103,12 @@ namespace etl
/// Can be used as a reference type for all reference_flat_maps containing a specific type.
///\ingroup reference_flat_map
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TMapped, typename TKeyCompare = etl::less<TKey> >
class ireference_flat_map
{
public:
typedef ETL_PAIR<const TKey, TMapped> value_type;
typedef ETL_OR_STD::pair<const TKey, TMapped> value_type;
protected:
@ -126,7 +126,7 @@ namespace etl
typedef size_t size_type;
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
{
public:
@ -224,7 +224,7 @@ namespace etl
};
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
{
public:
@ -317,9 +317,9 @@ namespace etl
typename lookup_t::const_iterator ilookup;
};
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
protected:
@ -525,10 +525,10 @@ namespace etl
template <typename TIterator>
void assign(TIterator first, TIterator last)
{
ETL_STATIC_ASSERT((etl::is_same<value_type, typename ETL_STD::iterator_traits<TIterator>::value_type>::value), "Incompatible data for assign");
ETL_STATIC_ASSERT((etl::is_same<value_type, typename etl::iterator_traits<TIterator>::value_type>::value), "Incompatible data for assign");
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_map_full));
#endif
@ -545,7 +545,7 @@ namespace etl
/// If asserts or exceptions are enabled, emits flat_map_full if the reference_flat_map is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(reference value)
ETL_OR_STD::pair<iterator, bool> insert(reference value)
{
iterator i_element = lower_bound(value.first);
@ -693,7 +693,7 @@ namespace etl
//*********************************************************************
iterator lower_bound(key_parameter_t key)
{
return ETL_STD::lower_bound(begin(), end(), key, compare);
return etl::lower_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -703,7 +703,7 @@ namespace etl
//*********************************************************************
const_iterator lower_bound(key_parameter_t key) const
{
return ETL_STD::lower_bound(cbegin(), cend(), key, compare);
return etl::lower_bound(cbegin(), cend(), key, compare);
}
//*********************************************************************
@ -713,7 +713,7 @@ namespace etl
//*********************************************************************
iterator upper_bound(key_parameter_t key)
{
return ETL_STD::upper_bound(begin(), end(), key, compare);
return etl::upper_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -723,7 +723,7 @@ namespace etl
//*********************************************************************
const_iterator upper_bound(key_parameter_t key) const
{
return ETL_STD::upper_bound(begin(), end(), key, compare);
return etl::upper_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -731,11 +731,11 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
iterator i_lower = ETL_STD::lower_bound(begin(), end(), key, compare);
iterator i_lower = etl::lower_bound(begin(), end(), key, compare);
return ETL_MAKE_PAIR(i_lower, ETL_STD::upper_bound(i_lower, end(), key, compare));
return ETL_OR_STD::make_pair(i_lower, etl::upper_bound(i_lower, end(), key, compare));
}
//*********************************************************************
@ -743,11 +743,11 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
const_iterator i_lower = ETL_STD::lower_bound(cbegin(), cend(), key, compare);
const_iterator i_lower = etl::lower_bound(cbegin(), cend(), key, compare);
return ETL_MAKE_PAIR(i_lower, ETL_STD::upper_bound(i_lower, cend(), key, compare));
return ETL_OR_STD::make_pair(i_lower, etl::upper_bound(i_lower, cend(), key, compare));
}
//*************************************************************************
@ -819,9 +819,9 @@ namespace etl
///\param i_element The place to insert.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert_at(iterator i_element, value_type& value)
ETL_OR_STD::pair<iterator, bool> insert_at(iterator i_element, value_type& value)
{
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
if (i_element == end())
{
@ -886,7 +886,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::ireference_flat_map<TKey, TMapped, TKeyCompare>& lhs, const etl::ireference_flat_map<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -906,11 +906,11 @@ namespace etl
/// A reference_flat_map implementation that uses a fixed size buffer.
///\tparam TKey The key type.
///\tparam TValue The value type.
///\tparam TCompare The type to compare keys. Default = ETL_STD::less<TKey>
///\tparam TCompare The type to compare keys. Default = etl::less<TKey>
///\tparam MAX_SIZE_ The maximum number of elements that can be stored.
///\ingroup reference_flat_map
//***************************************************************************
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = etl::less<TKey> >
class reference_flat_map : public ireference_flat_map<TKey, TValue, TCompare>
{
public:

View File

@ -78,12 +78,12 @@ namespace etl
/// Can be used as a reference type for all reference_flat_multimaps containing a specific type.
///\ingroup reference_flat_multimap
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TMapped, typename TKeyCompare = etl::less<TKey> >
class ireference_flat_multimap
{
public:
typedef ETL_PAIR<const TKey, TMapped> value_type;
typedef ETL_OR_STD::pair<const TKey, TMapped> value_type;
protected:
@ -101,7 +101,7 @@ namespace etl
typedef size_t size_type;
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
{
public:
@ -199,7 +199,7 @@ namespace etl
};
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
{
public:
@ -292,9 +292,9 @@ namespace etl
typename lookup_t::const_iterator ilookup;
};
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
protected:
@ -443,7 +443,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multimap_full));
#endif
@ -460,11 +460,11 @@ namespace etl
/// If asserts or exceptions are enabled, emits reference_flat_multimap_full if the reference_flat_multimap is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(value_type& value)
ETL_OR_STD::pair<iterator, bool> insert(value_type& value)
{
ETL_ASSERT(!lookup.full(), ETL_ERROR(flat_multimap_full));
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
iterator i_element = lower_bound(value.first);
@ -505,7 +505,7 @@ namespace etl
//*********************************************************************
size_t erase(key_parameter_t key)
{
ETL_PAIR<iterator, iterator> range = equal_range(key);
ETL_OR_STD::pair<iterator, iterator> range = equal_range(key);
if (range.first == end())
{
@ -513,7 +513,7 @@ namespace etl
}
else
{
size_t d = ETL_STD::distance(range.first, range.second);
size_t d = etl::distance(range.first, range.second);
erase(range.first, range.second);
return d;
}
@ -603,9 +603,9 @@ namespace etl
//*********************************************************************
size_t count(key_parameter_t key) const
{
ETL_PAIR<const_iterator, const_iterator> range = equal_range(key);
ETL_OR_STD::pair<const_iterator, const_iterator> range = equal_range(key);
return ETL_STD::distance(range.first, range.second);
return etl::distance(range.first, range.second);
}
//*********************************************************************
@ -615,7 +615,7 @@ namespace etl
//*********************************************************************
iterator lower_bound(key_parameter_t key)
{
return ETL_STD::lower_bound(begin(), end(), key, compare);
return etl::lower_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -625,7 +625,7 @@ namespace etl
//*********************************************************************
const_iterator lower_bound(key_parameter_t key) const
{
return ETL_STD::lower_bound(cbegin(), cend(), key, compare);
return etl::lower_bound(cbegin(), cend(), key, compare);
}
//*********************************************************************
@ -635,7 +635,7 @@ namespace etl
//*********************************************************************
iterator upper_bound(key_parameter_t key)
{
return ETL_STD::upper_bound(begin(), end(), key, compare);
return etl::upper_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -645,7 +645,7 @@ namespace etl
//*********************************************************************
const_iterator upper_bound(key_parameter_t key) const
{
return ETL_STD::upper_bound(begin(), end(), key, compare);
return etl::upper_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -653,11 +653,11 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
iterator i_lower = ETL_STD::lower_bound(begin(), end(), key, compare);
iterator i_lower = etl::lower_bound(begin(), end(), key, compare);
return ETL_MAKE_PAIR(i_lower, ETL_STD::upper_bound(i_lower, end(), key, compare));
return ETL_OR_STD::make_pair(i_lower, etl::upper_bound(i_lower, end(), key, compare));
}
//*********************************************************************
@ -665,11 +665,11 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
const_iterator i_lower = ETL_STD::lower_bound(cbegin(), cend(), key, compare);
const_iterator i_lower = etl::lower_bound(cbegin(), cend(), key, compare);
return ETL_MAKE_PAIR(i_lower, ETL_STD::upper_bound(i_lower, cend(), key, compare));
return ETL_OR_STD::make_pair(i_lower, etl::upper_bound(i_lower, cend(), key, compare));
}
//*************************************************************************
@ -741,9 +741,9 @@ namespace etl
///\param i_element The place to insert.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert_at(iterator i_element, value_type& value)
ETL_OR_STD::pair<iterator, bool> insert_at(iterator i_element, value_type& value)
{
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
if (i_element == end())
{
@ -799,7 +799,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::ireference_flat_multimap<TKey, TMapped, TKeyCompare>& lhs, const etl::ireference_flat_multimap<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -819,11 +819,11 @@ namespace etl
/// A reference_flat_multimap implementation that uses a fixed size buffer.
///\tparam TKey The key type.
///\tparam TValue The value type.
///\tparam TCompare The type to compare keys. Default = ETL_STD::less<TKey>
///\tparam TCompare The type to compare keys. Default = etl::less<TKey>
///\tparam MAX_SIZE_ The maximum number of elements that can be stored.
///\ingroup reference_flat_multimap
//***************************************************************************
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<TKey> >
template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = etl::less<TKey> >
class reference_flat_multimap : public ireference_flat_multimap<TKey, TValue, TCompare>
{
public:

View File

@ -35,10 +35,10 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "type_traits.h"
#include "vector.h"
@ -98,7 +98,7 @@ namespace etl
/// Can be used as a reference type for all reference_flat_multisets containing a specific type.
///\ingroup reference_flat_multiset
//***************************************************************************
template <typename T, typename TKeyCompare = ETL_STD::less<T> >
template <typename T, typename TKeyCompare = etl::less<T> >
class ireference_flat_multiset
{
public:
@ -119,7 +119,7 @@ namespace etl
public:
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
{
public:
@ -217,7 +217,7 @@ namespace etl
};
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
{
public:
@ -316,9 +316,9 @@ namespace etl
public:
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*********************************************************************
/// Returns an iterator to the beginning of the reference_flat_multiset.
@ -439,7 +439,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multiset_full));
#endif
@ -456,13 +456,13 @@ namespace etl
/// If asserts or exceptions are enabled, emits reference_flat_multiset_full if the reference_flat_multiset is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(value_type& value)
ETL_OR_STD::pair<iterator, bool> insert(value_type& value)
{
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
ETL_ASSERT(!lookup.full(), ETL_ERROR(flat_multiset_full));
iterator i_element = ETL_STD::lower_bound(begin(), end(), value, compare);
iterator i_element = etl::lower_bound(begin(), end(), value, compare);
if (i_element == end())
{
@ -516,7 +516,7 @@ namespace etl
//*********************************************************************
size_t erase(parameter_t key)
{
ETL_PAIR<iterator, iterator> range = equal_range(key);
ETL_OR_STD::pair<iterator, iterator> range = equal_range(key);
if (range.first == end())
{
@ -524,7 +524,7 @@ namespace etl
}
else
{
size_t d = ETL_STD::distance(range.first, range.second);
size_t d = etl::distance(range.first, range.second);
erase(range.first, range.second);
return d;
}
@ -566,7 +566,7 @@ namespace etl
//*********************************************************************
iterator find(parameter_t key)
{
iterator itr = ETL_STD::lower_bound(begin(), end(), key, compare);
iterator itr = etl::lower_bound(begin(), end(), key, compare);
if (itr != end())
{
@ -590,7 +590,7 @@ namespace etl
//*********************************************************************
const_iterator find(parameter_t key) const
{
const_iterator itr = ETL_STD::lower_bound(begin(), end(), key, compare);
const_iterator itr = etl::lower_bound(begin(), end(), key, compare);
if (itr != end())
{
@ -614,9 +614,9 @@ namespace etl
//*********************************************************************
size_t count(parameter_t key) const
{
ETL_PAIR<const_iterator, const_iterator> range = equal_range(key);
ETL_OR_STD::pair<const_iterator, const_iterator> range = equal_range(key);
return ETL_STD::distance(range.first, range.second);
return etl::distance(range.first, range.second);
}
//*********************************************************************
@ -626,7 +626,7 @@ namespace etl
//*********************************************************************
iterator lower_bound(parameter_t key)
{
return ETL_STD::lower_bound(begin(), end(), key, compare);
return etl::lower_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -636,7 +636,7 @@ namespace etl
//*********************************************************************
const_iterator lower_bound(parameter_t key) const
{
return ETL_STD::lower_bound(cbegin(), cend(), key, compare);
return etl::lower_bound(cbegin(), cend(), key, compare);
}
//*********************************************************************
@ -646,7 +646,7 @@ namespace etl
//*********************************************************************
iterator upper_bound(parameter_t key)
{
return ETL_STD::upper_bound(begin(), end(), key, compare);
return etl::upper_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -656,7 +656,7 @@ namespace etl
//*********************************************************************
const_iterator upper_bound(parameter_t key) const
{
return ETL_STD::upper_bound(cbegin(), cend(), key, compare);
return etl::upper_bound(cbegin(), cend(), key, compare);
}
//*********************************************************************
@ -664,9 +664,9 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(parameter_t key)
{
return ETL_STD::equal_range(begin(), end(), key, compare);
return etl::equal_range(begin(), end(), key, compare);
}
//*********************************************************************
@ -674,9 +674,9 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(parameter_t key) const
{
return ETL_STD::equal_range(begin(), end(), key, compare);
return etl::equal_range(begin(), end(), key, compare);
}
//*************************************************************************
@ -748,9 +748,9 @@ namespace etl
///\param i_element The place to insert.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert_at(iterator i_element, reference value)
ETL_OR_STD::pair<iterator, bool> insert_at(iterator i_element, reference value)
{
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
if (i_element == end())
{
@ -805,7 +805,7 @@ namespace etl
/// An reference flat set
///\ingroup reference_flat_multiset
//***************************************************************************
template <typename TKey, const size_t MAX_SIZE_, typename TKeyCompare = ETL_STD::less<TKey> >
template <typename TKey, const size_t MAX_SIZE_, typename TKeyCompare = etl::less<TKey> >
class reference_flat_multiset : public ireference_flat_multiset<TKey, TKeyCompare>
{
public:
@ -868,7 +868,7 @@ namespace etl
template <typename T, typename TKeyCompare>
bool operator ==(const etl::ireference_flat_multiset<T, TKeyCompare>& lhs, const etl::ireference_flat_multiset<T, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************

View File

@ -35,10 +35,10 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "type_traits.h"
#include "pool.h"
@ -99,7 +99,7 @@ namespace etl
/// Can be used as a reference type for all reference_flat_sets containing a specific type.
///\ingroup reference_flat_set
//***************************************************************************
template <typename T, typename TKeyCompare = ETL_STD::less<T> >
template <typename T, typename TKeyCompare = etl::less<T> >
class ireference_flat_set
{
public:
@ -120,7 +120,7 @@ namespace etl
public:
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
{
public:
@ -218,7 +218,7 @@ namespace etl
};
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
{
public:
@ -317,9 +317,9 @@ namespace etl
public:
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*********************************************************************
/// Returns an iterator to the beginning of the reference_flat_set.
@ -440,7 +440,7 @@ namespace etl
void assign(TIterator first, TIterator last)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first, last);
difference_type d = etl::distance(first, last);
ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_set_full));
#endif
@ -457,7 +457,7 @@ namespace etl
/// If asserts or exceptions are enabled, emits reference_flat_set_full if the reference_flat_set is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(reference value)
ETL_OR_STD::pair<iterator, bool> insert(reference value)
{
iterator i_element = lower_bound(value);
@ -547,7 +547,7 @@ namespace etl
//*********************************************************************
iterator find(parameter_t key)
{
iterator itr = ETL_STD::lower_bound(begin(), end(), key, compare);
iterator itr = etl::lower_bound(begin(), end(), key, compare);
if (itr != end())
{
@ -571,7 +571,7 @@ namespace etl
//*********************************************************************
const_iterator find(parameter_t key) const
{
const_iterator itr = ETL_STD::lower_bound(begin(), end(), key, compare);
const_iterator itr = etl::lower_bound(begin(), end(), key, compare);
if (itr != end())
{
@ -605,7 +605,7 @@ namespace etl
//*********************************************************************
iterator lower_bound(parameter_t key)
{
return ETL_STD::lower_bound(begin(), end(), key, compare);
return etl::lower_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -615,7 +615,7 @@ namespace etl
//*********************************************************************
const_iterator lower_bound(parameter_t key) const
{
return ETL_STD::lower_bound(cbegin(), cend(), key, compare);
return etl::lower_bound(cbegin(), cend(), key, compare);
}
//*********************************************************************
@ -625,7 +625,7 @@ namespace etl
//*********************************************************************
iterator upper_bound(parameter_t key)
{
return ETL_STD::upper_bound(begin(), end(), key, compare);
return etl::upper_bound(begin(), end(), key, compare);
}
//*********************************************************************
@ -635,7 +635,7 @@ namespace etl
//*********************************************************************
const_iterator upper_bound(parameter_t key) const
{
return ETL_STD::upper_bound(cbegin(), cend(), key, compare);
return etl::upper_bound(cbegin(), cend(), key, compare);
}
//*********************************************************************
@ -643,9 +643,9 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(parameter_t key)
{
return ETL_STD::equal_range(begin(), end(), key, compare);
return etl::equal_range(begin(), end(), key, compare);
}
//*********************************************************************
@ -653,9 +653,9 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair.
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(parameter_t key) const
{
return ETL_STD::upper_bound(cbegin(), cend(), key, compare);
return etl::upper_bound(cbegin(), cend(), key, compare);
}
//*************************************************************************
@ -727,9 +727,9 @@ namespace etl
///\param i_element The place to insert.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert_at(iterator i_element, reference value)
ETL_OR_STD::pair<iterator, bool> insert_at(iterator i_element, reference value)
{
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
if (i_element == end())
{
@ -788,7 +788,7 @@ namespace etl
/// An reference flat set
///\ingroup reference_flat_set
//***************************************************************************
template <typename TKey, const size_t MAX_SIZE_, typename TKeyCompare = ETL_STD::less<TKey> >
template <typename TKey, const size_t MAX_SIZE_, typename TKeyCompare = etl::less<TKey> >
class reference_flat_set : public ireference_flat_set<TKey, TKeyCompare>
{
public:
@ -851,7 +851,7 @@ namespace etl
template <typename T, typename TKeyCompare>
bool operator ==(const etl::ireference_flat_set<T, TKeyCompare>& lhs, const etl::ireference_flat_set<T, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************

View File

@ -285,10 +285,10 @@ namespace etl
if (!task_list.full())
{
typename task_list_t::iterator itask = ETL_STD::upper_bound(task_list.begin(),
task_list.end(),
task.get_task_priority(),
compare_priority());
typename task_list_t::iterator itask = etl::upper_bound(task_list.begin(),
task_list.end(),
task.get_task_priority(),
compare_priority());
task_list.insert(itask, &task);
}

View File

@ -46,9 +46,9 @@ SOFTWARE.
#include "parameter_type.h"
#include "iterator.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
@ -457,7 +457,7 @@ namespace etl
/// A templated base for all etl::set types.
///\ingroup set
//***************************************************************************
template <typename T, typename TCompare = ETL_STD::less<T> >
template <typename T, typename TCompare = etl::less<T> >
class iset : public etl::set_base
{
public:
@ -549,7 +549,7 @@ namespace etl
//*************************************************************************
/// iterator.
//*************************************************************************
class iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, value_type>
class iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
{
public:
@ -654,7 +654,7 @@ namespace etl
//*************************************************************************
/// const_iterator
//*************************************************************************
class const_iterator : public etl::iterator<ETL_BIDIRECTIONAL_ITERATOR_TAG, const value_type>
class const_iterator : public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
{
public:
@ -761,10 +761,10 @@ namespace etl
};
friend class const_iterator;
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
typedef ETL_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
//*************************************************************************
/// Assignment operator.
@ -911,9 +911,9 @@ namespace etl
/// Returns two iterators with bounding (lower bound, upper bound) the
/// value provided
//*************************************************************************
ETL_PAIR<iterator, iterator> equal_range(const value_type& value)
ETL_OR_STD::pair<iterator, iterator> equal_range(const value_type& value)
{
return ETL_MAKE_PAIR<iterator, iterator>(
return ETL_OR_STD::make_pair<iterator, iterator>(
iterator(*this, find_lower_node(root_node, value)),
iterator(*this, find_upper_node(root_node, value)));
}
@ -922,9 +922,9 @@ namespace etl
/// Returns two const iterators with bounding (lower bound, upper bound)
/// the value provided.
//*************************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(const value_type& value) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(const value_type& value) const
{
return ETL_MAKE_PAIR<const_iterator, const_iterator>(
return ETL_OR_STD::make_pair<const_iterator, const_iterator>(
const_iterator(*this, find_lower_node(root_node, value)),
const_iterator(*this, find_upper_node(root_node, value)));
}
@ -1015,7 +1015,7 @@ namespace etl
/// If asserts or exceptions are enabled, emits set_full if the set is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(value_type& value)
ETL_OR_STD::pair<iterator, bool> insert(value_type& value)
{
// Default to no inserted node
Node* inserted_node = nullptr;
@ -1031,7 +1031,7 @@ namespace etl
inserted = inserted_node == &node;
// Insert node into tree and return iterator to new node location in tree
return ETL_MAKE_PAIR(iterator(*this, inserted_node), inserted);
return ETL_OR_STD::make_pair(iterator(*this, inserted_node), inserted);
}
//*********************************************************************
@ -1950,7 +1950,7 @@ namespace etl
//*************************************************************************
/// A templated set implementation that uses a fixed size buffer.
//*************************************************************************
template <typename T, const size_t MAX_SIZE_, typename TCompare = ETL_STD::less<T> >
template <typename T, const size_t MAX_SIZE_, typename TCompare = etl::less<T> >
class set : public etl::iset<T, TCompare>
{
public:
@ -2037,7 +2037,7 @@ namespace etl
template <typename T, typename TCompare>
bool operator ==(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -2063,10 +2063,7 @@ namespace etl
template <typename T, typename TCompare>
bool operator <(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//*************************************************************************

View File

@ -82,15 +82,15 @@ namespace etl
// Set 'type' to be the smallest of the first parameter and any of the others.
// This is recursive.
using type = typename etl::conditional<(etl::size_of<T1>() < etl::size_of<smallest_other>()), // Boolean
T1, // TrueType
smallest_other> // FalseType
::type; // The smallest type of the two.
using type = typename etl::conditional<(etl::size_of<T1>::value < etl::size_of<smallest_other>::value), // Boolean
T1, // TrueType
smallest_other> // FalseType
::type; // The smallest type of the two.
// The size of the smallest type.
enum
{
size = etl::size_of<type>()
size = etl::size_of<type>::value
};
};
@ -106,7 +106,7 @@ namespace etl
enum
{
size = etl::size_of<type>()
size = etl::size_of<type>::value
};
};
#else

View File

@ -94,15 +94,15 @@ namespace etl
// Set 'type' to be the smallest of the first parameter and any of the others.
// This is recursive.
using type = typename etl::conditional<(etl::size_of<T1>() < etl::size_of<smallest_other>()), // Boolean
T1, // TrueType
smallest_other> // FalseType
::type; // The smallest type of the two.
using type = typename etl::conditional<(etl::size_of<T1>::value < etl::size_of<smallest_other>::value), // Boolean
T1, // TrueType
smallest_other> // FalseType
::type; // The smallest type of the two.
// The size of the smallest type.
enum
{
size = etl::size_of<type>()
size = etl::size_of<type>::value
};
};
@ -118,7 +118,7 @@ namespace etl
enum
{
size = etl::size_of<type>()
size = etl::size_of<type>::value
};
};
#else

View File

@ -38,7 +38,7 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "algorithm.h"
#include "container.h"
#include "alignment.h"
@ -278,7 +278,7 @@ namespace etl
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
#endif
base_t::add_in();
::new (&p_buffer[top_index]) T(ETL_STD::forward<Args>(args)...);
::new (&p_buffer[top_index]) T(etl::forward<Args>(args)...);
}
#else
//*************************************************************************
@ -408,7 +408,7 @@ namespace etl
//*************************************************************************
void reverse()
{
ETL_STD::reverse(p_buffer, p_buffer + current_size);
etl::reverse(p_buffer, p_buffer + current_size);
}
//*************************************************************************

View File

@ -235,9 +235,9 @@ namespace etl
}
else
{
return ETL_STD::find_if(state_table.begin(),
state_table.end(),
is_state(state_id));
return etl::find_if(state_table.begin(),
state_table.end(),
is_state(state_id));
}
}
@ -280,9 +280,9 @@ namespace etl
while (t != transition_table.end())
{
// Scan the transition table from the latest position.
t = ETL_STD::find_if(t,
transition_table.end(),
is_transition(event_id, current_state_id));
t = etl::find_if(t,
transition_table.end(),
is_transition(event_id, current_state_id));
// Found an entry?
if (t != transition_table.end())

View File

@ -1,46 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_ALGORITHM_INCLUDED
#define ETL_STL_ALGORITHM_INCLUDED
#include "../platform.h"
#include "../private/choose_namespace.h"
#include "../private/choose_tag_types.h"
#include "../private/choose_pair_types.h"
#if defined(ETL_NO_STL)
#include "alternate/algorithm.h"
#else
#include <algorithm>
#endif
#endif

View File

@ -1,870 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_ALTERNATE_ALGORITHM_INCLUDED
#define ETL_STL_ALTERNATE_ALGORITHM_INCLUDED
#include "../../platform.h"
#include "../../type_traits.h"
#include <string.h>
#include "etl/private/choose_tag_types.h"
#include "etl/private/choose_pair_types.h"
// Local alternate definitions.
#include "iterator.h"
#include "functional.h"
#include "utility.h"
namespace etlstd
{
//***************************************************************************
// swap
template <typename T>
void swap(T& a, T& b)
{
T c = a;
a = b;
b = c;
}
//***************************************************************************
// iter_swap
template <typename TIterator1, typename TIterator2>
void iter_swap(TIterator1 a, TIterator2 b)
{
typename etlstd::iterator_traits<TIterator1>::value_type c = *a;
*a = *b;
*b = c;
}
//***************************************************************************
// swap_ranges
template <typename T1terator1, typename TIterator2>
TIterator2 swap_ranges(T1terator1 first1,
T1terator1 last1,
TIterator2 first2)
{
while (first1 != last1)
{
iter_swap(first1++, first2++);
}
return first2;
}
//***************************************************************************
// advance
template <typename TIterator, typename TDistance>
typename etl::enable_if<!etl::is_same<typename etlstd::iterator_traits<TIterator>::iterator_tag, etlstd::random_access_iterator_tag>::value, void>::type
advance(TIterator itr, TDistance distance)
{
while (distance-- != 0)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
typename etl::enable_if<etl::is_same<typename etlstd::iterator_traits<TIterator>::iterator_tag, etlstd::random_access_iterator_tag>::value, void>::type
advance(TIterator itr, TDistance distance)
{
return itr += distance;
}
//***************************************************************************
// copy
// Pointer
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<etl::is_pointer<TIterator1>::value &&
etl::is_pointer<TIterator2>::value &&
etl::is_pod<typename etlstd::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy(TIterator1 sb, TIterator1 se, TIterator2 db)
{
typedef typename etlstd::iterator_traits<TIterator1>::value_type value_t;
typedef typename etlstd::iterator_traits<TIterator1>::difference_type difference_t;
difference_t count = (se - sb);
return TIterator2(memmove(db, sb, sizeof(value_t) * count)) + count;
}
// Other iterator
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<!etl::is_pointer<TIterator1>::value ||
!etl::is_pointer<TIterator2>::value ||
!etl::is_pod<typename etlstd::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy(TIterator1 sb, TIterator1 se, TIterator2 db)
{
while (sb != se)
{
*db++ = *sb++;
}
return db;
}
//***************************************************************************
// reverse_copy
template <typename TIterator1, typename TIterator2>
TIterator2 reverse_copy(TIterator1 sb, TIterator1 se, TIterator2 db)
{
while (sb != se)
{
*(db++) = *(--se);
}
return db;
}
//***************************************************************************
// copy_n
// Pointer
template <typename TIterator1, typename TSize, typename TIterator2>
typename etl::enable_if<etl::is_pointer<TIterator1>::value &&
etl::is_pointer<TIterator2>::value &&
etl::is_pod<typename etlstd::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy_n(TIterator1 sb, TSize count, TIterator2 db)
{
typedef typename etlstd::iterator_traits<TIterator1>::value_type value_t;
return TIterator2(memmove(db, sb, sizeof(value_t) * count)) + count;
}
// Other iterator
template <typename TIterator1, typename TSize, typename TIterator2>
typename etl::enable_if<!etl::is_pointer<TIterator1>::value ||
!etl::is_pointer<TIterator2>::value ||
!etl::is_pod<typename etlstd::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy_n(TIterator1 sb, TSize count, TIterator2 db)
{
while (count != 0)
{
*db++ = *sb++;
--count;
}
return db;
}
//***************************************************************************
// copy_backward
// Pointer
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<etl::is_pointer<TIterator1>::value &&
etl::is_pointer<TIterator2>::value &&
etl::is_pod<typename etlstd::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de)
{
typedef typename etlstd::iterator_traits<TIterator1>::value_type value_t;
const size_t length = (se - sb);
return TIterator2(memmove(de - length, sb, sizeof(value_t) * length));
}
// Other iterator
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<!etl::is_pointer<TIterator1>::value ||
!etl::is_pointer<TIterator2>::value ||
!etl::is_pod<typename etlstd::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de)
{
while (se != sb)
{
*(--de) = *(--se);
}
return de;
}
//***************************************************************************
// move
template <typename TIterator1, typename TIterator2>
TIterator2 move(TIterator1 sb, TIterator1 se, TIterator2 db)
{
while (sb != se)
{
*db++ = etlstd::move(*sb++);
}
return db;
}
//***************************************************************************
// move_backward
template <typename TIterator1, typename TIterator2>
TIterator2 move_backward(TIterator1 sb, TIterator1 se, TIterator2 de)
{
while (sb != se)
{
*(--de) = etlstd::move(*(--se));
}
return de;
}
//***************************************************************************
// reverse
// Pointers
template <typename TIterator>
typename etl::enable_if<etl::is_pointer<TIterator>::value, void>::type
reverse(TIterator b, TIterator e)
{
if (b != e)
{
while (b < --e)
{
etlstd::iter_swap(b, e);
++b;
}
}
}
// Other
template <typename TIterator>
typename etl::enable_if<!etl::is_pointer<TIterator>::value, void>::type
reverse(TIterator b, TIterator e)
{
while ((b != e) && (b != --e))
{
etlstd::iter_swap(b++, e);
}
}
//***************************************************************************
// lower_bound
template<typename TIterator, typename TValue, typename TCompare>
TIterator lower_bound(TIterator first, TIterator last, const TValue& value, TCompare compare)
{
typedef typename etlstd::iterator_traits<TIterator>::difference_type difference_t;
difference_t count = etlstd::distance(first, last);
while (count > 0)
{
TIterator itr = first;
difference_t step = count / 2;
etlstd::advance(itr, step);
if (compare(*itr, value))
{
first = ++itr;
count -= step + 1;
}
else
{
count = step;
}
}
return first;
}
template<typename TIterator, typename TValue>
TIterator lower_bound(TIterator first, TIterator last, const TValue& value)
{
typedef etlstd::less<typename etlstd::iterator_traits<TIterator>::value_type> compare;
return etlstd::lower_bound(first, last, value, compare());
}
//***************************************************************************
// upper_bound
template<typename TIterator, typename TValue, typename TCompare>
TIterator upper_bound(TIterator first, TIterator last, const TValue& value, TCompare compare)
{
typedef typename etlstd::iterator_traits<TIterator>::difference_type difference_t;
difference_t count = etlstd::distance(first, last);
while (count > 0)
{
TIterator itr = first;
difference_t step = count / 2;
etlstd::advance(itr, step);
if (!compare(value, *itr))
{
first = ++itr;
count -= step + 1;
}
else
{
count = step;
}
}
return first;
}
template<typename TIterator, typename TValue>
TIterator upper_bound(TIterator first, TIterator last, const TValue& value)
{
typedef etlstd::less<typename etlstd::iterator_traits<TIterator>::value_type> compare;
return etlstd::upper_bound(first, last, value, compare());
}
//***************************************************************************
// equal_range
template<typename TIterator, typename TValue, typename TCompare>
ETL_PAIR<TIterator, TIterator> equal_range(TIterator first, TIterator last, const TValue& value, TCompare compare)
{
return ETL_MAKE_PAIR(etlstd::lower_bound(first, last, value, compare),
etlstd::upper_bound(first, last, value, compare));
}
template<typename TIterator, typename TValue>
ETL_PAIR<TIterator, TIterator> equal_range(TIterator first, TIterator last, const TValue& value)
{
typedef etlstd::less<typename etlstd::iterator_traits<TIterator>::value_type> compare;
return ETL_MAKE_PAIR(etlstd::lower_bound(first, last, value, compare()),
etlstd::upper_bound(first, last, value, compare()));
}
//***************************************************************************
// find_if
template <typename TIterator, typename TUnaryPredicate>
TIterator find_if(TIterator first, TIterator last, TUnaryPredicate predicate)
{
while (first != last)
{
if (predicate(*first))
{
return first;
}
++first;
}
return last;
}
//***************************************************************************
// find
template <typename TIterator, typename T>
TIterator find(TIterator first, TIterator last, const T& value)
{
while (first != last)
{
if (*first == value)
{
return first;
}
++first;
}
return last;
}
//***************************************************************************
// fill
template<typename TIterator, typename TValue>
typename etl::enable_if<!(etl::is_same<char, TValue>::value || etl::is_same<unsigned char, TValue>::value) || !etl::is_pointer<TIterator>::value, void>::type
fill(TIterator first, TIterator last, const TValue& value)
{
while (first != last)
{
*first++ = value;
}
}
template<typename TIterator, typename TValue>
typename etl::enable_if<(etl::is_same<char, TValue>::value || etl::is_same<unsigned char, TValue>::value) && etl::is_pointer<TIterator>::value, void>::type
fill(TIterator first, TIterator last, const TValue& value)
{
memset(first, value, last - first);
}
//***************************************************************************
// fill_n
template<typename TIterator, typename TSize, typename TValue>
typename etl::enable_if<!(etl::is_same<char, TValue>::value || etl::is_same<unsigned char, TValue>::value) || !etl::is_pointer<TIterator>::value, TIterator>::type
fill_n(TIterator first, TSize count, const TValue& value)
{
for (TSize i = 0; i < count; ++i)
{
*first++ = value;
}
return first;
}
template<typename TIterator, typename TSize, typename TValue>
typename etl::enable_if<(etl::is_same<char, TValue>::value || etl::is_same<unsigned char, TValue>::value) && etl::is_pointer<TIterator>::value, void>::type
fill_n(TIterator first, TSize count, const TValue& value)
{
memset(first, value, count);
}
//***************************************************************************
// count
template <typename TIterator, typename T>
typename iterator_traits<TIterator>::difference_type count(TIterator first, TIterator last, const T& value)
{
typename iterator_traits<TIterator>::difference_type n = 0;
while (first != last)
{
if (*first == value)
{
++n;
}
++first;
}
return n;
}
//***************************************************************************
// count
template <typename TIterator, typename TUnaryPredicate>
typename iterator_traits<TIterator>::difference_type count_if(TIterator first, TIterator last, TUnaryPredicate predicate)
{
typename iterator_traits<TIterator>::difference_type n = 0;
while (first != last)
{
if (predicate(*first))
{
++n;
}
++first;
}
return n;
}
//***************************************************************************
// equal
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<!etl::is_pointer<TIterator1>::value || !etl::is_pointer<TIterator2>::value || !etl::is_pod<typename etlstd::iterator_traits<TIterator1>::value_type>::value, bool>::type
equal(TIterator1 first1, TIterator1 last1, TIterator2 first2)
{
while (first1 != last1)
{
if (*first1++ != *first2++)
{
return false;
}
}
return true;
}
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<etl::is_pointer<TIterator1>::value && etl::is_pointer<TIterator2>::value && etl::is_pod<typename etlstd::iterator_traits<TIterator1>::value_type>::value, bool>::type
equal(TIterator1 first1, TIterator1 last1, TIterator2 first2)
{
typedef typename etlstd::iterator_traits<TIterator1>::value_type value_t;
return (memcmp(first1, first2, sizeof(value_t) * (last1 - first1)) == 0);
}
//***************************************************************************
// lexicographical_compare
template <typename TIterator1, typename TIterator2, typename TCompare>
bool lexicographical_compare(TIterator1 first1, TIterator1 last1,
TIterator2 first2, TIterator2 last2,
TCompare compare)
{
while ((first1 != last1) && (first2 != last2))
{
if (compare(*first1, *first2))
{
return true;
}
if (compare(*first2, *first1))
{
return false;
}
++first1;
++first2;
}
return (first1 == last1) && (first2 != last2);
}
//***************************************************************************
// lexicographical_compare
template <typename TIterator1, typename TIterator2>
bool lexicographical_compare(TIterator1 first1, TIterator1 last1,
TIterator2 first2, TIterator2 last2)
{
typedef etlstd::less<typename etlstd::iterator_traits<TIterator1>::value_type> compare;
return etlstd::lexicographical_compare(first1, last1, first2, last2, compare());
}
//***************************************************************************
// min
template <typename T, typename TCompare>
const T& min(const T& a, const T& b, TCompare compare)
{
return (compare(a, b)) ? a : b;
}
template <typename T>
const T& min(const T& a, const T& b)
{
typedef etlstd::less<T> compare;
return etlstd::min(a, b, compare());
}
//***************************************************************************
// max
template <typename T, typename TCompare>
const T& max(const T& a, const T& b, TCompare compare)
{
return (compare(a, b)) ? b : a;
}
template <typename T>
const T& max(const T& a, const T& b)
{
typedef etlstd::less<T> compare;
return etlstd::max(a, b, compare());
}
//***************************************************************************
// transform
template <typename TIteratorIn, typename TIteratorOut, typename TUnaryOperation>
TIteratorOut transform(TIteratorIn first1, TIteratorIn last1, TIteratorOut d_first, TUnaryOperation unary_operation)
{
while (first1 != last1)
{
*d_first++ = unary_operation(*first1++);
}
return d_first;
}
template <typename TIteratorIn1, typename TIteratorIn2, typename TIteratorOut, typename TBinaryOperation>
TIteratorOut transform(TIteratorIn1 first1, TIteratorIn1 last1, TIteratorIn2 first2, TIteratorOut d_first, TBinaryOperation binary_operation)
{
while (first1 != last1)
{
*d_first++ = binary_operation(*first1++, *first2++);
}
return d_first;
}
//***************************************************************************
// Heap
namespace private_heap
{
// Push Heap Helper
template <typename TIterator, typename TDistance, typename TValue, typename TCompare>
void push_heap(TIterator first, TDistance value_index, TDistance top_index, TValue value, TCompare compare)
{
TDistance parent = (value_index - 1) / 2;
while ((value_index > top_index) && compare(first[parent], value))
{
first[value_index] = first[parent];
value_index = parent;
parent = (value_index - 1) / 2;
}
first[value_index] = value;
}
// Adjust Heap Helper
template <typename TIterator, typename TDistance, typename TValue, typename TCompare>
void adjust_heap(TIterator first, TDistance value_index, TDistance length, TValue value, TCompare compare)
{
TDistance top_index = value_index;
TDistance child2nd = (2 * value_index) + 2;
while (child2nd < length)
{
if (compare(first[child2nd], first[child2nd - 1]))
{
child2nd--;
}
first[value_index] = first[child2nd];
value_index = child2nd;
child2nd = 2 * (child2nd + 1);
}
if (child2nd == length)
{
first[value_index] = first[child2nd - 1];
value_index = child2nd - 1;
}
push_heap(first, value_index, top_index, value, compare);
}
// Is Heap Helper
template <typename TIterator, typename TDistance, typename TCompare>
bool is_heap(const TIterator first, const TDistance n, TCompare compare)
{
TDistance parent = 0;
for (TDistance child = 1; child < n; ++child)
{
if (compare(first[parent], first[child]))
{
return false;
}
if ((child & 1) == 0)
{
++parent;
}
}
return true;
}
}
// Pop Heap
template <typename TIterator, typename TCompare>
void pop_heap(TIterator first, TIterator last, TCompare compare)
{
typedef typename etlstd::iterator_traits<TIterator>::value_type value_t;
typedef typename etlstd::iterator_traits<TIterator>::difference_type distance_t;
value_t value = last[-1];
last[-1] = first[0];
private_heap::adjust_heap(first, distance_t(0), distance_t(last - first - 1), value, compare);
}
// Pop Heap
template <typename TIterator>
void pop_heap(TIterator first, TIterator last)
{
typedef etlstd::less<typename etlstd::iterator_traits<TIterator>::value_type> compare;
etlstd::pop_heap(first, last, compare());
}
// Push Heap
template <typename TIterator, typename TCompare>
void push_heap(TIterator first, TIterator last, TCompare compare)
{
typedef typename etlstd::iterator_traits<TIterator>::difference_type difference_t;
typedef typename etlstd::iterator_traits<TIterator>::value_type value_t;
private_heap::push_heap(first, difference_t(last - first - 1), difference_t(0), value_t(*(last - 1)), compare);
}
// Push Heap
template <typename TIterator>
void push_heap(TIterator first, TIterator last)
{
typedef etlstd::less<typename etlstd::iterator_traits<TIterator>::value_type> compare;
etlstd::push_heap(first, last, compare());
}
// Make Heap
template <typename TIterator, typename TCompare>
void make_heap(TIterator first, TIterator last, TCompare compare)
{
typedef typename etlstd::iterator_traits<TIterator>::difference_type difference_t;
if ((last - first) < 2)
{
return;
}
difference_t length = last - first;
difference_t parent = (length - 2) / 2;
while (true)
{
private_heap::adjust_heap(first, parent, length, *(first + parent), compare);
if (parent == 0)
{
return;
}
--parent;
}
}
// Make Heap
template <typename TIterator>
void make_heap(TIterator first, TIterator last)
{
typedef etlstd::less<typename etlstd::iterator_traits<TIterator>::value_type> compare;
etlstd::make_heap(first, last, compare());
}
// Is Heap
template <typename TIterator>
bool is_heap(TIterator first, TIterator last)
{
typedef etlstd::less<typename etlstd::iterator_traits<TIterator>::value_type> compare;
return private_heap::is_heap(first, last - first, compare());
}
// Is Heap
template <typename TIterator, typename TCompare>
bool is_heap(TIterator first, TIterator last, TCompare compare)
{
return private_heap::is_heap(first, last - first, compare);
}
//***************************************************************************
// Search
template<typename TIterator1, typename TIterator2, typename TCompare>
TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last, TCompare compare)
{
while (true)
{
TIterator1 itr = first;
TIterator2 search_itr = search_first;
while (true)
{
if (search_itr == search_last)
{
return first;
}
if (itr == last)
{
return last;
}
if (!compare(*itr, *search_itr))
{
break;
}
++itr;
++search_itr;
}
++first;
}
}
// Search
template<typename TIterator1, class TIterator2>
TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last)
{
typedef etlstd::equal_to<typename etlstd::iterator_traits<TIterator1>::value_type> compare;
return etlstd::search(first, last, search_first, search_last, compare());
}
//***************************************************************************
// Rotate
template<typename TIterator>
TIterator rotate(TIterator first, TIterator middle, TIterator last)
{
TIterator next = middle;
while (first != next)
{
etlstd::swap(*first++, *next++);
if (next == last)
{
next = middle;
}
else if (first == middle)
{
middle = next;
}
}
return first;
}
//***************************************************************************
// find_end
// Predicate
template <typename TIterator1, typename TIterator2, typename TPredicate>
TIterator1 find_end(TIterator1 b, TIterator1 e,
TIterator2 sb, TIterator2 se,
TPredicate predicate)
{
if (sb == se)
{
return e;
}
TIterator1 result = e;
while (true)
{
TIterator1 new_result = etlstd::search(b, e, sb, se, predicate);
if (new_result == e)
{
break;
}
else
{
result = new_result;
b = result;
++b;
}
}
return result;
}
// Default
template <typename TIterator1, typename TIterator2>
TIterator1 find_end(TIterator1 b, TIterator1 e,
TIterator2 sb, TIterator2 se)
{
typedef etlstd::equal_to<typename etlstd::iterator_traits<TIterator1>::value_type> predicate;
return find_end(b, e, sb, se, predicate());
}
}
#endif

View File

@ -1,137 +0,0 @@
#ifndef ETL_STL_ALTERNATE_FUNCTIONAL_INCLUDED
#define ETL_STL_ALTERNATE_FUNCTIONAL_INCLUDED
#include "../../platform.h"
#include "../../private/choose_tag_types.h"
#include "../../private/choose_pair_types.h"
namespace etlstd
{
//***************************************************************************
template <typename T = void>
struct less
{
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs < rhs;
}
};
//***************************************************************************
template <typename T = void>
struct greater
{
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs > rhs;
}
};
//***************************************************************************
template <typename T = void>
struct equal_to
{
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs == rhs;
}
};
//***************************************************************************
template <typename T = void>
struct not_equal_to
{
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs != rhs;
}
};
//***************************************************************************
template <typename TArgumentType, typename TResultType>
struct unary_function
{
typedef TArgumentType argument_type;
typedef TResultType result_type;
};
//***************************************************************************
template <typename TFirstArgumentType, typename TSecondArgumentType, typename TResultType>
struct binary_function
{
typedef TFirstArgumentType first_argument_type;
typedef TSecondArgumentType second_argument_type;
typedef TResultType result_type;
};
//***************************************************************************
template <typename TFunction>
class binder1st : public etlstd::unary_function<typename TFunction::second_argument_type, typename TFunction::result_type>
{
protected:
TFunction operation;
typename TFunction::first_argument_type value;
public:
binder1st(const TFunction& f, const typename TFunction::first_argument_type& v)
: operation (f), value(v)
{
}
typename TFunction::result_type operator()(typename TFunction::second_argument_type& x) const
{
return operation(value, x);
}
typename TFunction::result_type operator()(const typename TFunction::second_argument_type& x) const
{
return operation(value, x);
}
};
template <typename F, typename T>
binder1st<F> bind1st(const F& f, const T& x)
{
return binder1st<F>(f, x);
}
//***************************************************************************
template <typename TFunction >
class binder2nd : public etlstd::unary_function<typename TFunction::first_argument_type, typename TFunction::result_type>
{
protected:
TFunction operation;
typename TFunction::second_argument_type value;
public:
binder2nd(const TFunction& f, const typename TFunction::second_argument_type& v)
: operation (f), value(v)
{
}
typename TFunction::result_type operator()(typename TFunction::first_argument_type& x) const
{
return operation(x, value);
}
typename TFunction::result_type operator()(const typename TFunction::first_argument_type& x) const
{
return operation(x, value);
}
};
template <typename F, typename T>
binder2nd<F> bind2nd(const F& f, const T& x)
{
return binder2nd<F>(f, x);
}
}
#endif

View File

@ -1,394 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_ALTERNATE_ITERATOR_INCLUDED
#define ETL_STL_ALTERNATE_ITERATOR_INCLUDED
#include "../../platform.h"
#include "../../type_traits.h"
#include <string.h>
#include "../../private/choose_tag_types.h"
#include "../../private/choose_pair_types.h"
namespace etlstd
{
//***************************************************************************
// iterator tags
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
//***************************************************************************
// iterator_traits
template <typename TIterator>
struct iterator_traits
{
typedef typename TIterator::iterator_category iterator_category;
typedef typename TIterator::value_type value_type;
typedef typename TIterator::difference_type difference_type;
typedef typename TIterator::pointer pointer;
typedef typename TIterator::reference reference;
};
template <typename T>
struct iterator_traits<T*>
{
typedef ETL_RANDOM_ACCESS_ITERATOR_TAG iterator_category;
typedef T value_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef T& reference;
};
template <typename T>
struct iterator_traits<const T*>
{
typedef ETL_RANDOM_ACCESS_ITERATOR_TAG iterator_category;
typedef T value_type;
typedef ptrdiff_t difference_type;
typedef const T* pointer;
typedef const T& reference;
};
//***************************************************************************
// advance
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_INPUT_ITERATOR_TAG)
{
while (n--)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OUTPUT_ITERATOR_TAG)
{
while (n--)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_FORWARD_ITERATOR_TAG)
{
while (n--)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_BIDIRECTIONAL_ITERATOR_TAG)
{
if (n > 0)
{
while (n--)
{
++itr;
}
}
else
{
while (n++)
{
--itr;
}
}
}
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_RANDOM_ACCESS_ITERATOR_TAG)
{
itr += n;
}
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR17 void advance(TIterator& itr, TDistance n)
{
typedef typename etlstd::iterator_traits<TIterator>::iterator_category tag;
advance_helper(itr, n, tag());
}
//***************************************************************************
// distance
template<typename TIterator>
ETL_CONSTEXPR17 typename etlstd::iterator_traits<TIterator>::difference_type distance_helper(TIterator first, TIterator last, ETL_INPUT_ITERATOR_TAG)
{
typename etlstd::iterator_traits<TIterator>::difference_type d = 0;
while (first != last)
{
++d;
++first;
}
return d;
}
template<typename TIterator>
ETL_CONSTEXPR17 typename etlstd::iterator_traits<TIterator>::difference_type distance_helper(TIterator first, TIterator last, ETL_FORWARD_ITERATOR_TAG)
{
typename etlstd::iterator_traits<TIterator>::difference_type d = 0;
while (first != last)
{
++d;
++first;
}
return d;
}
template<typename TIterator>
ETL_CONSTEXPR17 typename etlstd::iterator_traits<TIterator>::difference_type distance_helper(TIterator first, TIterator last, ETL_BIDIRECTIONAL_ITERATOR_TAG)
{
typename etlstd::iterator_traits<TIterator>::difference_type d = 0;
while (first != last)
{
++d;
++first;
}
return d;
}
template<typename TIterator>
ETL_CONSTEXPR17 typename etlstd::iterator_traits<TIterator>::difference_type distance_helper(TIterator first, TIterator last, ETL_RANDOM_ACCESS_ITERATOR_TAG)
{
return last - first;
}
template<typename TIterator>
ETL_CONSTEXPR17 typename etlstd::iterator_traits<TIterator>::difference_type distance(TIterator first, TIterator last)
{
typedef typename etlstd::iterator_traits<TIterator>::iterator_category tag;
return distance_helper(first, last, tag());
}
//***************************************************************************
// reverse_iterator
template <typename TIterator>
class reverse_iterator
{
public:
typedef typename iterator_traits<TIterator>::iterator_category iterator_category;
typedef typename iterator_traits<TIterator>::value_type value_type;
typedef typename iterator_traits<TIterator>::difference_type difference_type;
typedef typename iterator_traits<TIterator>::pointer pointer;
typedef typename iterator_traits<TIterator>::reference reference;
typedef TIterator iterator_type;
ETL_CONSTEXPR17 reverse_iterator()
: current()
{
}
ETL_CONSTEXPR17 explicit reverse_iterator(TIterator itr)
: current(itr)
{
}
template <typename TOther>
ETL_CONSTEXPR17 reverse_iterator(const reverse_iterator<TOther>& other)
: current(other.base())
{
}
template<class TOther>
ETL_CONSTEXPR17 reverse_iterator& operator=(const reverse_iterator<TOther>& other)
{
current = other.base();
return (*this);
}
ETL_CONSTEXPR17 TIterator base() const
{
return current;
}
ETL_NODISCARD ETL_CONSTEXPR17 reference operator*() const
{
TIterator temp = current;
return *(--temp);
}
ETL_NODISCARD ETL_CONSTEXPR17 pointer operator->() const
{
TIterator temp = current;
return &(*--temp);
}
ETL_CONSTEXPR17 reverse_iterator& operator++()
{
--current;
return *this;
}
ETL_CONSTEXPR17 reverse_iterator operator++(int)
{
reverse_iterator temp = *this;
--current;
return temp;
}
ETL_CONSTEXPR17 reverse_iterator& operator--()
{
++current;
return (*this);
}
ETL_CONSTEXPR17 reverse_iterator operator--(int)
{
reverse_iterator temp = *this;
++current;
return temp;
}
ETL_CONSTEXPR17 reverse_iterator& operator+=(const difference_type offset)
{
current -= offset;
return (*this);
}
ETL_CONSTEXPR17 reverse_iterator& operator-=(const difference_type offset)
{
current += offset;
return (*this);
}
ETL_NODISCARD ETL_CONSTEXPR17 reverse_iterator operator+(const difference_type offset) const
{
return reverse_iterator(current - offset);
}
ETL_NODISCARD ETL_CONSTEXPR17 reverse_iterator operator-(const difference_type offset) const
{
return (reverse_iterator(current + offset));
}
ETL_NODISCARD ETL_CONSTEXPR17 reference operator[](const difference_type offset) const
{
return (*(*this + offset));
}
protected:
TIterator current;
};
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator ==(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return lhs.base() == rhs.base();
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator !=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return !(lhs == rhs);
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator <(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return rhs.base() < lhs.base();
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator >(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return rhs < lhs;
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator <=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return !(rhs < lhs);
}
template <class TIterator>
inline ETL_CONSTEXPR17 bool operator >=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return !(lhs < rhs);
}
template <class TIterator>
inline ETL_CONSTEXPR17 typename reverse_iterator<TIterator>::difference_type operator -(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return rhs.base() - lhs.base();
}
template <class TIterator, class TDifference>
inline ETL_CONSTEXPR17 reverse_iterator<TIterator> operator +(TDifference n, const reverse_iterator<TIterator>& itr)
{
return itr.operator +(n);
}
//***************************************************************************
// Previous
template<typename TIterator>
ETL_CONSTEXPR17 TIterator prev(TIterator itr, typename etlstd::iterator_traits<TIterator>::difference_type n = 1)
{
etlstd::advance(itr, -n);
return itr;
}
//***************************************************************************
// Next
template<typename TIterator>
ETL_CONSTEXPR17 TIterator next(TIterator itr, typename etlstd::iterator_traits<TIterator>::difference_type n = 1)
{
etlstd::advance(itr, n);
return itr;
}
}
#endif

View File

@ -1,453 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_ALTERNATE_LIMITS_INCLUDED
#define ETL_STL_ALTERNATE_LIMITS_INCLUDED
#include "../../platform.h"
#include "../../type_traits.h"
#include "../../char_traits.h"
#include "../../integral_limits.h"
#include "../../private/choose_tag_types.h"
#include "../../private/choose_pair_types.h"
#include <limits.h>
#include <stdint.h>
#include <float.h>
#define ETL_LOG2(x) (((x) * 301) / 1000)
namespace etlstd
{
template<class T> class numeric_limits;
enum float_round_style
{
round_indeterminate = -1,
round_toward_zero = 0,
round_to_nearest = 1,
round_toward_infinity = 2,
round_toward_neg_infinity = 3,
};
enum float_denorm_style
{
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
};
//***************************************************************************
// Base for integral types.
template <typename T>
class etl_integral_type
{
public:
static ETL_CONST_OR_CONSTEXPR bool is_specialized = true;
static ETL_CONST_OR_CONSTEXPR int max_digits10 = 0;
static ETL_CONST_OR_CONSTEXPR bool is_integer = true;
static ETL_CONST_OR_CONSTEXPR bool is_exact = true;
static ETL_CONST_OR_CONSTEXPR int radix = 2;
static ETL_CONSTEXPR T epsilon() { return 0; }
static ETL_CONSTEXPR T round_error() { return 0; }
static ETL_CONST_OR_CONSTEXPR int digits = (CHAR_BIT * sizeof(T)) - (etl::is_signed<T>::value ? 1 : 0);
static ETL_CONST_OR_CONSTEXPR int digits10 = ETL_LOG2(digits);
static ETL_CONST_OR_CONSTEXPR bool is_signed = etl::is_signed<T>::value;
static ETL_CONST_OR_CONSTEXPR int min_exponent = 0;
static ETL_CONST_OR_CONSTEXPR int min_exponent10 = 0;
static ETL_CONST_OR_CONSTEXPR int max_exponent = 0;
static ETL_CONST_OR_CONSTEXPR int max_exponent10 = 0;
static ETL_CONST_OR_CONSTEXPR bool has_infinity = false;
static ETL_CONST_OR_CONSTEXPR bool has_quiet_NaN = false;
static ETL_CONST_OR_CONSTEXPR bool has_signaling_NaN = false;
static ETL_CONST_OR_CONSTEXPR float_denorm_style has_denorm = denorm_absent;
static ETL_CONST_OR_CONSTEXPR bool has_denorm_loss = false;
static ETL_CONSTEXPR T infinity() { return 0; }
static ETL_CONSTEXPR T quiet_NaN() { return 0; }
static ETL_CONSTEXPR T signaling_NaN() { return 0; }
static ETL_CONSTEXPR T denorm_min() { return 0; }
static ETL_CONST_OR_CONSTEXPR bool is_iec559 = false;
static ETL_CONST_OR_CONSTEXPR bool is_bounded = true;
static ETL_CONST_OR_CONSTEXPR bool is_modulo = etl::is_unsigned<T>::value;
static ETL_CONST_OR_CONSTEXPR bool traps = false;
static ETL_CONST_OR_CONSTEXPR bool tinyness_before = false;
static ETL_CONST_OR_CONSTEXPR float_round_style round_style = round_toward_zero;
};
//***************************************************************************
// Base for floating point types.
template <typename T>
class etl_floating_point_type
{
public:
static ETL_CONST_OR_CONSTEXPR bool is_specialized = true;
static ETL_CONST_OR_CONSTEXPR bool is_signed = true;
static ETL_CONST_OR_CONSTEXPR bool is_integer = false;
static ETL_CONST_OR_CONSTEXPR bool is_exact = false;
static ETL_CONST_OR_CONSTEXPR int radix = 2;
static ETL_CONST_OR_CONSTEXPR bool has_infinity = false;
static ETL_CONST_OR_CONSTEXPR bool has_quiet_NaN = false;
static ETL_CONST_OR_CONSTEXPR bool has_signaling_NaN = false;
static ETL_CONST_OR_CONSTEXPR float_denorm_style has_denorm = denorm_present;
static ETL_CONST_OR_CONSTEXPR bool has_denorm_loss = true;
static ETL_CONST_OR_CONSTEXPR bool is_iec559 = true;
static ETL_CONST_OR_CONSTEXPR bool is_bounded = true;
static ETL_CONST_OR_CONSTEXPR bool is_modulo = false;
static ETL_CONSTEXPR T round_error() { return T(0.5); }
static ETL_CONSTEXPR T infinity() { return 0; }
static ETL_CONSTEXPR T quiet_NaN() { return 0; }
static ETL_CONSTEXPR T signaling_NaN() { return 0; }
static ETL_CONST_OR_CONSTEXPR bool traps = false;
static ETL_CONST_OR_CONSTEXPR bool tinyness_before = true;
static ETL_CONST_OR_CONSTEXPR float_round_style round_style = round_to_nearest;
};
//***************************************************************************
// Default
template <typename T>
class numeric_limits;
template <typename T>
class numeric_limits<const T> : public numeric_limits<T> { };
template <typename T>
class numeric_limits<volatile T> : public numeric_limits<T> { };
template <typename T>
class numeric_limits<const volatile T> : public numeric_limits<T> { };
//***************************************************************************
// bool
template<>
class numeric_limits<bool>
{
public:
static ETL_CONST_OR_CONSTEXPR bool is_specialized = true;
static ETL_CONSTEXPR bool min() { return false; }
static ETL_CONSTEXPR bool max() { return true; }
static ETL_CONSTEXPR bool lowest() { return false; }
static ETL_CONST_OR_CONSTEXPR int digits = 1;
static ETL_CONST_OR_CONSTEXPR int digits10 = 0;
static ETL_CONST_OR_CONSTEXPR int max_digits10 = 0;
static ETL_CONST_OR_CONSTEXPR bool is_signed = false;
static ETL_CONST_OR_CONSTEXPR bool is_integer = true;
static ETL_CONST_OR_CONSTEXPR bool is_exact = true;
static ETL_CONST_OR_CONSTEXPR int radix = 2;
static ETL_CONST_OR_CONSTEXPR bool epsilon() { return false; }
static ETL_CONST_OR_CONSTEXPR bool round_error() { return false; }
static ETL_CONST_OR_CONSTEXPR int min_exponent = 0;
static ETL_CONST_OR_CONSTEXPR int min_exponent10 = 0;
static ETL_CONST_OR_CONSTEXPR int max_exponent = 0;
static ETL_CONST_OR_CONSTEXPR int max_exponent10 = 0;
static ETL_CONST_OR_CONSTEXPR bool has_infinity = false;
static ETL_CONST_OR_CONSTEXPR bool has_quiet_NaN = false;
static ETL_CONST_OR_CONSTEXPR bool has_signaling_NaN = false;
static ETL_CONST_OR_CONSTEXPR float_denorm_style has_denorm = denorm_absent;
static ETL_CONST_OR_CONSTEXPR bool has_denorm_loss = false;
static ETL_CONSTEXPR bool infinity() { return false; }
static ETL_CONSTEXPR bool quiet_NaN() { return false; }
static ETL_CONSTEXPR bool signaling_NaN() { return false; }
static ETL_CONSTEXPR bool denorm_min() { return false; }
static ETL_CONST_OR_CONSTEXPR bool is_iec559 = false;
static ETL_CONST_OR_CONSTEXPR bool is_bounded = true;
static ETL_CONST_OR_CONSTEXPR bool is_modulo = false;
static ETL_CONST_OR_CONSTEXPR bool traps = false;
static ETL_CONST_OR_CONSTEXPR bool tinyness_before = false;
static ETL_CONST_OR_CONSTEXPR float_round_style round_style = round_toward_zero;
};
//***************************************************************************
// char
template<>
class numeric_limits<char> : public etl_integral_type<char>
{
public:
static ETL_CONSTEXPR char min() { return char(CHAR_MIN); }
static ETL_CONSTEXPR char max() { return char(CHAR_MAX); }
static ETL_CONSTEXPR char lowest() { return char(CHAR_MIN); }
};
//***************************************************************************
// unsigned char
template<>
class numeric_limits<unsigned char> : public etl_integral_type<unsigned char>
{
public:
static ETL_CONSTEXPR unsigned char min() { return 0; }
static ETL_CONSTEXPR unsigned char max() { return UCHAR_MAX; }
static ETL_CONSTEXPR unsigned char lowest() { return 0; }
};
//***************************************************************************
// signed char
template<>
class numeric_limits<signed char> : public etl_integral_type<signed char>
{
public:
static ETL_CONSTEXPR signed char min() { return SCHAR_MIN; }
static ETL_CONSTEXPR signed char max() { return SCHAR_MAX; }
static ETL_CONSTEXPR signed char lowest() { return SCHAR_MIN; }
};
#if (ETL_NO_LARGE_CHAR_SUPPORT == false)
//***************************************************************************
// char16_t
template<>
class numeric_limits<char16_t> : public etl_integral_type<char16_t>
{
public:
static ETL_CONSTEXPR char16_t min() { return 0; }
static ETL_CONSTEXPR char16_t max() { return UINT_LEAST16_MAX; }
static ETL_CONSTEXPR char16_t lowest() { return 0; }
};
//***************************************************************************
// char32_t
template<>
class numeric_limits<char32_t> : public etl_integral_type<char32_t>
{
public:
static ETL_CONSTEXPR char32_t min() { return 0; }
static ETL_CONSTEXPR char32_t max() { return UINT_LEAST32_MAX; }
static ETL_CONSTEXPR char32_t lowest() { return 0; }
};
#endif
//***************************************************************************
// wchar_t
template<>
class numeric_limits<wchar_t> : public etl_integral_type<wchar_t>
{
public:
static ETL_CONSTEXPR wchar_t min() { return WCHAR_MIN; }
static ETL_CONSTEXPR wchar_t max() { return WCHAR_MAX; }
static ETL_CONSTEXPR wchar_t lowest() { return WCHAR_MIN; }
};
//***************************************************************************
// short
template<>
class numeric_limits<short> : public etl_integral_type<short>
{
public:
static ETL_CONSTEXPR short min() { return SHRT_MIN; }
static ETL_CONSTEXPR short max() { return SHRT_MAX; }
static ETL_CONSTEXPR short lowest() { return SHRT_MIN; }
};
//***************************************************************************
// unsigned short
template<>
class numeric_limits<unsigned short> : public etl_integral_type<unsigned short>
{
public:
static ETL_CONSTEXPR unsigned short min() { return 0; }
static ETL_CONSTEXPR unsigned short max() { return USHRT_MAX; }
static ETL_CONSTEXPR unsigned short lowest() { return 0; }
};
//***************************************************************************
// int
template<>
class numeric_limits<int> : public etl_integral_type<int>
{
public:
static ETL_CONSTEXPR int min() { return INT_MIN; }
static ETL_CONSTEXPR int max() { return INT_MAX; }
static ETL_CONSTEXPR int lowest() { return INT_MIN; }
};
//***************************************************************************
// unsigned int
template<>
class numeric_limits<unsigned int> : public etl_integral_type<unsigned int>
{
public:
static ETL_CONSTEXPR unsigned int min() { return 0; }
static ETL_CONSTEXPR unsigned int max() { return UINT_MAX; }
static ETL_CONSTEXPR unsigned int lowest() { return 0; }
};
//***************************************************************************
// long
template<>
class numeric_limits<long> : public etl_integral_type<long>
{
public:
static ETL_CONSTEXPR long min() { return LONG_MIN; }
static ETL_CONSTEXPR long max() { return LONG_MAX; }
static ETL_CONSTEXPR long lowest() { return LONG_MIN; }
};
//***************************************************************************
// unsigned long
template<>
class numeric_limits<unsigned long> : public etl_integral_type<unsigned long>
{
public:
static ETL_CONSTEXPR unsigned long min() { return 0; }
static ETL_CONSTEXPR unsigned long max() { return ULONG_MAX; }
static ETL_CONSTEXPR unsigned long lowest() { return 0; }
};
//***************************************************************************
// long long
template<>
class numeric_limits<long long> : public etl_integral_type<long long>
{
public:
static ETL_CONSTEXPR long long min() { return LLONG_MIN; }
static ETL_CONSTEXPR long long max() { return LLONG_MAX; }
static ETL_CONSTEXPR long long lowest() { return LLONG_MIN; }
};
//***************************************************************************
// unsigned long long
template<>
class numeric_limits<unsigned long long> : public etl_integral_type<unsigned long long>
{
public:
static ETL_CONSTEXPR unsigned long long min() { return 0; }
static ETL_CONSTEXPR unsigned long long max() { return ULLONG_MAX; }
static ETL_CONSTEXPR unsigned long long lowest() { return 0; }
};
//***************************************************************************
// float
template<>
class numeric_limits<float> : public etl_floating_point_type<float>
{
public:
static ETL_CONSTEXPR float min() { return FLT_MIN; }
static ETL_CONSTEXPR float max() { return FLT_MAX; }
static ETL_CONSTEXPR float lowest() { return -FLT_MAX; }
static ETL_CONSTEXPR float epsilon() { return FLT_EPSILON; }
static ETL_CONSTEXPR float denorm_min() { return FLT_MIN; }
static ETL_CONST_OR_CONSTEXPR int digits = FLT_MANT_DIG;
static ETL_CONST_OR_CONSTEXPR int digits10 = FLT_DIG;
static ETL_CONST_OR_CONSTEXPR int max_digits10 = ETL_LOG2(FLT_MANT_DIG) + 2;
static ETL_CONST_OR_CONSTEXPR int min_exponent = FLT_MIN_EXP;
static ETL_CONST_OR_CONSTEXPR int min_exponent10 = FLT_MIN_10_EXP;
static ETL_CONST_OR_CONSTEXPR int max_exponent = FLT_MAX_EXP;
static ETL_CONST_OR_CONSTEXPR int max_exponent10 = FLT_MAX_10_EXP;
};
//***************************************************************************
// double
template<>
class numeric_limits<double> : public etl_floating_point_type<double>
{
public:
static ETL_CONSTEXPR double min() { return DBL_MIN; }
static ETL_CONSTEXPR double max() { return DBL_MAX; }
static ETL_CONSTEXPR double lowest() { return -DBL_MAX; }
static ETL_CONSTEXPR double epsilon() { return DBL_EPSILON; }
static ETL_CONSTEXPR double denorm_min() { return DBL_MIN; }
static ETL_CONST_OR_CONSTEXPR int digits = DBL_MANT_DIG;
static ETL_CONST_OR_CONSTEXPR int digits10 = DBL_DIG;
static ETL_CONST_OR_CONSTEXPR int max_digits10 = ETL_LOG2(DBL_MANT_DIG) + 2;
static ETL_CONST_OR_CONSTEXPR int min_exponent = DBL_MIN_EXP;
static ETL_CONST_OR_CONSTEXPR int min_exponent10 = DBL_MIN_10_EXP;
static ETL_CONST_OR_CONSTEXPR int max_exponent = DBL_MAX_EXP;
static ETL_CONST_OR_CONSTEXPR int max_exponent10 = DBL_MAX_10_EXP;
};
//***************************************************************************
// long double
template<>
class numeric_limits<long double> : public etl_floating_point_type<long double>
{
public:
static ETL_CONSTEXPR long double min() { return LDBL_MIN; }
static ETL_CONSTEXPR long double max() { return LDBL_MAX; }
static ETL_CONSTEXPR long double lowest() { return -LDBL_MAX; }
static ETL_CONSTEXPR long double epsilon() { return LDBL_EPSILON; }
static ETL_CONSTEXPR long double denorm_min() { return LDBL_MIN; }
static ETL_CONST_OR_CONSTEXPR int digits = LDBL_MANT_DIG;
static ETL_CONST_OR_CONSTEXPR int digits10 = LDBL_DIG;
static ETL_CONST_OR_CONSTEXPR int max_digits10 = ETL_LOG2(LDBL_MANT_DIG) + 2;
static ETL_CONST_OR_CONSTEXPR int min_exponent = LDBL_MIN_EXP;
static ETL_CONST_OR_CONSTEXPR int min_exponent10 = LDBL_MIN_10_EXP;
static ETL_CONST_OR_CONSTEXPR int max_exponent = LDBL_MAX_EXP;
static ETL_CONST_OR_CONSTEXPR int max_exponent10 = LDBL_MAX_10_EXP;
};
}
#endif

View File

@ -1,163 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_ALTERNATE_UTILITY_INCLUDED
#define ETL_STL_ALTERNATE_UTILITY_INCLUDED
#include "../../platform.h"
#include "../../type_traits.h"
#include "../../private/choose_tag_types.h"
#include "../../private/choose_pair_types.h"
namespace etlstd
{
//******************************************************************************
template <typename T1, typename T2>
struct pair
{
typedef T1 first_type;
typedef T2 second_type;
T1 first;
T2 second;
pair()
: first(T1()),
second(T2())
{
}
pair(const T1& a, const T2& b)
: first(a),
second(b)
{
}
template <typename U1, typename U2>
pair(const pair<U1, U2>& other)
: first(other.first),
second(other.second)
{
}
pair(const pair<T1, T2>& other)
: first(other.first),
second(other.second)
{
}
void swap(pair<T1, T2>& other)
{
T1 temp1 = first;
T2 temp2 = second;
first = other.first;
second = other.second;
other.first = temp1;
other.second = temp2;
}
};
//******************************************************************************
template <typename T1, typename T2>
inline pair<T1, T2> make_pair(T1 a, T2 b)
{
return pair<T1, T2>(a, b);
}
//******************************************************************************
template <typename T1, typename T2>
inline void swap(pair<T1, T2>& a, pair<T1, T2>& b)
{
a.swap(b);
}
//******************************************************************************
template <typename T1, typename T2>
inline bool operator ==(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return (a.first == b.first) && (a.second == b.second);
}
template <typename T1, typename T2>
inline bool operator !=(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return !(a == b);
}
template <typename T1, typename T2>
inline bool operator <(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return (a.first < b.first) ||
(!(b.first < a.first) && (a.second < b.second));
}
template <typename T1, typename T2>
inline bool operator >(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return (b < a);
}
template <typename T1, typename T2>
inline bool operator <=(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return !(b < a);
}
template <typename T1, typename T2>
inline bool operator >=(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return !(a < b);
}
#if ETL_CPP11_SUPPORTED
//******************************************************************************
template <typename T>
constexpr typename etl::remove_reference<T>::type&& move(T&& t) noexcept
{
return static_cast<typename etl::remove_reference<T>::type&&>(t);
}
//******************************************************************************
template <typename T>
constexpr T&& forward(typename etl::remove_reference<T>::type& t) noexcept
{
return static_cast<T&&>(t);
}
template <typename T>
constexpr T&& forward(typename etl::remove_reference<T>::type&& t) noexcept
{
return static_cast<T&&>(t);
}
#endif
}
#endif

View File

@ -1,17 +0,0 @@
#ifndef ETL_STL_FUNCTIONAL_INCLUDED
#define ETL_STL_FUNCTIONAL_INCLUDED
#include "../platform.h"
#include "../private/choose_namespace.h"
#include "../private/choose_tag_types.h"
#include "../private/choose_pair_types.h"
#if defined(ETL_NO_STL)
#include "alternate/functional.h"
#else
#include <functional>
#endif
#endif

View File

@ -1,47 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_ITERATOR_INCLUDED
#define ETL_STL_ITERATOR_INCLUDED
#include "../platform.h"
#include "../private/choose_namespace.h"
#include "../private/choose_tag_types.h"
#include "../private/choose_pair_types.h"
#if defined(ETL_NO_STL)
#include "alternate/iterator.h"
#else
#include <iterator>
#endif
#endif

View File

@ -1,46 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_LIMITS_INCLUDED
#define ETL_STL_LIMITS_INCLUDED
#include "../platform.h"
#include "../private/choose_namespace.h"
#include "../private/choose_tag_types.h"
#include "../private/choose_pair_types.h"
#if defined(ETL_NO_STL)
#include "alternate/limits.h"
#else
#include <limits>
#endif
#endif

View File

@ -1,46 +0,0 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_STL_UTILITY_INCLUDED
#define ETL_STL_UTILITY_INCLUDED
#include "../platform.h"
#include "../private/choose_namespace.h"
#include "../private/choose_tag_types.h"
#include "../private/choose_pair_types.h"
#if defined(ETL_NO_STL)
#include "alternate/utility.h"
#else
#include <utility>
#endif
#endif

View File

@ -109,7 +109,7 @@ namespace etl
typedef const T& const_reference;
typedef const T* const_pointer;
typedef const T* const_iterator;
typedef ETL_STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
enum
{
@ -310,10 +310,10 @@ namespace etl
//*************************************************************************
template <typename TIterator,
typename TDummy = typename etl::enable_if<etl::is_random_iterator<TIterator>::value, void>::type>
void assign(TIterator begin_, TIterator end_)
void assign(TIterator begin_, TIterator end_)
{
mbegin = etl::addressof(*begin_);
mend = etl::addressof(*begin_) + ETL_STD::distance(begin_, end_);
mend = etl::addressof(*begin_) + etl::distance(begin_, end_);
}
//*************************************************************************
@ -321,8 +321,8 @@ namespace etl
//*************************************************************************
template <typename TIterator,
typename TSize,
typename TDummy = typename etl::enable_if<etl::is_random_iterator<TIterator>::value, void>::type>
void assign(TIterator begin_, TSize size_)
typename TDummy = typename etl::enable_if<etl::is_integral<TSize>::value, void>::type>
void assign(TIterator begin_, TSize size_)
{
mbegin = etl::addressof(*begin_);
mend = etl::addressof(*begin_) + size_;
@ -351,8 +351,10 @@ namespace etl
//*************************************************************************
void swap(basic_string_view& other)
{
ETL_STD::swap(mbegin, other.mbegin);
ETL_STD::swap(mend, other.mend);
using ETL_OR_STD::swap; // Allow ADL
swap(mbegin, other.mbegin);
swap(mend, other.mend);
}
//*************************************************************************
@ -364,9 +366,9 @@ namespace etl
if (position < size())
{
n = ETL_STD::min(count, size() - position);
n = etl::min(count, size() - position);
ETL_STD::copy(mbegin + position, mbegin + position + n, destination);
etl::copy(mbegin + position, mbegin + position + n, destination);
}
return n;
@ -381,7 +383,7 @@ namespace etl
if (position < size())
{
size_t n = ETL_STD::min(count, size() - position);
size_t n = etl::min(count, size() - position);
view = basic_string_view(mbegin + position, mbegin + position + n);
}
@ -495,7 +497,7 @@ namespace etl
return npos;
}
const_iterator iposition = ETL_STD::search(begin() + position, end(), view.begin(), view.end());
const_iterator iposition = etl::search(begin() + position, end(), view.begin(), view.end());
if (iposition == end())
{
@ -503,7 +505,7 @@ namespace etl
}
else
{
return ETL_STD::distance(begin(), iposition);
return etl::distance(begin(), iposition);
}
}
@ -532,9 +534,9 @@ namespace etl
return npos;
}
position = ETL_STD::min(position, size());
position = etl::min(position, size());
const_iterator iposition = ETL_STD::find_end(begin(),
const_iterator iposition = etl::find_end(begin(),
begin() + position,
view.begin(),
view.end());
@ -545,7 +547,7 @@ namespace etl
}
else
{
return ETL_STD::distance(begin(), iposition);
return etl::distance(begin(), iposition);
}
}
@ -615,7 +617,7 @@ namespace etl
return npos;
}
position = ETL_STD::min(position, size() - 1);
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
@ -711,7 +713,7 @@ namespace etl
return npos;
}
position = ETL_STD::min(position, size() - 1);
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
@ -762,7 +764,7 @@ namespace etl
friend bool operator == (const etl::basic_string_view<T, TTraits>& lhs, const etl::basic_string_view<T, TTraits>& rhs)
{
return (lhs.size() == rhs.size()) &&
ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
@ -778,7 +780,7 @@ namespace etl
//*************************************************************************
friend bool operator < (const etl::basic_string_view<T, TTraits>& lhs, const etl::basic_string_view<T, TTraits>& rhs)
{
return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
//*************************************************************************

View File

@ -117,7 +117,7 @@ namespace etl
typename etl::conditional<ID == T14::ID, typename T14::type,
typename etl::conditional<ID == T15::ID, typename T15::type,
typename etl::conditional<ID == T16::ID, typename T16::type,
etl::null_type<0>>::type>::type>::type>::type>
etl::null_type<0> >::type>::type>::type>::type>
::type>::type>::type>::type>
::type>::type>::type>::type>
::type>::type>::type>::type type;
@ -218,7 +218,7 @@ namespace etl
typename etl::conditional<etl::is_same<T, typename T14::type1>::value, typename T14::type2,
typename etl::conditional<etl::is_same<T, typename T15::type1>::value, typename T15::type2,
typename etl::conditional<etl::is_same<T, typename T16::type1>::value, typename T16::type2,
etl::null_type<0>>::type>::type>::type>::type>::type>::type>::type>::type>
etl::null_type<0> >::type>::type>::type>::type>::type>::type>::type>::type>
::type>::type>::type>::type>::type>::type>::type>::type type;
ETL_STATIC_ASSERT(!(etl::is_same<etl::null_type<0>, type>::value), "Invalid type");

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -191,7 +191,7 @@ namespace etl
{
ETL_ASSERT(position < size(), ETL_ERROR(string_out_of_bounds));
length_ = ETL_STD::min(length_, size() - position);
length_ = etl::min(length_, size() - position);
new_string.assign(buffer + position, buffer + position + length_);
}

View File

@ -191,7 +191,7 @@ namespace etl
{
ETL_ASSERT(position < size(), ETL_ERROR(string_out_of_bounds));
length_ = ETL_STD::min(length_, size() - position);
length_ = etl::min(length_, size() - position);
new_string.assign(buffer + position, buffer + position + length_);
}

View File

@ -37,10 +37,10 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "container.h"
#include "pool.h"
@ -127,12 +127,12 @@ namespace etl
/// Can be used as a reference type for all unordered_map containing a specific type.
///\ingroup unordered_map
//***************************************************************************
template <typename TKey, typename T, typename THash = etl::hash<TKey>, typename TKeyEqual = ETL_STD::equal_to<TKey> >
template <typename TKey, typename T, typename THash = etl::hash<TKey>, typename TKeyEqual = etl::equal_to<TKey> >
class iunordered_map
{
public:
typedef ETL_PAIR<const TKey, T> value_type;
typedef ETL_OR_STD::pair<const TKey, T> value_type;
typedef TKey key_type;
typedef T mapped_type;
@ -172,7 +172,7 @@ namespace etl
typedef typename bucket_t::const_iterator local_const_iterator;
//*********************************************************************
class iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, T>
class iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, T>
{
public:
@ -332,7 +332,7 @@ namespace etl
};
//*********************************************************************
class const_iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, const T>
class const_iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, const T>
{
public:
@ -482,7 +482,7 @@ namespace etl
local_iterator inode;
};
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*********************************************************************
/// Returns an iterator to the beginning of the unordered_map.
@ -609,7 +609,7 @@ namespace etl
{
size_t index = bucket(key);
return ETL_STD::distance(pbuckets[index].begin(), pbuckets[index].end());
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
//*********************************************************************
@ -752,7 +752,7 @@ namespace etl
void assign(TIterator first_, TIterator last_)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first_, last_);
difference_type d = etl::distance(first_, last_);
ETL_ASSERT(d >= 0, ETL_ERROR(unordered_map_iterator));
ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_map_full));
#endif
@ -770,9 +770,9 @@ namespace etl
/// If asserts or exceptions are enabled, emits unordered_map_full if the unordered_map is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(const value_type& key_value_pair)
ETL_OR_STD::pair<iterator, bool> insert(const value_type& key_value_pair)
{
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
ETL_ASSERT(!full(), ETL_ERROR(unordered_map_full));
@ -1082,7 +1082,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
iterator f = find(key);
iterator l = f;
@ -1092,7 +1092,7 @@ namespace etl
++l;
}
return ETL_PAIR<iterator, iterator>(f, l);
return ETL_OR_STD::pair<iterator, iterator>(f, l);
}
//*********************************************************************
@ -1103,7 +1103,7 @@ namespace etl
///\param key The key to search for.
///\return A const iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
const_iterator f = find(key);
const_iterator l = f;
@ -1113,7 +1113,7 @@ namespace etl
++l;
}
return ETL_PAIR<const_iterator, const_iterator>(f, l);
return ETL_OR_STD::pair<const_iterator, const_iterator>(f, l);
}
//*************************************************************************
@ -1370,7 +1370,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::iunordered_map<TKey, TMapped, TKeyCompare>& lhs, const etl::iunordered_map<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -1389,7 +1389,7 @@ namespace etl
//*************************************************************************
/// A templated unordered_map implementation that uses a fixed size buffer.
//*************************************************************************
template <typename TKey, typename TValue, const size_t MAX_SIZE_, const size_t MAX_BUCKETS_ = MAX_SIZE_, typename THash = etl::hash<TKey>, typename TKeyEqual = ETL_STD::equal_to<TKey> >
template <typename TKey, typename TValue, const size_t MAX_SIZE_, const size_t MAX_BUCKETS_ = MAX_SIZE_, typename THash = etl::hash<TKey>, typename TKeyEqual = etl::equal_to<TKey> >
class unordered_map : public etl::iunordered_map<TKey, TValue, THash, TKeyEqual>
{
private:

View File

@ -37,10 +37,10 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "container.h"
#include "pool.h"
@ -127,12 +127,12 @@ namespace etl
/// Can be used as a reference type for all unordered_multimap containing a specific type.
///\ingroup unordered_multimap
//***************************************************************************
template <typename TKey, typename T, typename THash = etl::hash<TKey>, typename TKeyEqual = ETL_STD::equal_to<TKey> >
template <typename TKey, typename T, typename THash = etl::hash<TKey>, typename TKeyEqual = etl::equal_to<TKey> >
class iunordered_multimap
{
public:
typedef ETL_PAIR<const TKey, T> value_type;
typedef ETL_OR_STD::pair<const TKey, T> value_type;
typedef TKey key_type;
typedef T mapped_type;
@ -171,7 +171,7 @@ namespace etl
typedef typename bucket_t::const_iterator local_const_iterator;
//*********************************************************************
class iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, T>
class iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, T>
{
public:
@ -331,7 +331,7 @@ namespace etl
};
//*********************************************************************
class const_iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, const T>
class const_iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, const T>
{
public:
@ -482,7 +482,7 @@ namespace etl
local_iterator inode;
};
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*********************************************************************
/// Returns an iterator to the beginning of the unordered_multimap.
@ -609,7 +609,7 @@ namespace etl
{
size_t index = bucket(key);
return ETL_STD::distance(pbuckets[index].begin(), pbuckets[index].end());
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
//*********************************************************************
@ -641,7 +641,7 @@ namespace etl
void assign(TIterator first_, TIterator last_)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first_, last_);
difference_type d = etl::distance(first_, last_);
ETL_ASSERT(d >= 0, ETL_ERROR(unordered_multimap_iterator));
ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_multimap_full));
#endif
@ -982,7 +982,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
iterator f = find(key);
iterator l = f;
@ -997,7 +997,7 @@ namespace etl
}
}
return ETL_PAIR<iterator, iterator>(f, l);
return ETL_OR_STD::pair<iterator, iterator>(f, l);
}
//*********************************************************************
@ -1008,7 +1008,7 @@ namespace etl
///\param key The key to search for.
///\return A const iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
const_iterator f = find(key);
const_iterator l = f;
@ -1023,7 +1023,7 @@ namespace etl
}
}
return ETL_PAIR<const_iterator, const_iterator>(f, l);
return ETL_OR_STD::pair<const_iterator, const_iterator>(f, l);
}
//*************************************************************************
@ -1279,7 +1279,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::iunordered_multimap<TKey, TMapped, TKeyCompare>& lhs, const etl::iunordered_multimap<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -1298,7 +1298,7 @@ namespace etl
//*************************************************************************
/// A templated unordered_multimap implementation that uses a fixed size buffer.
//*************************************************************************
template <typename TKey, typename TValue, const size_t MAX_SIZE_, const size_t MAX_BUCKETS_ = MAX_SIZE_, typename THash = etl::hash<TKey>, typename TKeyEqual = ETL_STD::equal_to<TKey> >
template <typename TKey, typename TValue, const size_t MAX_SIZE_, const size_t MAX_BUCKETS_ = MAX_SIZE_, typename THash = etl::hash<TKey>, typename TKeyEqual = etl::equal_to<TKey> >
class unordered_multimap : public etl::iunordered_multimap<TKey, TValue, THash, TKeyEqual>
{
private:

View File

@ -37,10 +37,10 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "container.h"
#include "pool.h"
@ -126,7 +126,7 @@ namespace etl
/// Can be used as a reference type for all unordered_multiset containing a specific type.
///\ingroup unordered_multiset
//***************************************************************************
template <typename TKey, typename THash = etl::hash<TKey>, typename TKeyEqual = ETL_STD::equal_to<TKey> >
template <typename TKey, typename THash = etl::hash<TKey>, typename TKeyEqual = etl::equal_to<TKey> >
class iunordered_multiset
{
public:
@ -168,7 +168,7 @@ namespace etl
typedef typename bucket_t::const_iterator local_const_iterator;
//*********************************************************************
class iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, TKey>
class iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, TKey>
{
public:
@ -327,7 +327,7 @@ namespace etl
};
//*********************************************************************
class const_iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, const TKey>
class const_iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, const TKey>
{
public:
@ -477,7 +477,7 @@ namespace etl
local_iterator inode;
};
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*********************************************************************
/// Returns an iterator to the beginning of the unordered_multiset.
@ -604,7 +604,7 @@ namespace etl
{
size_t index = bucket(key);
return ETL_STD::distance(pbuckets[index].begin(), pbuckets[index].end());
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
//*********************************************************************
@ -636,7 +636,7 @@ namespace etl
void assign(TIterator first_, TIterator last_)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first_, last_);
difference_type d = etl::distance(first_, last_);
ETL_ASSERT(d >= 0, ETL_ERROR(unordered_multiset_iterator));
ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_multiset_full));
#endif
@ -654,9 +654,9 @@ namespace etl
/// If asserts or exceptions are enabled, emits unordered_multiset_full if the unordered_multiset is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(const value_type& key)
ETL_OR_STD::pair<iterator, bool> insert(const value_type& key)
{
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
ETL_ASSERT(!full(), ETL_ERROR(unordered_multiset_full));
@ -977,7 +977,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
iterator f = find(key);
iterator l = f;
@ -992,7 +992,7 @@ namespace etl
}
}
return ETL_PAIR<iterator, iterator>(f, l);
return ETL_OR_STD::pair<iterator, iterator>(f, l);
}
//*********************************************************************
@ -1003,7 +1003,7 @@ namespace etl
///\param key The key to search for.
///\return A const iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
const_iterator f = find(key);
const_iterator l = f;
@ -1018,7 +1018,7 @@ namespace etl
}
}
return ETL_PAIR<const_iterator, const_iterator>(f, l);
return ETL_OR_STD::pair<const_iterator, const_iterator>(f, l);
}
//*************************************************************************
@ -1274,7 +1274,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::iunordered_multiset<TKey, TMapped, TKeyCompare>& lhs, const etl::iunordered_multiset<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -1293,7 +1293,7 @@ namespace etl
//*************************************************************************
/// A templated unordered_multiset implementation that uses a fixed size buffer.
//*************************************************************************
template <typename TKey, const size_t MAX_SIZE_, size_t MAX_BUCKETS_ = MAX_SIZE_, typename THash = etl::hash<TKey>, typename TKeyEqual = ETL_STD::equal_to<TKey> >
template <typename TKey, const size_t MAX_SIZE_, size_t MAX_BUCKETS_ = MAX_SIZE_, typename THash = etl::hash<TKey>, typename TKeyEqual = etl::equal_to<TKey> >
class unordered_multiset : public etl::iunordered_multiset<TKey, THash, TKeyEqual>
{
private:

View File

@ -37,10 +37,10 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "algorithm.h"
#include "iterator.h"
#include "functional.h"
#include "utility.h"
#include "container.h"
#include "pool.h"
@ -127,7 +127,7 @@ namespace etl
/// Can be used as a reference type for all unordered_set containing a specific type.
///\ingroup unordered_set
//***************************************************************************
template <typename TKey, typename THash = etl::hash<TKey>, typename TKeyEqual = ETL_STD::equal_to<TKey> >
template <typename TKey, typename THash = etl::hash<TKey>, typename TKeyEqual = etl::equal_to<TKey> >
class iunordered_set
{
public:
@ -169,7 +169,7 @@ namespace etl
typedef typename bucket_t::const_iterator local_const_iterator;
//*********************************************************************
class iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, TKey>
class iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, TKey>
{
public:
@ -328,7 +328,7 @@ namespace etl
};
//*********************************************************************
class const_iterator : public etl::iterator<ETL_FORWARD_ITERATOR_TAG, const TKey>
class const_iterator : public etl::iterator<ETL_OR_STD::forward_iterator_tag, const TKey>
{
public:
@ -478,7 +478,7 @@ namespace etl
local_iterator inode;
};
typedef typename ETL_STD::iterator_traits<iterator>::difference_type difference_type;
typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
//*********************************************************************
/// Returns an iterator to the beginning of the unordered_set.
@ -605,7 +605,7 @@ namespace etl
{
size_t index = bucket(key);
return ETL_STD::distance(pbuckets[index].begin(), pbuckets[index].end());
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
//*********************************************************************
@ -637,7 +637,7 @@ namespace etl
void assign(TIterator first_, TIterator last_)
{
#if defined(ETL_DEBUG)
difference_type d = ETL_STD::distance(first_, last_);
difference_type d = etl::distance(first_, last_);
ETL_ASSERT(d >= 0, ETL_ERROR(unordered_set_iterator));
ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_set_full));
#endif
@ -655,9 +655,9 @@ namespace etl
/// If asserts or exceptions are enabled, emits unordered_set_full if the unordered_set is already full.
///\param value The value to insert.
//*********************************************************************
ETL_PAIR<iterator, bool> insert(const value_type& key)
ETL_OR_STD::pair<iterator, bool> insert(const value_type& key)
{
ETL_PAIR<iterator, bool> result(end(), false);
ETL_OR_STD::pair<iterator, bool> result(end(), false);
ETL_ASSERT(!full(), ETL_ERROR(unordered_set_full));
@ -964,7 +964,7 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
ETL_PAIR<iterator, iterator> equal_range(key_parameter_t key)
ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
{
iterator f = find(key);
iterator l = f;
@ -974,7 +974,7 @@ namespace etl
++l;
}
return ETL_PAIR<iterator, iterator>(f, l);
return ETL_OR_STD::pair<iterator, iterator>(f, l);
}
//*********************************************************************
@ -985,7 +985,7 @@ namespace etl
///\param key The key to search for.
///\return A const iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
ETL_PAIR<const_iterator, const_iterator> equal_range(key_parameter_t key) const
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
{
const_iterator f = find(key);
const_iterator l = f;
@ -995,7 +995,7 @@ namespace etl
++l;
}
return ETL_PAIR<const_iterator, const_iterator>(f, l);
return ETL_OR_STD::pair<const_iterator, const_iterator>(f, l);
}
//*************************************************************************
@ -1251,7 +1251,7 @@ namespace etl
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::iunordered_set<TKey, TMapped, TKeyCompare>& lhs, const etl::iunordered_set<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
@ -1270,7 +1270,7 @@ namespace etl
//*************************************************************************
/// A templated unordered_set implementation that uses a fixed size buffer.
//*************************************************************************
template <typename TKey, const size_t MAX_SIZE_, size_t MAX_BUCKETS_ = MAX_SIZE_, typename THash = etl::hash<TKey>, typename TKeyEqual = ETL_STD::equal_to<TKey> >
template <typename TKey, const size_t MAX_SIZE_, size_t MAX_BUCKETS_ = MAX_SIZE_, typename THash = etl::hash<TKey>, typename TKeyEqual = etl::equal_to<TKey> >
class unordered_set : public etl::iunordered_set<TKey, THash, TKeyEqual>
{
private:

View File

@ -34,11 +34,136 @@ SOFTWARE.
#include "platform.h"
#include "type_traits.h"
#if !defined(ETL_NO_STL)
#include <utility>
#endif
///\defgroup utility utility
///\ingroup utilities
namespace etl
{
//******************************************************************************
template <typename T1, typename T2>
struct pair
{
typedef T1 first_type;
typedef T2 second_type;
T1 first;
T2 second;
pair()
: first(T1()),
second(T2())
{
}
pair(const T1& a, const T2& b)
: first(a),
second(b)
{
}
template <typename U1, typename U2>
pair(const pair<U1, U2>& other)
: first(other.first),
second(other.second)
{
}
pair(const pair<T1, T2>& other)
: first(other.first),
second(other.second)
{
}
void swap(pair<T1, T2>& other)
{
T1 temp1 = first;
T2 temp2 = second;
first = other.first;
second = other.second;
other.first = temp1;
other.second = temp2;
}
};
//******************************************************************************
template <typename T1, typename T2>
inline pair<T1, T2> make_pair(T1 a, T2 b)
{
return pair<T1, T2>(a, b);
}
//******************************************************************************
template <typename T1, typename T2>
inline void swap(pair<T1, T2>& a, pair<T1, T2>& b)
{
a.swap(b);
}
//******************************************************************************
template <typename T1, typename T2>
inline bool operator ==(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return (a.first == b.first) && (a.second == b.second);
}
template <typename T1, typename T2>
inline bool operator !=(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return !(a == b);
}
template <typename T1, typename T2>
inline bool operator <(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return (a.first < b.first) ||
(!(b.first < a.first) && (a.second < b.second));
}
template <typename T1, typename T2>
inline bool operator >(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return (b < a);
}
template <typename T1, typename T2>
inline bool operator <=(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return !(b < a);
}
template <typename T1, typename T2>
inline bool operator >=(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return !(a < b);
}
#if ETL_CPP11_SUPPORTED
//******************************************************************************
template <typename T>
constexpr typename etl::remove_reference<T>::type&& move(T&& t) noexcept
{
return static_cast<typename etl::remove_reference<T>::type&&>(t);
}
//******************************************************************************
template <typename T>
constexpr T&& forward(typename etl::remove_reference<T>::type& t) noexcept
{
return static_cast<T&&>(t);
}
template <typename T>
constexpr T&& forward(typename etl::remove_reference<T>::type&& t) noexcept
{
return static_cast<T&&>(t);
}
#endif
#if defined(ETL_NO_STL)
//***************************************************************************
/// exchange (const)
//***************************************************************************
@ -49,6 +174,16 @@ namespace etl
object = new_value;
return old_value;
}
#else
//***************************************************************************
/// exchange (const)
//***************************************************************************
template <typename T, typename U = T>
T exchange(T& object, const U& new_value)
{
return std::exchange(object, new_value);
}
#endif
//***************************************************************************
/// as_const

Some files were not shown because too many files have changed in this diff Show More