2 Sep
2014
2 Sep
'14
6:58 a.m.
On 2014-09-02 03:27, Lorenzo Caminiti wrote:
On Mon, Sep 1, 2014 at 3:42 PM, Sebastian Redl
wrote: Either way, my need for static if is to conditionally have specific declarations in a class template or not, so unless the library can do this (the suggested usage won’t work in a pure declaration context), it’s no use to me. I know... too bad enable_if cannot be used to disable these data member declarations.
You could use inheritance. If the condition is true, you inherit from a struct that provides the data member, otherwise you inherit from a struct that does not. Ugly, I know, but it works if inheritance is an option for you.