Suppose I have
template <typename T>
class Base {}
and
class DoubleBase: public Base<double>
I would like to write
template <typename T>
concept DerivedFromBase = std::is_base_of<Base<?>, T>::value;
class Container {
public:
template <DerivedFromBase T>
explicit Container(const T& value);
};
Where the question mark is to be interpreted as in Java (a bounded wildcard), for example Class<?>
. Is there a way to indicate that I want the container to accept any child class regardless of the base class’s template parameter.
I have found this but I will abandon the above structure unless I can find something simpler