1

Parameter pack expansion in using declarations is not supported in C++14, and so the following code fails to compile:

template<typename T>    struct A 
{
    virtual void foo(T);
};

template<typename... T>    struct B: public A<T>...
{
    using A<T>...;
};

Is there a work-around to achieve the same results? Otherwise, one would have to manually spell out the using declaration for expected types, and modify the class every time a new type is used.

erip
  • 16,374
  • 11
  • 66
  • 121
Jens
  • 9,058
  • 2
  • 26
  • 43
  • You can wrap `A` in a class that provides a free (friend) function to call `foo`, e.g. `template struct wrapper : A { friend void bar(T t) { this->foo(t); } };` then `template struct B : wrapper... { template void foo(X x) { bar(x); } };` – dyp Dec 22 '15 at 15:11
  • 3
    http://stackoverflow.com/questions/27183568/c-how-to-introduce-overload-set-from-variadic-number-of-bases – Columbo Dec 22 '15 at 15:11
  • @dyp I'm tempted to write [the paper](http://wg21.cmeerw.net/ewg/issue102) myself, but someone is responsible... :/ – Columbo Dec 22 '15 at 15:16
  • @Columbo Why not contact Vandervoorde and ask if you can help. – dyp Dec 22 '15 at 15:18

0 Answers0