remove vs. erase 【TODO】

erase :

说明:Removes from the list container either a single element (position) or a range of elements ([first,last)).This effectively reduces the container size by the number of elements removed, which are destroyed.以iterator为单元,对元素进行清除。

返回值:An iterator pointing to the element that followed the last element erased by the function call. This is the container end if the operation erased the last element in the sequence.

remove:

说明:Remove elements with specific value。Removes from the container all the elements that compare equal to val. This calls the destructor of these objects and reduces the container size by the number of elements removed.

返回值:空

posted @ 2024-03-19 18:18  光風霽月  阅读(3)  评论(0编辑  收藏  举报