feat: Replace verbose pair access with C++17 structured bindings #3416
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.
Summary
This PR replaces verbose pair access patterns with modern C++17 structured bindings throughout the oneDAL codebase.
Changes Made
Files Modified (9 total):
cpp/oneapi/dal/table/backend/convert/copy_convert_impl_dpc.cppcpp/oneapi/dal/table/backend/convert/copy_convert_impl_cpu.cppcpp/oneapi/dal/table/backend/heterogen_kernels.cppcpp/oneapi/dal/io/csv/detail/read_graph_kernel_impl.hppcpp/oneapi/dal/io/csv/backend/cpu/read_graph.hppcpp/oneapi/dal/graph/detail/directed_adjacency_vector_graph_impl.hppcpp/oneapi/dal/test/engine/dataframe_common.cppcpp/oneapi/dal/algo/triangle_counting/backend/cpu/relabel_kernel.hppcpp/oneapi/dal/algo/svm/test/batch.cppImprovements:
1. Shape/Dimension Pairs
Before:
After:
2. Edge List Pairs
Before:
unfiltered_neighs[++rows_vec_atomic[edges[u].first] - 1] = edges[u].second;After:
3. Iterator Range Pairs
Before:
After:
4. Test Data Pairs
Before:
After:
Benefits
✅ Improved Readability: Code is more self-documenting with meaningful variable names
✅ Reduced Verbosity: Eliminated repetitive
.firstand.secondaccess✅ Modern C++17 Style: Aligned with current C++ best practices
✅ Better Intent: Made it clear that pairs represent related values (dimensions, coordinates, etc.)
✅ No Breaking Changes: Pure syntax improvement, no functional changes
Statistics
Testing
Checklist