• STL: replace


    replace

    Examines each element in a range and replaces it if it matches a specified value.

     
    template<class ForwardIterator, class Type> 
       void replace( 
          ForwardIterator _First,  
          ForwardIterator _Last, 
          const Type& _OldVal,  
          const Type& _NewVal 
       );

    replace_if

    Examines each element in a range and replaces it if it satisfies a specified predicate.

    template<class ForwardIterator, class Predicate, class Type> 
       void replace_if( 
          ForwardIterator _First,  
          ForwardIterator _Last, 
          Predicate _Pred,  
          const Type& _Val 
       );

    replace_copy

    Examines each element in a source range and replaces it if it matches a specified value while copying the result into a new destination range.

    template<class InputIterator, class OutputIterator, class Type> 
       OutputIterator replace_copy( 
          InputIterator _First,  
          InputIterator _Last,  
          OutputIterator _Result, 
          const Type& _OldVal,  
          const Type& _NewVal 
       );

    replace_copy_if

    Examines each element in a source range and replaces it if it satisfies a specified predicate while copying the result into a new destination range.

    template<class InputIterator, class OutputIterator, class Predicate, class Type> 
       OutputIterator replace_copy_if( 
          InputIterator _First,  
          InputIterator _Last,  
          OutputIterator _Result,  
          Predicate _Pred,  
          const Type& _Val 
       );
  • 相关阅读:
    高可用-mysql安装,双主模式+keepalived
    源码-mybatis-01-SqlSessionFactory创建
    J.U.C-volatile
    设计模式-模板设计模式(行为)
    设计模式-代理模式
    线程-join();
    Net Core 文件的上传下载
    mysql 开启日志记录执行SQL语句
    C# 方法多个返回值
    C# get set 方法 设置默认值
  • 原文地址:https://www.cnblogs.com/freewater/p/2953620.html
Copyright © 2020-2023  润新知