Document and use the fact that SingletonIndex::SetGlobalInstance always returns true#4162
Merged
thewtex merged 4 commits intoInsightSoftwareConsortium:masterfrom Sep 5, 2023
Conversation
Also fixed its comment.
`SingletonIndex::SetGlobalInstancePrivate` did always unconditionally return `true`, so it might as well just return `void`.
`SingletonIndex::SetGlobalInstance` always returns true, so it is not necessary to handle the hypothetical case that it /might/ return false.
01836ea to
6ec6328
Compare
dzenanz
approved these changes
Aug 21, 2023
thewtex
approved these changes
Sep 5, 2023
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Sep 7, 2023
Added overloads of `SetGlobalInstance` and `Singleton` without the unused `func` parameter. Let the new `SetGlobalInstance` overload just return `void`, instead of `bool`. Deprecated the original overloads. Follow-up to: pull request InsightSoftwareConsortium#4164 commit 6d1c4c7 "STYLE: SingletonIndex does not need to store the unused `func` parameter" pull request InsightSoftwareConsortium#4162 commit 6ec6328 "STYLE: Let `Singleton` assume that SetGlobalInstance always returns true"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Sep 14, 2023
Added overloads of `SetGlobalInstance` and `Singleton` without the unused `func` parameter. Let the new `SetGlobalInstance` overload just return `void`, instead of `bool`. Deprecated the original overloads, and made them `ITK_FUTURE_LEGACY_REMOVE`. Follow-up to: pull request InsightSoftwareConsortium#4164 commit 6d1c4c7 "STYLE: SingletonIndex does not need to store the unused `func` parameter" pull request InsightSoftwareConsortium#4162 commit 6ec6328 "STYLE: Let `Singleton` assume that SetGlobalInstance always returns true"
dzenanz
pushed a commit
that referenced
this pull request
Sep 18, 2023
Added overloads of `SetGlobalInstance` and `Singleton` without the unused `func` parameter. Let the new `SetGlobalInstance` overload just return `void`, instead of `bool`. Deprecated the original overloads, and made them `ITK_FUTURE_LEGACY_REMOVE`. Follow-up to: pull request #4164 commit 6d1c4c7 "STYLE: SingletonIndex does not need to store the unused `func` parameter" pull request #4162 commit 6ec6328 "STYLE: Let `Singleton` assume that SetGlobalInstance always returns true"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note that
SetGlobalInstancehas always just returnedtrue, from the very first commit, pull request #118 commit a66337e ENH: Synchronize factories across modules in Python by Francois Budin (@fbudin69500) and Hans Johnson (@hjmjohnson), February 2019.Looking at the initial (2019) version of
SetGlobalInstanceandSetGlobalInstancePrivate:ITK/Modules/Core/Common/include/itkSingleton.h
Lines 62 to 64 in a66337e
ITK/Modules/Core/Common/src/itkSingleton.cxx
Lines 97 to 104 in a66337e