Skip to content

Commit

Permalink
COMP: Workaround VS2017 error C2653/C2886 using-declaration compiler bug
Browse files Browse the repository at this point in the history
Partially reverted pull request #2567
commit 4f30980 "STYLE: Avoid repeating parent aliases"
because of Visual Studio 2017 compile errors reported by Dženan Zukić at
#2759 "COMP: making it compile on VS2017"

Worked around the following VS2017 compile errors:

> error C2653: '...': is not a class or namespace name
> error C2886: '...': symbol cannot be used in a member using-declaration

The compiler bug that caused these errors is reported here:
"Compile error when using "using declaration" referencing a base class type that refers to itself"
EssentiaX - Reported March 12, 2019 [Fixed in version 16.2]
https://developercommunity.visualstudio.com/t/486683
  • Loading branch information
N-Dekker authored and dzenanz committed Oct 5, 2021
1 parent 3be070c commit 066ddb8
Show file tree
Hide file tree
Showing 54 changed files with 60 additions and 61 deletions.
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkCellInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#define itkCellInheritedTypedefs(superclassArg) \
using Superclass = superclassArg; \
using typename Superclass::PixelType; \
using typename Superclass::CellType; \
using CellType = typename Superclass::CellType; \
using typename Superclass::CellAutoPointer; \
using typename Superclass::CellConstAutoPointer; \
using typename Superclass::CellRawPointer; \
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkContinuousIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ITK_TEMPLATE_EXPORT ContinuousIndex : public Point<TCoordRep, VIndexDimens
using IndexType = Index<VIndexDimension>;

/** The Array type from which this Vector is derived. */
using typename Superclass::BaseArray;
using BaseArray = typename Superclass::BaseArray;
using Iterator = typename BaseArray::Iterator;
using ConstIterator = typename BaseArray::ConstIterator;

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkOptimizerParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ITK_TEMPLATE_EXPORT OptimizerParameters : public Array<TParametersValueTyp
using Self = OptimizerParameters;
using Superclass = Array<TParametersValueType>;
using ArrayType = Superclass;
using typename Superclass::VnlVectorType;
using VnlVectorType = typename Superclass::VnlVectorType;
using typename Superclass::SizeValueType;

/** Helper class for managing different types of parameter
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshLineCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshLineCell
// itkCellInheritedTypedefs
using Superclass = TCellInterface;
using typename Superclass::PixelType;
using typename Superclass::CellType;
using CellType = typename Superclass::CellType;
using typename Superclass::CellAutoPointer;
using typename Superclass::CellConstAutoPointer;
using typename Superclass::CellRawPointer;
using typename Superclass::CellConstRawPointer;
using typename Superclass::CellTraits;
using CellTraits = typename Superclass::CellTraits;
using typename Superclass::CoordRepType;
using typename Superclass::InterpolationWeightType;
using typename Superclass::PointIdentifier;
Expand Down
1 change: 0 additions & 1 deletion Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshPoint : public Point<TCoordRep, VPointDime
using typename Superclass::ValueType;
using typename Superclass::CoordRepType;
using typename Superclass::RealType;
using typename Superclass::BaseArray;
using typename Superclass::Iterator;
using typename Superclass::ConstIterator;
using typename Superclass::VectorType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ class ITK_TEMPLATE_EXPORT QuadEdgeMeshPolygonCell : public TCellInterface
// itkCellInheritedTypedefs
using Superclass = TCellInterface;
using typename Superclass::PixelType;
using typename Superclass::CellType;
using CellType = typename Superclass::CellType;
using typename Superclass::CellAutoPointer;
using typename Superclass::CellConstAutoPointer;
using typename Superclass::CellRawPointer;
using typename Superclass::CellConstRawPointer;
using typename Superclass::CellTraits;
using CellTraits = typename Superclass::CellTraits;
using typename Superclass::CoordRepType;
using typename Superclass::InterpolationWeightType;
using typename Superclass::PointIdentifier;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkAffineTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class ITK_TEMPLATE_EXPORT AffineTransform

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost.*/
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Compose affine transformation with a translation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ITK_TEMPLATE_EXPORT CenteredAffineTransform : public AffineTransform<TPara

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Set/Get the transformation from a container of parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ITK_TEMPLATE_EXPORT CenteredEuler3DTransform : public Euler3DTransform<TPa

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Set the transformation from a container of parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class ITK_TEMPLATE_EXPORT CenteredRigid2DTransform : public Rigid2DTransform<TPa

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Set the transformation from a container of parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ITK_TEMPLATE_EXPORT CenteredSimilarity2DTransform : public Similarity2DTra

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Set the transformation from a container of parameters
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkCompositeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ITK_TEMPLATE_EXPORT CompositeTransform : public MultiTransform<TParameters
itkNewMacro(Self);

