git-svn-id: svn://db.shs.com.ru/pip@378 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -289,7 +289,7 @@ public:
|
|||||||
|
|
||||||
typedef int (*CompareFunc)(const T * , const T * );
|
typedef int (*CompareFunc)(const T * , const T * );
|
||||||
static int compare_func(const T * t0, const T * t1) {return (*t0) < (*t1) ? -1 : ((*t0) == (*t1) ? 0 : 1);}
|
static int compare_func(const T * t0, const T * t1) {return (*t0) < (*t1) ? -1 : ((*t0) == (*t1) ? 0 : 1);}
|
||||||
PIDeque<T> & sort(CompareFunc compare = compare_func) {qsort(pid_data + pid_start, pid_size, sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
|
PIDeque<T> & sort(CompareFunc compare = compare_func) {piqsort(pid_data + pid_start, pid_size, sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
|
||||||
|
|
||||||
PIDeque<T> & enlarge(llong pid_size) {llong ns = size_s() + pid_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;}
|
PIDeque<T> & enlarge(llong pid_size) {llong ns = size_s() + pid_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;}
|
||||||
|
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ public:
|
|||||||
|
|
||||||
typedef int (*CompareFunc)(const T * , const T * );
|
typedef int (*CompareFunc)(const T * , const T * );
|
||||||
static int compare_func(const T * t0, const T * t1) {return (*t0) < (*t1) ? -1 : ((*t0) == (*t1) ? 0 : 1);}
|
static int compare_func(const T * t0, const T * t1) {return (*t0) < (*t1) ? -1 : ((*t0) == (*t1) ? 0 : 1);}
|
||||||
PIVector<T> & sort(CompareFunc compare = compare_func) {qsort(piv_data, piv_size, sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
|
PIVector<T> & sort(CompareFunc compare = compare_func) {piqsort(piv_data, piv_size, sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
|
||||||
|
|
||||||
PIVector<T> & enlarge(llong piv_size) {llong ns = size_s() + piv_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;}
|
PIVector<T> & enlarge(llong piv_size) {llong ns = size_s() + piv_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;}
|
||||||
|
|
||||||
@@ -469,7 +469,7 @@ public:
|
|||||||
void resize(uint size, const T & new_type = T());
|
void resize(uint size, const T & new_type = T());
|
||||||
PIVector<T, Allocator> & enlarge(uint size);
|
PIVector<T, Allocator> & enlarge(uint size);
|
||||||
void clear();
|
void clear();
|
||||||
PIVector<T, Allocator> & sort(CompareFunc compare = compare_func) {qsort(&at(0), _stlc::size(), sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
|
PIVector<T, Allocator> & sort(CompareFunc compare = compare_func) {piqsort(&at(0), _stlc::size(), sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
|
||||||
PIVector<T, Allocator> & fill(const T & t) {_stlc::assign(_stlc::size(), t); return *this;}
|
PIVector<T, Allocator> & fill(const T & t) {_stlc::assign(_stlc::size(), t); return *this;}
|
||||||
T & back();
|
T & back();
|
||||||
const T & back() const;
|
const T & back() const;
|
||||||
@@ -497,7 +497,7 @@ public:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
_CVector & enlarge(int size_) {int ns = size_s() + size_; if (ns <= 0) _stlc::clear(); else _stlc::resize(ns); return *this;}
|
_CVector & enlarge(int size_) {int ns = size_s() + size_; if (ns <= 0) _stlc::clear(); else _stlc::resize(ns); return *this;}
|
||||||
_CVector & sort(CompareFunc compare = compare_func) {qsort(&at(0), _stlc::size(), sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
|
_CVector & sort(CompareFunc compare = compare_func) {piqsort(&at(0), _stlc::size(), sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
|
||||||
_CVector & fill(const T & t) {_stlc::assign(_stlc::size(), t); return *this;}
|
_CVector & fill(const T & t) {_stlc::assign(_stlc::size(), t); return *this;}
|
||||||
_CVector & pop_front() {_stlc::erase(_stlc::begin()); return *this;}
|
_CVector & pop_front() {_stlc::erase(_stlc::begin()); return *this;}
|
||||||
_CVector & push_front(const T & t) {_stlc::insert(_stlc::begin(), t); return *this;}
|
_CVector & push_front(const T & t) {_stlc::insert(_stlc::begin(), t); return *this;}
|
||||||
|
|||||||
@@ -247,3 +247,8 @@ int main(int argc, char * argv[]) {
|
|||||||
/*! \page using_advanced Advanced using
|
/*! \page using_advanced Advanced using
|
||||||
* Sorry, creativity crysis xD
|
* Sorry, creativity crysis xD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void piqsort(void * base, size_t num, size_t size, int (*compar)(const void *, const void *)) {
|
||||||
|
qsort(base, num, size, compar);
|
||||||
|
}
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ PIString errorString();
|
|||||||
|
|
||||||
void errorClear();
|
void errorClear();
|
||||||
|
|
||||||
|
void piqsort(void* base, size_t num, size_t size, int (*compar)(const void*,const void*));
|
||||||
|
|
||||||
/// Return readable version of PIP
|
/// Return readable version of PIP
|
||||||
PIString PIPVersion();
|
PIString PIPVersion();
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ typedef void(*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG);
|
|||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <cstdlib>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user