an example of showing how STL negate function object was defined


👍 g++ negate.cpp && ./a.out
-13
👍 cat negate.cpp 
#include <iostream>
using namespace std;

template<typename T>
struct neg:public unary_function<T,T>{
  T operator()(const T& x) const {
    return -x;
  }
};

int main() {
  cout << neg<int>()(13) << endl;
}