Skip to content

Commit

Permalink
Address more review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
crtrott committed Oct 31, 2023
1 parent a2dc803 commit a775fd5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/experimental/__p0009_bits/compressed_pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct __compressed_pair<
}

MDSPAN_INLINE_FUNCTION_DEFAULTED
constexpr __compressed_pair() noexcept(noexcept(_T2())) = default;
constexpr __compressed_pair() = default;
MDSPAN_INLINE_FUNCTION_DEFAULTED
constexpr __compressed_pair(__compressed_pair const &) = default;
MDSPAN_INLINE_FUNCTION_DEFAULTED
Expand Down Expand Up @@ -116,7 +116,7 @@ struct __compressed_pair<
}

MDSPAN_INLINE_FUNCTION_DEFAULTED
constexpr __compressed_pair() noexcept(noexcept(_T1())) = default;
constexpr __compressed_pair() = default;
MDSPAN_INLINE_FUNCTION_DEFAULTED
constexpr __compressed_pair(__compressed_pair const &) = default;
MDSPAN_INLINE_FUNCTION_DEFAULTED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
// Preconditions:
// * extents_type::index-cast(i) is a multidimensional index in extents_.


// GCC warns about comma operator changing its meaning inside [] in C++23
#if defined(__GNUC__) && !defined(__clang_major__)
# pragma GCC diagnostic push
Expand Down
11 changes: 6 additions & 5 deletions tests/test_mdspan_size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,20 @@ std::size_t product_of_extents(const Extents& e)
template<class Extents>
void test_mdspan_size(std::vector<char>& storage, Extents&& e)
{
const std::size_t min_storage_size = product_of_extents(e);
using extents_type = std::remove_cv_t<std::remove_reference_t<Extents>>;
using mdspan_t = Kokkos::mdspan<char, extents_type>;
const typename mdspan_t::size_type min_storage_size = product_of_extents(e);
if(storage.size() < min_storage_size) {
storage.resize(min_storage_size);
}
using extents_type = std::remove_cv_t<std::remove_reference_t<Extents>>;
Kokkos::mdspan<char, extents_type> m(storage.data(), std::forward<Extents>(e));
mdspan_t m(storage.data(), std::forward<Extents>(e));

static_assert(std::is_same<decltype(m.size()), typename decltype(m)::size_type>::value,
static_assert(std::is_same<decltype(m.size()), typename mdspan_t::size_type>::value,
"The return type of mdspan::size() must be size_type.");

// m.size() must not overflow, as long as the product of extents
// is representable as a value of type size_type.
ASSERT_EQ( min_storage_size, size_t(m.size()) );
ASSERT_EQ( min_storage_size, m.size());
}

TEST(TestMdspan, MdspanSizeReturnTypeAndPrecondition)
Expand Down

0 comments on commit a775fd5

Please sign in to comment.