mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-16 00:46:03 +08:00
let map/multimap/set/multiset return iterator on erase (#463)
Beginning with C++11, erase(iterator) and erase(const_iterator) returns an iterator following the removed element.
This commit is contained in:
parent
c70db16a20
commit
d05bf1b4fd
@ -993,10 +993,10 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Erases the value at the specified position.
|
||||
//*************************************************************************
|
||||
void erase(iterator position)
|
||||
iterator erase(iterator position)
|
||||
{
|
||||
// Remove the node by its key
|
||||
erase((*position).first);
|
||||
// Remove the node by its node specified in iterator position
|
||||
return erase(const_iterator(position));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -1101,10 +1101,10 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Erases the value at the specified position.
|
||||
//*************************************************************************
|
||||
void erase(iterator position)
|
||||
iterator erase(iterator position)
|
||||
{
|
||||
// Remove the node by its node specified in iterator position
|
||||
(void)erase(const_iterator(position));
|
||||
return erase(const_iterator(position));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -1085,10 +1085,10 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Erases the value at the specified position.
|
||||
//*************************************************************************
|
||||
void erase(iterator position)
|
||||
iterator erase(iterator position)
|
||||
{
|
||||
// Remove the node by its node specified in iterator position
|
||||
(void)erase(const_iterator(position));
|
||||
return erase(const_iterator(position));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -956,10 +956,10 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Erases the value at the specified position.
|
||||
//*************************************************************************
|
||||
void erase(iterator position)
|
||||
iterator erase(iterator position)
|
||||
{
|
||||
// Remove the node by its key
|
||||
erase((*position));
|
||||
// Remove the node by its node specified in iterator position
|
||||
return erase(const_iterator(position));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -830,8 +830,10 @@ namespace
|
||||
std::advance(i_compare, 2);
|
||||
std::advance(i_data, 2);
|
||||
|
||||
compare_data.erase(i_compare);
|
||||
data.erase(i_data);
|
||||
Compare_Data::iterator i_compare1 = compare_data.erase(i_compare);
|
||||
Data::iterator i_data1 = data.erase(i_data);
|
||||
|
||||
CHECK(i_compare1->second == i_data1->second);
|
||||
|
||||
bool isEqual = Check_Equal(data.begin(),
|
||||
data.end(),
|
||||
|
||||
@ -699,8 +699,10 @@ namespace
|
||||
Compare_Data::iterator i_compare = compare_data.begin();
|
||||
Data::iterator i_data = data.begin();
|
||||
|
||||
compare_data.erase(i_compare);
|
||||
data.erase(i_data);
|
||||
Compare_Data::iterator i_compare1 = compare_data.erase(i_compare);
|
||||
Data::iterator i_data1 = data.erase(i_data);
|
||||
|
||||
CHECK(i_compare1->second == i_data1->second);
|
||||
|
||||
bool isEqual = Check_Equal(data.begin(),
|
||||
data.end(),
|
||||
|
||||
@ -713,8 +713,10 @@ namespace
|
||||
Compare_Data::iterator i_compare = compare_data.begin();
|
||||
Data::iterator i_data = data.begin();
|
||||
|
||||
compare_data.erase(i_compare);
|
||||
data.erase(i_data);
|
||||
Compare_Data::iterator i_compare1 = compare_data.erase(i_compare);
|
||||
Data::iterator i_data1 = data.erase(i_data);
|
||||
|
||||
CHECK_EQUAL(*i_compare1, *i_data1);
|
||||
|
||||
bool isEqual = Check_Equal(data.begin(),
|
||||
data.end(),
|
||||
|
||||
@ -754,8 +754,10 @@ namespace
|
||||
std::advance(i_compare, 2);
|
||||
std::advance(i_data, 2);
|
||||
|
||||
compare_data.erase(i_compare);
|
||||
data.erase(i_data);
|
||||
Compare_Data::iterator i_compare1 = compare_data.erase(i_compare);
|
||||
Data::iterator i_data1 = data.erase(i_data);
|
||||
|
||||
CHECK_EQUAL(*i_compare1, *i_data1);
|
||||
|
||||
bool isEqual = Check_Equal(data.begin(),
|
||||
data.end(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user