/** Sub transform type **/
using typename Superclass::TransformType;
using TransformType = typename Superclass::TransformType;
using typename Superclass::TransformTypePointer;
/** InverseTransform type. */
using typename Superclass::InverseTransformBasePointer;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkEuler2DTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ITK_TEMPLATE_EXPORT Euler2DTransform : public Rigid2DTransform<TParameters

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost.*/
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/**
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkIdentityTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ITK_TEMPLATE_EXPORT IdentityTransform : public Transform<TParametersValueT

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost.*/
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Method to transform a point. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class ITK_TEMPLATE_EXPORT MatrixOffsetTransformBase

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Set the transformation to an Identity
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkRigid2DTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ITK_TEMPLATE_EXPORT Rigid2DTransform : public MatrixOffsetTransformBase<TP

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/**
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkRigid3DTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ITK_TEMPLATE_EXPORT Rigid3DTransform : public MatrixOffsetTransformBase<TP

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Set the transformation from a container of parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ITK_TEMPLATE_EXPORT ScalableAffineTransform : public AffineTransform<TPara

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Set the transformation to an Identity
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkScaleTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ITK_TEMPLATE_EXPORT ScaleTransform

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost.*/
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

using typename Superclass::MatrixType;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkSimilarity2DTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class ITK_TEMPLATE_EXPORT Similarity2DTransform : public Rigid2DTransform<TParam

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Set the Scale part of the transform. */
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkTranslationTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class ITK_TEMPLATE_EXPORT TranslationTransform : public Transform<TParametersVal

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost.*/
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Transform category type. */
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/include/itkv3Rigid3DTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class ITK_TEMPLATE_EXPORT Rigid3DTransform : public itk::Rigid3DTransform<TParam

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

/** Get an inverse of this transform. */
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/test/itkMultiTransformTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class MultiTransformTestTransform : public itk::MultiTransform<TScalar, NDimensi
itkNewMacro(Self);

/** Sub transform type **/
using typename Superclass::TransformType;
using TransformType = typename Superclass::TransformType;
using typename Superclass::TransformTypePointer;
/** InverseTransform type. */
using typename Superclass::InverseTransformBasePointer;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Transform/test/itkRigid3DTransformTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Rigid3DTransformSurrogate : public Rigid3DTransform<TScalar>

/** Base inverse transform type. This type should not be changed to the
* concrete inverse transform type or inheritance would be lost. */
using typename Superclass::InverseTransformBaseType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;

InverseTransformBasePointer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ITK_TEMPLATE_EXPORT AttributeLabelObject : public LabelObject<TLabel, VIma
using Self = AttributeLabelObject;
using Superclass = LabelObject<TLabel, VImageDimension>;
using Pointer = SmartPointer<Self>;
using typename Superclass::LabelObjectType;
using LabelObjectType = typename Superclass::LabelObjectType;
using ConstPointer = SmartPointer<const Self>;
using ConstWeakPointer = WeakPointer<const Self>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ITK_TEMPLATE_EXPORT AttributeOpeningLabelMapFilter : public InPlaceLabelMa
using PixelType = typename ImageType::PixelType;
using IndexType = typename ImageType::IndexType;

using typename Superclass::LabelObjectType;
using LabelObjectType = typename Superclass::LabelObjectType;

using AttributeAccessorType = TAttributeAccessor;
using AttributeValueType = typename AttributeAccessorType::AttributeValueType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ITK_TEMPLATE_EXPORT LabelMapToLabelImageFilter : public LabelMapFilter<TIn
using typename Superclass::InputImageConstPointer;
using typename Superclass::InputImageRegionType;
using typename Superclass::InputImagePixelType;
using typename Superclass::LabelObjectType;
using LabelObjectType = typename Superclass::LabelObjectType;

