I want to be able to call makeAnother() this without providing a template argument. I've tried using different forms of decltype(this) both in and outside of the function body with no success.
#include <vector>
template <class T>
class A {
template <class Derived>
Derived makeAnother() {
Derived result;
/* do stuff */
return result;
}
std::vector<T> v;
};
class B : A<int>
{
/* stuff */
};
int main() {
B foo;
B result = foo.makeAnother(); // this doesn't work
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire