Content assist : clue of type of a function that has parameter type depend on “using” inside T

故事扮演 提交于 2019-12-12 06:02:18

问题


How to make Visual Studio show a completely-deduced content-assist for a function that has type depends on alias of a T?

Example

b.f in the example can't give me a completely-deduced content-assist.
It should clue int, not SomeClass::A<int>::AT.

class SomeClass{
    template<class T>class A{public: using AT=T;};
    template<class AX>class B{public: void f( typename AX::AT){}};
    template<class AX,class X>class C{public: void f( typename X){}};
    public: void test(){
        B<A<int>> b;     b.f(
    }
};

Testing b.f() :-

Poor Workaround

I have to refactor B<A<int>> to C<A<int>,int>.

template<class T>class A{public: using AT=T;};
template<class AX,class X>class C{public: void f( typename X){}};
public: void test(){
    C<A<int>,int> c;  c.f(
}

Testing c.f() :-

I may rely on content-assist too much, but it greatly helps a newbie like me.

来源:https://stackoverflow.com/questions/44093393/content-assist-clue-of-type-of-a-function-that-has-parameter-type-depend-on-u

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!