std.compress

John Colvin john.loughran.colvin at gmail.com
Tue Jun 4 09:33:40 PDT 2013


On Tuesday, 4 June 2013 at 16:09:09 UTC, Walter Bright wrote:
> On 6/4/2013 6:34 AM, Jacob Carlborg wrote:
>> I'm wondering if (un)compress can take the compressing 
>> algorithm as a template
>> parameter. Does that make sense?
>>
>> Something like:
>>
>> auto result = data.compress!(LZW);
>>
>> Then we could pass different compressing algorithms to the 
>> compress function.
>
> I don't see the point. Furthermore, it requires that the 
> compress template know about all the compression algorithms 
> available, which limits future expansion.

Not necessarily. If the compression algorithms were free 
functions in the module you could just be passing an alias to 
one, which compress would then call. (which would also allow 
people to specify their own algorithms)


More information about the Digitalmars-d mailing list