doc ru, printf() before assert in containers
This commit is contained in:
@@ -440,6 +440,11 @@ public:
|
||||
}
|
||||
inline PIDeque<T> & insert(size_t index, const PIDeque<T> & other) {
|
||||
if (other.isEmpty()) return *this;
|
||||
#ifdef USE_DEBUG
|
||||
if (&other == this) {
|
||||
printf("error with PIDeque<%s>::insert\n", __PIP_TYPENAME__(T));
|
||||
}
|
||||
#endif
|
||||
assert(&other != this);
|
||||
bool dir = pid_rsize <= 2 ? true : (index >= pid_rsize / 2 ? true : false);
|
||||
if (dir) {
|
||||
@@ -544,6 +549,11 @@ public:
|
||||
inline PIDeque<T> & append(const T & e) {return push_back(e);}
|
||||
inline PIDeque<T> & append(T && e) {return push_back(std::move(e));}
|
||||
inline PIDeque<T> & append(const PIDeque<T> & v) {
|
||||
#ifdef USE_DEBUG
|
||||
if (&v == this) {
|
||||
printf("error with PIDeque<%s>::append\n", __PIP_TYPENAME__(T));
|
||||
}
|
||||
#endif
|
||||
assert(&v != this);
|
||||
size_t ps = pid_size;
|
||||
alloc(pid_size + v.pid_size, true);
|
||||
@@ -615,6 +625,11 @@ public:
|
||||
inline PIDeque<PIDeque<T>> reshape(size_t rows, size_t cols, int order = byRow) const {
|
||||
PIDeque<PIDeque<T>> ret;
|
||||
if (isEmpty()) return ret;
|
||||
#ifdef USE_DEBUG
|
||||
if (rows*cols != pid_size) {
|
||||
printf("error with PIDeque<%s>::reshape\n", __PIP_TYPENAME__(T));
|
||||
}
|
||||
#endif
|
||||
assert(rows*cols == pid_size);
|
||||
ret.resize(rows);
|
||||
if (order == byRow) {
|
||||
@@ -762,6 +777,11 @@ private:
|
||||
if (as != pid_rsize) {
|
||||
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize))
|
||||
T * p_d = (T*)(realloc((void*)(pid_data), as*sizeof(T)));
|
||||
#ifdef USE_DEBUG
|
||||
if (!p_d) {
|
||||
printf("error with PIDeque<%s>::alloc\n", __PIP_TYPENAME__(T));
|
||||
}
|
||||
#endif
|
||||
assert(p_d);
|
||||
pid_data = p_d;
|
||||
pid_rsize = as;
|
||||
|
||||
@@ -208,6 +208,11 @@ public:
|
||||
const T at(const Key & key) const {return (*this)[key];}
|
||||
|
||||
PIMap<Key, T> & operator <<(const PIMap<Key, T> & other) {
|
||||
#ifdef USE_DEBUG
|
||||
if (&other == this) {
|
||||
printf("error with PIMap<%s, %s>::<<\n", __PIP_TYPENAME__(Key), __PIP_TYPENAME__(T));
|
||||
}
|
||||
#endif
|
||||
assert(&other != this);
|
||||
if (other.isEmpty()) return *this;
|
||||
if (other.size() == 1) {insert(other.pim_index[0].key, other.pim_content[0]); return *this;}
|
||||
|
||||
@@ -1199,6 +1199,11 @@ public:
|
||||
//! \~\sa \a append(), \a prepend(), \a remove()
|
||||
inline PIVector<T> & insert(size_t index, const PIVector<T> & v) {
|
||||
if (v.isEmpty()) return *this;
|
||||
#ifdef USE_DEBUG
|
||||
if (&v == this) {
|
||||
printf("error with PIVector<%s>::insert\n", __PIP_TYPENAME__(T));
|
||||
}
|
||||
#endif
|
||||
assert(&v != this);
|
||||
ssize_t os = piv_size - index;
|
||||
alloc(piv_size + v.piv_size);
|
||||
@@ -1385,6 +1390,11 @@ public:
|
||||
}
|
||||
|
||||
inline PIVector<T> & push_back(const PIVector<T> & v) {
|
||||
#ifdef USE_DEBUG
|
||||
if (&v == this) {
|
||||
printf("error with PIVector<%s>::push_back\n", __PIP_TYPENAME__(T));
|
||||
}
|
||||
#endif
|
||||
assert(&v != this);
|
||||
size_t ps = piv_size;
|
||||
alloc(piv_size + v.piv_size);
|
||||
@@ -1485,6 +1495,11 @@ public:
|
||||
inline PIVector<PIVector<T>> reshape(size_t rows, size_t cols, ReshapeOrder order = byRow) const {
|
||||
PIVector<PIVector<T>> ret;
|
||||
if (isEmpty()) return ret;
|
||||
#ifdef USE_DEBUG
|
||||
if (rows*cols != piv_size) {
|
||||
printf("error with PIVector<%s>::reshape\n", __PIP_TYPENAME__(T));
|
||||
}
|
||||
#endif
|
||||
assert(rows*cols == piv_size);
|
||||
ret.resize(rows);
|
||||
if (order == byRow) {
|
||||
@@ -1609,6 +1624,11 @@ private:
|
||||
if (as == piv_rsize) return;
|
||||
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-piv_rsize))
|
||||
T * p_d = (T*)(realloc((void*)(piv_data), as*sizeof(T)));
|
||||
#ifdef USE_DEBUG
|
||||
if (!p_d) {
|
||||
printf("error with PIVector<%s>::alloc\n", __PIP_TYPENAME__(T));
|
||||
}
|
||||
#endif
|
||||
assert(p_d);
|
||||
piv_data = p_d;
|
||||
piv_rsize = as;
|
||||
|
||||
Reference in New Issue
Block a user