Glas :Re: [glas] Reference counting? |
From: Pieter Collins (Pieter.Collins_at_[hidden])
Date: 2007-10-15 05:31:48
I think that a general-purpose package needs to provide vector/matrix
classes taylored to various uses. An application using many 3d vectors
will have very different requirements (fast allocation/deallocation,
efficient storage) to an application using 1000x1000 matrices (efficient
manipulation using views/slices).
As I see it, reference counting will improve safety and may allow
storage and slicing to be implemented by the same class, but does not
introduce extra mathematical functionality. The expense is probably
worth it for large objects, but not for small objects.
Regarding the copy semantics, how about introducing a new concept
"VectorView" which uses shallow copies to complement "VectorContainer"
which uses deep copies? It seems like this concept is sufficiently
important to be worth adding, though I generally think it's important to
keep the number of different concepts to a minimum.
Presumably it would be possible to separate storage (including reference
counting) from the rest of the code by using an array template argument
similar to uBlas.
Regards,
Pieter
-- Dr. Pieter Collins Centrum voor Wiskunde en Informatica Postbus 94079 1090 GB Amsterdam The Netherlands Tel: +31 20 5924196 Fax: +31 20 5924199 Email: Pieter.Collins_at_[hidden]