Skip to content

Commit

Permalink
Merge pull request #214 from crtrott/fix-186
Browse files Browse the repository at this point in the history
Make operator implementation standard conformant
  • Loading branch information
mhoemmen authored Nov 23, 2022
2 parents adb4f68 + 7dc0cdd commit 151aa4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions include/experimental/__p0009_bits/mdspan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class mdspan
MDSPAN_FORCE_INLINE_FUNCTION
constexpr reference operator[](SizeTypes... indices) const
{
return __accessor_ref().access(__ptr_ref(), __mapping_ref()(index_type(indices)...));
return __accessor_ref().access(__ptr_ref(), __mapping_ref()(static_cast<index_type>(std::move(indices))...));
}
#endif

Expand Down Expand Up @@ -291,7 +291,7 @@ class mdspan
MDSPAN_FORCE_INLINE_FUNCTION
constexpr reference operator[](Index idx) const
{
return __accessor_ref().access(__ptr_ref(), __mapping_ref()(index_type(idx)));
return __accessor_ref().access(__ptr_ref(), __mapping_ref()(static_cast<index_type>(std::move(idx))));
}
#endif

Expand All @@ -307,7 +307,7 @@ class mdspan
MDSPAN_FORCE_INLINE_FUNCTION
constexpr reference operator()(SizeTypes... indices) const
{
return __accessor_ref().access(__ptr_ref(), __mapping_ref()(indices...));
return __accessor_ref().access(__ptr_ref(), __mapping_ref()(static_cast<index_type>(std::move(indices))...));
}

MDSPAN_TEMPLATE_REQUIRES(
Expand Down
8 changes: 4 additions & 4 deletions include/experimental/__p1684_bits/mdarray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class mdarray {
MDSPAN_FORCE_INLINE_FUNCTION
constexpr const_reference operator[](SizeTypes... indices) const noexcept
{
return ctr_[map_(index_type(indices)...)];
return ctr_[map_(static_cast<index_type>(std::move(indices))...)];
}

MDSPAN_TEMPLATE_REQUIRES(
Expand All @@ -333,7 +333,7 @@ class mdarray {
MDSPAN_FORCE_INLINE_FUNCTION
constexpr reference operator[](SizeTypes... indices) noexcept
{
return ctr_[map_(index_type(indices)...)];
return ctr_[map_(static_cast<index_type>(std::move(indices))...)];
}
#endif

Expand Down Expand Up @@ -377,7 +377,7 @@ class mdarray {
MDSPAN_FORCE_INLINE_FUNCTION
constexpr const_reference operator()(SizeTypes... indices) const noexcept
{
return ctr_[map_(index_type(indices)...)];
return ctr_[map_(static_cast<index_type>(std::move(indices))...)];
}
MDSPAN_TEMPLATE_REQUIRES(
class... SizeTypes,
Expand All @@ -389,7 +389,7 @@ class mdarray {
MDSPAN_FORCE_INLINE_FUNCTION
constexpr reference operator()(SizeTypes... indices) noexcept
{
return ctr_[map_(index_type(indices)...)];
return ctr_[map_(static_cast<index_type>(std::move(indices))...)];
}

#if 0
Expand Down

0 comments on commit 151aa4f

Please sign in to comment.