diff options
author | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-05-02 15:38:09 +0000 |
---|---|---|
committer | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-05-02 15:38:09 +0000 |
commit | a9a537ad4024fe5011d38ce6ae2160081c361285 (patch) | |
tree | 0bf8382389a94be395ba3bbfc2e0572869362f23 /src/pugixml.cpp | |
parent | a50f47f8056ffbb5fc52f2db07858c7dcd511d2e (diff) |
Iterator improvements: safety assertions in xml_named_node_iterator, const_cast workaround for BCC32 bugv1.2
git-svn-id: http://pugixml.googlecode.com/svn/trunk@915 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r-- | src/pugixml.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 7dadede..4035ab1 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4928,7 +4928,7 @@ namespace pugi PUGI__FN xml_node* xml_node_iterator::operator->() const { assert(_wrap._root); - return &_wrap; + return const_cast<xml_node*>(&_wrap); // BCC32 workaround } PUGI__FN const xml_node_iterator& xml_node_iterator::operator++() @@ -4989,7 +4989,7 @@ namespace pugi PUGI__FN xml_attribute* xml_attribute_iterator::operator->() const { assert(_wrap._attr); - return &_wrap; + return const_cast<xml_attribute*>(&_wrap); // BCC32 workaround } PUGI__FN const xml_attribute_iterator& xml_attribute_iterator::operator++() @@ -5039,16 +5039,19 @@ namespace pugi PUGI__FN xml_node& xml_named_node_iterator::operator*() const { + assert(_node._root); return _node; } PUGI__FN xml_node* xml_named_node_iterator::operator->() const { - return &_node; + assert(_node._root); + return const_cast<xml_node*>(&_node); // BCC32 workaround } PUGI__FN const xml_named_node_iterator& xml_named_node_iterator::operator++() { + assert(_node._root); _node = _node.next_sibling(_name); return *this; } |