-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use more iterators with copy_n #3209
Conversation
29af3b8
to
77ee2b0
Compare
src/image.cpp
Outdated
DataBuf buf(allocate64); // allocate a buffer | ||
std::copy_n(dir.c_data(8), 4, buf.begin()); // copy dir[8:11] into buffer (short strings) | ||
DataBuf buf(allocate64); // allocate a buffer | ||
std::copy(dir.begin() + 8, dir.begin() + 8 + 4, buf.begin()); // copy dir[8:11] into buffer (short strings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this better? It seems more verbose than the old version that used std::copy_n
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably makes more sense to use iterators in general instead of C pointers with these functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworked.
It's a bit safer to do so. Signed-off-by: Rosen Penev <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3209 +/- ##
==========================================
- Coverage 63.93% 63.91% -0.02%
==========================================
Files 104 104
Lines 21755 21752 -3
Branches 10636 10636
==========================================
- Hits 13908 13903 -5
- Misses 5639 5641 +2
Partials 2208 2208 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
It's a bit safer to do so.