Created
August 9, 2009 09:20
-
-
Save mashiro/164672 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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