Now i have a problem using it in a structure like a tree. A node should have a link to it's parent and an array to it's childs.
My Node class looks similar to the following
Code: Select all
class Node {
shared_ptr _parent;
dyn_anytype _childs;
public void appendChild(shared_ptr theChild) {
dynAppend(_childs, theChild); // works as expected
theChild._parent = this; // does not work, because this is of type Node and not of type shared_ptr
}Another thing is, if i have a super class AbstractNode and Node is a subclass of it, i am not able to write the following
Code: Select all
shared_pointer foo;
shared_pointer bar = new Node(...)
foo = bar; // does not workIt would be very nice it shared_ptr could behave like covariant c++ std::shared_ptr.