mardi 2 mai 2017

C++ 11 template sub type

I'm looking to inject in a type and use this as the template type, in addition to this I would like to implicitly pass in a subtype to be used. For example:

template<class T>
class MyClass
{
    MyClass(T myTypeObject);

    typename T::SubType mySubTypeObject;
}

Is this possible at all? I have tried adding the following into the injected type and passing this in but it does not work.

typedef MyType SubType;

Aucun commentaire:

Enregistrer un commentaire