Nik*_*s R 1 c++ templates c++11
我想向模板类添加一个静态函数,无需先传递模板参数即可访问该静态函数。那可能吗?
namespace foo {
template <typename T>
class bar {
public:
static void eggs();
};
}
foo::bar<some_t>::eggs(); // works
foo::bar::eggs(); // does not work
Run Code Online (Sandbox Code Playgroud)
我想避免移动eggs()到foo名称空间或为其创建一个新的名称空间(例如foo::bar_::eggs(),呃)。