using typename Superclass::OutputImageType;
using typename Superclass::OutputImagePointer;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Filtering/LabelMap/include/itkShapeLabelObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ITK_TEMPLATE_EXPORT ShapeLabelObject : public LabelObject<TLabel, VImageDi
/** Standard class type aliases */
using Self = ShapeLabelObject;
using Superclass = LabelObject<TLabel, VImageDimension>;
using typename Superclass::LabelObjectType;
using LabelObjectType = typename Superclass::LabelObjectType;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
using ConstWeakPointer = WeakPointer<const Self>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ITK_TEMPLATE_EXPORT StatisticsLabelObject : public ShapeLabelObject<TLabel
/** Standard class type aliases */
using Self = StatisticsLabelObject;
using Superclass = ShapeLabelObject<TLabel, VImageDimension>;
using typename Superclass::LabelObjectType;
using LabelObjectType = typename Superclass::LabelObjectType;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
using ConstWeakPointer = WeakPointer<const Self>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ITK_TEMPLATE_EXPORT GaussianRandomSpatialNeighborSubsampler
/** Standard class type aliases */
using Self = GaussianRandomSpatialNeighborSubsampler<TSample, TRegion>;
using Superclass = UniformRandomSpatialNeighborSubsampler<TSample, TRegion>;
using typename Superclass::Baseclass;
using Baseclass = typename Superclass::Baseclass;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ITK_TEMPLATE_EXPORT RegionConstrainedSubsampler : public SubsamplerBase<TS
/** Standard class type aliases */
using Self = RegionConstrainedSubsampler<TSample, TRegion>;
using Superclass = SubsamplerBase<TSample>;
using typename Superclass::Baseclass;
using Baseclass = typename Superclass::Baseclass;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ITK_TEMPLATE_EXPORT SpatialNeighborSubsampler : public RegionConstrainedSu
/** Standard class type aliases */
using Self = SpatialNeighborSubsampler<TSample, TRegion>;
using Superclass = RegionConstrainedSubsampler<TSample, TRegion>;
using typename Superclass::Baseclass;
using Baseclass = typename Superclass::Baseclass;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ITK_TEMPLATE_EXPORT UniformRandomSpatialNeighborSubsampler : public Spatia
/** Standard class type aliases */
using Self = UniformRandomSpatialNeighborSubsampler<TSample, TRegion>;
using Superclass = SpatialNeighborSubsampler<TSample, TRegion>;
using typename Superclass::Baseclass;
using Baseclass = typename Superclass::Baseclass;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class ITK_TEMPLATE_EXPORT ANTSNeighborhoodCorrelationImageToImageMetricv4

using typename Superclass::FixedImageType;
using typename Superclass::MovingImageType;
using typename Superclass::VirtualImageType;
using VirtualImageType = typename Superclass::VirtualImageType;
using typename Superclass::FixedOutputPointType;
using typename Superclass::MovingOutputPointType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ITK_TEMPLATE_EXPORT ANTSNeighborhoodCorrelationImageToImageMetricv4GetValu
using typename Superclass::DomainType;
using typename Superclass::AssociateType;

using typename Superclass::VirtualImageType;
using VirtualImageType = typename Superclass::VirtualImageType;
using typename Superclass::VirtualPointType;
using typename Superclass::VirtualIndexType;
using typename Superclass::FixedImagePointType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class ITK_TEMPLATE_EXPORT CorrelationImageToImageMetricv4

using typename Superclass::MovingTransformType;
using typename Superclass::JacobianType;
using typename Superclass::VirtualImageType;
using VirtualImageType = typename Superclass::VirtualImageType;
using typename Superclass::VirtualIndexType;
using typename Superclass::VirtualPointType;
using typename Superclass::VirtualPointSetType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ITK_TEMPLATE_EXPORT CorrelationImageToImageMetricv4GetValueAndDerivativeTh
using typename Superclass::DomainType;
using typename Superclass::AssociateType;

using typename Superclass::ImageToImageMetricv4Type;
using ImageToImageMetricv4Type = typename Superclass::ImageToImageMetricv4Type;
using typename Superclass::VirtualIndexType;
using typename Superclass::VirtualPointType;
using typename Superclass::FixedImagePointType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ITK_TEMPLATE_EXPORT CorrelationImageToImageMetricv4HelperThreader
using typename Superclass::DomainType;
using typename Superclass::AssociateType;

using typename Superclass::ImageToImageMetricv4Type;
using ImageToImageMetricv4Type = typename Superclass::ImageToImageMetricv4Type;
using typename Superclass::VirtualIndexType;
using typename Superclass::VirtualPointType;
using typename Superclass::FixedImagePointType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ITK_TEMPLATE_EXPORT DemonsImageToImageMetricv4

using typename Superclass::MovingTransformType;
using typename Superclass::JacobianType;
using typename Superclass::VirtualImageType;
using VirtualImageType = typename Superclass::VirtualImageType;
using typename Superclass::VirtualIndexType;
using typename Superclass::VirtualPointType;
using VirtualSPointSetType = typename Superclass::VirtualPointSetType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ITK_TEMPLATE_EXPORT DemonsImageToImageMetricv4GetValueAndDerivativeThreade
using typename Superclass::DomainType;
using typename Superclass::AssociateType;

using typename Superclass::ImageToImageMetricv4Type;
using ImageToImageMetricv4Type = typename Superclass::ImageToImageMetricv4Type;
using typename Superclass::VirtualPointType;
using typename Superclass::VirtualIndexType;
using typename Superclass::FixedImagePointType;
Expand Down
Loading

0 comments on commit 066ddb8

Please sign in to comment.