Marcus Lindblom wrote:
> I also understand that the parent logic makes that hard to do. (Unless
> you'd create a temporary wrapper object with an internal parent pointer,
> which I suspect has it's own set of issues).
Just to clarify how this wrapper could work:
tempalte<class P>
class CPtrWrap:
private std::vector<P>
{
typedef typename P::value_type value_type; // value_type is c-ptr
void insert(iterator where, value_type value) { ... }
... wrap everything
};
typedef CPtrWrap<Node, InternalNodeRefPtr> MFNodes;
class MFNodesWithParent // or a template
{
Node * m_parent;
MFNodes * m_nodes;
void push_back(Node* child) {
m_nodes.push_back(child);
child->setParent(m_parent);
}
class const_iterator;
// no mutable iterator, or an iterator with a proxy-reference object
that does addChild() on assignment
... all stl-container required functions
}
class Node
{
MFNodes m_nodes;
MFNodesWithParent getNodes() {
return MFNodesWithParent(this, m_nodes);
}
? getNodes() const; // this one could return 'const MFNodes&'
};
What might cause problems is that getNodes returns a container-ref
object by value, and users might not expect this. Mostly I'd expect
issues with rvalue references, but that can be worked around.
It might not be that hard, just a lot of typing to wrap everything.
Cheers,
/Marcus
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core