假设我有以下内容:
// Foo.h
struct Foo {};
// Bar.h
struct Bar {
template <typename T, typename = typename std::enable_if<std::is_base_of<Foo, T>::value>::type>
void foobar();
};
// Bar.hpp
// ...?
void Bar::foobar() {}
如何在Bar.hpp上声明foobar
函数?
答案 0 :(得分:0)
默认参数只能指定一次。这样做:
template <class T, class>
void Bar::foobar() {}