Pointers or copies?
Chris Nicholson-Sauls
ibisbasenji at gmail.com
Wed Dec 20 15:27:22 PST 2006
BCS wrote:
> I haven't used it but IIRC cashew has much of what you want.
>
> http://www.dsource.org/projects/cashew
It should. I was just trying to be nice and not go promoting it all over the place like I
usually do. :) Also, as he said he is new to the language, I wasn't sure how he might
feel about pseudo-members.
Using Cashew, a Queue of type 'objct' as an array would look like:
# import cashew .utils .array ;
#
# objct[] queue ;
To add to the queue:
# queue ~= target;
To add multiple items:
# queue.push(target1, target2, target3... targetN);
To remove from the queue:
# queue.remove(target);
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
More information about the Digitalmars-d
mailing list