aboutsummaryrefslogtreecommitdiffhomepage
path: root/util.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2011-12-26 22:51:34 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2011-12-26 22:51:34 -0800
commitb67eaa3abd1539e6d0a610dc5e8cca428334beb6 (patch)
treef0106ff9e7abb5aa3e03824321314df126f9f137 /util.h
parent046c9b56f5344107a0105cc00f4a34071a8170b4 (diff)
More migration to the STL
Diffstat (limited to 'util.h')
-rw-r--r--util.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/util.h b/util.h
index ad90bb68..47d8bc4f 100644
--- a/util.h
+++ b/util.h
@@ -458,11 +458,6 @@ long al_peek_long( array_list_t *l );
*/
func_ptr_t al_peek_func( array_list_t *l );
-/**
- Returns 1 if the list is empty, 0 otherwise
-*/
-int al_empty( array_list_t *l);
-
/**
Call the function func for each entry in the list
*/
@@ -474,6 +469,19 @@ void al_foreach( array_list_t *l, void (*func)( void * ));
*/
void al_foreach2( array_list_t *l, void (*func)( void *, void *), void *aux);
+template<typename T>
+T al_list_to(array_list_t *list)
+{
+ T result;
+ int i, c = al_get_count(list);
+ for (i=0; i < c; i++) {
+ void *val = al_get(list, i);
+ result.push_back(val);
+ }
+ return result;
+}
+
+
/**
Compares two wide character strings with an (arguably) intuitive
ordering.