lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re[4]: [lmi] Why does this crash?


From: Vaclav Slavik
Subject: Re: Re[4]: [lmi] Why does this crash?
Date: Wed, 21 Apr 2010 12:02:49 +0200

On Tue, 2010-04-20 at 23:06 +0200, Vadim Zeitlin wrote:
> I don't know libxml API really well but why do we need dynamic
> allocation, couldn't we simply store the pointer to xml::node itself
> directly in _private? I'm probably missing something obvious here...

Well, it's of no use storing a pointer to no-stack xml::node here, is
it? That would be useful for libxml callbacks and such (which xmlwrapp
doesn't need now), but not if I want to keep a copy of xml::node
corresponding to xmlNode for its entire lifetime.

I want xml::node::begin() to return iterator that always points to the
same xml::node instance. To achieve this, I must _have_ that instance
somewhere, and it can't be on stack, obviously. So I have to either have
m_children vector in xml::node (this means dynamic allocation too) or
allocate xml::node on demand and store it with xmlNode.

Vaclav





reply via email to

[Prev in Thread] Current Thread [Next in Thread]