Overview
Features
Download
Documentation
Community
Add-Ons & Services

AutoPtr to get the return value of DOMParser::parseString

Please post support and help requests here.

AutoPtr to get the return value of DOMParser::parseString

Postby ymjzxw » 25 Apr 2012, 08:24

According to the ParserWriterTest.cpp of Poco:
AutoPtr<Document> pDoc = parser.parseString(XHTML);
parseString() will new a Document object and return this to caller.
If this pointer was assigned to AutoPtr, this Document object will be de-constructed by caller, instead of Poco lib itself.

I don't think it is the correct usage. Since the Document object is built by "parser", it should be destroyed by "parser" too.
if it was assigned to a AutoPtr, after AutoPto leave its scope, it will be de-constructed automatically.

Am i right ?
ymjzxw
 
Posts: 1
Joined: 25 Apr 2012, 08:10

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron