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

This commit is contained in:
2019-06-22 14:55:23 +00:00
parent 71128017dd
commit fb44b01c0f
24 changed files with 433 additions and 142 deletions

View File

@@ -36,38 +36,27 @@ class PIDeque {
public:
inline PIDeque(): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T)
//printf("new vector 1 %p (%s) ... !{\n", this, typeid(T).name());
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline PIDeque(const PIDeque<T> & other): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T)
//printf("new vector 2 %p (%s) ... !{\n", this, typeid(T).name());
alloc(other.pid_size, true);
newT(pid_data + pid_start, other.pid_data + other.pid_start, pid_size);
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline PIDeque(const T * data, size_t size): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T)
//printf("new vector 2 %p (%s) ... !{\n", this, typeid(T).name());
alloc(size, true);
newT(pid_data + pid_start, data, pid_size);
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline PIDeque(size_t pid_size, const T & f = T()): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T)
//printf("new vector 3 %p (%s) ... !{\n", this, typeid(T).name());
resize(pid_size, f);
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline ~PIDeque() {
inline virtual ~PIDeque() {
PIINTROSPECTION_CONTAINER_DELETE(T)
PIINTROSPECTION_CONTAINER_FREE(T, (pid_rsize)*sizeof(T))
//printf("delete deque %p (%s) (s=%d, rs=%d, st=%d, d=%p) ... ~{\n", this, typeid(T).name(), int(pid_size), int(pid_rsize), int(pid_start), pid_data);
deleteT(pid_data + pid_start, pid_size);
dealloc();
//deleteRaw(pid_tdata);
_reset();
//printf("}~\n");
}
inline PIDeque<T> & operator =(const PIDeque<T> & other) {
@@ -188,9 +177,8 @@ public:
inline PIDeque<T> & clear() {resize(0); return *this;}
inline PIDeque<T> & fill(const T & f = T()) {
//if (sizeof(T) == 1) memset(pid_data, f, pid_size);
deleteT(pid_data + pid_start, pid_size);
//zeroRaw(pid_data, pid_size);
PIINTROSPECTION_CONTAINER_USED(T, pid_size*sizeof(T))
for (size_t i = pid_start; i < pid_start + pid_size; ++i)
elementNew(pid_data + i, f);
return *this;
@@ -206,8 +194,6 @@ public:
if (new_size > pid_size) {
size_t os = pid_size;
alloc(new_size, true);
//if (sizeof(T) == 1) memset(&(pid_data[os]), f, ds);
//zeroRaw(&(pid_data[os]), new_size - os);
PIINTROSPECTION_CONTAINER_USED(T, (new_size-os)*sizeof(T))
for (size_t i = os + pid_start; i < new_size + pid_start; ++i) elementNew(pid_data + i, f);
}
@@ -229,7 +215,6 @@ public:
inline PIDeque<T> & insert(size_t index, const T & v = T()) {
bool dir = pid_rsize <= 2 ? true : (index >= pid_rsize / 2 ? true : false);
//piCout << "insert" << dir << index << pid_size << pid_rsize << pid_start << "!<";
if (dir) {
alloc(pid_size + 1, true);
if (index < pid_size - 1) {
@@ -238,11 +223,9 @@ public:
}
} else {
alloc(pid_size + 1, false, -1);
//piCout << "insert front" << pid_size << pid_rsize << pid_start << "!<";
if (index > 0)
memmove((void*)(&(pid_data[pid_start])), (const void*)(&(pid_data[pid_start + 1])), index * sizeof(T));
}
//piCout << "insert" << pid_start << index << (pid_start + ssize_t(index)) << pid_size << ">!";
PIINTROSPECTION_CONTAINER_USED(T, sizeof(T))
elementNew(pid_data + pid_start + index, v);
return *this;
@@ -250,22 +233,16 @@ public:
inline PIDeque<T> & insert(size_t index, const PIDeque<T> & other) {
if (other.isEmpty()) return *this;
bool dir = pid_rsize <= 2 ? true : (index >= pid_rsize / 2 ? true : false);
//piCout << this << "insert" << dir << index << pid_size << pid_rsize << pid_start << " <- " << other.size() << "!<";
if (dir) {
ssize_t os = pid_size - index;
alloc(pid_size + other.pid_size, true);
if (os > 0)
memmove((void*)(&(pid_data[index + pid_start + other.pid_size])), (const void*)(&(pid_data[index + pid_start])), os * sizeof(T));
} else {
//if (pid_start < other.pid_size) pid_start = 0;
//piCout << this << " insert offseted start ba" << pid_start << pid_size << pid_rsize;
alloc(pid_size + other.pid_size, false, -other.pid_size);
//piCout << this << " insert offseted start aa" << pid_start << pid_size << pid_rsize;
//piCout << this << " insert front" << pid_size << pid_rsize << pid_start << "!<";
if (index > 0)
memmove((void*)(&(pid_data[pid_start])), (const void*)(&(pid_data[pid_start + other.pid_size])), index * sizeof(T));
}
//piCout << this << "insert" << pid_start << index << (pid_start + ssize_t(index)) << pid_size << ">!";
newT(pid_data + pid_start + index, other.pid_data + other.pid_start, other.pid_size);
return *this;
}
@@ -279,7 +256,6 @@ public:
size_t os = pid_size - index - count;
deleteT(&(pid_data[index + pid_start]), count);
if (os <= index) {
//if (true) {
if (os > 0) memmove((void*)(&(pid_data[index + pid_start])), (const void*)(&(pid_data[index + pid_start + count])), os * sizeof(T));
} else {
if (index > 0) memmove((void*)(&(pid_data[pid_start + count])), (const void*)(&(pid_data[pid_start])), index * sizeof(T));
@@ -351,12 +327,9 @@ private:
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;
//printf("asize .. %p rs=%d ns=%d s_=%d t=%d \n", this, pid_rsize, s, s_, t);
while (s_ >> t) {
++t;
//printf("asize ++ %p rs=%d ns=%d s_=%d t=%d \n", this, pid_rsize, s, s_, t);
}
//printf("asize ok %p rs=%d ns=%d s_=%d t=%d \n", this, pid_rsize, s, s_, t);
return (1 << t);
}
inline void newT(T * dst, const T * src, size_t s) {
@@ -365,11 +338,7 @@ private:
elementNew(dst + i, src[i]);
}
inline static T * newRaw(size_t s) {
//std::cout << std::dec << " ![("<<this<<")newRaw " << s << " elements ... <" << std::endl;
//uchar * ret = new uchar[s * sizeof(T)];
uchar * ret = (uchar*)(malloc(s * sizeof(T)));//new uchar[];
//zeroRaw((T*)ret, s);
//std::cout << std::hex << " > (new 0x" << (llong)ret << ") ok]!" << std::endl;
return (T*)ret;
}
/*void reallocRawTemp(size_t s) {
@@ -378,24 +347,17 @@ private:
}*/
inline void deleteT(T * d, size_t sz) {
PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T))
//std::cout << " ~[("<<this<<")deleteT " << std::dec << sz << " elements " << " start " << pid_start << std::hex << " 0x" << (llong)d << " ... <" << std::endl;
if ((uchar*)d != 0) {
for (size_t i = 0; i < sz; ++i)
elementDelete(d[i]);
//zeroRaw(d, sz);
}
//cout << " > ok]~" << endl;
}
inline static void deleteRaw(T *& d) {
//cout << " ~[("<<this<<")deleteRaw " << std::dec << pid_rsize << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
if ((uchar*)d != 0) free((uchar*)d);
d = 0;
//cout << " > ok]~" << endl;
}
inline static void zeroRaw(T * d, size_t s) {
//cout << " ~[("<<this<<")zeroRaw " << std::dec << s << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
if ((uchar*)d != 0) memset(d, 0, s*sizeof(T));
//cout << " > ok]~" << endl;
}
inline void elementNew(T * to, const T & from) {new(to)T(from);}
inline void elementDelete(T & from) {from.~T();}
@@ -418,11 +380,9 @@ private:
pid_start = ssize_t(pid_rsize) - pid_size - pid_size;
}
}*/
//printf("(%p) check move st=%d sz=%d rs=%d\n", this, pid_start, pid_size, pid_rsize);
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) {
//printf("(%p) move %d -> %d\n", this, pid_start, ns);
memmove((void*)(pid_data + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
pid_start = ns;
}
@@ -431,14 +391,12 @@ private:
} else {
ssize_t ns = (pid_rsize - pid_size) / 2;
if (pid_start != ns) {
//printf("(%p) move %d -> %d\n", this, pid_start, ns);
memmove((void*)(pid_data + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
pid_start = ns;
}
}
}
inline void alloc(size_t new_size, bool direction, ssize_t start_offset = 0) { // direction == true -> alloc forward
//if(new_size == 65536) printf("(%p) alloc too much size %d->%d", this, (int)pid_size, (int)new_size);
if (direction) {
if (pid_start + new_size <= pid_rsize) {
pid_size = new_size;
@@ -447,50 +405,35 @@ private:
}
pid_size = new_size;
size_t as = asize(pid_start + new_size);
//if(as > 1000) piCout << "too much deque size" << new_size << as;
if (as != pid_rsize) {
//printf("(%p) realloc %d -> %d (%p)\n", this, pid_rsize, as, pid_data);
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize)*sizeof(T))
T * p_d = (T*)(realloc((void*)(pid_data), as*sizeof(T)));
//if(!p_d) printf("(%p) realloc (%d)%d -> %d (%p) %d\n", this, (int)pid_start, (int)pid_rsize, (int)as, pid_data, (int)new_size);
assert(p_d);
pid_data = p_d;
pid_rsize = as;
//printf("(%p) realloc done (%p)\n", this, pid_data);
}
} else {
size_t as;
//piCout << "INS ba" << *this;
if (pid_start + start_offset < 0)
as = asize(pid_rsize - start_offset);
else as = pid_rsize;
//if(as > 1000) piCout << "too much deque size" << new_size << as;
//printf("%X alloc %d %d\n", this, pid_rsize, start_offset);
//printf("%X alloc %d %d %d %d %d %d\n", this, new_size, pid_size, pid_rsize, as, pid_start, start_offset);
if (as > pid_rsize) {
//printf("%X alloc new size %d\n", this, as);
//cout << std::hex << " ![("<<this<<")realloc " << pid_data << " data ... <\n" << endl;
T * td = newRaw(as);
ssize_t ns = pid_start + as - pid_rsize;
//printf("%X pid_start ost=%d ors=%d nst=%d nrs=%d\n", this, pid_start, pid_rsize, ns, as);
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize)*sizeof(T))
if (pid_rsize > 0 && pid_data != 0) {
//printf("%X copy from %p + %d to %p + %d %d el\n", this, pid_data, pid_start, td, ns, pid_size);
memcpy((void*)(td + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
deleteRaw(pid_data);
}
pid_data = td;
pid_rsize = as;
pid_start = ns;
//piCout << "INS aa" << *this;
}
pid_start += start_offset;
pid_size = new_size;
checkMove(direction);
}
//checkMove(direction);
//printf("%X alloc new start %d\n", this, pid_start);
}
T * pid_data;
@@ -504,8 +447,9 @@ private:
template<> inline void PIDeque<T>::elementNew(T * to, const T & from) {(*to) = from;} \
template<> inline void PIDeque<T>::elementDelete(T & from) {;} \
template<> inline PIDeque<T> & PIDeque<T>::_resizeRaw(size_t new_size) {if (new_size > pid_size) alloc(new_size, true); return *this;} \
template<> inline PIDeque<T> & PIDeque<T>::clear() {pid_size = 0; return *this;} \
template<> inline PIDeque<T> & PIDeque<T>::assign(size_t new_size, const T & f) {_resizeRaw(new_size); return fill(f);}
template<> inline PIDeque<T> & PIDeque<T>::clear() {PIINTROSPECTION_CONTAINER_UNUSED(T, pid_size*sizeof(T)); pid_size = 0; return *this;} \
template<> inline PIDeque<T> & PIDeque<T>::assign(size_t new_size, const T & f) {\
_resizeRaw(new_size); return fill(f);}
#else

