Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Iterator problems in for loop #63

Open
GoogleCodeExporter opened this issue Mar 17, 2015 · 0 comments
Open

Iterator problems in for loop #63

GoogleCodeExporter opened this issue Mar 17, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

This code works like it should (from the beginner example):
ticpp::Iterator<ticpp::Element> child;
for(child = child.begin(doc.FirstChildElement()); child != child.end(); child++)
or
ticpp::Iterator<ticpp::Element> child;
for(child = child.begin(doc.FirstChildElement()); child != child.end(); ++child)

Now I get SIGSEGV when I want to do it like this:
for(ticpp::Iterator<ticpp::Element> child = 
child.begin(doc.FirstChildElement()); child != child.end(); child++)

Loop ends immediately when I change the iteration:
for(ticpp::Iterator<ticpp::Element> child = 
child.begin(doc.FirstChildElement()); child != child.end(); ++child)

I'm using Code::Blocks on Windows. Although it can be worked around it still is 
quite annoying when you are used to the STL iterators (like in the last 
example).

Original issue reported on code.google.com by [email protected] on 17 Feb 2011 at 4:31

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant