vendredi 29 mai 2015

Use decltype( *this ) not inside a member

I tried to do:

struct Something {
    decltype( *this ) *something;
};

Which got me 'this' may only be used inside a nonstatic member function, and is nonsense.

I tried more:

auto something -> decltype( *this );
auto something -> this;
typedef decltype( this ) t;
t something;

And failed multiple times. Is there a way to achieve this?

I am forced to do something similar to this: (A lot more of those bad macros)

#define Head() this_type *x; this_type *Get( ) { ... }; void Set( this_type *_x ) { ... };

The sad part is that I mustn't give the Head() the current type as a parameter. It's as if they are trying to make new language out of C++.

Aucun commentaire:

Enregistrer un commentaire