template <class T, class U> struct Additional {
T t;
U u;
};
template <class T, class U> struct Base {
void test1() {
additional-> // members are shown here
}
Additional<T, U>* additional;
};
template <class T, class U> struct Derived : Base<T, U> {
void test2() {
additional-> // IntelliSense: 'No members available'
}
};
I marked with comments the points of interest. The goal is to access suggested members inside test2()
. At the first time I tried to declare a template struct
inside another template struct
(Additional
in Base
), but the notation became complex so I switched to keep Additional
outside. I'm making dynamic containers for kernel driver usage. VS2019, Win 10, latest updates for both. Some suggested variants that did not work:
template <class T, class U> struct Derived : Base<T, U> {
void test2() {
this->additional-> // This one passed the compile
}
};
template <class T, class U> struct Derived : Base<T, U> {
void test2() {
Base<T, U>::
}
};
template <class T, class U> struct Derived : Base<T, U> {
using Base<T, U>::additional;
void test2() {
additional->
}
};