Skip to content

Commit 19a96aa

Browse files
authored
Merge pull request #5824 from N-Dekker/Replace-push_back-with-emplace_back
STYLE: Replace `push_back(T(a, b, c))` with `emplace_back(a, b, c)`
2 parents 9eb7bc6 + 289f59e commit 19a96aa

8 files changed

Lines changed: 15 additions & 15 deletions

File tree

Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ QuadEdgeMeshFrontBaseIterator<TMesh, TQE>::QuadEdgeMeshFrontBaseIterator(MeshTyp
4747
}
4848
}
4949
m_Front = new FrontType;
50-
m_Front->push_back(FrontAtom(seed, 0));
50+
m_Front->emplace_back(seed, 0);
5151
m_IsPointVisited = IsVisitedContainerType::New();
5252
m_IsPointVisited->SetElement(seed->GetOrigin(), true);
5353
m_IsPointVisited->SetElement(seed->GetDestination(), true);
@@ -107,7 +107,7 @@ QuadEdgeMeshFrontBaseIterator<TMesh, TQE>::operator++()
107107
const CoordinateType oCost = this->GetCost(oEdge) + fit->m_Cost;
108108

109109
// Push the Sym() on the front:
110-
m_Front->push_back(FrontAtom(oEdge->GetSym(), oCost));
110+
m_Front->emplace_back(oEdge->GetSym(), oCost);
111111

112112
// We still want to handle oEdge
113113
m_CurrentEdge = oEdge;

Modules/Filtering/ImageLabel/include/itkBinaryContourImageFilter.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ BinaryContourImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData
158158
++outLineIt;
159159
}
160160
// create the run length object to go in the vector
161-
fgLine.push_back(RunLength(length, thisIndex));
161+
fgLine.emplace_back(length, thisIndex);
162162
}
163163
else
164164
{
@@ -174,7 +174,7 @@ BinaryContourImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData
174174
++outLineIt;
175175
}
176176
// create the run length object to go in the vector
177-
bgLine.push_back(RunLength(length, thisIndex));
177+
bgLine.emplace_back(length, thisIndex);
178178
}
179179
}
180180

Modules/Filtering/LabelMap/include/itkLabelObject.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ LabelObject<TLabel, VImageDimension>::RemoveIndex(const IndexType & idx)
135135
IndexType newIdx = idx;
136136
++newIdx[0];
137137
const LengthType newLength = orgLineLength - it->GetLength() - 1;
138-
m_LineContainer.push_back(LineType(newIdx, newLength));
138+
m_LineContainer.emplace_back(newIdx, newLength);
139139
return true;
140140
}
141141
}

Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilter.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,12 @@ LaplacianDeformationQuadEdgeMeshFilter<TInputMesh, TOutputMesh, TSolverTraits>::
255255
w *= t.m_Weight;
256256
ww -= w;
257257

258-
todo.push_back(Triple(temp->GetDestination(), w, degree - 1));
258+
todo.emplace_back(temp->GetDestination(), w, degree - 1);
259259

260260
temp = temp->GetOnext();
261261
} while (temp != qe);
262262

263-
todo.push_back(Triple(vId, ww, degree - 1));
263+
todo.emplace_back(vId, ww, degree - 1);
264264
}
265265
}
266266
}

Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricWithIndexv4.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,10 +626,10 @@ const typename PointSetToPointSetMetricWithIndexv4<TFixedPointSet, TMovingPointS
626626
for (PointIdentifier p = 1; p < nWorkUnits; ++p)
627627
{
628628
const PointIdentifier endRange = (p * nPoints) / static_cast<double>(nWorkUnits);
629-
ranges.push_back(PointIdentifierPair(startRange, endRange));
629+
ranges.emplace_back(startRange, endRange);
630630
startRange = endRange;
631631
}
632-
ranges.push_back(PointIdentifierPair(startRange, nPoints));
632+
ranges.emplace_back(startRange, nPoints);
633633

634634
return ranges;
635635
}

Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.hxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ MultiLabelSTAPLEImageFilter<TInputImage, TOutputImage, TWeights>::AllocateConfus
104104
// the confusion matrix has as many rows as there are input labels, and
105105
// one more column to accommodate "reject" classifications by the combined
106106
// classifier.
107-
this->m_ConfusionMatrixArray.push_back(ConfusionMatrixType(static_cast<unsigned int>(this->m_TotalLabelCount) + 1,
108-
static_cast<unsigned int>(this->m_TotalLabelCount)));
109-
this->m_UpdatedConfusionMatrixArray.push_back(ConfusionMatrixType(
110-
static_cast<unsigned int>(this->m_TotalLabelCount) + 1, static_cast<unsigned int>(this->m_TotalLabelCount)));
107+
this->m_ConfusionMatrixArray.emplace_back(static_cast<unsigned int>(this->m_TotalLabelCount) + 1,
108+
static_cast<unsigned int>(this->m_TotalLabelCount));
109+
this->m_UpdatedConfusionMatrixArray.emplace_back(static_cast<unsigned int>(this->m_TotalLabelCount) + 1,
110+
static_cast<unsigned int>(this->m_TotalLabelCount));
111111
}
112112
}
113113

Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionComputeIterationThreader.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ LevelSetEvolutionComputeIterationThreader<
192192

193193
const auto temp_update = static_cast<LevelSetOutputType>(termContainer->Evaluate(inputIndex, characteristics));
194194

195-
this->m_NodePairsPerThread[threadId].push_back(NodePairType(levelsetIndex, temp_update));
195+
this->m_NodePairsPerThread[threadId].emplace_back(levelsetIndex, temp_update);
196196

197197
++listIt;
198198
}

Modules/Video/Filtering/include/itkFrameAverageVideoFilter.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ FrameAverageVideoFilter<TInputVideoStream, TOutputVideoStream>::ThreadedGenerate
114114
std::vector<IterType> inputIters;
115115
for (SizeValueType i = inputStart; i < inputStart + numFrames; ++i)
116116
{
117-
inputIters.push_back(IterType(input->GetFrame(i), outputRegionForThread));
117+
inputIters.emplace_back(input->GetFrame(i), outputRegionForThread);
118118
}
119119

120120
// Get the output frame and its iterator

0 commit comments

Comments
 (0)