qsort2, pop, push methods for Dynamic_array<>
This commit is contained in:
parent
b221ec6529
commit
3098b6cf5b
1 changed files with 16 additions and 0 deletions
|
@ -130,6 +130,16 @@ public:
|
|||
return (insert_dynamic(&array, (uchar*)&el));
|
||||
}
|
||||
|
||||
bool push(Elem &el)
|
||||
{
|
||||
return append(el);
|
||||
}
|
||||
|
||||
Elem *pop()
|
||||
{
|
||||
return (Elem*)pop_dynamic(&array);
|
||||
}
|
||||
|
||||
size_t elements()
|
||||
{
|
||||
return array.elements;
|
||||
|
@ -168,6 +178,12 @@ public:
|
|||
{
|
||||
my_qsort(array.buffer, array.elements, sizeof(Elem), (qsort_cmp)cmp_func);
|
||||
}
|
||||
|
||||
typedef int (*CMP_FUNC2)(const Elem *el1, const Elem *el2, void *);
|
||||
void sort(CMP_FUNC2 cmp_func, void *data)
|
||||
{
|
||||
my_qsort2(array.buffer, array.elements, sizeof(Elem), (qsort2_cmp)cmp_func, data);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue