为什么以下代码不起作用(使用VS2013)?
class Test1
{
public:
template<typename T>
using my_type = T;
};
template<typename T, typename V>
class My : public T
{
public:
using t_type = T;
using my_type2 = t_type::my_type<V>;
};
int main()
{
const My<Test1, double>::my_type2 x = 5.5;
return 0;
}
Test1 :: my_type将具有更复杂的类型。我将是一个基于策略的类,其中Test1将是策略之一。my_type2应该基于策略成为特定类型。而且Test1不能是直接采用V类型的模板。谢谢。
欢迎来到C ++的黑暗角落
改变这个
using my_type2 = t_type::my_type<V>;
对此:
using my_type2 = typename t_type::template my_type<V>;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句