Skip to content

Commit

Permalink
ENH: ITK_FUTURE_DEPRECATED for SetGlobalInstance and Singleton overloads
Browse files Browse the repository at this point in the history
These specific "deprecated" warnings should not appear when legacy support is
enabled.
  • Loading branch information
N-Dekker committed Nov 28, 2024
1 parent 36ed7f1 commit 3e62740
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Modules/Core/Common/include/itkSingleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ class ITKCommon_EXPORT SingletonIndex

#ifndef ITK_FUTURE_LEGACY_REMOVE
template <typename T>
[[deprecated("Prefer calling the SetGlobalInstance(globalName, global, deleteFunc) overload (without the unused func "
"parameter)!")]] bool
SetGlobalInstance(const char * globalName,
T * global,
std::function<void(void *)> itkNotUsed(func),
std::function<void()> deleteFunc)
ITK_FUTURE_DEPRECATED("Prefer calling the SetGlobalInstance(globalName, global, deleteFunc) overload (without the "
"unused func parameter)!")
bool SetGlobalInstance(const char * globalName,
T * global,
std::function<void(void *)> itkNotUsed(func),
std::function<void()> deleteFunc)
{
this->SetGlobalInstance(globalName, global, std::move(deleteFunc));
// Just returns true for backward compatibility (legacy only).
Expand Down Expand Up @@ -148,8 +148,9 @@ Singleton(const char * globalName, std::function<void()> deleteFunc)

#ifndef ITK_FUTURE_LEGACY_REMOVE
template <typename T>
[[deprecated("Prefer calling the Singleton(globalName, deleteFunc) overload (without the unused func parameter)!")]] T *
Singleton(const char * globalName, std::function<void(void *)> itkNotUsed(func), std::function<void()> deleteFunc)
ITK_FUTURE_DEPRECATED(
"Prefer calling the Singleton(globalName, deleteFunc) overload (without the unused func parameter)!")
T * Singleton(const char * globalName, std::function<void(void *)> itkNotUsed(func), std::function<void()> deleteFunc)
{
return Singleton<T>(globalName, std::move(deleteFunc));
}
Expand Down

0 comments on commit 3e62740

Please sign in to comment.