Skip to content

ENH: Support C-style arrays as MetaDataObjectType for MetaDataDictionary#3320

Merged
dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:MetaDataDictionary-SupportsArrays
Mar 23, 2022
Merged

ENH: Support C-style arrays as MetaDataObjectType for MetaDataDictionary#3320
dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:MetaDataDictionary-SupportsArrays

Conversation

@N-Dekker
Copy link
Copy Markdown
Contributor

@N-Dekker N-Dekker commented Mar 21, 2022

Allows passing a N-dimensional C-style array as value, when calling
itk::EncapsulateMetaData(dictionary, key, value).

@github-actions github-actions Bot added area:Core Issues affecting the Core module type:Enhancement Improvement of existing methods or implementation type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct labels Mar 21, 2022
@thewtex thewtex requested a review from hjmjohnson March 22, 2022 00:43
Copy link
Copy Markdown
Contributor

@Leengit Leengit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Allows passing a N-dimensional C-style array as value, when calling
`itk::EncapsulateMetaData(dictionary, key, value)`.
@N-Dekker N-Dekker force-pushed the MetaDataDictionary-SupportsArrays branch from b828da6 to 8ceb12d Compare March 22, 2022 13:34
@N-Dekker
Copy link
Copy Markdown
Contributor Author

FYI: This force-push only adjusted the unit test and the commit text, not the actual implementation.

@N-Dekker N-Dekker marked this pull request as ready for review March 22, 2022 16:20
@N-Dekker
Copy link
Copy Markdown
Contributor Author

/AZP run ITK.Windows


/** `Assign` overload for C-style arrays (as well as arrays of arrays). */
template <typename TValue, size_t VNumberOfElements>
static void
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should / can this return a reference to the left hand side?

Copy link
Copy Markdown
Contributor Author

@N-Dekker N-Dekker Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Leengit Thanks for asking. The Assign overload for C-style arrays might indeed return a reference to the left hand side, but I would not say it should. Because it isn't really necessary. Note that it is just an internal private member function (template). Technically, it is not a template specialization of the other Assign(target, source), it is just an overload. (If it would have been a template specialization, it would be required to have the same return type as the generic function template. But that's not the case here.)

@dzenanz dzenanz merged commit 7299e5c into InsightSoftwareConsortium:master Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Core Issues affecting the Core module type:Enhancement Improvement of existing methods or implementation type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants