byKey and byValue: properties or methods?
sclytrack
sclytrack at fake.com
Fri Jan 20 11:40:10 PST 2012
On 01/20/2012 06:58 PM, Andrei Alexandrescu wrote:
> On 1/17/12 12:48 AM, Andrei Alexandrescu wrote:
>> I hate I must ask this:
>>
>> int[string] aa;
>> foreach (k; aa.byKey) { ... }
>>
>> or
>>
>> int[string] aa;
>> foreach (k; aa.byKey()) { ... }
>>
>>
>>
>> Thanks,
>>
>> Andrei "I told you" Alexandrescu
>
> I tallied the votes.
>
> Function: Mail Mantis, bearophile, Jacob Carlborg, Olivier Pisano, Ary
> Manzana, torhu,
sclytrack
>
> Property: Nick Sabalausky, Simen Kjaeraas.
>
> I wasn't able to discern a clear vote from the others. Please correct
> the list.
>
>
> Thanks,
>
> Andrei
Collection properties should satisfy the "torhu" criteria.
Collection property. Usually indexed.
Conditions:
1) The focus is on collection
2) torhu criteria
I know strings can be seen as a collection of chars.
Is string a collection or not, that's another vote.
Memory aid: torhu criteria
---
auto k = aa.byKey;
writeln(k.front);
k.popFront();
writeln(k.front);
---
to this:
---
writeln(aa.byKey.front);
aa.byKey.popFront();
writeln(aa.byKey.front);
More information about the Digitalmars-d
mailing list