Skip to content

Commit b836eb1

Browse files
N-Dekkerhjmjohnson
authored andcommitted
STYLE: Use MakeFilled in Filled member functions FixedArray, Index, Size
1 parent b7715b3 commit b836eb1

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

Modules/Core/Common/include/itkFixedArray.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define itkFixedArray_h
2020

2121
#include "itkMacro.h"
22+
#include "itkMakeFilled.h"
2223
#include <algorithm>
2324
#include <array>
2425

@@ -423,12 +424,7 @@ class ITK_TEMPLATE_EXPORT FixedArray
423424
static constexpr FixedArray
424425
Filled(const ValueType & value)
425426
{
426-
FixedArray result{};
427-
for (ValueType & element : result.m_InternalArray)
428-
{
429-
element = value;
430-
}
431-
return result;
427+
return MakeFilled<FixedArray>(value);
432428
}
433429
};
434430

Modules/Core/Common/include/itkIndex.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#ifndef itkIndex_h
1919
#define itkIndex_h
2020

21+
#include "itkMakeFilled.h"
2122
#include "itkOffset.h"
2223
#include <type_traits> // For is_integral.
2324

@@ -484,12 +485,7 @@ struct ITK_TEMPLATE_EXPORT Index final
484485
static constexpr Self
485486
Filled(const IndexValueType value)
486487
{
487-
Self result{};
488-
for (IndexValueType & indexValue : result.m_InternalArray)
489-
{
490-
indexValue = value;
491-
}
492-
return result;
488+
return MakeFilled<Self>(value);
493489
}
494490

495491

Modules/Core/Common/include/itkSize.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "itkIntTypes.h"
2222
#include "itkMacro.h"
23+
#include "itkMakeFilled.h"
2324
#include <algorithm> // For copy_n.
2425
#include <type_traits> // For is_integral.
2526
#include <memory>
@@ -406,12 +407,7 @@ struct ITK_TEMPLATE_EXPORT Size final
406407
static constexpr Self
407408
Filled(const SizeValueType value)
408409
{
409-
Self result{};
410-
for (SizeValueType & sizeValue : result.m_InternalArray)
411-
{
412-
sizeValue = value;
413-
}
414-
return result;
410+
return MakeFilled<Self>(value);
415411
}
416412

417413
}; //------------ End struct Size

0 commit comments

Comments
 (0)