Re: list filtering



On Wed, 13 Dec 2000, JЖrgen Sigvardsson wrote:

 Hi, 

 I think that this function is useful. But I recommend the names
	g_list_partition
	g_slist_partition
 as STL calls this operation that way.

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I have implemented list filtering functions for my own purpose since there 
> were none in glib.
> 
> typedef gboolean (*GPredicateFunc)(gpointer data, gpointer cond);
> GList* g_list_filter & g_slist_filter(GList* list, GList** filtered_elements, 
> GPredicateFunc f, gpointer filter_cond)
> 
> It scans through the list. For every element which fulfills the filter 
> condition, the element is removed from list and put on filtered_elements. The 
> result is two lists: The remaining elements are returned, while the elements 
> which were removed are in *filtered_elements (in no particular order).
> 
> Would this functionality be interesting for glib? If so tell me where I can 
> send a patch.
> 
> - -- 
> JЖrgen Sigvardsson, B. Sc.
> Lecturer, Computer Science Dept. Karlstad University
> Tel: +46-(0)54-700 1786
> 

 Best regards,
  -Vlad





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