#include "math_iter.h"
#include "math_inset.h"
-// Is this still needed? (Lgb)
+#include "support/LOstream.h"
+
+using std::ostream;
+using std::endl;
+
static inline
void * my_memcpy(void * ps_in, void const * pt_in, size_t n)
{
last_ = array.last_;
// deep copy
- // we'll not yet get exeption safety
+ deep_copy();
+}
+
+void MathedArray::deep_copy()
+{
MathedIter it(this);
while (it.OK()) {
if (it.IsInset()) {
MathedInset * inset = it.GetInset();
inset = inset->Clone();
- raw_pointer_insert(inset, it.getPos() + 1, sizeof(inset));
+ raw_pointer_insert(inset, it.getPos() + 1);
}
it.Next();
}
a.last(dx);
a[dx] = '\0';
- MathedIter it(&a);
- it.Reset();
-
- while (it.OK()) {
- if (it.IsInset()) {
- MathedInset * inset = it.GetInset();
- inset = inset->Clone();
- a.raw_pointer_insert(inset, it.getPos() + 1, sizeof(inset));
- }
- it.Next();
- }
swap(a);
+ deep_copy();
}
}
#else
-void MathedArray::raw_pointer_insert(void * p, int pos, int len)
+void MathedArray::raw_pointer_insert(void * p, int pos)
{
- my_memcpy(&bf_[pos], &p, len);
+ my_memcpy(&bf_[pos], &p, sizeof(p));
}
#endif