Skip to content

Commit

Permalink
STYLE: Use trailing return type instead of typename in "*.h" files
Browse files Browse the repository at this point in the history
Did Notepad++ v8.4.8, Find in Files (Regular expression enabled):

    Find what: ^typename (\w+<.+>::)(.+)\r\n\1(.+)\r\n{\r\n
    Replace with: auto\r\n$1$3 -> $2\r\n{\r\n

    Find what: ^inline typename (\w+<.+>::)(.+)\r\n\1(.+)\r\n{\r\n
    Replace with: inline auto\r\n$1$3 -> $2\r\n{\r\n

Specifically for "itk*.h" files

In accordance with ITKSoftwareGuide pull request InsightSoftwareConsortium/ITKSoftwareGuide#162
commit InsightSoftwareConsortium/ITKSoftwareGuide@c64b23b
"ENH: Add "Trailing Return Types" section"

Follow-up to pull request #4026
commit f048a5b "STYLE: Use trailing return type
for declarations containing "inline""
  • Loading branch information
N-Dekker authored and hjmjohnson committed Apr 30, 2023
1 parent 1ee4cd8 commit c1628d5
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
Expand Up @@ -75,8 +75,8 @@ InOrderTreeIterator<TTreeType>::InOrderTreeIterator(TTreeType * tree, TreeNodeTy

/** Get the type of the iterator */
template <typename TTreeType>
typename InOrderTreeIterator<TTreeType>::NodeType
InOrderTreeIterator<TTreeType>::GetType() const
auto
InOrderTreeIterator<TTreeType>::GetType() const -> NodeType
{
return TreeIteratorBaseEnums::TreeIteratorBaseNode::INORDER;
}
Expand Down
Expand Up @@ -106,8 +106,8 @@ LeafTreeIterator<TTreeType>::~LeafTreeIterator() = default;

/** Return the type of iterator */
template <typename TTreeType>
typename LeafTreeIterator<TTreeType>::NodeType
LeafTreeIterator<TTreeType>::GetType() const
auto
LeafTreeIterator<TTreeType>::GetType() const -> NodeType
{
return TreeIteratorBaseEnums::TreeIteratorBaseNode::LEAF;
}
Expand Down
Expand Up @@ -89,8 +89,8 @@ PostOrderTreeIterator<TTreeType>::PostOrderTreeIterator(TTreeType * tree)

/** Return the type of the iterator */
template <typename TTreeType>
typename PostOrderTreeIterator<TTreeType>::NodeType
PostOrderTreeIterator<TTreeType>::GetType() const
auto
PostOrderTreeIterator<TTreeType>::GetType() const -> NodeType
{
return TreeIteratorBaseEnums::TreeIteratorBaseNode::POSTORDER;
}
Expand Down
Expand Up @@ -75,8 +75,8 @@ PreOrderTreeIterator<TTreeType>::PreOrderTreeIterator(const TTreeType * tree, co

/** Return the type of the iterator */
template <typename TTreeType>
typename PreOrderTreeIterator<TTreeType>::NodeType
PreOrderTreeIterator<TTreeType>::GetType() const
auto
PreOrderTreeIterator<TTreeType>::GetType() const -> NodeType
{
return TreeIteratorBaseEnums::TreeIteratorBaseNode::PREORDER;
}
Expand Down
Expand Up @@ -74,8 +74,8 @@ RootTreeIterator<TTreeType>::RootTreeIterator(TTreeType * tree, const TreeNodeTy

/** Return the type of the iterator */
template <typename TTreeType>
typename RootTreeIterator<TTreeType>::NodeType
RootTreeIterator<TTreeType>::GetType() const
auto
RootTreeIterator<TTreeType>::GetType() const -> NodeType
{
return TreeIteratorBaseEnums::TreeIteratorBaseNode::ROOT;
}
Expand Down
12 changes: 8 additions & 4 deletions Modules/Core/Transform/include/itkTranslationTransform.h
Expand Up @@ -257,32 +257,36 @@ class ITK_TEMPLATE_EXPORT TranslationTransform : public Transform<TParametersVal

// Back transform a point
template <typename TParametersValueType, unsigned int VDimension>
inline typename TranslationTransform<TParametersValueType, VDimension>::InputPointType
inline auto
TranslationTransform<TParametersValueType, VDimension>::BackTransform(const OutputPointType & point) const
-> InputPointType
{
return point - m_Offset;
}

// Back transform a vector
template <typename TParametersValueType, unsigned int VDimension>
inline typename TranslationTransform<TParametersValueType, VDimension>::InputVectorType
inline auto
TranslationTransform<TParametersValueType, VDimension>::BackTransform(const OutputVectorType & vect) const
-> InputVectorType
{
return vect;
}

// Back transform a vnl_vector
template <typename TParametersValueType, unsigned int VDimension>
inline typename TranslationTransform<TParametersValueType, VDimension>::InputVnlVectorType
inline auto
TranslationTransform<TParametersValueType, VDimension>::BackTransform(const OutputVnlVectorType & vect) const
-> InputVnlVectorType
{
return vect;
}

// Back Transform a CovariantVector
template <typename TParametersValueType, unsigned int VDimension>
inline typename TranslationTransform<TParametersValueType, VDimension>::InputCovariantVectorType
inline auto
TranslationTransform<TParametersValueType, VDimension>::BackTransform(const OutputCovariantVectorType & vect) const
-> InputCovariantVectorType
{
return vect;
}
Expand Down
Expand Up @@ -89,8 +89,8 @@ class ITK_TEMPLATE_EXPORT Clamp


template <typename TInput, typename TOutput>
inline typename Clamp<TInput, TOutput>::OutputType
Clamp<TInput, TOutput>::operator()(const InputType & A) const
inline auto
Clamp<TInput, TOutput>::operator()(const InputType & A) const -> OutputType
{
const auto dA = static_cast<double>(A);

Expand Down
8 changes: 4 additions & 4 deletions Modules/Numerics/FEM/include/itkFEMPArray.h
Expand Up @@ -104,8 +104,8 @@ class FEMPArray : public std::vector<FEMP<T>>
* Find function for for non-const objects
*/
template <typename T>
typename FEMPArray<T>::ClassTypePointer
FEMPArray<T>::Find(int gn)
auto
FEMPArray<T>::Find(int gn) -> ClassTypePointer
{
auto it = this->begin();
auto iend = this->end();
Expand Down Expand Up @@ -136,8 +136,8 @@ FEMPArray<T>::Find(int gn)
* Find function for for const objects
*/
template <typename T>
typename FEMPArray<T>::ClassTypeConstPointer
FEMPArray<T>::Find(int gn) const
auto
FEMPArray<T>::Find(int gn) const -> ClassTypeConstPointer
{
using ConstIterator = typename Superclass::const_iterator;

Expand Down

0 comments on commit c1628d5

Please sign in to comment.