Re: Upcoming GLib changes

On Thu, 1 Jul 1999, Damon Chaplin wrote:

> I agree with this. I think:
>  g_stack_push()
>  g_stack_pop()
>  g_stack_empty()
>  g_stack_peek()

Let's add the following, just to make the stack more useful:

g_stack_shift()			/* like pop(), only on the other end */
g_stack_unshift()       /* like push(), only on the other end */

The problem is that these make the implementation more difficult.
If people don't want to add them to g_stack, that's not a big deal.

I'll be putting them in my bucketized array library.  (which should
be a nice comprimise between GList and GArray).


> is much better than:
>  g_slist_prepend()
>  g_slist_remove()
>  if (slist == NULL)
>  slist ? slist->data
> It's worth it just for the code readability.
> (though I would have used a GPtrArray.)
> I also think g_stack_index() is useful for a stack. Java stacks have a
> search() method.
> Damon
> -- 
>          To unsubscribe: mail with 
>                        "unsubscribe" as the Subject.

Scott Wimer

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]