Add constexpr begin(), end(), cbegin(), cend() to FixedArray, Index, Offset, and Size#3236
Merged
hjmjohnson merged 4 commits intoInsightSoftwareConsortium:masterfrom Mar 1, 2022
Conversation
The iterator types of `Index`, `Offset`, and `Size` are just raw pointer types, and for those types, a function-style cast `T(expression)` is generally discouraged in C++. Moreover, specifically in the implementation of the `begin()` and `end()` member functions of `Index`, `Offset`, and `Size`, casting appeared unnecessary anyway.
Mirrored the corresponding member functions of `std::array`. Following commit 549a19c "STYLE: Change aggregate classes to mirror std::array", Hans Johnson, 2018-02-12
Added `constexpr` keywords to the `cbegin()`, `begin()`, `cend()`, and `end()` member functions of `FixedArray`, `Index`, `Offset`, and `Size`. Allows iterating over their elements at compile-time.
hjmjohnson
approved these changes
Feb 27, 2022
b3ac69d to
665536e
Compare
dzenanz
approved these changes
Feb 28, 2022
665536e to
b7eb203
Compare
Added compile-time checks for the `cbegin()`, `begin()`, `cend()`, and `end()` member functions of `FixedArray`, `Index`, `Offset`, and `Size`.
b7eb203 to
9f1c34e
Compare
Contributor
Author
|
/azp run ITK.Linux |
hjmjohnson
approved these changes
Mar 1, 2022
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Apr 22, 2024
Follow-up to pull request InsightSoftwareConsortium#3236 commit 47bce26 "ENH: Declare begin(), end() of FixedArray, Index, Offset, Size constexpr"
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.
No description provided.