Skip to content

Commit d15674d

Browse files
authored
Merge pull request #54 from awslabs/FB-ListGenerator
Fix assignment operator to not add empty elements to the beginning of the list during json deserialization
2 parents 10a5722 + 08c8480 commit d15674d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/json/ModelInternalMapOrListJsonDeserializer.vm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
#end
6262
#if($template.recursionDepth > 1)
6363
#set($template.containerVar = ${template.lowerCaseVarName} + "List")
64-
${template.currentSpaces}Aws::Vector<${CppViewHelper.computeCppType($template.currentShape.listMember.shape)}> ${template.lowerCaseVarName}List((size_t)${template.lowerCaseVarName}JsonList.GetLength());
64+
${template.currentSpaces}Aws::Vector<${CppViewHelper.computeCppType($template.currentShape.listMember.shape)}> ${template.lowerCaseVarName}List;
65+
${template.currentSpaces}${template.lowerCaseVarName}List.reserve((size_t)${template.lowerCaseVarName}JsonList.GetLength());
6566
#end
6667
${template.currentSpaces}for(unsigned ${template.lowerCaseVarName}Index = 0; ${template.lowerCaseVarName}Index < ${template.lowerCaseVarName}JsonList.GetLength(); ++${template.lowerCaseVarName}Index)
6768
${template.currentSpaces}{

0 commit comments

Comments
 (0)