Re: [Libclc-developers] Introducing the double linked list interface
Status: Planning
Brought to you by:
augestad
|
From: Thomas S. <ts...@ci...> - 2003-03-18 22:12:14
|
[Note: This was sent to me, but it appears to be meant for the list. In the future, use 'Reply to all'. Sourceforge does not rewrite headers as much as other lists ] Michael B.Allen wrote: > On Mon, 17 Mar 2003 19:37:01 -0500 > > Bryan Donlan <bd...@bd...> wrote: >>>CLC_DL_NODE *clc_dl_FindFirst(CLC_DL_LIST *list, >>> int type, >>> size_t size, >>> void *find, >>> int (*cmp)(int typekey, >>> const void *datakey, >>> int typenode, >>> const void *datanode), >>> int dir, >>> CLC_DL_SEARCH_DATA *srch); > > This is far too complicated. Also these callback interfaces are less > pleasant than a simple iterator interface because you frequently operate > on variable on the stack. > > I would just have an iterate function that initializes the search context > object and a next object that returns each element. I don't see the > advantage of returning the first element with the initial call. It's > a little awkward programatically actually. Have you people looked at this? http://www.cis.strath.ac.uk/~tstegen/dlib/ It has a generic iterator type which can iterate over any datastructure. It works by using pointers to functions which does all the necessary operations. It is possible to have several iterators over the same datastructure at the same time. If there is any interest I can change it to conform to the guidelines of libclc. -- Thomas. -- Thomas. |