Skip to content

Commit

Permalink
STYLE: Use conventional const notation
Browse files Browse the repository at this point in the history
As recommended by the CppCoreGuidelines:
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rl-const

Place `const` qualifier before type name to be consistent
across the toolkit. Conventional notation is more familiar to more
programmers.
  • Loading branch information
hjmjohnson committed Dec 5, 2024
1 parent 6450e69 commit 6533a96
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
9 changes: 8 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,14 @@ PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Middle
PPIndentWidth: -1
QualifierAlignment: Leave
QualifierAlignment: Custom
QualifierOrder:
- static
- inline
- friend
- constexpr
- const
- type
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
Expand Down
9 changes: 8 additions & 1 deletion Examples/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,14 @@ PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Middle
PPIndentWidth: -1
QualifierAlignment: Leave
QualifierAlignment: Custom
QualifierOrder:
- static
- inline
- friend
- constexpr
- const
- type
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/test/itkSmartPointerTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class itkTestObject
}
}
inline friend std::ostream &
operator<<(std::ostream & os, itkTestObject const & o)
operator<<(std::ostream & os, const itkTestObject & o)
{
os << "itkTestObject " << (const void *)&o << ' ' << o.m_ReferenceCount;
return os;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class ITK_TEMPLATE_EXPORT ImageToImageMetric : public SingleValuedCostFunction

~FixedImageSamplePoint() = default;

friend inline std::ostream &
inline friend std::ostream &
operator<<(std::ostream & os, const FixedImageSamplePoint & val)
{
os << "point: " << static_cast<typename NumericTraits<FixedImagePointType>::PrintType>(val.point) << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class ImageVoxel
m_Value = val;
}

friend inline std::ostream &
inline friend std::ostream &
operator<<(std::ostream & os, const ImageVoxel & val)
{
os << "Vpos: " << val.m_Vpos << std::endl;
Expand Down

0 comments on commit 6533a96

Please sign in to comment.