From 369fe1f7f9f3a424ee3cf8f992c3128db27fa479 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 27 Mar 2017 16:03:43 -0700 Subject: Remove CFX_ArrayTemplate in CXFA_ValueArray Change-Id: I68f317b9fb9b162a5d99cdacc619c85f96a5bf52 Reviewed-on: https://pdfium-review.googlesource.com/3239 Commit-Queue: dsinclair Reviewed-by: dsinclair --- xfa/fxfa/parser/cxfa_valuearray.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_valuearray.cpp') diff --git a/xfa/fxfa/parser/cxfa_valuearray.cpp b/xfa/fxfa/parser/cxfa_valuearray.cpp index 1170010139..eded624c36 100644 --- a/xfa/fxfa/parser/cxfa_valuearray.cpp +++ b/xfa/fxfa/parser/cxfa_valuearray.cpp @@ -6,20 +6,20 @@ #include "xfa/fxfa/parser/cxfa_valuearray.h" +#include + #include "xfa/fxfa/parser/cxfa_scriptcontext.h" CXFA_ValueArray::CXFA_ValueArray(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} -CXFA_ValueArray::~CXFA_ValueArray() { - for (int32_t i = 0; i < GetSize(); i++) - delete GetAt(i); -} +CXFA_ValueArray::~CXFA_ValueArray() {} std::vector CXFA_ValueArray::GetAttributeObject() { - std::vector objArray; - for (int32_t i = 0; i < GetSize(); i++) - objArray.push_back(CXFA_ScriptContext::ToObject(GetAt(i), nullptr)); - - return objArray; + std::vector result(m_Values.size()); + std::transform(m_Values.begin(), m_Values.end(), result.begin(), + [](const std::unique_ptr& value) { + return CXFA_ScriptContext::ToObject(value.get(), nullptr); + }); + return result; } -- cgit v1.2.3