negate the contents of result : negate « STL Algorithms Helper « C++






negate the contents of result

  
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
  vector<int> v, v2, result(10);

  for(unsigned i=0; i < 10; ++i) v.push_back(i);
  for(unsigned i=0; i < 10; ++i) v2.push_back(i);

  transform(v.begin(), v.end(), v.begin(), negate<int>());

  return 0;
}
  
    
  








Related examples in the same category

1.negate for list
2.Negate contents of a list with transform() and negate()