c++模板元编程2(三)
2014-11-24 12:38:43
·
作者:
·
浏览: 2
h "; ret += get_description
(); ret += " and it pointer to function returning "; ret += get_description
(); return ret.c_str(); } }; template
struct get_description
{ operator const char* () { std::cout << typeid(T).name() << "\n"; static std::string ret = "pointer to function with "; ret += get_description
(); ret += " returning "; ret += get_description
(); std::cout << typeid(T).name() << "\n"; return ret.c_str(); } }; template
struct get_description
{ operator const char* () { std::cout << typeid(T).name() << "\n"; static std::string ret = "this is a pointer function with "; ret += get_description
(); ret += " and it pointer to function with "; ret += get_description
(); ret += " returning "; ret += get_description
(); std::cout << typeid(T).name() << "\n"; return ret.c_str(); } };
测试代码:
void fun_text_descriptor()
{
//std::cout << get_description
() << std::endl;
typedef int (*FunPoint[10])(char*);
std::cout << get_description
()<< std::endl; std::cout << get_description
() << std::endl; }
好了就做了这几个题!!!!