This question already has an answer here except for the fact that I read said question and still couldn't figure out what was wrong.
I am trying to do this:
template<typename T>
class base
{
protected:
base() {}
virtual ~base() {}
virtual void method(void* const voidp) const = 0;
};
template<typename T>
class child : public base<T> // ERROR: child is not a template type
{
public:
child(std::vector<T> arg)
: _arg{arg}
{
}
virtual ~child() {}
void method(void* const voidp) const
{
for(template std::vector<T>::const_iterator it = _arg.begin(); it != _arg.end(); ++ it)
{
method2(voidp, *it);
}
}
protected:
std::vector<T> _arg;
};
I am slightly confused since this appears to be identical to the linked example, unless I am mistaken?
Edit: This is method2
void method2(void* const voidp, const double& arg) // second argument comes in both double and float formats
{
}
// so there is also a: void method2(void* const voidp, const float& arg)
Aucun commentaire:
Enregistrer un commentaire