lizh06 / ticpp

Automatically exported from code.google.com/p/ticpp
0 stars 0 forks source link

Iterator problems in for loop #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 simmo.s...@gmail.com on 17 Feb 2011 at 4:31