[ad_1]
below is the code to test using pack expansion, the code can compile. but when I uncomment the constructor line, compiler give me that : “expected nested-name-specifier before ‘Container’”
template <typename T, typename ... Args>
struct Container
{
private:
T t;
public:
Container()
{
}
Container(const T& t_): t(t_)
{
}
void test()
{
}
void operator=(const T& t)
{
}
void operator=(T&& t)
{
}
};
template <typename... bases>
struct X :
private Container<bases, bases...>...
{
//using Container<bases, bases...>::Container...; //comment the constructor
using Container<bases, bases...>::test...;
using Container<bases, bases...>::operator=...;
};
class A
{
public:
void g()
{
}
};
class B
{
public:
void g()
{
}
};
int main()
{
X<A, B> x;
return 0;
}
gcc version:
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04)
[ad_2]