lizh06 / ticpp

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

ticpp::Iterator<T>.begin( Doc.FirstChildElement() ) does not return the same pointer value #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

This is a code snippet:

    ticpp::Document Doc( XmlFilePath );
    Doc.LoadFile();
    ticpp::Element* RootElem = Doc.FirstChildElement();

    ticpp::Iterator< Element > Child;
    Child = Child.begin(RootElem);

    ticpp::Element* Begin2 = Child.begin(RootElem);

    if( Child == Begin2 ) {
        //We should always go in this block !!!
        //<code />
    }

What is the expected output? What do you see instead?
The comparison should return true, but it returns false instead.
I believe the begin method returns a different T pointer for the same Node*
parent parameter.

___

What version of the product are you using? On what operating system?

ticpp 2.5.3, windows XP SP2, vs2005, lib build /MDd /Od

___

Please provide any additional information below.

Thanks for your job! Best regards

Pierre 

Original issue reported on code.google.com by pierre.a...@gmail.com on 22 Feb 2008 at 11:29

GoogleCodeExporter commented 9 years ago
Well,

I think the problem comes from:
Node* Node::NodeFactory( .. ) which is called in the FirstChild method.
It instanciates a new temp Node*.

So definitively, Child.begin() can not return the same Element pointer.

IMHO, the iterator comparison operator should compare the m_tiXmlPointer member 
value?

Thank you

Original comment by pierre.a...@gmail.com on 22 Feb 2008 at 12:06

GoogleCodeExporter commented 9 years ago
rjmyst3,
What are your thoughts on the change suggested here? It seems like this is an
appropriate change. If so I can make this change.

Original comment by rpusz...@gmail.com on 26 Jun 2008 at 3:42

GoogleCodeExporter commented 9 years ago
It sounds like the right fix to me. Make sure that a comparison to 
Iterator<>.end()
still works properly.

Original comment by rjmy...@gmail.com on 26 Jun 2008 at 11:16

GoogleCodeExporter commented 9 years ago
svn r96

Original comment by rjmy...@gmail.com on 18 Jul 2008 at 1:38