zoukankan      html  css  js  c++  java
  • STL: remove

    remove

    Eliminates a specified value from a given range without disturbing the order of the remaining elements and returning the end of a new range free of the specified value.

     
    template<class ForwardIterator, class Type> 
       ForwardIterator remove( 
          ForwardIterator _First,  
          ForwardIterator _Last,  
          const Type& _Val 
       );

    注,The list class has a more efficient member function version of remove, which also relinks pointers. remove并不真正从容器中删除那些元素(也就说,容器大小并没有改变),而是将每一个不等于value的元素依次赋值给first之后的空间。返回值ForwardIterator 标示出重新整理后的最后一个元素的下一个位置。如果要删除那些残余的数据,可以讲返回的迭代器交给区间所在容器的erase成员函数。

    remove_copy

    Copies elements from a source range to a destination range, except that elements of a specified value are not copied, without disturbing the order of the remaining elements and returning the end of a new destination range.

    template<class InputIterator, class OutputIterator, class Type> 
       OutputIterator remove_copy( 
          InputIterator _First,  
          InputIterator _Last,  
          OutputIterator _Result, 
          const Type& _Val 
       );

    remove_copy_if

    Copies elements from a source range to a destination range, except that satisfying a predicate are not copied, without disturbing the order of the remaining elements and returning the end of a new destination range.

     
    template<class InputIterator, class OutputIterator, class Predicate> 
       OutputIterator remove_copy_if( 
          InputIterator _First,  
          InputIterator _Last,  
          OutputIterator _Result, 
          Predicate _Pred 
       );

    remove_if

    Eliminates elements that satisfy a predicate from a given range without disturbing the order of the remaining elements and returning the end of a new range free of the specified value.

    template<class ForwardIterator, class Predicate> 
       ForwardIterator remove_if( 
          ForwardIterator _First,  
          ForwardIterator _Last, 
          Predicate _Pred 
       );
  • 相关阅读:
    POJ 3041 Asteroids 最小点覆盖 == 二分图的最大匹配
    POJ 3083 Children of the Candy Corn bfs和dfs
    POJ 2049 Finding Nemo bfs 建图很难。。
    POJ 2513 Colored Sticks 字典树、并查集、欧拉通路
    POJ 1013 Counterfeit Dollar 集合上的位运算
    POJ 2965 The Pilots Brothers' refrigerator 位运算枚举
    无聊拿socket写的100以内的加法考试。。。
    POJ 1753 Flip Game
    初学socket,c语言写的简单局域网聊天
    汇编语言 复习 第十一章 标志寄存器
  • 原文地址:https://www.cnblogs.com/freewater/p/2953607.html
Copyright © 2011-2022 走看看