-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray_Util.h
More file actions
23 lines (21 loc) · 1.03 KB
/
Array_Util.h
File metadata and controls
23 lines (21 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
typedef struct arrayUtil{
void *base;
int typeSize;
int length;
} ArrayUtil;
typedef int (* MatchFunc)(void *hint,void *item);
typedef void (*ConvertFunc)(void* hint, void* sourceItem, void* destinationItem);
typedef void* (*ReducerFunc)(void* hint, void* previousItem, void* item);
typedef void (*OperationFunc)(void* hint, void* item);
ArrayUtil create(int typeSize, int length);
ArrayUtil resize(ArrayUtil util, int length);
int areEqual(ArrayUtil a , ArrayUtil b);
int findIndex(ArrayUtil a,void* element);
void dispose(ArrayUtil a);
void* findFirst(ArrayUtil util, MatchFunc* match, void* hint);
void* findLast(ArrayUtil util, MatchFunc* match, void* hint);
int count(ArrayUtil util, MatchFunc* match, void* hint);
int filter(ArrayUtil util, MatchFunc* match, void* hint, void** destination, int maxItems );
void map(ArrayUtil source, ArrayUtil destination, ConvertFunc* convert, void* hint);
void* reduce(ArrayUtil util, ReducerFunc* reducer, void* hint, void* initialValue);
void forEach(ArrayUtil util, OperationFunc* operation, void* hint);