std.array suggestion (version 3)

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Mon Sep 4 04:39:15 PDT 2006


Oskar Linde wrote:
> Ivan Senji wrote:
>> Oskar Linde wrote:
>>> Hi,
>>>
>>> It's time for version 3 of my std.array suggestion. Some changes:
>>>
>> <snip>
>>
>> Sorry for a little late reply but I have been thinking about your 
>> std.array a little and was wondering why restrict ourselves to arrays,
>> wouldn't it be better to have std.algorithm that would work on both 
>> arrays and user defined types that have opApply or have opIndex and 
>> length. It is possible to check those things at compile time.
> 
> Sorry for this short reply. I am a little short on time. But you have a 
> good point that I have been pursuing lately. It is very possible to make 
> the algorithms more generic. In fact, many algorithms should already 
> work on any type supplying a length, an opIndex and an opApply. I would 
> like to go further by identifying and minimizing the requirements each 
> algorithm places on its argument types. Such requirements should then be 
> classified into concepts and documented.

That sounds great. A more generic version of those functions would be 
something extremely useful. I have been experimenting with that idea 
myself, and the biggest problem might be identifying what those minimal 
requirements should be.



More information about the Digitalmars-d mailing list