mercredi 13 mai 2015

equivalence to decltype(*this) from a static method?

I have some macros that need access to the type of the current class and I currently get away with this via a DRY-violating pattern:

struct ThisScruct{
    typedef ThisStruct SelfT;
    declare_static_methods_using_offsetof
};

This comes up alot with use of the offsetof keyword, at least in my own work.

Now before you lock onto "this" not being accessible via a static method - realize I just want to know how to get the type ThisScruct in a generic/macro friendly way from a static method context. I don't actually need/want an instance and am looking for way that actually works like the above without typedefing SelfT

Aucun commentaire:

Enregistrer un commentaire