Skip to content

Commit d93cec0

Browse files
Fixed unnecessary temporary object using emplace
1 parent e574dc9 commit d93cec0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/algorithms/StatePreparation.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ gatesToUncompute(std::vector<std::complex<double>>& amplitudes,
230230
// qubit directly the controls are collected and then newly set
231231
qc::Controls newControls;
232232
for (const auto& control : op->getControls()) {
233-
newControls.emplace(
234-
qc::Control{control.qubit + static_cast<Qubit>(i)});
233+
newControls.emplace(control.qubit + static_cast<Qubit>(i));
235234
}
236235
op->setControls(newControls);
237236
}
@@ -252,8 +251,7 @@ gatesToUncompute(std::vector<std::complex<double>>& amplitudes,
252251
// qubit directly the controls are collected and then newly set
253252
qc::Controls newControls;
254253
for (const auto& control : op->getControls()) {
255-
newControls.emplace(
256-
qc::Control{control.qubit + static_cast<Qubit>(i)});
254+
newControls.emplace(control.qubit + static_cast<Qubit>(i));
257255
}
258256
op->setControls(newControls);
259257
}

0 commit comments

Comments
 (0)