void remove(const _Ty& _Val_arg) {// erase each element matching _Val /* Dinkumware makes a copy of _Val_arg in case it's removed along the way, i.e. * when the user pass an element of the list as _Val_arg. * * We believe that the signature of std::list::remove should be changed * from remove(const _Ty&) to remove(_Ty) to explicitly indicate that a copy is involved. */ const _Ty _Val = _Val_arg;// in case it's removed along the way iterator _Last = end(); for (iterator _First = begin(); _First != _Last; ) if (*_First == _Val) _First = erase(_First); else ++_First; }
iterator erase(const_iterator _Where) {// erase element at _Where
if (_Pnode != _Myhead) {// not list head, safe to erase _Nextnode(_Prevnode(_Pnode)) = _Nextnode(_Pnode); _Prevnode(_Nextnode(_Pnode)) = _Prevnode(_Pnode); this->_Alnod.destroy(_Pnode); this->_Alnod.deallocate(_Pnode, 1);