Skip to content

Commit

Permalink
STYLE: Pass bool parameters by (const) value, not by const reference
Browse files Browse the repository at this point in the history
Removed the ampersand (`&`) from declarations of "in" (`const`) `bool`
parameters of non-virtual member functions.

Following C++ Core Guidelines, April 10, 2022, "For “in” parameters, pass
cheaply-copied types by value and others by reference to `const`":
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f16-for-in-parameters-pass-cheaply-copied-types-by-value-and-others-by-reference-to-const
  • Loading branch information
N-Dekker authored and hjmjohnson committed Jun 2, 2022
1 parent 0fcfaf1 commit c9a24b1
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshEulerOperatorJoinVertexFunction
* \return false else
*/
bool
IsFaceIsolated(QEType * e, const bool & iWasLeftFace, std::stack<TQEType *> & oToBeDeleted);
IsFaceIsolated(QEType * e, const bool iWasLeftFace, std::stack<TQEType *> & oToBeDeleted);

bool
IsSamosa(QEType * e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ QuadEdgeMeshEulerOperatorJoinVertexFunction<TMesh, TQEType>::ProcessIsolatedFace
template <typename TMesh, typename TQEType>
bool
QuadEdgeMeshEulerOperatorJoinVertexFunction<TMesh, TQEType>::IsFaceIsolated(QEType * e,
const bool & iWasLeftFace,
const bool iWasLeftFace,
std::stack<TQEType *> & oToBeDeleted)
{
bool border;
Expand Down
6 changes: 3 additions & 3 deletions Modules/Filtering/FFT/include/itkFFTWGlobalConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class ITKFFT_EXPORT FFTWGlobalConfiguration : public Object
* may be written to the cache file
*/
static void
SetNewWisdomAvailable(const bool & v);
SetNewWisdomAvailable(const bool v);
static bool
GetNewWisdomAvailable();

Expand Down Expand Up @@ -260,7 +260,7 @@ class ITKFFT_EXPORT FFTWGlobalConfiguration : public Object
* If true, will create a wisdom file in the location
*/
static void
SetReadWisdomCache(const bool & v);
SetReadWisdomCache(const bool v);
static bool
GetReadWisdomCache();

Expand All @@ -272,7 +272,7 @@ class ITKFFT_EXPORT FFTWGlobalConfiguration : public Object
* If true, will create a wisdom file in the location
*/
static void
SetWriteWisdomCache(const bool & v);
SetWriteWisdomCache(const bool v);
static bool
GetWriteWisdomCache();

Expand Down
6 changes: 3 additions & 3 deletions Modules/Filtering/FFT/src/itkFFTWGlobalConfiguration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ FFTWGlobalConfiguration::GetLockMutex()
}

void
FFTWGlobalConfiguration::SetNewWisdomAvailable(const bool & v)
FFTWGlobalConfiguration::SetNewWisdomAvailable(const bool v)
{
itkInitGlobalsMacro(PimplGlobals);
GetInstance()->m_NewWisdomAvailable = v;
Expand Down Expand Up @@ -781,7 +781,7 @@ FFTWGlobalConfiguration::SetPlanRigor(const std::string & name)
}

void
FFTWGlobalConfiguration::SetReadWisdomCache(const bool & v)
FFTWGlobalConfiguration::SetReadWisdomCache(const bool v)
{
itkInitGlobalsMacro(PimplGlobals);
GetInstance()->m_ReadWisdomCache = v;
Expand All @@ -799,7 +799,7 @@ FFTWGlobalConfiguration::GetReadWisdomCache()
}

void
FFTWGlobalConfiguration::SetWriteWisdomCache(const bool & v)
FFTWGlobalConfiguration::SetWriteWisdomCache(const bool v)
{
itkInitGlobalsMacro(PimplGlobals);
GetInstance()->m_WriteWisdomCache = v;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ class ITK_TEMPLATE_EXPORT FastMarchingQuadEdgeMeshFilterBase : public FastMarchi
const OutputVectorRealType & iF,
const NodeType & iId1,
const OutputPointType & iP1,
const bool & iIsFar1,
const bool iIsFar1,
const OutputVectorRealType iVal1,
const NodeType & iId2,
const OutputPointType & iP2,
const bool & iIsFar2,
const bool iIsFar2,
const OutputVectorRealType & iVal2) const;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ FastMarchingQuadEdgeMeshFilterBase<TInput, TOutput>::Solve(OutputMeshType *
const OutputVectorRealType & iF,
const NodeType & iId1,
const OutputPointType & iP1,
const bool & iIsFar1,
const bool iIsFar1,
const OutputVectorRealType iVal1,
const NodeType & iId2,
const OutputPointType & iP2,
const bool & iIsFar2,
const bool iIsFar2,
const OutputVectorRealType & iVal2) const
{
OutputVectorType Edge1 = iP1 - iCurrentPoint;
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/HDF5/src/itkHDF5ImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ doesAttrExist(const H5::H5Object & object, const char * const name)
} // namespace

void
HDF5ImageIO ::WriteScalar(const std::string & path, const bool & value)
HDF5ImageIO ::WriteScalar(const std::string & path, const bool value)
{
hsize_t numScalars(1);
H5::DataSpace scalarSpace(1, &numScalars);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class ITK_TEMPLATE_EXPORT ImageToNeighborhoodSampleAdaptor
GetRegion() const;

void
SetUseImageRegion(const bool & flag);
SetUseImageRegion(const bool flag);

/** Method to get UseImageRegion flag */
itkGetConstMacro(UseImageRegion, bool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ ImageToNeighborhoodSampleAdaptor<TImage, TBoundaryCondition>::GetRegion() const

template <typename TImage, typename TBoundaryCondition>
void
ImageToNeighborhoodSampleAdaptor<TImage, TBoundaryCondition>::SetUseImageRegion(const bool & flag)
ImageToNeighborhoodSampleAdaptor<TImage, TBoundaryCondition>::SetUseImageRegion(const bool flag)
{
if (flag != m_UseImageRegion)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class LevelSetContainer<TIdentifier, LevelSetDenseImage<TImage>>

/** Compute information from data object and/or allocate new level set image */
void
CopyInformationAndAllocate(const Self * iOther, const bool & iAllocate)
CopyInformationAndAllocate(const Self * iOther, const bool iAllocate)
{
LevelSetContainerType internalContainer = iOther->GetContainer();
LevelSetContainerConstIteratorType it = internalContainer.begin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ITK_TEMPLATE_EXPORT UpdateMalcolmSparseLevelSet : public Object
/** Update separately the zero layer for points with positive/negative update values
* Move points to -1 or +1 layers */
void
EvolveWithPhasedPropagation(LevelSetLayerType & ioList, LevelSetLayerType & ioUpdate, const bool & iContraction);
EvolveWithPhasedPropagation(LevelSetLayerType & ioList, LevelSetLayerType & ioUpdate, const bool iContraction);

/** Make sure the layers are of single pixel thickness only. This method is related
to the minimal interface function described in the original paper. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ template <unsigned int VDimension, typename TEquationContainer>
void
UpdateMalcolmSparseLevelSet<VDimension, TEquationContainer>::EvolveWithPhasedPropagation(LevelSetLayerType & ioList,
LevelSetLayerType & ioUpdate,
const bool & iContraction)
const bool iContraction)
{
itkAssertInDebugAndIgnoreInReleaseMacro(ioList.size() == ioUpdate.size());

Expand Down

0 comments on commit c9a24b1

Please sign in to comment.