Subject: Re: [boost] [static_if] Is there interest in a `static if` emulation library?
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2014-09-01 21:06:23
On Mon, Sep 1, 2014 at 11:26 AM, Matt Calabrese <rivorus_at_[hidden]> wrote:
> On Mon, Sep 1, 2014 at 8:00 AM, Robert Ramey <ramey_at_[hidden]> wrote:
>> The compile-times argument doesn't impress me much though. Using
>> a much more complex syntax or new library to shave a tiny bit of
> Even if your condition is known through a compile-time
> constant bool, If you don't add a level of indirection to prevent both from
> being instantiated, either manually or by way of a higher-level facility
> like a static if, your compile time for that translation unit can possibly
> double, or worse.
Yes, the point of static if wouldn't necessarily be performance even
if compile-time performance could be improved by it, as Matt already
pointed out (similar points are made in the various static if
In fact, in my original example the static if is used for correctness
and not performance (so to check the assertion when T provides the
appropriate operations for the check to actually compile).