View File

@@ -39,7 +39,7 @@ public:
PIList(const Type & v0, const Type & v1, const Type & v2) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);}
PIList(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);}
PIList(uint size, const Type & value = Type()) {piMonitor.containers++; _stlc::resize(size, value);}
~PIList() {piMonitor.containers--;}
virtual ~PIList() {piMonitor.containers--;}
Type & operator [](uint index) {return (*this)[index];}
Type & operator [](uint index) const {return (*this)[index];}
const Type * data(uint index = 0) const {return &(*this)[index];}

View File

@@ -76,7 +76,7 @@ class PIMap {
public:
PIMap() {;}
PIMap(const PIMap<Key, T> & other) {*this = other;}
~PIMap() {;}
virtual ~PIMap() {;}
PIMap<Key, T> & operator =(const PIMap<Key, T> & other) {
if (this == &other) return *this;

View File

@@ -31,6 +31,7 @@ template<typename T>
class PIP_EXPORT PIQueue: public PIDeque<T> {
public:
PIQueue() {;}
virtual ~PIQueue() {;}
PIDeque<T> & enqueue(const T & v) {PIDeque<T>::push_front(v); return *this;}
T dequeue() {return PIDeque<T>::take_back();}
T & head() {return PIDeque<T>::back();}

View File

@@ -41,7 +41,9 @@ public:
//! Contructs an empty set
PISet() {}
virtual ~PISet() {;}
//! Contructs set with one element "value"
PISet(const T & value) {_CSet::insert(value, 0);}

View File

@@ -31,6 +31,7 @@ template<typename T>
class PIP_EXPORT PIStack: public PIVector<T> {
public:
PIStack() {;}
virtual ~PIStack() {;}
PIVector<T> & push(const T & v) {PIVector<T>::push_back(v); return *this;}
T pop() {return PIVector<T>::take_back();}
T & top() {return PIVector<T>::back();}

View File

@@ -35,33 +35,28 @@ template <typename T>
class PIVector {
public:
inline PIVector(): piv_data(0), piv_size(0), piv_rsize(0) {
//printf("new vector 1 %p (%s) ... !{\n", this, typeid(T).name());
//printf("(s=%d, d=%p) }!\n", int(piv_size), piv_data);
PIINTROSPECTION_CONTAINER_NEW(T)
}
inline PIVector(const T * data, size_t size): piv_data(0), piv_size(0), piv_rsize(0) {
//printf("new vector 2 %p (%s) ... !{\n", this, typeid(T).name());
PIINTROSPECTION_CONTAINER_NEW(T)
alloc(size);
newT(piv_data, data, piv_size);
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline PIVector(const PIVector<T> & other): piv_data(0), piv_size(0), piv_rsize(0) {
//printf("new vector 2 %p (%s) ... !{\n", this, typeid(T).name());
PIINTROSPECTION_CONTAINER_NEW(T)
alloc(other.piv_size);
newT(piv_data, other.piv_data, piv_size);
//printf("(s=%d, d=%p) }!\n", int(piv_size), piv_data);
}
inline PIVector(size_t piv_size, const T & f = T()): piv_data(0), piv_size(0), piv_rsize(0) {
//printf("new vector 3 %p (%s) ... !{\n", this, typeid(T).name());
PIINTROSPECTION_CONTAINER_NEW(T)
resize(piv_size, f);
//printf("(s=%d, d=%p) }!\n", int(piv_size), piv_data);
}
inline ~PIVector() {
//printf("delete vector %p (%s) (s=%d, d=%p) ... ~{\n", this, typeid(T).name(), int(piv_size), piv_data);
inline virtual ~PIVector() {
PIINTROSPECTION_CONTAINER_DELETE(T)
PIINTROSPECTION_CONTAINER_FREE(T, (piv_rsize)*sizeof(T))
deleteT(piv_data, piv_size);
dealloc();
//deleteRaw(piv_tdata);
_reset();
//printf("}~\n");
}
inline PIVector<T> & operator =(const PIVector<T> & other) {
@@ -182,9 +177,8 @@ public:
inline PIVector<T> & clear() {resize(0); return *this;}
inline PIVector<T> & fill(const T & f = T()) {
//if (sizeof(T) == 1) memset(piv_data, f, piv_size);
deleteT(piv_data, piv_size);
//zeroRaw(piv_data, piv_size);
PIINTROSPECTION_CONTAINER_USED(T, piv_size*sizeof(T))
for (size_t i = 0; i < piv_size; ++i)
elementNew(piv_data + i, f);
return *this;
@@ -201,8 +195,7 @@ public:
if (new_size > piv_size) {
size_t os = piv_size;
alloc(new_size);
//if (sizeof(T) == 1) memset(&(piv_data[os]), f, ds);
//zeroRaw(&(piv_data[os]), new_size - os);
PIINTROSPECTION_CONTAINER_USED(T, (new_size-os)*sizeof(T))
for (size_t i = os; i < new_size; ++i)
elementNew(piv_data + i, f);
}
@@ -231,7 +224,7 @@ public:
size_t os = piv_size - index - 1;
memmove((void*)(&(piv_data[index + 1])), (const void*)(&(piv_data[index])), os * sizeof(T));
}
//zeroRaw(&(piv_data[index]), 1);
PIINTROSPECTION_CONTAINER_USED(T, sizeof(T))
elementNew(piv_data + index, v);
return *this;
}
@@ -273,7 +266,7 @@ public:
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); 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;
@@ -312,15 +305,12 @@ private:
return (1 << t);
}
inline void newT(T * dst, const T * src, size_t s) {
PIINTROSPECTION_CONTAINER_USED(T, s*sizeof(T))
for (size_t i = 0; i < s; ++i)
elementNew(dst + i, src[i]);
}
inline T * newRaw(size_t s) {
//cout << std::dec << " ![("<<this<<")newRaw " << s << " elements ... <\n" << endl;
//uchar * ret = new uchar[s * sizeof(T)];
uchar * ret = (uchar*)(malloc(s * sizeof(T)));//new uchar[];
//zeroRaw((T*)ret, s);
//cout << std::hex << " > (new 0x" << (llong)ret << ") ok]!" << endl;
return (T*)ret;
}
/*void reallocRawTemp(size_t s) {
@@ -328,24 +318,18 @@ private:
else piv_tdata = (T*)(realloc(piv_tdata, s * sizeof(T)));
}*/
inline void deleteT(T * d, size_t sz) {
//cout << " ~[("<<this<<")deleteT " << std::dec << sz << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T))
if ((uchar*)d != 0) {
for (size_t i = 0; i < sz; ++i)
elementDelete(d[i]);
//zeroRaw(d, sz);
}
//cout << " > ok]~" << endl;
}
inline void deleteRaw(T *& d) {
//cout << " ~[("<<this<<")deleteRaw " << std::dec << piv_rsize << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
if ((uchar*)d != 0) free((uchar*)d);
d = 0;
//cout << " > ok]~" << endl;
}
inline void zeroRaw(T * d, size_t s) {
//cout << " ~[("<<this<<")zeroRaw " << std::dec << s << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
if ((uchar*)d != 0) memset(d, 0, s*sizeof(T));
//cout << " > ok]~" << endl;
}
inline void elementNew(T * to, const T & from) {new(to)T(from);}
inline void elementDelete(T & from) {from.~T();}
@@ -355,19 +339,15 @@ private:
piv_size = new_size;
return;
}
//int os = piv_size;
piv_size = new_size;
size_t as = asize(new_size);
if (as == piv_rsize) return;
//if(as > 1000) piCout << "too much vector size" << new_size << as;
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-piv_rsize)*sizeof(T))
//cout << std::hex << " ![("<<this<<")realloc " << piv_data << " data ... <\n" << endl;
T * p_d = (T*)(realloc((void*)(piv_data), as*sizeof(T)));
assert(p_d);
piv_data = p_d;
//zeroRaw(&(piv_data[os]), as - os);
piv_rsize = as;
//cout << std::hex << " > (new 0x" << (llong)piv_data << ") ok]!" << endl;
/*piv_rsize = as;
T * pd = newRaw(piv_rsize);
if (os > 0 && piv_data != 0) {
@@ -434,13 +414,14 @@ __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) {memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \
template<> inline void PIVector<T>::deleteT(T * d, size_t sz) {;} \
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>::elementNew(T * to, const T & from) {(*to) = from;} \
template<> inline void PIVector<T>::elementDelete(T & from) {;} \
template<> inline PIVector<T> & PIVector<T>::_resizeRaw(size_t new_size) {alloc(new_size); return *this;} \
template<> inline PIVector<T> & PIVector<T>::clear() {piv_size = 0; return *this;} \
template<> inline PIVector<T> & PIVector<T>::assign(size_t new_size, const T & f) {_resizeRaw(new_size); return fill(f);}
template<> inline PIVector<T> & PIVector<T>::clear() {PIINTROSPECTION_CONTAINER_UNUSED(T, piv_size*sizeof(T)); piv_size = 0; return *this;} \
template<> inline PIVector<T> & PIVector<T>::assign(size_t new_size, const T & f) {\
_resizeRaw(new_size); return fill(f);}
#else