Skip to content

Instantly share code, notes, and snippets.

@yifu
Created September 21, 2012 15:09
Show Gist options
  • Select an option

  • Save yifu/3762069 to your computer and use it in GitHub Desktop.

Select an option

Save yifu/3762069 to your computer and use it in GitHub Desktop.
#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