I was reading the caffe source codes. In the caffe.cpp which is the source of tools/caffe, I encounter the following codes which puzzles me:
#define RegisterBrewFunction(func) \
namespace { \
class __Registerer_##func { \
public: /* NOLINT */ \
__Registerer_##func() { \
g_brew_map[#func] = &func; \
} \
}; \
__Registerer_##func g_registerer_##func; \
}
Based on my knowledge, this macro replace RegisterBrewFunction(func) with a anonymous class, and the only thing it has done is add <#func, &func> to g_brew_map. So why not just doing this like this?
#define RegisterBrewFunction(func) g_brew_map[#func]=&func;
Hope someone help me about this.