git-svn-id: svn://db.shs.com.ru/pip@186 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-03-02 08:09:01 +00:00
parent 0d77d3b425
commit 741615b9d3
11 changed files with 104 additions and 19 deletions

View File

@@ -295,7 +295,7 @@ public:
PIDeque<T> & removeOne(const T & v) {for (size_t i = 0; i < pid_size; ++i) if (pid_data[i + pid_start] == v) {remove(i); return *this;} return *this;}
PIDeque<T> & removeAll(const T & v) {for (llong i = 0; i < pid_size; ++i) if (pid_data[i + pid_start] == v) {remove(i); --i;} return *this;}
PIDeque<T> & push_back(const T & v) {alloc(pid_size + 1, true); elementNew(pid_data + pid_start + pid_size - 1, v); return *this;}
PIDeque<T> & push_back(const T & v) {alloc(pid_size + 1, true); PIINTROSPECTION_CONTAINER_USED(sizeof(T)); elementNew(pid_data + pid_start + pid_size - 1, v); return *this;}
PIDeque<T> & append(const T & v) {return push_back(v);}
PIDeque<T> & operator <<(const T & v) {return push_back(v);}
PIDeque<T> & operator <<(const PIDeque<T> & t) {
@@ -462,8 +462,8 @@ private:
};
#define __PIDEQUE_SIMPLE_TYPE__(T) \
template<> inline void PIDeque<T>::newT(T * dst, const T * src, size_t s) {memcpy(dst, src, s * sizeof(T));} \
template<> inline void PIDeque<T>::deleteT(T * d, size_t sz) {;} \
template<> inline void PIDeque<T>::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(s*sizeof(T)); memcpy(dst, src, s * sizeof(T));} \
template<> inline void PIDeque<T>::deleteT(T * d, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(sz*sizeof(T));} \
template<> inline void PIDeque<T>::elementNew(T * to, const T & from) {(*to) = from;} \
template<> inline void PIDeque<T>::elementDelete(T & from) {;}

View File

@@ -28,6 +28,7 @@
#include "pivector.h"
#include "pideque.h"
class PIByteArray;
#if !defined(PIP_CONTAINERS_STL) || defined(DOXYGEN)
@@ -53,6 +54,8 @@ void piQuickSort(T * a, ssize_t N) {
template <typename Key, typename T>
class PIMap {
template <typename Key1, typename T1> friend PIByteArray & operator >>(PIByteArray & s, PIMap<Key1, T1> & v);
template <typename Key1, typename T1> friend PIByteArray & operator <<(PIByteArray & s, const PIMap<Key1, T1> & v);
public:
PIMap() {;}
PIMap(const PIMap<Key, T> & other) {*this = other;}
@@ -244,7 +247,9 @@ protected:
bool operator <(const MapIndex & s) const {return key < s.key;}
bool operator >(const MapIndex & s) const {return key > s.key;}
};
template <typename Key1, typename T1> friend PIByteArray & operator >>(PIByteArray & s, typename PIMap<Key1, T1>::MapIndex & v);
template <typename Key1, typename T1> friend PIByteArray & operator <<(PIByteArray & s, const typename PIMap<Key1, T1>::MapIndex & v);
ssize_t binarySearch(ssize_t first, ssize_t last, const Key & key, bool & found) const {
ssize_t mid;
while (first <= last) {