Skip to content
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

<mdspan>: Reduce amount of function calls in non-optimized debug mode #3674

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'mdspan/main' into mdspan/debug-experience
JMazurkiewicz committed Apr 26, 2023

Verified

This commit was signed with the committer’s verified signature.
Murderlon Merlijn Vos
commit e56dc014021a2f43d21c98f1959047a9cd0a009d
33 changes: 2 additions & 31 deletions stl/inc/mdspan
Original file line number Diff line number Diff line change
@@ -983,37 +983,8 @@ public:
return _Acc;
}

_NODISCARD constexpr index_type extent(const rank_type _Rank) const noexcept {
const auto& _Ext = _Map.extents();
return _Ext.extent(_Rank);
}

_NODISCARD constexpr size_type size() const noexcept {
const auto& _Ext = _Map.extents();
size_type _Result = 1;
for (rank_type _Dim = 0; _Dim < extents_type::_Rank; ++_Dim) {
_Result *= _Ext.extent(_Dim);
}
return _Result;
}

_NODISCARD constexpr bool empty() const noexcept {
for (rank_type _Dim = 0; _Dim < extents_type::_Rank; ++_Dim) {
if (_Map.extents().extent(_Dim) == 0) {
return true;
}
}

return false;
}

friend constexpr void swap(mdspan& _Left, mdspan& _Right) noexcept {
swap(_Left._Ptr, _Right._Ptr);
swap(_Left._Map, _Right._Map);
swap(_Left._Acc, _Right._Acc);
}

_NODISCARD static constexpr bool is_always_unique() {
_NODISCARD static constexpr bool is_always_unique() noexcept(
noexcept(mapping_type::is_always_unique())) /* strengthened */ {
return mapping_type::is_always_unique();
}

You are viewing a condensed version of this merge commit. You can view the full changes here.