mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
IAR compatibilty.
Fixed bug in 'insert' where existing element was not checked for.
This commit is contained in:
parent
e744c11b50
commit
4a0fcb0f70
19
iflat_set.h
19
iflat_set.h
@ -51,7 +51,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 = std::less<T>>
|
||||
template <typename T, typename TKeyCompare = std::less<T> >
|
||||
class iflat_set : public flat_set_base
|
||||
{
|
||||
private:
|
||||
@ -226,7 +226,7 @@ namespace etl
|
||||
|
||||
if (i_element == end())
|
||||
{
|
||||
// At the end.
|
||||
// At the end. Doesn't exist.
|
||||
buffer.push_back(value);
|
||||
result.first = end() - 1;
|
||||
result.second = true;
|
||||
@ -234,9 +234,18 @@ namespace etl
|
||||
else
|
||||
{
|
||||
// Not at the end.
|
||||
buffer.insert(i_element, value);
|
||||
result.first = i_element;
|
||||
result.second = true;
|
||||
// Does not exist already?
|
||||
if (*i_element != value)
|
||||
{
|
||||
buffer.insert(i_element, value);
|
||||
result.first = i_element;
|
||||
result.second = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.first = i_element;
|
||||
result.second = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user