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

This commit is contained in:
2019-06-25 13:48:18 +00:00
parent df2f01e6aa
commit 1598ac053c
2 changed files with 205 additions and 162 deletions

View File

@@ -167,12 +167,38 @@ public:
inline const T & back() const {return pid_data[pid_start + pid_size - 1];}
inline T & front() {return pid_data[pid_start];}
inline const T & front() const {return pid_data[pid_start];}
inline bool operator ==(const PIDeque<T> & t) const {if (pid_size != t.pid_size) return false; for (size_t i = 0; i < pid_size; ++i) if (t[i] != (*this)[i]) return false; return true;}
inline bool operator !=(const PIDeque<T> & t) const {if (pid_size != t.pid_size) return true; for (size_t i = 0; i < pid_size; ++i) if (t[i] != (*this)[i]) return true; return false;}
inline bool contains(const T & v) const {for (size_t i = pid_start; i < pid_start + pid_size; ++i) if (v == pid_data[i]) return true; return false;}
inline int etries(const T & v) const {int ec = 0; for (size_t i = pid_start; i < pid_start + pid_size; ++i) if (v == pid_data[i]) ++ec; return ec;}
inline ssize_t indexOf(const T & v) const {for (ssize_t i = pid_start; i < pid_start + pid_size; ++i) if (v == pid_data[i]) return i - pid_start; return -1;}
inline ssize_t lastIndexOf(const T & v) const {for (ssize_t i = pid_start + pid_size - 1; i >= pid_start; --i) if (v == pid_data[i]) return i - pid_start; return -1;}
inline bool operator ==(const PIDeque<T> & t) const {
if (pid_size != t.pid_size) return false;
for (size_t i = 0; i < pid_size; ++i)
if (t[i] != (*this)[i])
return false;
return true;
}
inline bool operator !=(const PIDeque<T> & t) const {return !(*this == t);}
inline bool contains(const T & v) const {
for (size_t i = pid_start; i < pid_start + pid_size; ++i)
if (v == pid_data[i])
return true;
return false;
}
inline int etries(const T & v) const {
int ec = 0;
for (size_t i = pid_start; i < pid_start + pid_size; ++i)
if (v == pid_data[i]) ++ec;
return ec;
}
inline ssize_t indexOf(const T & v) const {
for (ssize_t i = pid_start; i < pid_start + pid_size; ++i)
if (v == pid_data[i])
return i - pid_start;
return -1;
}
inline ssize_t lastIndexOf(const T & v) const {
for (ssize_t i = pid_start + pid_size - 1; i >= pid_start; --i)
if (v == pid_data[i])
return i - pid_start;
return -1;
}
inline T * data(size_t index = 0) {return &(pid_data[pid_start + index]);}
inline const T * data(size_t index = 0) const {return &(pid_data[pid_start + index]);}
@@ -186,7 +212,10 @@ public:
return *this;
}
inline PIDeque<T> & assign(const T & f = T()) {return fill(f);}
inline PIDeque<T> & assign(size_t new_size, const T & f) {resize(new_size); return fill(f);}
inline PIDeque<T> & assign(size_t new_size, const T & f) {
resize(new_size);
return fill(f);
}
inline PIDeque<T> & resize(size_t new_size, const T & f = T()) {
if (new_size < pid_size) {
@@ -234,6 +263,7 @@ public:
}
inline PIDeque<T> & insert(size_t index, const PIDeque<T> & other) {
if (other.isEmpty()) return *this;
assert(&other != this);
bool dir = pid_rsize <= 2 ? true : (index >= pid_rsize / 2 ? true : false);
if (dir) {
ssize_t os = pid_size - index;
@@ -276,28 +306,51 @@ public:
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);}
inline PIDeque<T> & sort(CompareFunc compare = compare_func) {piqsort(pid_data + pid_start, pid_size, sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
inline PIDeque<T> & sort(CompareFunc compare = compare_func) {
piqsort(pid_data + pid_start, pid_size, sizeof(T), (int(*)(const void * , const void * ))compare);
return *this;
}
inline PIDeque<T> & enlarge(llong pid_size) {llong ns = size_s() + pid_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;}
inline PIDeque<T> & enlarge(llong pid_size) {
llong ns = size_s() + pid_size;
if (ns <= 0) clear();
else resize(size_t(ns));
return *this;
}
inline 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;}
inline PIDeque<T> & removeAll(const T & v) {for (ssize_t i = 0; i < ssize_t(pid_size); ++i) if (pid_data[i + pid_start] == v) {remove(i); --i;} return *this;}
inline 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;
}
inline PIDeque<T> & removeAll(const T & v) {
for (ssize_t i = 0; i < ssize_t(pid_size); ++i)
if (pid_data[i + pid_start] == v) {
remove(i);
--i;
}
return *this;
}
inline PIDeque<T> & push_back(const T & v) {alloc(pid_size + 1, true); PIINTROSPECTION_CONTAINER_USED(T, sizeof(T)); elementNew(pid_data + pid_start + pid_size - 1, v); return *this;}
inline PIDeque<T> & push_back(const T & v) {
alloc(pid_size + 1, true);
PIINTROSPECTION_CONTAINER_USED(T, sizeof(T));
elementNew(pid_data + pid_start + pid_size - 1, v);
return *this;
}
inline PIDeque<T> & append(const T & v) {return push_back(v);}
inline PIDeque<T> & append(const PIDeque<T> & t) {
assert(&t != this);
size_t ps = pid_size;
alloc(pid_size + t.pid_size, true);
newT(pid_data + ps + pid_start, t.pid_data + t.pid_start, t.pid_size);
return *this;
}
inline PIDeque<T> & operator <<(const T & v) {return push_back(v);}
inline PIDeque<T> & operator <<(const PIDeque<T> & t) {
size_t ps = pid_size;
alloc(pid_size + t.pid_size, true);
newT(pid_data + ps + pid_start, t.pid_data + t.pid_start, t.pid_size);
return *this;
}
inline PIDeque<T> & operator <<(const PIDeque<T> & t) {return append(t);}
inline PIDeque<T> & push_front(const T & v) {insert(0, v); return *this;}
inline PIDeque<T> & prepend(const T & v) {return push_front(v);}
@@ -309,29 +362,22 @@ public:
inline T take_front() {T t(front()); pop_front(); return t;}
template <typename ST>
PIDeque<ST> toType() const {PIDeque<ST> ret(pid_size); for (uint i = 0; i < pid_size; ++i) ret[i] = ST(pid_data[i + pid_start]); return ret;}
PIDeque<ST> toType() const {
PIDeque<ST> ret(pid_size);
for (uint i = 0; i < pid_size; ++i)
ret[i] = ST(pid_data[i + pid_start]);
return ret;
}
private:
inline void _reset() {pid_size = pid_rsize = pid_start = 0; pid_data = 0;}
/*void * qmemmove(void * dst, void * src, size_t size) {
if (piAbs<ssize_t>(ssize_t(dst) - ssize_t(src)) >= size)
memcpy(dst, src, size);
else {
char * tb = new char[size];
memcpy(tb, src, size);
memcpy(dst, tb, size);
delete tb;
}
return dst;
}*/
inline size_t asize(ssize_t s) {
if (s <= 0) return 0;
if (pid_rsize + pid_rsize >= size_t(s) && pid_rsize < size_t(s))
return pid_rsize + pid_rsize;
ssize_t t = 0, s_ = s - 1;
while (s_ >> t) {
while (s_ >> t)
++t;
}
return (1 << t);
}
inline void newT(T * dst, const T * src, size_t s) {
@@ -339,14 +385,6 @@ private:
for (size_t i = 0; i < s; ++i)
elementNew(dst + i, src[i]);
}
inline static T * newRaw(size_t s) {
uchar * ret = (uchar*)(malloc(s * sizeof(T)));//new uchar[];
return (T*)ret;
}
/*void reallocRawTemp(size_t s) {
if (pid_tdata == 0) pid_tdata = (T*)(malloc(s * sizeof(T)));
else pid_tdata = (T*)(realloc(pid_tdata, s * sizeof(T)));
}*/
inline void deleteT(T * d, size_t sz) {
PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T))
if ((uchar*)d != 0) {
@@ -354,34 +392,15 @@ private:
elementDelete(d[i]);
}
}
inline static void deleteRaw(T *& d) {
if ((uchar*)d != 0) free((uchar*)d);
d = 0;
}
inline static void zeroRaw(T * d, size_t s) {
if ((uchar*)d != 0) memset(d, 0, s*sizeof(T));
}
inline void elementNew(T * to, const T & from) {new(to)T(from);}
inline void elementDelete(T & from) {from.~T();}
inline void dealloc() {deleteRaw(pid_data);}
inline void dealloc() {
if ((uchar*)pid_data != 0) free((uchar*)pid_data);
pid_data = 0;
}
inline void checkMove(bool direction) {
if (pid_size >= 4) {
if (pid_size < pid_rsize / 6) {
/*if (direction) {
if (pid_start >= 4 && pid_start > pid_size + pid_size && pid_start > pid_rsize / 2) {
piCout << (int)this << "checkMove" << direction << pid_start << (int)pid_data << pid_rsize << pid_size;
piCout << (int)this << "move from" << pid_start << "to" << pid_size << "," << (int)pid_data << pid_rsize << pid_size;
memmove(pid_data + pid_size, pid_data + pid_start, pid_size * sizeof(T));
pid_start = pid_size;
}
} else {
if (ssize_t(pid_start) < ssize_t(pid_rsize) - pid_size - pid_size && ssize_t(pid_start) < ssize_t(pid_rsize / 2) - pid_size) {
piCout << (int)this << "checkMove" << direction << pid_start << (int)pid_data << pid_rsize << pid_size;
piCout << (int)this << "move from" << pid_start << "to" << (ssize_t(pid_rsize) - pid_size) << "," << (int)pid_data << pid_rsize << pid_size;
memmove(pid_data + ssize_t(pid_rsize) - pid_size - pid_size, pid_data + pid_start, pid_size * sizeof(T));
pid_start = ssize_t(pid_rsize) - pid_size - pid_size;
}
}*/
if (pid_start < ssize_t(pid_size + pid_size) || pid_start > (ssize_t(pid_rsize) - ssize_t(pid_size) - ssize_t(pid_size))) {
ssize_t ns = (pid_rsize - pid_size) / 2;
if (pid_start != ns) {
@@ -421,7 +440,7 @@ private:
else as = pid_rsize;
if (as > pid_rsize) {
T * td = newRaw(as);
T * td = (T*)(malloc(as * sizeof(T)));
ssize_t ns = pid_start + as - pid_rsize;
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize)*sizeof(T))
if (pid_rsize > 0 && pid_data != 0) {
@@ -445,9 +464,9 @@ private:
#define __PIDEQUE_SIMPLE_TYPE__(T) \
template<> inline void PIDeque<T>::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(T, s*sizeof(T)); memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \
template<> inline void PIDeque<T>::deleteT(T * d, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T));} \
template<> inline void PIDeque<T>::deleteT(T *, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T));} \
template<> inline void PIDeque<T>::elementNew(T * to, const T & from) {(*to) = from;} \
template<> inline void PIDeque<T>::elementDelete(T & from) {;} \
template<> inline void PIDeque<T>::elementDelete(T &) {;} \
template<> inline PIDeque<T> & PIDeque<T>::_resizeRaw(size_t new_size) { \
if (new_size > pid_size) { \
PIINTROSPECTION_CONTAINER_USED(T, (new_size-pid_size)*sizeof(T)); \
@@ -511,7 +530,19 @@ inline std::ostream & operator <<(std::ostream & s, const PIDeque<T> & v) {s <<
#endif
template<typename T>
inline PICout operator <<(PICout s, const PIDeque<T> & v) {s.space(); s.setControl(0, true); s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PIDeque<T> & v) {
s.space();
s.setControl(0, true);
s << "{";
for (size_t i = 0; i < v.size(); ++i) {
s << v[i];
if (i < v.size() - 1)
s << ", ";
}
s << "}";
s.restoreControl();
return s;
}
#endif // PIDEQUE_H

View File

@@ -96,7 +96,6 @@ public:
size_t pos;
public:
inline const_iterator(): parent(0), pos(0) {}
//T & operator *() {return (*parent)[pos];}
inline const T & operator *() const {return (*parent)[pos];}
inline void operator ++() {++pos;}
inline void operator ++(int) {++pos;}
@@ -132,7 +131,6 @@ public:
size_t pos;
public:
inline const_reverse_iterator(): parent(0), pos(0) {}
//T & operator *() {return (*parent)[pos];}
inline const T & operator *() const {return (*parent)[pos];}
inline void operator ++() {--pos;}
inline void operator ++(int) {--pos;}
@@ -165,12 +163,39 @@ public:
inline const T & back() const {return piv_data[piv_size - 1];}
inline T & front() {return piv_data[0];}
inline const T & front() const {return piv_data[0];}
inline bool operator ==(const PIVector<T> & t) const {if (piv_size != t.piv_size) return false; for (size_t i = 0; i < piv_size; ++i) if (t[i] != piv_data[i]) return false; return true;}
inline bool operator !=(const PIVector<T> & t) const {if (piv_size != t.piv_size) return true; for (size_t i = 0; i < piv_size; ++i) if (t[i] != piv_data[i]) return true; return false;}
inline bool contains(const T & v) const {for (size_t i = 0; i < piv_size; ++i) if (v == piv_data[i]) return true; return false;}
inline int etries(const T & v) const {int ec = 0; for (size_t i = 0; i < piv_size; ++i) if (v == piv_data[i]) ++ec; return ec;}
inline ssize_t indexOf(const T & v) const {for (size_t i = 0; i < piv_size; ++i) if (v == piv_data[i]) return i; return -1;}
inline ssize_t lastIndexOf(const T & v) const {for (ssize_t i = piv_size - 1; i >= 0; --i) if (v == piv_data[i]) return i; return -1;}
inline bool operator ==(const PIVector<T> & t) const {
if (piv_size != t.piv_size)
return false;
for (size_t i = 0; i < piv_size; ++i)
if (t[i] != piv_data[i])
return false;
return true;
}
inline bool operator !=(const PIVector<T> & t) const {return !(*this == t);}
inline bool contains(const T & v) const {
for (size_t i = 0; i < piv_size; ++i)
if (v == piv_data[i])
return true;
return false;
}
inline int etries(const T & v) const {
int ec = 0;
for (size_t i = 0; i < piv_size; ++i)
if (v == piv_data[i]) ++ec;
return ec;
}
inline ssize_t indexOf(const T & v) const {
for (size_t i = 0; i < piv_size; ++i)
if (v == piv_data[i])
return i;
return -1;
}
inline ssize_t lastIndexOf(const T & v) const {
for (ssize_t i = piv_size - 1; i >= 0; --i)
if (v == piv_data[i])
return i;
return -1;
}
inline T * data(size_t index = 0) {return &(piv_data[index]);}
inline const T * data(size_t index = 0) const {return &(piv_data[index]);}
@@ -184,7 +209,10 @@ public:
return *this;
}
inline PIVector<T> & assign(const T & f = T()) {return fill(f);}
inline PIVector<T> & assign(size_t new_size, const T & f) {resize(new_size); return fill(f);}
inline PIVector<T> & assign(size_t new_size, const T & f) {
resize(new_size);
return fill(f);
}
inline PIVector<T> & resize(size_t new_size, const T & f = T()) {
if (new_size < piv_size) {
@@ -230,6 +258,7 @@ public:
}
inline PIVector<T> & insert(size_t index, const PIVector<T> & other) {
if (other.isEmpty()) return *this;
assert(&other != this);
ssize_t os = piv_size - index;
alloc(piv_size + other.piv_size);
if (os > 0)
@@ -259,40 +288,78 @@ public:
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);}
inline PIVector<T> & sort(CompareFunc compare = compare_func) {piqsort(piv_data, piv_size, sizeof(T), (int(*)(const void * , const void * ))compare); return *this;}
inline PIVector<T> & sort(CompareFunc compare = compare_func) {
piqsort(piv_data, piv_size, sizeof(T), (int(*)(const void * , const void * ))compare);
return *this;
}
inline PIVector<T> & enlarge(llong piv_size) {llong ns = size_s() + piv_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;}
inline PIVector<T> & enlarge(llong piv_size) {
llong ns = size_s() + piv_size;
if (ns <= 0) clear();
else resize(size_t(ns));
return *this;
}
inline PIVector<T> & removeOne(const T & v) {for (size_t i = 0; i < piv_size; ++i) if (piv_data[i] == v) {remove(i); return *this;} return *this;}
inline PIVector<T> & removeAll(const T & v) {for (ssize_t i = 0; i < ssize_t(piv_size); ++i) if (piv_data[i] == v) {remove(i); --i;} return *this;}
inline PIVector<T> & removeOne(const T & v) {
for (size_t i = 0; i < piv_size; ++i)
if (piv_data[i] == v) {
remove(i);
return *this;
}
return *this;
}
inline PIVector<T> & removeAll(const T & v) {
for (ssize_t i = 0; i < ssize_t(piv_size); ++i)
if (piv_data[i] == v) {
remove(i);
--i;
}
return *this;
}
inline PIVector<T> & push_back(const T & v) {alloc(piv_size + 1); PIINTROSPECTION_CONTAINER_USED(T, sizeof(T)); elementNew(piv_data + piv_size - 1, v); return *this;}
inline PIVector<T> & push_back(const T & v) {
alloc(piv_size + 1);
PIINTROSPECTION_CONTAINER_USED(T, sizeof(T));
elementNew(piv_data + piv_size - 1, v);
return *this;
}
inline PIVector<T> & append(const T & v) {return push_back(v);}
inline PIVector<T> & append(const PIVector<T> & other) {
size_t ps = piv_size;
alloc(piv_size + other.piv_size);
newT(piv_data + ps, other.piv_data, other.piv_size);
return *this;
}
inline PIVector<T> & operator <<(const T & v) {return push_back(v);}
inline PIVector<T> & operator <<(const PIVector<T> & other) {
assert(&other != this);
size_t ps = piv_size;
alloc(piv_size + other.piv_size);
newT(piv_data + ps, other.piv_data, other.piv_size);
return *this;
}
inline PIVector<T> & operator <<(const T & v) {return push_back(v);}
inline PIVector<T> & operator <<(const PIVector<T> & other) {return append(other);}
inline PIVector<T> & push_front(const T & v) {insert(0, v); return *this;}
inline PIVector<T> & prepend(const T & v) {return push_front(v);}
inline PIVector<T> & pop_back() {if (piv_size == 0) return *this; resize(piv_size - 1); return *this;}
inline PIVector<T> & pop_front() {if (piv_size == 0) return *this; remove(0); return *this;}
inline PIVector<T> & pop_back() {
if (piv_size == 0)
return *this;
resize(piv_size - 1);
return *this;
}
inline PIVector<T> & pop_front() {
if (piv_size == 0)
return *this;
remove(0);
return *this;
}
inline T take_back() {T t(back()); pop_back(); return t;}
inline T take_front() {T t(front()); pop_front(); return t;}
template <typename ST>
PIVector<ST> toType() const {PIVector<ST> ret(piv_size); for (uint i = 0; i < piv_size; ++i) ret[i] = ST(piv_data[i]); return ret;}
PIVector<ST> toType() const {
PIVector<ST> ret(piv_size);
for (uint i = 0; i < piv_size; ++i)
ret[i] = ST(piv_data[i]);
return ret;
}
private:
inline void _reset() {piv_size = piv_rsize = 0; piv_data = 0;}
@@ -309,14 +376,6 @@ private:
for (size_t i = 0; i < s; ++i)
elementNew(dst + i, src[i]);
}
inline T * newRaw(size_t s) {
uchar * ret = (uchar*)(malloc(s * sizeof(T)));//new uchar[];
return (T*)ret;
}
/*void reallocRawTemp(size_t s) {
if (piv_tdata == 0) piv_tdata = (T*)(malloc(s * sizeof(T)));
else piv_tdata = (T*)(realloc(piv_tdata, s * sizeof(T)));
}*/
inline void deleteT(T * d, size_t sz) {
PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T))
if ((uchar*)d != 0) {
@@ -339,81 +398,22 @@ private:
size_t as = asize(new_size);
if (as == piv_rsize) return;
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-piv_rsize)*sizeof(T))
T * p_d = (T*)(realloc((void*)(piv_data), as*sizeof(T)));
assert(p_d);
piv_data = p_d;
piv_rsize = as;
/*piv_rsize = as;
T * pd = newRaw(piv_rsize);
if (os > 0 && piv_data != 0) {
memcpy(pd, piv_data, os * sizeof(T));
deleteRaw(piv_data);
}
piv_data = pd;*/
}
T * piv_data;
size_t piv_size, piv_rsize;
};
/*
#define __PIVECTOR_SIMPLE_FUNCTIONS__(T) \
template<> inline PIVector<T>::~PIVector() {dealloc(); _reset();} \
template<> inline PIVector<T> & PIVector<T>::push_back(const T & v) {alloc(piv_size + 1); piv_data[piv_size - 1] = v; return *this;} \
template<> inline PIVector<T> & PIVector<T>::fill(const T & f) { \
for (size_t i = 0; i < piv_size; ++i) \
piv_data[i] = f; \
return *this; \
} \
template<> inline PIVector<T> & PIVector<T>::resize(size_t new_size, const T & f) { \
if (new_size < piv_size) \
piv_size = new_size; \
if (new_size > piv_size) { \
size_t os = piv_size; \
alloc(new_size); \
for (size_t i = os; i < new_size; ++i) piv_data[i] = f; \
} \
return *this; \
} \
template<> inline PIVector<T> & PIVector<T>::insert(size_t index, const T & v) { \
alloc(piv_size + 1); \
if (index < piv_size - 1) { \
size_t os = piv_size - index - 1; \
memmove(&(piv_data[index + 1]), &(piv_data[index]), os * sizeof(T)); \
} \
piv_data[index] = v; \
return *this; \
} \
template<> inline PIVector<T> & PIVector<T>::remove(size_t index, size_t count) { \
if (count == 0) return *this; \
if (index + count >= piv_size) { \
resize(index); \
return *this; \
} \
size_t os = piv_size - index - count; \
memmove(&(piv_data[index]), &(piv_data[index + count]), os * sizeof(T)); \
piv_size -= count; \
return *this; \
}
__PIVECTOR_SIMPLE_FUNCTIONS__(char)
__PIVECTOR_SIMPLE_FUNCTIONS__(uchar)
__PIVECTOR_SIMPLE_FUNCTIONS__(short)
__PIVECTOR_SIMPLE_FUNCTIONS__(ushort)
__PIVECTOR_SIMPLE_FUNCTIONS__(int)
__PIVECTOR_SIMPLE_FUNCTIONS__(uint)
__PIVECTOR_SIMPLE_FUNCTIONS__(long)
__PIVECTOR_SIMPLE_FUNCTIONS__(ulong)
__PIVECTOR_SIMPLE_FUNCTIONS__(llong)
__PIVECTOR_SIMPLE_FUNCTIONS__(ullong)
__PIVECTOR_SIMPLE_FUNCTIONS__(float)
__PIVECTOR_SIMPLE_FUNCTIONS__(double)
__PIVECTOR_SIMPLE_FUNCTIONS__(ldouble)*/
#define __PIVECTOR_SIMPLE_TYPE__(T) \
template<> inline void PIVector<T>::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(T, s*sizeof(T)); memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \
template<> inline void PIVector<T>::deleteT(T * d, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T));} \
template<> inline void PIVector<T>::deleteT(T *, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T));} \
template<> inline void PIVector<T>::elementNew(T * to, const T & from) {(*to) = from;} \
template<> inline void PIVector<T>::elementDelete(T & from) {;} \
template<> inline void PIVector<T>::elementDelete(T &) {;} \
template<> inline PIVector<T> & PIVector<T>::_resizeRaw(size_t new_size) { \
if (new_size > piv_size) { \
PIINTROSPECTION_CONTAINER_USED(T, (new_size-piv_size)*sizeof(T)); \
@@ -537,7 +537,19 @@ inline std::ostream & operator <<(std::ostream & s, const PIVector<T> & v) {s <<
#endif
template<typename T>
inline PICout operator <<(PICout s, const PIVector<T> & v) {s.space(); s.setControl(0, true); s << "{"; for (size_t i = 0; i < v.size(); ++i) {s << v[i]; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;}
inline PICout operator <<(PICout s, const PIVector<T> & v) {
s.space();
s.setControl(0, true);
s << "{";
for (size_t i = 0; i < v.size(); ++i) {
s << v[i];
if (i < v.size() - 1)
s << ", ";
}
s << "}";
s.restoreControl();
return s;
}
#endif // PIVECTOR_H