In C ++ 0x there is a better way to do this
class X: public Super { using Super::Super; };
If you declare a perfect forwarding pattern, your type will not work well when resolving overloads. Imagine your base class being converted from int and there are two functions for printing classes
class Base { public: Base(int n); }; class Specific: public Base { public: template<typename... Args> Specific(Args&&... args); }; void printOut(Specific const& b); void printOut(std::string const& s);
You call it with
printOut("hello");
What will be called? This is ambiguous because Specific can convert any arguments, including arrays of characters. It does this without regard to existing base class constructors. Inheritance of constructors using declarations declares only the constructors needed to do the job.
Johannes Schaub - litb Jun 25 2018-10-25T00-06-25 18:36
source share