问题
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