Go back to Richel Bilderbeek's homepage.

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

 

 

 

 

 

(C++) std::multiplies

 

std::multiplies is a functor that encapsulates operator*. The functor to perform a division on a range is std::divides.

 

 

 

 

 

Example

 

#include <vector>
#include <algorithm
#include <numeric>

//From http://www.richelbilderbeek.nl/CppTriple.htm
void Triple(std::vector<int>& v)
{
  std::transform(v.begin(),v.end(),v.begin(),
    std::bind2nd(std::multiplies<int>(),3));
}

 

 

 

 

 

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

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict