#的用法是负责将其后面的东西转换为字符串,比如
#define STRINGIFY(m) #m #define AS_STRING(m) STRINGIFY(m) int main() { std::cout << AS_STRING(this is a string)<<std::endl; return 0; } ####是连接符,将前后两个东西链接成一个词。
#define REGISTER_LAYER_CREATOR(type, creator) \ static LayerRegisterer<float> g_creator_f_##type(#type, creator<float>); \ static LayerRegisterer<double> g_creator_d_##type(#type, creator<double>); \该宏代码创建类对象
1.给类型取别名
typedef std::map<string,Creator> CreatorRegistry;2. 函数指针用法
// 形式1:返回类型(*函数名)(参数表) // 形势2:typedef 返回类型(*新类型)(参数表) //定义一个函数指针pFUN,它指向一个返回类型为char,有一个整型的参数的函数 char (*pFun)(int); //定义一个返回类型为char,参数为int的函数 //从指针层面上理解该函数,即函数的函数名实际上是一个指针, //该指针指向函数在内存中的首地址 typedef char(*PTRFUN)(int); //定义一种函数指针类型为PTRFUN,输入参数为int, 返回类型的char的函数指针 PTRFUN pFun; //指针变量声明 typedef shared_ptr<Layer<Dtype> > (*Creator) (const LayerParameter&); // Creator 为一种函数指针的类型别名