mercredi 30 novembre 2016

Accessing static properties of a pointer type

I am trying to call a static method of a type in a tuple, but the tuple uses pointers, not the type itself. This means that when I use tuple_element I am getting a pointer type which I can not use to call the static method.

Does anyone know how to either convert a pointer type to its non-pointer equivalent, or access a static property of a pointer type?

struct Example
{
    static int example()
    {
        return 0;
    }
};

typedef Example* PointerType;

int main()
{
    PointerType::example(); // Nope
    (*PointerType)::example(); // Nope
    (typename *PointerType)::example(); // Nope
    (PointerType*)::example(); // Nope
}

Aucun commentaire:

Enregistrer un commentaire