"Andrei Alexandrescu" <[email protected]> wrote in message
news:[email protected]...
>
> Not convinced. They call it specialization, and it's a powerful concept.
> We use it in std.algorithm all over the place.
>
> Andrei
You can do that just as well without using an 'else' block.
version(ThisOS)
{
doItThisWay();
}
else version(ThatOS)
{
doItThatWay();
}
else version(SomeOS)
{
doItSlowWay();
}
else version(OtherOS)
{
doItSlowWay();
}
else
static assert(0, "OS not implemented");
This means you're forced to choose which way when implementing that new
version, instead of hoping that it will work.
This is not really the same thing as (eg) specializing searching for narrow
strings.