How i can use "using" keyword in multiple inheritance when parameter pack is template parameter of base class?
Code below compiles just fine
struct A
{
void foo(int) {}
};
struct B
{
void foo(int) {}
};
template<typename ...Types>
struct C : public Types...
{
using Types::foo...;
};
int main()
{
C<A,B> c;
}
But if i use template instead of A
and B
- I've got compile error
template<typename T>
struct TA {};
template<>
struct TA<int>
{
void foo(int) {}
};
template<>
struct TA<double>
{
void foo(int) {}
};
template<typename ...Types>
struct TC : public TA<Types>...
{
using TA<Types>::foo...; // ERROR C3520
};
Error:
error C3520: 'Types': parameter pack must be expanded in this context
How to rewrite second piece of code to get it work?
PS I tried this code with gcc and it's compiles without errors. But now I am using msvc...