Skip to content

Instantly share code, notes, and snippets.

@mashiro
Created August 9, 2009 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mashiro/164672 to your computer and use it in GitHub Desktop.
Save mashiro/164672 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <functional>
template <typename T>
struct add1 : std::unary_function<T, T> {
#if 1
typedef typename std::unary_function<T, T>::result_type result_type;
typedef typename std::unary_function<T, T>::argument_type argument_type;
#endif
result_type operator ()(const argument_type& arg) const {
return arg + 1;
}
};
int main() {
std::cout << add1<int>()(1) << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment