// Serialize each struct
s << "auto " << param->GetName() + "_bytes = std::make_shared<std::vector<uint8_t>>();";
s << param->GetName() + "_bytes->reserve(" << param->GetName() << "[i]->size());";
- s << "auto " << param->GetName() + "_reparsed = std::make_unique<" << struct_type << ">();";
s << "BitInserter " << param->GetName() + "_bi(*" << param->GetName() << "_bytes);";
s << param->GetName() << "[i]->Serialize(" << param->GetName() << "_bi);";
// Parse it again
s << "auto " << param->GetName() << "_view = PacketView<kLittleEndian>(" << param->GetName() << "_bytes);";
- s << "auto result = Parse" << struct_type << "(" << param->GetName() + "_view.begin());";
+ s << param->GetElementField()->GetDataType() << " " << param->GetName() << "_reparsed = ";
+ s << "Parse" << struct_type << "(" << param->GetName() + "_view.begin());";
// Push it into a new container
if (param->GetFieldType() == VectorField::kFieldType) {
s << move_only_param_name << ".push_back(std::move(" << param->GetName() + "_reparsed));";
} else if (param->GetFieldType() == ArrayField::kFieldType) {
- s << move_only_param_name << "[i] = " << param->GetName() << "_reparsed;";
+ s << move_only_param_name << "[i] = std::move(" << param->GetName() << "_reparsed);";
} else {
ERROR() << param << " is not supported by Pybind11";
}