Skip to content

Commit

Permalink
ENH: deprecate mpl::IsBaseOf and the header which implements it
Browse files Browse the repository at this point in the history
  • Loading branch information
dzenanz committed Sep 13, 2021
1 parent e90519e commit d458298
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 42 deletions.
1 change: 1 addition & 0 deletions Documentation/ITK5MigrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ To modernize your code base, replace:
* `MutexLock` with `std::mutex`, and `#include "itkMutexLock.h"` with `#include <mutex>`.
* `mpl::EnableIf<X>::Type` with `std::enable_if_t<X>`, and `#include "itkEnableIf.h"` with `#include <type_traits>`.
* `mpl::IsSame<X, Y>::Value` with `std::is_same<X, Y>::value`, and `#include "itkIsSame.h"` with `#include <type_traits>`.
* `mpl::IsBaseOf<X, Y>::Value` with `std::is_base_of<X, Y>::value`, and `#include "itkIsBaseOf.h"` with `#include <type_traits>`.


Modern CMake requirement
Expand Down
12 changes: 9 additions & 3 deletions Modules/Core/Common/include/itkIsBaseOf.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
#ifndef itkIsBaseOf_h
#define itkIsBaseOf_h

#include "itkIsConvertible.h"
#include <type_traits>

#include "itkMacro.h"

#if !defined(ITK_LEGACY_REMOVE)

namespace itk
{
/// \cond HIDE_META_PROGRAMMING
Expand All @@ -39,12 +42,15 @@ namespace mpl
template <typename TBase, typename TDerived>
struct IsBaseOf
{
static constexpr bool Value =
IsConvertible<const TDerived *, const TBase *>::Value && !std::is_same<const TBase *, const void *>::value;
static constexpr bool Value = std::is_base_of<const TDerived *, const TBase *>::value;
};
} // end namespace mpl

/// \endcond
} // end namespace itk

#else // ITK_LEGACY_REMOVE
# error Use C++ 11 std::is_base_of directly
#endif

#endif // itkIsBaseOf_h
1 change: 0 additions & 1 deletion Modules/Core/Common/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ itkMultithreadingTest.cxx

itkMetaProgrammingLibraryTest.cxx
itkIsConvertible.cxx
itkIsBaseOf.cxx
itkPromoteType.cxx
itkMetaDataDictionaryTest.cxx
itkStdStreamLogOutputTest.cxx
Expand Down
38 changes: 0 additions & 38 deletions Modules/Core/Common/test/itkIsBaseOf.cxx

This file was deleted.

1 change: 1 addition & 0 deletions Utilities/Maintenance/BuildHeaderTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"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
"itkIsBaseOf.h", # Compatibility file, it should not be used
"itkViewImage.h", # Depends on VTK_RENDERING_BACKEND
"QuickView.h", # Depends on VTK_RENDERING_BACKEND
"itkBSplineDeformableTransformInitializer.h",
Expand Down

0 comments on commit d458298

Please sign in to comment.