From 342845e644ab2c09d7ddf5c2d15f2dd16d453c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 10 Sep 2021 11:16:43 -0400 Subject: [PATCH] ENH: deprecate itk::IsSame and the header which implements it It should be replaced by std::is_same from STL. --- Documentation/ITK5MigrationGuide.md | 1 + Modules/Core/Common/include/itkIsSame.h | 10 +++++++++- Utilities/Maintenance/BuildHeaderTest.py | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Documentation/ITK5MigrationGuide.md b/Documentation/ITK5MigrationGuide.md index a5b06b04d9b..4f6f1a01957 100644 --- a/Documentation/ITK5MigrationGuide.md +++ b/Documentation/ITK5MigrationGuide.md @@ -80,6 +80,7 @@ To modernize your code base, replace: * `FastMutexLock` with `std::mutex`, and `#include "itkFastMutexLock.h"` with `#include `. * `MutexLock` with `std::mutex`, and `#include "itkMutexLock.h"` with `#include `. * `mpl::EnableIf::Type` with `std::enable_if_t`, and `#include "itkEnableIf.h"` with `#include `. + * `mpl::IsSame::Value` with `std::is_same::value`, and `#include "itkIsSame.h"` with `#include `. Modern CMake requirement diff --git a/Modules/Core/Common/include/itkIsSame.h b/Modules/Core/Common/include/itkIsSame.h index 2cb976e5263..3a7019851e9 100644 --- a/Modules/Core/Common/include/itkIsSame.h +++ b/Modules/Core/Common/include/itkIsSame.h @@ -18,7 +18,11 @@ #ifndef itkIsSame_h #define itkIsSame_h -#include "itkMetaProgrammingLibrary.h" +#include "itkMacro.h" + +#if !defined(ITK_LEGACY_REMOVE) + +# include "itkMetaProgrammingLibrary.h" namespace itk { @@ -50,4 +54,8 @@ using mpl::IsSame; } // end namespace itk +#else // ITK_LEGACY_REMOVE +# error Use C++ 11 std::is_same directly +#endif + #endif // itkIsSame_h diff --git a/Utilities/Maintenance/BuildHeaderTest.py b/Utilities/Maintenance/BuildHeaderTest.py index a7280bfca2b..7cd755db63d 100755 --- a/Utilities/Maintenance/BuildHeaderTest.py +++ b/Utilities/Maintenance/BuildHeaderTest.py @@ -49,6 +49,7 @@ "vtkCaptureScreen.h", # these includes require VTK "itkMultiThreader.h", # Compatibility file, it should not be used "itkEnableIf.h", # Compatibility file, it should not be used + "itkIsSame.h", # Compatibility file, it should not be used "itkViewImage.h", # Depends on VTK_RENDERING_BACKEND "QuickView.h", # Depends on VTK_RENDERING_BACKEND "itkBSplineDeformableTransformInitializer.h",