Steven Schveighoffer <[email protected]> wrote:
I wish there was a way to optionally make the class final (i.e. make it a parameter).

I first thought this to work:

template bar( bool b ) {
    mixin( b ? "final:" : "" );
    class bar {
    }
}

static assert( msg, __traits( isFinalClass, bar!true ) );
static assert( msg, !__traits( isFinalClass, bar!false ) );

But I guess mixin creates a new scope, rendering it useless.

--
Simen

Reply via email to