digitalmars.D.learn - static switch
- cal (15/15) Jun 11 2012 Does a switch statement acting on a template parameter act just
- Dmitry Olshansky (4/17) Jun 12 2012 It doesn't. It's easy to check anyway.
- cal (4/5) Jun 12 2012 Not for me :) I just saw that it worked, and wondered if it
- bearophile (5/8) Jun 12 2012 See:
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: } } } Thanks, cal
Jun 11 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
Jun 12 2012
On Tuesday, 12 June 2012 at 08:35:44 UTC, Dmitry Olshansky wrote:It doesn't. It's easy to check anyway.Not for me :) I just saw that it worked, and wondered if it worked statically. Thanks!
Jun 12 2012
cal: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?See: http://d.puremagic.com/issues/show_bug.cgi?id=6921 Bye, bearophile
Jun 12 2012