我得到了带有模板方法的类,这些方法如下:
struct undefined {};
template<typename T> struct is_undefined : mpl::false_ {};
template<> struct is_undefined<undefined> : mpl::true_ {};
template<class C>
struct foo {
template<class F, class V>
typename boost::disable_if<is_undefined<C> >::type
apply(const F &f, const V &variables) {
}
template<class F, class V>
typename boost::enable_if<is_undefined<C> >::type
apply(const F &f, const V &variables) {
}
};
显然,两个模板都被实例化,导致编译时错误。模板方法的实例化与自由函数的实例化不同吗?我已经以不同的方式解决了这个问题,但我想知道发生了什么。我唯一能想到的可能会导致这种行为,启用条件不依赖于直接模板参数,而是依赖于类模板参数
谢谢