static switch

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Jun 12 01:35:41 PDT 2012


On 12.06.2012 10:13, cal wrote:
> Does a switch statement acting on a template parameter act just like a
> chain of static if-else's? That is, does it just generate the code for
> the matching case?
>
> enum E { A, B, C }
>
> class Blah(E param) {
> void foo() {
> switch(param) {
> case(E.A) : blah;
> case(E.B) : ....
> default:
> }
> }
> }
>

It doesn't. It's easy to check anyway.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list