Mixin replacement for switch...case?
philippe.sigaud at gmail.com
Wed Oct 24 11:23:50 PDT 2012
On Wed, Oct 24, 2012 at 9:56 AM, Jerome <jerome.spamable at yahoo.com> wrote:
>> Remark 1: I understand that your mixin will be expanded into cascaded
>> if...else statements. It would probably be more efficient to expand into
>> switch...case, don't you think?
> Oh! I've just figured out that it is not a mixin, but a function template.
That was to allow runtime arguments to be used. In your example, value
is a compile-time argument. In this case, all tests can be done at CT
and your code should result *only* in the right branch: no need to
develop an entire switch statement.
More information about the Digitalmars-d