Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) std::not_equal_to

 

Predicate to perform operator!= on two values.

 

 

 

 

 

Example

 

The code below shows how to count the number of non-zero values.

 

#include <algorithm>
#include <vector>

//From http://www.richelbilderbeek.nl/CppCountNonZeroes.htm
int CountNonZeroes(const std::vector<double>& v)
{
 return std::count_if(
    v.begin(),
    v.end(),
    std::bind2nd(std::not_equal_to<double>(),0.0));
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict