M
MikhailGorbachev
I'm having a problem getting derived types to be inferred as valid
parameters by a function template.
template <typename T>
struct Base {}
template<typename T>
struct Derived : public Base<T> {}
template <typename T>
void fn(Base<T>* b) { }
When I call fn with a Derived<int>* gcc gives me the error "no
matching function for call to..."
Is there any way to get the function template to accept derived
objects?
Thanks,
Alex Rubinsteyn
parameters by a function template.
template <typename T>
struct Base {}
template<typename T>
struct Derived : public Base<T> {}
template <typename T>
void fn(Base<T>* b) { }
When I call fn with a Derived<int>* gcc gives me the error "no
matching function for call to..."
Is there any way to get the function template to accept derived
objects?
Thanks,
Alex Rubinsteyn