std.compress

Walter Bright newshound2 at digitalmars.com
Tue Jun 4 13:15:07 PDT 2013


On 6/4/2013 11:55 AM, Jonathan M Davis wrote:
> Well, I'd expect it to be compress!lzw(), but in any case, what it buys you is
> that you can pass the algorithm around without caring what it is so that while
> code higher up on the stack may have to know that it's lzw, code deeper down
> doesn't have to care what type of algorithm it's using. Now, whether that
> flexibility is all that useful in this particular case, I don't know, but it
> _does_ help with generic code. It's like how a lot of std.algorithm takes its
> predicate as an alias.

There is zero utility in this:

auto compress(alias dg)
{
     return dg();
}

Not even for generic code.


More information about the Digitalmars-d mailing list