Currently from the user perspective, the assignment operator works differently for smart pointers and non-smart pointers. Right now,
a = b
will, if the type is not a smart pointer:
If a is uninitialized: create a "copy" [via copy constructor] of b;
Otherwise, assign b's contents to a, so that existing pointers to a will also have their values updated.
or if the type is a smart pointer:
Make a a new shared pointer indistinguishable from b, whether or not a is assigned.
After trying @tjfulle's suggestion of "they should behave like standard fortran objects" so that assignment copies the data, I'm thinking that instead we should have them behave as derived types that hold pointers to another class. This would make it far easier to implement consistent and complete assignment semantics.
Currently from the user perspective, the assignment operator works differently for smart pointers and non-smart pointers. Right now,
will, if the type is not a smart pointer:
a
is uninitialized: create a "copy" [via copy constructor] ofb
;b
's contents toa
, so that existing pointers toa
will also have their values updated. or if the type is a smart pointer:a
a new shared pointer indistinguishable fromb
, whether or nota
is assigned.After trying @tjfulle's suggestion of "they should behave like standard fortran objects" so that assignment copies the data, I'm thinking that instead we should have them behave as derived types that hold pointers to another class. This would make it far easier to implement consistent and complete assignment semantics.