Less surprising behavior for the ok() method of FabArray. #1223
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.
This makes the
ok()
method of FabArray returnfalse
instead of crashing if thedefine()
method has yet to be called.We allow FabArray and its derived classes to be default constructed, which places them in a unusable state until the the
define
method has been called. We also provide anok()
method, which according to its doxygen strings returns whether the FabArray is well-defined. Currently, this method will crash with a not-particularly instructive error message if it is called on a default-constructed-but-not-defined FabArray. This pull request changes it to returnfalse
instead, which I'd argue is more intuitive - if it's legal to construct a FabArray and define it later, then it should be legal to test whether that has been done or not. I have also updated the doxygen string for the method in question.Even if we want this to crash instead of returning
false
, it should do so with its own assertion and a clear error message.The proposed changes: