Implemented deep copyonwrite() for nested types

This commit is contained in:
2021-05-23 10:28:10 +02:00
parent 88628fb306
commit 80eb98411f
5 changed files with 55 additions and 5 deletions

View File

@@ -152,7 +152,20 @@ void SparseMat<T>::copyonwrite(bool detachonly)
count = new int; *count=1;
if(!list) laerror("empty list with count>1");
unsort();
if(!detachonly) copylist(list);
if(!detachonly)
{
copylist(list);
if(!LA_traits<T>::is_plaindata()) //nested copyonwrite
{
matel<T> *l =list;
while(l)
{
LA_traits<T>::copyonwrite(l->elem);
l=l->next;
}
}
}
}
}