Replace auto_ptr with unique_ptr in XPath compiler

This commit is contained in:
Jez Higgins 2020-04-15 23:20:50 +01:00
parent 6674947a12
commit 36b3cd8a76

View file

@ -219,8 +219,8 @@ public:
Axis axis,
bool is_attr = false)
{
std::auto_ptr<NodeTest<string_type, string_adaptor> > test(getTest(node, end, !is_attr ? axis : ATTRIBUTE, context.namespaceContext()));
std::auto_ptr<XPathExpression_impl<string_type, string_adaptor> > thing;
std::unique_ptr<NodeTest<string_type, string_adaptor> > test(getTest(node, end, !is_attr ? axis : ATTRIBUTE, context.namespaceContext()));
std::unique_ptr<XPathExpression_impl<string_type, string_adaptor> > thing;
if(test.get() == 0)
thing.reset(XPath<string_type, string_adaptor>::compile_expression(node++, end, context));
@ -489,14 +489,14 @@ public:
const ExecutionContext<string_type, string_adaptor>& executionContext) const
{
NodeSet<string_type, string_adaptor> ns;
NodeSet<string_type, string_adaptor> nodes = expr_->evaluate(context, executionContext).asNodeSet();
for(typename NodeSet<string_type, string_adaptor>::const_iterator n = nodes.begin(), ne = nodes.end(); n != ne; ++n)
if(context == *n)
{
ns.push_back(context);
break;
} // if ...
NodeSet<string_type, string_adaptor> nodes = expr_->evaluate(context, executionContext).asNodeSet();
for(typename NodeSet<string_type, string_adaptor>::const_iterator n = nodes.begin(), ne = nodes.end(); n != ne; ++n)
if(context == *n)
{
ns.push_back(context);
break;
} // if ...
return XPathValue<string_type, string_adaptor>(new NodeSetValue<string_type, string_adaptor>(ns));
} // evaluate