Pointers or copies?

Chris Nicholson-Sauls ibisbasenji at gmail.com
Wed Dec 20 15:44:13 PST 2006


BCS wrote:
> Chris Nicholson-Sauls wrote:
>> The only issue is if he wants the queue to be an exclusive set, in 
>> which case adding to the queue becomes:
>> # queue ~= target; queue.unique();
>>
>> Or he could write a 'qpush' like so:
>> # void qpush (T) (inout T[] haystack, T[] bale ...) {
>> #   haystack.push(bale);
>> #   haystack.unique();
>> # }
>>
>> -- Chris Nicholson-Sauls
> 
> It seems what he real wants is a set. How about use an AA:
> 
> bool[Objct] set;
> 
> set[something] = true; // add something
> foreach(k,_;set) k.draw();    // work all
> set.remove(something); // to get rid of things
> 
> To bad void[T] isn't allowed <g>.

That would be the ideal, if he is after a set.  The void[T] did have its shining moments. 
  :)  Alas.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list