(C++) std::greater\_equal

January 11, 2018 · View on GitHub

 

 

 

 

 

(C++) std::greater_equal

 

Predicate to perform operator>= on two values.

 

 

 

 

 

Example

 

The code below shows how to replace values that are greater or equal to one by a zero.

 


#include <vector> #include <algorithm #include <numeric>   void ReplaceOneOrHigherByZero(std::vector<int>& v) {   std::replace_if(v.begin(),v.end(),     std::bind2nd(std::greater_equal<int>(),1),0); }

 

 

 

 

 

 

Contents

  1. 1Example
  2. 2#include void ReplaceOneOrHigherByZero(std::vector&#x26; v) { std::replace_if(v.begin(),v.end(), std::bind2nd(std::greater_equal(),1),0); }"> #include &#x3C;vector> #include &#x3C;algorithm #include &#x3C;numeric> void ReplaceOneOrHigherByZero(std::vector&#x3C;int>&#x26; v) { std::replace_if(v.begin(),v.end(), std::bind2nd(std::greater_equal&#x3C;int>(),1),0); }