Created
September 21, 2012 15:09
-
-
Save yifu/3762069 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> | |
| inline bool IsNull( const std::string& v ) { return ( v == "" ); } | |
| inline bool IsNull( long v ) { return ( v == 0 ); } | |
| inline bool IsNull( char c ) { return ( c == 0 ); } | |
| template <typename T> | |
| bool IsNotNull(const T & v) { return !IsNull(v); } | |
| template <typename T> | |
| struct Traits | |
| { | |
| typedef const T& param_type; | |
| }; | |
| template <> | |
| struct Traits<int> | |
| { | |
| typedef int param_type; | |
| }; | |
| int main() | |
| { | |
| f(2); | |
| int a = 3; | |
| f(a); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment