Subject: Re: [boost] [static_if] Is there interest in a `static if` emulation library?
From: Roland Bock (rbock_at_[hidden])
Date: 2014-09-02 02:58:21
On 2014-09-02 03:27, Lorenzo Caminiti wrote:
> On Mon, Sep 1, 2014 at 3:42 PM, Sebastian Redl
> <sebastian.redl_at_[hidden]> 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk