Pointers or copies?

BCS BCS at pathilink.com
Wed Dec 20 15:35:50 PST 2006


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>.



More information about the Digitalmars-d mailing list