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

This commit is contained in:
2019-06-25 12:05:22 +00:00
parent 17b37409d5
commit 6c7c81559c
3 changed files with 30 additions and 18 deletions

View File

@@ -324,16 +324,12 @@ private:
elementDelete(d[i]);
}
}
inline void deleteRaw(T *& d) {
if ((uchar*)d != 0) free((uchar*)d);
d = 0;
}
inline 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(piv_data);}
inline void dealloc() {
if ((uchar*)piv_data != 0) free((uchar*)piv_data);
piv_data = 0;
}
inline void alloc(size_t new_size) {
if (new_size <= piv_rsize) {
piv_size = new_size;
@@ -418,10 +414,18 @@ __PIVECTOR_SIMPLE_FUNCTIONS__(ldouble)*/
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>::_resizeRaw(size_t new_size) { \
if (new_size > piv_size) { \
PIINTROSPECTION_CONTAINER_USED(T, (new_size-piv_size)*sizeof(T)); \
} \
if (new_size < piv_size) { \
PIINTROSPECTION_CONTAINER_UNUSED(T, (piv_size-new_size)*sizeof(T)); \
} \
alloc(new_size); \
return *this; \
} \
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);}
template<> inline PIVector<T> & PIVector<T>::assign(size_t new_size, const T & f) {_resizeRaw(new_size); return fill(f);}
#else