From ebfc8f50bdfc1120504749d9b36503224001845e Mon Sep 17 00:00:00 2001 From: Nicolas Morales Date: Thu, 13 Feb 2025 17:24:48 +0100 Subject: [PATCH] Unstdify macros.hpp (#378) * remove random buggy identifier names macros.hpp * Fix a bunch of struct names in macros.hpp --- benchmarks/copy/copy_layout_stride.cpp | 2 +- benchmarks/sum/sum_submdspan_right.cpp | 5 +- .../ctest_constexpr_dereference.cpp | 6 +- .../ctest_constexpr_submdspan.cpp | 2 +- .../__p0009_bits/compressed_pair.hpp | 38 +-- .../__p0009_bits/default_accessor.hpp | 2 +- .../__p0009_bits/dynamic_extent.hpp | 2 +- include/experimental/__p0009_bits/extents.hpp | 26 +- .../__p0009_bits/full_extent_t.hpp | 2 +- .../experimental/__p0009_bits/layout_left.hpp | 26 +- .../__p0009_bits/layout_right.hpp | 28 +- .../__p0009_bits/layout_stride.hpp | 38 +-- include/experimental/__p0009_bits/macros.hpp | 316 +++++++++--------- include/experimental/__p0009_bits/mdspan.hpp | 88 ++--- .../__p0009_bits/no_unique_address.hpp | 12 +- .../__p0009_bits/trait_backports.hpp | 2 +- .../experimental/__p0009_bits/type_list.hpp | 3 +- include/experimental/__p1684_bits/mdarray.hpp | 62 ++-- .../__p2630_bits/submdspan_mapping.hpp | 2 +- tests/foo_customizations.hpp | 18 +- tests/test_exhaustive_layouts.cpp | 2 +- tests/test_extents.cpp | 6 +- tests/test_layout_ctors.cpp | 2 +- tests/test_layout_stride.cpp | 2 +- tests/test_mdarray_ctors.cpp | 4 +- tests/test_mdarray_to_mdspan.cpp | 4 +- tests/test_mdspan_ctors.cpp | 6 +- tests/test_mdspan_swap.cpp | 6 +- tests/test_submdspan.cpp | 4 +- 29 files changed, 356 insertions(+), 360 deletions(-) diff --git a/benchmarks/copy/copy_layout_stride.cpp b/benchmarks/copy/copy_layout_stride.cpp index fe0e3c5a..d91c9077 100644 --- a/benchmarks/copy/copy_layout_stride.cpp +++ b/benchmarks/copy/copy_layout_stride.cpp @@ -21,7 +21,7 @@ using index_type = int; -_MDSPAN_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; template void BM_MDSpan_Copy_2D_right(benchmark::State& state, MDSpan, DynSizes... dyn) { diff --git a/benchmarks/sum/sum_submdspan_right.cpp b/benchmarks/sum/sum_submdspan_right.cpp index 684da2a4..714b94ee 100644 --- a/benchmarks/sum/sum_submdspan_right.cpp +++ b/benchmarks/sum/sum_submdspan_right.cpp @@ -118,7 +118,7 @@ constexpr T&& _repeated_with(T&& v) noexcept { return std::forward(v); } template MDSPAN_FORCE_INLINE_FUNCTION -_MDSPAN_CONSTEXPR_14 void _do_sum_submdspan( +MDSPAN_IMPL_CONSTEXPR_14 void _do_sum_submdspan( T& sum, Kokkos::mdspan, Rest...> s ) @@ -128,7 +128,7 @@ _MDSPAN_CONSTEXPR_14 void _do_sum_submdspan( template MDSPAN_FORCE_INLINE_FUNCTION -_MDSPAN_CONSTEXPR_14 void _do_sum_submdspan( +MDSPAN_IMPL_CONSTEXPR_14 void _do_sum_submdspan( T& sum, Kokkos::mdspan, Rest...> s ) @@ -195,4 +195,3 @@ BENCHMARK_CAPTURE( //================================================================================ BENCHMARK_MAIN(); - diff --git a/compilation_tests/ctest_constexpr_dereference.cpp b/compilation_tests/ctest_constexpr_dereference.cpp index 1b6c01ad..d81c5882 100644 --- a/compilation_tests/ctest_constexpr_dereference.cpp +++ b/compilation_tests/ctest_constexpr_dereference.cpp @@ -162,7 +162,7 @@ constexpr bool multidimensional_single_element_stress_test_impl_1( std::integer_sequence ) { - return _MDSPAN_FOLD_AND( + return MDSPAN_IMPL_FOLD_AND( multidimensional_single_element_stress_test_impl_2( std::make_index_sequence{} ) /* && ... */ @@ -226,7 +226,7 @@ stress_test_2d_single_element_stress_test_impl_1( std::integer_sequence ) { - return _MDSPAN_FOLD_AND( + return MDSPAN_IMPL_FOLD_AND( stress_test_2d_single_element_stress_test_impl_2( idx1, std::integral_constant{} ) /* && ... */ @@ -240,7 +240,7 @@ stress_test_2d_single_element_stress_test_impl_0( std::integer_sequence idxs2 ) { - return _MDSPAN_FOLD_AND( + return MDSPAN_IMPL_FOLD_AND( stress_test_2d_single_element_stress_test_impl_1( std::integral_constant{}, idxs2 ) /* && ... */ diff --git a/compilation_tests/ctest_constexpr_submdspan.cpp b/compilation_tests/ctest_constexpr_submdspan.cpp index 2532ebb3..fb778c53 100644 --- a/compilation_tests/ctest_constexpr_submdspan.cpp +++ b/compilation_tests/ctest_constexpr_submdspan.cpp @@ -360,7 +360,7 @@ constexpr bool submdspan_single_element_stress_test_impl_1( std::integer_sequence ) { - return _MDSPAN_FOLD_AND( + return MDSPAN_IMPL_FOLD_AND( submdspan_single_element_stress_test_impl_2( std::make_index_sequence{} ) /* && ... */ diff --git a/include/experimental/__p0009_bits/compressed_pair.hpp b/include/experimental/__p0009_bits/compressed_pair.hpp index c2e405be..d6edb7fd 100644 --- a/include/experimental/__p0009_bits/compressed_pair.hpp +++ b/include/experimental/__p0009_bits/compressed_pair.hpp @@ -30,11 +30,11 @@ namespace detail { template struct __compressed_pair { MDSPAN_IMPL_NO_UNIQUE_ADDRESS _T1 __t1_val{}; MDSPAN_IMPL_NO_UNIQUE_ADDRESS _T2 __t2_val{}; - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T1 &__first() noexcept { return __t1_val; } + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T1 &__first() noexcept { return __t1_val; } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T1 const &__first() const noexcept { return __t1_val; } - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T2 &__second() noexcept { return __t2_val; } + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T2 &__second() noexcept { return __t2_val; } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T2 const &__second() const noexcept { return __t2_val; } @@ -46,10 +46,10 @@ template struct __compressed_pair { MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr __compressed_pair(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __compressed_pair & operator=(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __compressed_pair & operator=(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED ~__compressed_pair() = default; @@ -64,16 +64,16 @@ template struct __compressed_pair { template struct __compressed_pair< _T1, _T2, - std::enable_if_t<_MDSPAN_TRAIT(std::is_empty, _T1) && !_MDSPAN_TRAIT(std::is_empty, _T2)>> + std::enable_if_t> : private _T1 { _T2 __t2_val{}; - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T1 &__first() noexcept { + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T1 &__first() noexcept { return *static_cast<_T1 *>(this); } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T1 const &__first() const noexcept { return *static_cast<_T1 const *>(this); } - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T2 &__second() noexcept { return __t2_val; } + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T2 &__second() noexcept { return __t2_val; } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T2 const &__second() const noexcept { return __t2_val; } @@ -85,10 +85,10 @@ struct __compressed_pair< MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr __compressed_pair(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __compressed_pair & operator=(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __compressed_pair & operator=(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED ~__compressed_pair() = default; @@ -101,14 +101,14 @@ struct __compressed_pair< template struct __compressed_pair< _T1, _T2, - std::enable_if_t> + std::enable_if_t> : private _T2 { _T1 __t1_val{}; - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T1 &__first() noexcept { return __t1_val; } + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T1 &__first() noexcept { return __t1_val; } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T1 const &__first() const noexcept { return __t1_val; } - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T2 &__second() noexcept { + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T2 &__second() noexcept { return *static_cast<_T2 *>(this); } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T2 const &__second() const noexcept { @@ -122,10 +122,10 @@ struct __compressed_pair< MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr __compressed_pair(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __compressed_pair & operator=(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __compressed_pair & operator=(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED ~__compressed_pair() = default; @@ -139,7 +139,7 @@ struct __compressed_pair< template struct __compressed_pair< _T1, _T2, - std::enable_if_t<_MDSPAN_TRAIT(std::is_empty, _T1) && _MDSPAN_TRAIT(std::is_empty, _T2)>> + std::enable_if_t> // We need to use the __no_unique_address_emulation wrapper here to avoid // base class ambiguities. #ifdef MDSPAN_IMPL_COMPILER_MSVC @@ -155,13 +155,13 @@ struct __compressed_pair< using __first_base_t = __no_unique_address_emulation<_T1, 0>; using __second_base_t = __no_unique_address_emulation<_T2, 1>; - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T1 &__first() noexcept { + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T1 &__first() noexcept { return this->__first_base_t::__ref(); } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T1 const &__first() const noexcept { return this->__first_base_t::__ref(); } - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T2 &__second() noexcept { + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T2 &__second() noexcept { return this->__second_base_t::__ref(); } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T2 const &__second() const noexcept { @@ -175,10 +175,10 @@ struct __compressed_pair< MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr __compressed_pair(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __compressed_pair & operator=(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __compressed_pair & operator=(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED ~__compressed_pair() = default; diff --git a/include/experimental/__p0009_bits/default_accessor.hpp b/include/experimental/__p0009_bits/default_accessor.hpp index ea0f537b..b858fba2 100644 --- a/include/experimental/__p0009_bits/default_accessor.hpp +++ b/include/experimental/__p0009_bits/default_accessor.hpp @@ -34,7 +34,7 @@ struct default_accessor { MDSPAN_TEMPLATE_REQUIRES( class OtherElementType, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, OtherElementType(*)[], element_type(*)[]) + MDSPAN_IMPL_TRAIT(std::is_convertible, OtherElementType(*)[], element_type(*)[]) ) ) MDSPAN_INLINE_FUNCTION diff --git a/include/experimental/__p0009_bits/dynamic_extent.hpp b/include/experimental/__p0009_bits/dynamic_extent.hpp index 2e29da13..ffa4a6b1 100644 --- a/include/experimental/__p0009_bits/dynamic_extent.hpp +++ b/include/experimental/__p0009_bits/dynamic_extent.hpp @@ -28,7 +28,7 @@ namespace MDSPAN_IMPL_STANDARD_NAMESPACE { #if defined(__cpp_lib_span) using std::dynamic_extent; #else -_MDSPAN_INLINE_VARIABLE constexpr auto dynamic_extent = std::numeric_limits::max(); +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto dynamic_extent = std::numeric_limits::max(); #endif } // namespace MDSPAN_IMPL_STANDARD_NAMESPACE diff --git a/include/experimental/__p0009_bits/extents.hpp b/include/experimental/__p0009_bits/extents.hpp index 76648a50..0d2f6256 100644 --- a/include/experimental/__p0009_bits/extents.hpp +++ b/include/experimental/__p0009_bits/extents.hpp @@ -52,7 +52,7 @@ struct __compare_extent_compatible : std::integral_constant MDSPAN_INLINE_FUNCTION static constexpr std::integral_constant< - bool, _MDSPAN_FOLD_AND(__compare_extent_compatible::value)> + bool, MDSPAN_IMPL_FOLD_AND(__compare_extent_compatible::value)> __check_compatible_extents( std::integral_constant, std::integer_sequence, @@ -64,8 +64,8 @@ template MDSPAN_INLINE_FUNCTION static constexpr bool are_valid_indices() { return - _MDSPAN_FOLD_AND(std::is_convertible::value) && - _MDSPAN_FOLD_AND(std::is_nothrow_constructible::value); + MDSPAN_IMPL_FOLD_AND(std::is_convertible::value) && + MDSPAN_IMPL_FOLD_AND(std::is_nothrow_constructible::value); } // ------------------------------------------------------------------ @@ -214,7 +214,7 @@ struct maybe_static_array { using static_vals_t = static_array; constexpr static size_t m_size = sizeof...(Values); constexpr static size_t m_size_dynamic = - _MDSPAN_FOLD_PLUS_RIGHT((Values == dyn_tag), 0); + MDSPAN_IMPL_FOLD_PLUS_RIGHT((Values == dyn_tag), 0); // Dynamic values member MDSPAN_IMPL_NO_UNIQUE_ADDRESS possibly_empty_array @@ -398,7 +398,7 @@ template class extents { private: constexpr static rank_type m_rank = sizeof...(Extents); constexpr static rank_type m_rank_dynamic = - _MDSPAN_FOLD_PLUS_RIGHT((Extents == dynamic_extent), /* + ... + */ 0); + MDSPAN_IMPL_FOLD_PLUS_RIGHT((Extents == dynamic_extent), /* + ... + */ 0); // internal storage type using maybe_static_array using vals_t = @@ -428,9 +428,9 @@ template class extents { MDSPAN_TEMPLATE_REQUIRES( class... OtherIndexTypes, /* requires */ ( - _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_convertible, OtherIndexTypes, + MDSPAN_IMPL_FOLD_AND(MDSPAN_IMPL_TRAIT(std::is_convertible, OtherIndexTypes, index_type) /* && ... */) && - _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, + MDSPAN_IMPL_FOLD_AND(MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, OtherIndexTypes) /* && ... */) && (sizeof...(OtherIndexTypes) == m_rank || sizeof...(OtherIndexTypes) == m_rank_dynamic))) @@ -442,8 +442,8 @@ template class extents { class OtherIndexType, size_t N, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, const OtherIndexType&, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, + MDSPAN_IMPL_TRAIT(std::is_convertible, const OtherIndexType&, index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, const OtherIndexType&) && (N == m_rank || N == m_rank_dynamic))) MDSPAN_INLINE_FUNCTION @@ -455,8 +455,8 @@ template class extents { MDSPAN_TEMPLATE_REQUIRES( class OtherIndexType, size_t N, /* requires */ - (_MDSPAN_TRAIT(std::is_convertible, const OtherIndexType&, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const OtherIndexType&) && + (MDSPAN_IMPL_TRAIT(std::is_convertible, const OtherIndexType&, index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, const OtherIndexType&) && (N == m_rank || N == m_rank_dynamic))) MDSPAN_INLINE_FUNCTION MDSPAN_CONDITIONAL_EXPLICIT(N != m_rank_dynamic) @@ -650,7 +650,7 @@ check_upper_bound(InputIndexType user_index, // Returning true to use AND fold instead of comma // CPP14 mode doesn't like the use of void expressions -// with the way the _MDSPAN_FOLD_AND is set up +// with the way the MDSPAN_IMPL_FOLD_AND is set up template MDSPAN_INLINE_FUNCTION constexpr bool @@ -673,7 +673,7 @@ check_all_indices_helper(std::index_sequence, Indices... indices) { // Suppress warning about statement has no effect - (void) _MDSPAN_FOLD_AND( + (void) MDSPAN_IMPL_FOLD_AND( (check_one_index(indices, exts.extent(RankIndices))) ); } diff --git a/include/experimental/__p0009_bits/full_extent_t.hpp b/include/experimental/__p0009_bits/full_extent_t.hpp index bd4b5c6a..a1e296ac 100644 --- a/include/experimental/__p0009_bits/full_extent_t.hpp +++ b/include/experimental/__p0009_bits/full_extent_t.hpp @@ -21,6 +21,6 @@ namespace MDSPAN_IMPL_STANDARD_NAMESPACE { struct full_extent_t { explicit full_extent_t() = default; }; -_MDSPAN_INLINE_VARIABLE constexpr auto full_extent = full_extent_t{ }; +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto full_extent = full_extent_t{ }; } // namespace MDSPAN_IMPL_STANDARD_NAMESPACE diff --git a/include/experimental/__p0009_bits/layout_left.hpp b/include/experimental/__p0009_bits/layout_left.hpp index 42c62d14..c6dc1d19 100644 --- a/include/experimental/__p0009_bits/layout_left.hpp +++ b/include/experimental/__p0009_bits/layout_left.hpp @@ -50,7 +50,7 @@ class layout_left::mapping { struct __rank_count {}; template - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type __compute_offset( __rank_count, const I& i, Indices... idx) const { return __compute_offset(__rank_count(), idx...) * @@ -58,13 +58,13 @@ class layout_left::mapping { } template - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type __compute_offset( __rank_count, const I& i) const { return i; } - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type __compute_offset(__rank_count<0,0>) const { return 0; } public: @@ -74,7 +74,7 @@ class layout_left::mapping { MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping() noexcept = default; MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(mapping const&) noexcept = default; - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr mapping(extents_type const& __exts) noexcept :__extents(__exts) { } @@ -82,11 +82,11 @@ class layout_left::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) ) ) MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible::value)) // needs two () due to comma - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(mapping const& other) noexcept // NOLINT(google-explicit-constructor) :__extents(other.extents()) { @@ -99,12 +99,12 @@ class layout_left::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) && + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) && (extents_type::rank() <= 1) ) ) MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible::value)) // needs two () due to comma - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(layout_right::mapping const& other) noexcept // NOLINT(google-explicit-constructor) :__extents(other.extents()) { @@ -147,11 +147,11 @@ class layout_left::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) ) ) MDSPAN_CONDITIONAL_EXPLICIT((extents_type::rank() > 0)) - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(layout_stride::mapping const& other) noexcept // NOLINT(google-explicit-constructor) :__extents(other.extents()) { @@ -162,7 +162,7 @@ class layout_left::mapping { detail::validate_strides(detail::with_rank{}, layout_left{}, __extents, other); } - MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default; MDSPAN_INLINE_FUNCTION constexpr const extents_type& extents() const noexcept { @@ -185,7 +185,7 @@ class layout_left::mapping { (detail::are_valid_indices()) ) ) - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type operator()(Indices... idxs) const noexcept { #if ! defined(NDEBUG) detail::check_all_indices(this->extents(), idxs...); @@ -239,7 +239,7 @@ class layout_left::mapping { template MDSPAN_INLINE_FUNCTION constexpr index_type __get_stride(MDSPAN_IMPL_STANDARD_NAMESPACE::extents,std::integer_sequence) const { - return _MDSPAN_FOLD_TIMES_RIGHT((Idx():1),1); + return MDSPAN_IMPL_FOLD_TIMES_RIGHT((Idx():1),1); } template MDSPAN_INLINE_FUNCTION diff --git a/include/experimental/__p0009_bits/layout_right.hpp b/include/experimental/__p0009_bits/layout_right.hpp index 0e99ebd2..93de9f47 100644 --- a/include/experimental/__p0009_bits/layout_right.hpp +++ b/include/experimental/__p0009_bits/layout_right.hpp @@ -48,25 +48,25 @@ class layout_right::mapping { struct __rank_count {}; template - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type __compute_offset( index_type offset, __rank_count, const I& i, Indices... idx) const { return __compute_offset(offset * __extents.extent(r) + i,__rank_count(), idx...); } template - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type __compute_offset( __rank_count<0,extents_type::rank()>, const I& i, Indices... idx) const { return __compute_offset(i,__rank_count<1,extents_type::rank()>(),idx...); } - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type __compute_offset(size_t offset, __rank_count) const { return static_cast(offset); } - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type __compute_offset(__rank_count<0,0>) const { return 0; } public: @@ -76,7 +76,7 @@ class layout_right::mapping { MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping() noexcept = default; MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(mapping const&) noexcept = default; - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr mapping(extents_type const& __exts) noexcept :__extents(__exts) { } @@ -84,11 +84,11 @@ class layout_right::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) ) ) MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible::value)) // needs two () due to comma - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(mapping const& other) noexcept // NOLINT(google-explicit-constructor) :__extents(other.extents()) { @@ -101,12 +101,12 @@ class layout_right::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) && + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) && (extents_type::rank() <= 1) ) ) MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible::value)) // needs two () due to comma - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(layout_left::mapping const& other) noexcept // NOLINT(google-explicit-constructor) :__extents(other.extents()) { @@ -147,11 +147,11 @@ class layout_right::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) ) ) MDSPAN_CONDITIONAL_EXPLICIT((extents_type::rank() > 0)) - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(layout_stride::mapping const& other) noexcept // NOLINT(google-explicit-constructor) :__extents(other.extents()) { @@ -162,7 +162,7 @@ class layout_right::mapping { detail::validate_strides(detail::with_rank{}, layout_right{}, __extents, other); } - MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default; MDSPAN_INLINE_FUNCTION constexpr const extents_type& extents() const noexcept { @@ -185,7 +185,7 @@ class layout_right::mapping { (detail::are_valid_indices()) ) ) - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type operator()(Indices... idxs) const noexcept { #if ! defined(NDEBUG) detail::check_all_indices(this->extents(), idxs...); @@ -236,7 +236,7 @@ class layout_right::mapping { template MDSPAN_INLINE_FUNCTION constexpr index_type __get_stride(MDSPAN_IMPL_STANDARD_NAMESPACE::extents,std::integer_sequence) const { - return _MDSPAN_FOLD_TIMES_RIGHT((Idx>N? __extents.template __extent():1),1); + return MDSPAN_IMPL_FOLD_TIMES_RIGHT((Idx>N? __extents.template __extent():1),1); } template MDSPAN_INLINE_FUNCTION diff --git a/include/experimental/__p0009_bits/layout_stride.hpp b/include/experimental/__p0009_bits/layout_stride.hpp index 62271bdb..7f29b79d 100644 --- a/include/experimental/__p0009_bits/layout_stride.hpp +++ b/include/experimental/__p0009_bits/layout_stride.hpp @@ -129,7 +129,7 @@ struct layout_stride { return this->__base_t::__ref().__second(); #endif } - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 __strides_storage_t& + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 __strides_storage_t& __strides_storage() noexcept { #if defined(MDSPAN_IMPL_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) return __members.__second(); @@ -139,9 +139,9 @@ struct layout_stride { } template - _MDSPAN_HOST_DEVICE + MDSPAN_IMPL_HOST_DEVICE constexpr index_type __get_size(::MDSPAN_IMPL_STANDARD_NAMESPACE::extents,std::integer_sequence) const { - return _MDSPAN_FOLD_TIMES_RIGHT( static_cast(extents().extent(Idx)), 1 ); + return MDSPAN_IMPL_FOLD_TIMES_RIGHT( static_cast(extents().extent(Idx)), 1 ); } //---------------------------------------------------------------------------- @@ -162,21 +162,21 @@ struct layout_stride { MDSPAN_INLINE_FUNCTION static constexpr bool _eq_impl(mapping const& self, mapping const& other) noexcept { using common_t = std::common_type_t; - return _MDSPAN_FOLD_AND((static_cast(self.stride(Idxs)) == static_cast(other.stride(Idxs))) /* && ... */) - && _MDSPAN_FOLD_AND((static_cast(self.extents().extent(Idxs)) == static_cast(other.extents().extent(Idxs))) /* || ... */); + return MDSPAN_IMPL_FOLD_AND((static_cast(self.stride(Idxs)) == static_cast(other.stride(Idxs))) /* && ... */) + && MDSPAN_IMPL_FOLD_AND((static_cast(self.extents().extent(Idxs)) == static_cast(other.extents().extent(Idxs))) /* || ... */); } template MDSPAN_INLINE_FUNCTION static constexpr bool _not_eq_impl(mapping const& self, mapping const& other) noexcept { using common_t = std::common_type_t; - return _MDSPAN_FOLD_OR((static_cast(self.stride(Idxs)) != static_cast(other.stride(Idxs))) /* || ... */) - || _MDSPAN_FOLD_OR((static_cast(self.extents().extent(Idxs)) != static_cast(other.extents().extent(Idxs))) /* || ... */); + return MDSPAN_IMPL_FOLD_OR((static_cast(self.stride(Idxs)) != static_cast(other.stride(Idxs))) /* || ... */) + || MDSPAN_IMPL_FOLD_OR((static_cast(self.extents().extent(Idxs)) != static_cast(other.extents().extent(Idxs))) /* || ... */); } template MDSPAN_FORCE_INLINE_FUNCTION static constexpr size_t _call_op_impl(mapping const& self, Integral... idxs) noexcept { - return _MDSPAN_FOLD_PLUS_RIGHT((idxs * self.stride(Idxs)), /* + ... + */ 0); + return MDSPAN_IMPL_FOLD_PLUS_RIGHT((idxs * self.stride(Idxs)), /* + ... + */ 0); } MDSPAN_INLINE_FUNCTION @@ -292,8 +292,8 @@ struct layout_stride { /* requires */ ( // MSVC 19.32 does not like using index_type here, requires the typename Extents::index_type // error C2641: cannot deduce template arguments for 'MDSPAN_IMPL_STANDARD_NAMESPACE::layout_stride::mapping' - _MDSPAN_TRAIT(std::is_convertible, const std::remove_const_t&, typename Extents::index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, typename Extents::index_type, const std::remove_const_t&) + MDSPAN_IMPL_TRAIT(std::is_convertible, const std::remove_const_t&, typename Extents::index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, typename Extents::index_type, const std::remove_const_t&) ) ) constexpr @@ -328,8 +328,8 @@ struct layout_stride { /* requires */ ( // MSVC 19.32 does not like using index_type here, requires the typename Extents::index_type // error C2641: cannot deduce template arguments for 'MDSPAN_IMPL_STANDARD_NAMESPACE::layout_stride::mapping' - _MDSPAN_TRAIT(std::is_convertible, const std::remove_const_t&, typename Extents::index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, typename Extents::index_type, const std::remove_const_t&) + MDSPAN_IMPL_TRAIT(std::is_convertible, const std::remove_const_t&, typename Extents::index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, typename Extents::index_type, const std::remove_const_t&) ) ) MDSPAN_INLINE_FUNCTION @@ -368,8 +368,8 @@ struct layout_stride { /* requires */ ( // MSVC 19.32 does not like using index_type here, requires the typename Extents::index_type // error C2641: cannot deduce template arguments for 'MDSPAN_IMPL_STANDARD_NAMESPACE::layout_stride::mapping' - _MDSPAN_TRAIT(std::is_convertible, const std::remove_const_t&, typename Extents::index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, typename Extents::index_type, const std::remove_const_t&) + MDSPAN_IMPL_TRAIT(std::is_convertible, const std::remove_const_t&, typename Extents::index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, typename Extents::index_type, const std::remove_const_t&) ) ) constexpr @@ -404,7 +404,7 @@ struct layout_stride { MDSPAN_TEMPLATE_REQUIRES( class StridedLayoutMapping, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, typename StridedLayoutMapping::extents_type) && + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, typename StridedLayoutMapping::extents_type) && detail::__is_mapping_of && StridedLayoutMapping::is_always_unique() && StridedLayoutMapping::is_always_strided() @@ -414,7 +414,7 @@ struct layout_stride { template requires( detail::__layout_mapping_alike && - _MDSPAN_TRAIT(std::is_constructible, extents_type, typename StridedLayoutMapping::extents_type) && + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, typename StridedLayoutMapping::extents_type) && StridedLayoutMapping::is_always_unique() && StridedLayoutMapping::is_always_strided() ) @@ -425,7 +425,7 @@ struct layout_stride { detail::__is_mapping_of || detail::__is_mapping_of)) ) // needs two () due to comma - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(StridedLayoutMapping const& other) noexcept // NOLINT(google-explicit-constructor) #if defined(MDSPAN_IMPL_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) : __members{ @@ -449,7 +449,7 @@ struct layout_stride { //-------------------------------------------------------------------------------- - MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED + MDSPAN_INLINE_FUNCTION_DEFAULTED MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default; MDSPAN_INLINE_FUNCTION constexpr const extents_type& extents() const noexcept { @@ -544,7 +544,7 @@ struct layout_stride { } public: - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 bool is_exhaustive() const noexcept { + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 bool is_exhaustive() const noexcept { return is_exhaustive_impl(detail::with_rank{}); } MDSPAN_INLINE_FUNCTION static constexpr bool is_strided() noexcept { return true; } diff --git a/include/experimental/__p0009_bits/macros.hpp b/include/experimental/__p0009_bits/macros.hpp index 948dd2c4..ed813db4 100644 --- a/include/experimental/__p0009_bits/macros.hpp +++ b/include/experimental/__p0009_bits/macros.hpp @@ -25,32 +25,32 @@ #include "assert.h" #endif -#ifndef _MDSPAN_HOST_DEVICE +#ifndef MDSPAN_IMPL_HOST_DEVICE # if defined(MDSPAN_IMPL_HAS_CUDA) || defined(MDSPAN_IMPL_HAS_HIP) -# define _MDSPAN_HOST_DEVICE __host__ __device__ +# define MDSPAN_IMPL_HOST_DEVICE __host__ __device__ # else -# define _MDSPAN_HOST_DEVICE +# define MDSPAN_IMPL_HOST_DEVICE # endif #endif #ifndef MDSPAN_FORCE_INLINE_FUNCTION # ifdef MDSPAN_IMPL_COMPILER_MSVC // Microsoft compilers -# define MDSPAN_FORCE_INLINE_FUNCTION __forceinline _MDSPAN_HOST_DEVICE +# define MDSPAN_FORCE_INLINE_FUNCTION __forceinline MDSPAN_IMPL_HOST_DEVICE # else -# define MDSPAN_FORCE_INLINE_FUNCTION __attribute__((always_inline)) _MDSPAN_HOST_DEVICE +# define MDSPAN_FORCE_INLINE_FUNCTION __attribute__((always_inline)) MDSPAN_IMPL_HOST_DEVICE # endif #endif #ifndef MDSPAN_INLINE_FUNCTION -# define MDSPAN_INLINE_FUNCTION inline _MDSPAN_HOST_DEVICE +# define MDSPAN_INLINE_FUNCTION inline MDSPAN_IMPL_HOST_DEVICE #endif #ifndef MDSPAN_FUNCTION -# define MDSPAN_FUNCTION _MDSPAN_HOST_DEVICE +# define MDSPAN_FUNCTION MDSPAN_IMPL_HOST_DEVICE #endif #ifdef MDSPAN_IMPL_HAS_HIP -# define MDSPAN_DEDUCTION_GUIDE _MDSPAN_HOST_DEVICE +# define MDSPAN_DEDUCTION_GUIDE MDSPAN_IMPL_HOST_DEVICE #else # define MDSPAN_DEDUCTION_GUIDE #endif @@ -64,15 +64,15 @@ // {{{1 #define MDSPAN_PP_COUNT(...) \ - _MDSPAN_PP_INTERNAL_EXPAND_ARGS_PRIVATE( \ - _MDSPAN_PP_INTERNAL_ARGS_AUGMENTER(__VA_ARGS__) \ + MDSPAN_IMPL_PP_INTERNAL_EXPAND_ARGS( \ + MDSPAN_IMPL_PP_INTERNAL_ARGS_AUGMENTER(__VA_ARGS__) \ ) -#define _MDSPAN_PP_INTERNAL_ARGS_AUGMENTER(...) unused, __VA_ARGS__ -#define _MDSPAN_PP_INTERNAL_EXPAND(x) x -#define _MDSPAN_PP_INTERNAL_EXPAND_ARGS_PRIVATE(...) \ - _MDSPAN_PP_INTERNAL_EXPAND( \ - _MDSPAN_PP_INTERNAL_COUNT_PRIVATE( \ +#define MDSPAN_IMPL_PP_INTERNAL_ARGS_AUGMENTER(...) unused, __VA_ARGS__ +#define MDSPAN_IMPL_PP_INTERNAL_EXPAND(x) x +#define MDSPAN_IMPL_PP_INTERNAL_EXPAND_ARGS(...) \ + MDSPAN_IMPL_PP_INTERNAL_EXPAND( \ + MDSPAN_IMPL_PP_INTERNAL_COUNT( \ __VA_ARGS__, 69, 68, 67, 66, 65, 64, 63, 62, 61, \ 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, \ 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, \ @@ -81,7 +81,7 @@ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 \ ) \ ) -# define _MDSPAN_PP_INTERNAL_COUNT_PRIVATE( \ +# define MDSPAN_IMPL_PP_INTERNAL_COUNT( \ _1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_, _9_, \ _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, \ _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, \ @@ -186,8 +186,8 @@ MDSPAN_FUNCTION constexpr void precondition(const char* cond, const char* file, # define MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) , typename ::std::enable_if<(REQ), int>::type = 0> # define MDSPAN_FUNCTION_REQUIRES(PAREN_PREQUALS, FNAME, PAREN_PARAMS, QUALS, REQ) \ MDSPAN_TEMPLATE_REQUIRES( \ - class __function_requires_ignored=void, \ - (std::is_void<__function_requires_ignored>::value && REQ) \ + class function_requires_ignored=void, \ + (std::is_void::value && REQ) \ ) MDSPAN_PP_REMOVE_PARENS(PAREN_PREQUALS) FNAME PAREN_PARAMS QUALS \ /**/ #endif @@ -287,8 +287,8 @@ MDSPAN_FUNCTION constexpr void precondition(const char* cond, const char* file, #define MDSPAN_INSTANTIATE_ONLY_IF_USED \ MDSPAN_TEMPLATE_REQUIRES( \ - class __instantiate_only_if_used_tparam=void, \ - ( _MDSPAN_TRAIT(std::is_void, __instantiate_only_if_used_tparam) ) \ + class instantiate_only_if_used_tparam=void, \ + ( MDSPAN_IMPL_TRAIT(std::is_void, instantiate_only_if_used_tparam) ) \ ) \ /**/ @@ -299,9 +299,9 @@ MDSPAN_FUNCTION constexpr void precondition(const char* cond, const char* file, // {{{1 #ifdef MDSPAN_IMPL_USE_INLINE_VARIABLES -# define _MDSPAN_INLINE_VARIABLE inline +# define MDSPAN_IMPL_INLINE_VARIABLE inline #else -# define _MDSPAN_INLINE_VARIABLE +# define MDSPAN_IMPL_INLINE_VARIABLE #endif // end inline variables }}}1 @@ -311,16 +311,16 @@ MDSPAN_FUNCTION constexpr void precondition(const char* cond, const char* file, // {{{1 #if MDSPAN_IMPL_USE_RETURN_TYPE_DEDUCTION -# define _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ +# define MDSPAN_IMPL_DEDUCE_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ auto MDSPAN_PP_REMOVE_PARENS(SIGNATURE) { return MDSPAN_PP_REMOVE_PARENS(BODY); } -# define _MDSPAN_DEDUCE_DECLTYPE_AUTO_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ +# define MDSPAN_IMPL_DEDUCE_DECLTYPE_AUTO_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ decltype(auto) MDSPAN_PP_REMOVE_PARENS(SIGNATURE) { return MDSPAN_PP_REMOVE_PARENS(BODY); } #else -# define _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ +# define MDSPAN_IMPL_DEDUCE_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ auto MDSPAN_PP_REMOVE_PARENS(SIGNATURE) \ -> std::remove_cv_t> \ { return MDSPAN_PP_REMOVE_PARENS(BODY); } -# define _MDSPAN_DEDUCE_DECLTYPE_AUTO_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ +# define MDSPAN_IMPL_DEDUCE_DECLTYPE_AUTO_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ auto MDSPAN_PP_REMOVE_PARENS(SIGNATURE) \ -> decltype(BODY) \ { return MDSPAN_PP_REMOVE_PARENS(BODY); } @@ -333,22 +333,22 @@ MDSPAN_FUNCTION constexpr void precondition(const char* cond, const char* file, //============================================================================== // {{{1 -struct __mdspan_enable_fold_comma { }; +struct mdspan_enable_fold_comma { }; #ifdef MDSPAN_IMPL_USE_FOLD_EXPRESSIONS -# define _MDSPAN_FOLD_AND(...) ((__VA_ARGS__) && ...) -# define _MDSPAN_FOLD_AND_TEMPLATE(...) ((__VA_ARGS__) && ...) -# define _MDSPAN_FOLD_OR(...) ((__VA_ARGS__) || ...) -# define _MDSPAN_FOLD_ASSIGN_LEFT(INIT, ...) (INIT = ... = (__VA_ARGS__)) -# define _MDSPAN_FOLD_ASSIGN_RIGHT(PACK, ...) (PACK = ... = (__VA_ARGS__)) -# define _MDSPAN_FOLD_TIMES_RIGHT(PACK, ...) (PACK * ... * (__VA_ARGS__)) -# define _MDSPAN_FOLD_PLUS_RIGHT(PACK, ...) (PACK + ... + (__VA_ARGS__)) -# define _MDSPAN_FOLD_COMMA(...) ((__VA_ARGS__), ...) +# define MDSPAN_IMPL_FOLD_AND(...) ((__VA_ARGS__) && ...) +# define MDSPAN_IMPL_FOLD_AND_TEMPLATE(...) ((__VA_ARGS__) && ...) +# define MDSPAN_IMPL_FOLD_OR(...) ((__VA_ARGS__) || ...) +# define MDSPAN_IMPL_FOLD_ASSIGN_LEFT(INIT, ...) (INIT = ... = (__VA_ARGS__)) +# define MDSPAN_IMPL_FOLD_ASSIGN_RIGHT(PACK, ...) (PACK = ... = (__VA_ARGS__)) +# define MDSPAN_IMPL_FOLD_TIMES_RIGHT(PACK, ...) (PACK * ... * (__VA_ARGS__)) +# define MDSPAN_IMPL_FOLD_PLUS_RIGHT(PACK, ...) (PACK + ... + (__VA_ARGS__)) +# define MDSPAN_IMPL_FOLD_COMMA(...) ((__VA_ARGS__), ...) #else namespace MDSPAN_IMPL_STANDARD_NAMESPACE { -namespace __fold_compatibility_impl { +namespace fold_compatibility_impl { // We could probably be more clever here, but at the (small) risk of losing some compiler understanding. For the // few operations we need, it's not worth generalizing over the operation @@ -356,73 +356,73 @@ namespace __fold_compatibility_impl { #if MDSPAN_IMPL_USE_RETURN_TYPE_DEDUCTION MDSPAN_FORCE_INLINE_FUNCTION -constexpr decltype(auto) __fold_right_and_impl() { +constexpr decltype(auto) fold_right_and_impl() { return true; } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr decltype(auto) __fold_right_and_impl(Arg&& arg, Args&&... args) { - return ((Arg&&)arg) && __fold_compatibility_impl::__fold_right_and_impl((Args&&)args...); +constexpr decltype(auto) fold_right_and_impl(Arg&& arg, Args&&... args) { + return ((Arg&&)arg) && fold_compatibility_impl::fold_right_and_impl((Args&&)args...); } MDSPAN_FORCE_INLINE_FUNCTION -constexpr decltype(auto) __fold_right_or_impl() { +constexpr decltype(auto) fold_right_or_impl() { return false; } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr auto __fold_right_or_impl(Arg&& arg, Args&&... args) { - return ((Arg&&)arg) || __fold_compatibility_impl::__fold_right_or_impl((Args&&)args...); +constexpr auto fold_right_or_impl(Arg&& arg, Args&&... args) { + return ((Arg&&)arg) || fold_compatibility_impl::fold_right_or_impl((Args&&)args...); } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr auto __fold_left_assign_impl(Arg1&& arg1) { +constexpr auto fold_left_assign_impl(Arg1&& arg1) { return (Arg1&&)arg1; } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr auto __fold_left_assign_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { - return __fold_compatibility_impl::__fold_left_assign_impl((((Arg1&&)arg1) = ((Arg2&&)arg2)), (Args&&)args...); +constexpr auto fold_left_assign_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { + return fold_compatibility_impl::fold_left_assign_impl((((Arg1&&)arg1) = ((Arg2&&)arg2)), (Args&&)args...); } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr auto __fold_right_assign_impl(Arg1&& arg1) { +constexpr auto fold_right_assign_impl(Arg1&& arg1) { return (Arg1&&)arg1; } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr auto __fold_right_assign_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { - return ((Arg1&&)arg1) = __fold_compatibility_impl::__fold_right_assign_impl((Arg2&&)arg2, (Args&&)args...); +constexpr auto fold_right_assign_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { + return ((Arg1&&)arg1) = fold_compatibility_impl::fold_right_assign_impl((Arg2&&)arg2, (Args&&)args...); } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr auto __fold_right_plus_impl(Arg1&& arg1) { +constexpr auto fold_right_plus_impl(Arg1&& arg1) { return (Arg1&&)arg1; } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr auto __fold_right_plus_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { - return ((Arg1&&)arg1) + __fold_compatibility_impl::__fold_right_plus_impl((Arg2&&)arg2, (Args&&)args...); +constexpr auto fold_right_plus_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { + return ((Arg1&&)arg1) + fold_compatibility_impl::fold_right_plus_impl((Arg2&&)arg2, (Args&&)args...); } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr auto __fold_right_times_impl(Arg1&& arg1) { +constexpr auto fold_right_times_impl(Arg1&& arg1) { return (Arg1&&)arg1; } template MDSPAN_FORCE_INLINE_FUNCTION -constexpr auto __fold_right_times_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { - return ((Arg1&&)arg1) * __fold_compatibility_impl::__fold_right_times_impl((Arg2&&)arg2, (Args&&)args...); +constexpr auto fold_right_times_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { + return ((Arg1&&)arg1) * fold_compatibility_impl::fold_right_times_impl((Arg2&&)arg2, (Args&&)args...); } #else @@ -431,32 +431,32 @@ constexpr auto __fold_right_times_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) // {{{2 template -struct __fold_right_and_impl_; +struct fold_right_and_impl_; template <> -struct __fold_right_and_impl_<> { - using __rv = bool; +struct fold_right_and_impl_<> { + using rv = bool; MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl() noexcept { + static constexpr rv + impl() noexcept { return true; } }; template -struct __fold_right_and_impl_ { - using __next_t = __fold_right_and_impl_; - using __rv = decltype(std::declval() && std::declval()); +struct fold_right_and_impl_ { + using next_t = fold_right_and_impl_; + using rv = decltype(std::declval() && std::declval()); MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg&& arg, Args&&... args) noexcept { - return ((Arg&&)arg) && __next_t::__impl((Args&&)args...); + static constexpr rv + impl(Arg&& arg, Args&&... args) noexcept { + return ((Arg&&)arg) && next_t::impl((Args&&)args...); } }; template MDSPAN_FORCE_INLINE_FUNCTION -constexpr typename __fold_right_and_impl_::__rv -__fold_right_and_impl(Args&&... args) { - return __fold_right_and_impl_::__impl((Args&&)args...); +constexpr typename fold_right_and_impl_::rv +fold_right_and_impl(Args&&... args) { + return fold_right_and_impl_::impl((Args&&)args...); } // end right and }}}2 @@ -466,32 +466,32 @@ __fold_right_and_impl(Args&&... args) { // {{{2 template -struct __fold_right_or_impl_; +struct fold_right_or_impl_; template <> -struct __fold_right_or_impl_<> { - using __rv = bool; +struct fold_right_or_impl_<> { + using rv = bool; MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl() noexcept { + static constexpr rv + impl() noexcept { return false; } }; template -struct __fold_right_or_impl_ { - using __next_t = __fold_right_or_impl_; - using __rv = decltype(std::declval() || std::declval()); +struct fold_right_or_impl_ { + using next_t = fold_right_or_impl_; + using rv = decltype(std::declval() || std::declval()); MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg&& arg, Args&&... args) noexcept { - return ((Arg&&)arg) || __next_t::__impl((Args&&)args...); + static constexpr rv + impl(Arg&& arg, Args&&... args) noexcept { + return ((Arg&&)arg) || next_t::impl((Args&&)args...); } }; template MDSPAN_FORCE_INLINE_FUNCTION -constexpr typename __fold_right_or_impl_::__rv -__fold_right_or_impl(Args&&... args) { - return __fold_right_or_impl_::__impl((Args&&)args...); +constexpr typename fold_right_or_impl_::rv +fold_right_or_impl(Args&&... args) { + return fold_right_or_impl_::impl((Args&&)args...); } // end right or }}}2 @@ -501,32 +501,32 @@ __fold_right_or_impl(Args&&... args) { // {{{2 template -struct __fold_right_plus_impl_; +struct fold_right_plus_impl_; template -struct __fold_right_plus_impl_ { - using __rv = Arg&&; +struct fold_right_plus_impl_ { + using rv = Arg&&; MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg&& arg) noexcept { + static constexpr rv + impl(Arg&& arg) noexcept { return (Arg&&)arg; } }; template -struct __fold_right_plus_impl_ { - using __next_t = __fold_right_plus_impl_; - using __rv = decltype(std::declval() + std::declval()); +struct fold_right_plus_impl_ { + using next_t = fold_right_plus_impl_; + using rv = decltype(std::declval() + std::declval()); MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { - return ((Arg1&&)arg) + __next_t::__impl((Arg2&&)arg2, (Args&&)args...); + static constexpr rv + impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { + return ((Arg1&&)arg) + next_t::impl((Arg2&&)arg2, (Args&&)args...); } }; template MDSPAN_FORCE_INLINE_FUNCTION -constexpr typename __fold_right_plus_impl_::__rv -__fold_right_plus_impl(Args&&... args) { - return __fold_right_plus_impl_::__impl((Args&&)args...); +constexpr typename fold_right_plus_impl_::rv +fold_right_plus_impl(Args&&... args) { + return fold_right_plus_impl_::impl((Args&&)args...); } // end right plus }}}2 @@ -536,32 +536,32 @@ __fold_right_plus_impl(Args&&... args) { // {{{2 template -struct __fold_right_times_impl_; +struct fold_right_times_impl_; template -struct __fold_right_times_impl_ { - using __rv = Arg&&; +struct fold_right_times_impl_ { + using rv = Arg&&; MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg&& arg) noexcept { + static constexpr rv + impl(Arg&& arg) noexcept { return (Arg&&)arg; } }; template -struct __fold_right_times_impl_ { - using __next_t = __fold_right_times_impl_; - using __rv = decltype(std::declval() * std::declval()); +struct fold_right_times_impl_ { + using next_t = fold_right_times_impl_; + using rv = decltype(std::declval() * std::declval()); MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { - return ((Arg1&&)arg) * __next_t::__impl((Arg2&&)arg2, (Args&&)args...); + static constexpr rv + impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { + return ((Arg1&&)arg) * next_t::impl((Arg2&&)arg2, (Args&&)args...); } }; template MDSPAN_FORCE_INLINE_FUNCTION -constexpr typename __fold_right_times_impl_::__rv -__fold_right_times_impl(Args&&... args) { - return __fold_right_times_impl_::__impl((Args&&)args...); +constexpr typename fold_right_times_impl_::rv +fold_right_times_impl(Args&&... args) { + return fold_right_times_impl_::impl((Args&&)args...); } // end right times }}}2 @@ -571,32 +571,32 @@ __fold_right_times_impl(Args&&... args) { // {{{2 template -struct __fold_right_assign_impl_; +struct fold_right_assign_impl_; template -struct __fold_right_assign_impl_ { - using __rv = Arg&&; +struct fold_right_assign_impl_ { + using rv = Arg&&; MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg&& arg) noexcept { + static constexpr rv + impl(Arg&& arg) noexcept { return (Arg&&)arg; } }; template -struct __fold_right_assign_impl_ { - using __next_t = __fold_right_assign_impl_; - using __rv = decltype(std::declval() = std::declval()); +struct fold_right_assign_impl_ { + using next_t = fold_right_assign_impl_; + using rv = decltype(std::declval() = std::declval()); MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { - return ((Arg1&&)arg) = __next_t::__impl((Arg2&&)arg2, (Args&&)args...); + static constexpr rv + impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { + return ((Arg1&&)arg) = next_t::impl((Arg2&&)arg2, (Args&&)args...); } }; template MDSPAN_FORCE_INLINE_FUNCTION -constexpr typename __fold_right_assign_impl_::__rv -__fold_right_assign_impl(Args&&... args) { - return __fold_right_assign_impl_::__impl((Args&&)args...); +constexpr typename fold_right_assign_impl_::rv +fold_right_assign_impl(Args&&... args) { + return fold_right_assign_impl_::impl((Args&&)args...); } // end right assign }}}2 @@ -606,33 +606,33 @@ __fold_right_assign_impl(Args&&... args) { // {{{2 template -struct __fold_left_assign_impl_; +struct fold_left_assign_impl_; template -struct __fold_left_assign_impl_ { - using __rv = Arg&&; +struct fold_left_assign_impl_ { + using rv = Arg&&; MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg&& arg) noexcept { + static constexpr rv + impl(Arg&& arg) noexcept { return (Arg&&)arg; } }; template -struct __fold_left_assign_impl_ { - using __assign_result_t = decltype(std::declval() = std::declval()); - using __next_t = __fold_left_assign_impl_<__assign_result_t, Args...>; - using __rv = typename __next_t::__rv; +struct fold_left_assign_impl_ { + using assign_result_t = decltype(std::declval() = std::declval()); + using next_t = fold_left_assign_impl_; + using rv = typename next_t::rv; MDSPAN_FORCE_INLINE_FUNCTION - static constexpr __rv - __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { - return __next_t::__impl(((Arg1&&)arg) = (Arg2&&)arg2, (Args&&)args...); + static constexpr rv + impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { + return next_t::impl(((Arg1&&)arg) = (Arg2&&)arg2, (Args&&)args...); } }; template MDSPAN_FORCE_INLINE_FUNCTION -constexpr typename __fold_left_assign_impl_::__rv -__fold_left_assign_impl(Args&&... args) { - return __fold_left_assign_impl_::__impl((Args&&)args...); +constexpr typename fold_left_assign_impl_::rv +fold_left_assign_impl(Args&&... args) { + return fold_left_assign_impl_::impl((Args&&)args...); } // end left assign }}}2 @@ -642,25 +642,25 @@ __fold_left_assign_impl(Args&&... args) { template -constexpr __mdspan_enable_fold_comma __fold_comma_impl(Args&&...) noexcept { return { }; } +constexpr mdspan_enable_fold_comma fold_comma_impl(Args&&...) noexcept { return { }; } template -struct __bools; +struct fold_bools; -} // __fold_compatibility_impl +} // fold_compatibility_impl } // end namespace MDSPAN_IMPL_STANDARD_NAMESPACE -# define _MDSPAN_FOLD_AND(...) MDSPAN_IMPL_STANDARD_NAMESPACE::__fold_compatibility_impl::__fold_right_and_impl((__VA_ARGS__)...) -# define _MDSPAN_FOLD_OR(...) MDSPAN_IMPL_STANDARD_NAMESPACE::__fold_compatibility_impl::__fold_right_or_impl((__VA_ARGS__)...) -# define _MDSPAN_FOLD_ASSIGN_LEFT(INIT, ...) MDSPAN_IMPL_STANDARD_NAMESPACE::__fold_compatibility_impl::__fold_left_assign_impl(INIT, (__VA_ARGS__)...) -# define _MDSPAN_FOLD_ASSIGN_RIGHT(PACK, ...) MDSPAN_IMPL_STANDARD_NAMESPACE::__fold_compatibility_impl::__fold_right_assign_impl((PACK)..., __VA_ARGS__) -# define _MDSPAN_FOLD_TIMES_RIGHT(PACK, ...) MDSPAN_IMPL_STANDARD_NAMESPACE::__fold_compatibility_impl::__fold_right_times_impl((PACK)..., __VA_ARGS__) -# define _MDSPAN_FOLD_PLUS_RIGHT(PACK, ...) MDSPAN_IMPL_STANDARD_NAMESPACE::__fold_compatibility_impl::__fold_right_plus_impl((PACK)..., __VA_ARGS__) -# define _MDSPAN_FOLD_COMMA(...) MDSPAN_IMPL_STANDARD_NAMESPACE::__fold_compatibility_impl::__fold_comma_impl((__VA_ARGS__)...) +# define MDSPAN_IMPL_FOLD_AND(...) MDSPAN_IMPL_STANDARD_NAMESPACE::fold_compatibility_impl::fold_right_and_impl((__VA_ARGS__)...) +# define MDSPAN_IMPL_FOLD_OR(...) MDSPAN_IMPL_STANDARD_NAMESPACE::fold_compatibility_impl::fold_right_or_impl((__VA_ARGS__)...) +# define MDSPAN_IMPL_FOLD_ASSIGN_LEFT(INIT, ...) MDSPAN_IMPL_STANDARD_NAMESPACE::fold_compatibility_impl::fold_left_assign_impl(INIT, (__VA_ARGS__)...) +# define MDSPAN_IMPL_FOLD_ASSIGN_RIGHT(PACK, ...) MDSPAN_IMPL_STANDARD_NAMESPACE::fold_compatibility_impl::fold_right_assign_impl((PACK)..., __VA_ARGS__) +# define MDSPAN_IMPL_FOLD_TIMES_RIGHT(PACK, ...) MDSPAN_IMPL_STANDARD_NAMESPACE::fold_compatibility_impl::fold_right_times_impl((PACK)..., __VA_ARGS__) +# define MDSPAN_IMPL_FOLD_PLUS_RIGHT(PACK, ...) MDSPAN_IMPL_STANDARD_NAMESPACE::fold_compatibility_impl::fold_right_plus_impl((PACK)..., __VA_ARGS__) +# define MDSPAN_IMPL_FOLD_COMMA(...) MDSPAN_IMPL_STANDARD_NAMESPACE::fold_compatibility_impl::fold_comma_impl((__VA_ARGS__)...) -# define _MDSPAN_FOLD_AND_TEMPLATE(...) \ - _MDSPAN_TRAIT(std::is_same, __fold_compatibility_impl::__bools<(__VA_ARGS__)..., true>, __fold_compatibility_impl::__bools) +# define MDSPAN_IMPL_FOLD_AND_TEMPLATE(...) \ + MDSPAN_IMPL_TRAIT(std::is_same, fold_compatibility_impl::fold_bools<(__VA_ARGS__)..., true>, fold_compatibility_impl::fold_bools) #endif @@ -671,9 +671,9 @@ struct __bools; // {{{1 #if MDSPAN_IMPL_USE_VARIABLE_TEMPLATES -# define _MDSPAN_TRAIT(TRAIT, ...) TRAIT##_v<__VA_ARGS__> +# define MDSPAN_IMPL_TRAIT(TRAIT, ...) TRAIT##_v<__VA_ARGS__> #else -# define _MDSPAN_TRAIT(TRAIT, ...) TRAIT<__VA_ARGS__>::value +# define MDSPAN_IMPL_TRAIT(TRAIT, ...) TRAIT<__VA_ARGS__>::value #endif // end Variable template compatibility }}}1 @@ -683,16 +683,16 @@ struct __bools; // {{{1 #if MDSPAN_IMPL_USE_CONSTEXPR_14 -# define _MDSPAN_CONSTEXPR_14 constexpr +# define MDSPAN_IMPL_CONSTEXPR_14 constexpr // Workaround for a bug (I think?) in EDG frontends # ifdef __EDG__ -# define _MDSPAN_CONSTEXPR_14_DEFAULTED +# define MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED # else -# define _MDSPAN_CONSTEXPR_14_DEFAULTED constexpr +# define MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED constexpr # endif #else -# define _MDSPAN_CONSTEXPR_14 -# define _MDSPAN_CONSTEXPR_14_DEFAULTED +# define MDSPAN_IMPL_CONSTEXPR_14 +# define MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED #endif // end Pre-C++14 constexpr }}}1 diff --git a/include/experimental/__p0009_bits/mdspan.hpp b/include/experimental/__p0009_bits/mdspan.hpp index c0ee10c6..fd6866cc 100644 --- a/include/experimental/__p0009_bits/mdspan.hpp +++ b/include/experimental/__p0009_bits/mdspan.hpp @@ -46,11 +46,11 @@ class mdspan { MDSPAN_FORCE_INLINE_FUNCTION static constexpr size_t __size(mdspan const& __self) noexcept { - return _MDSPAN_FOLD_TIMES_RIGHT((__self.__mapping_ref().extents().extent(Idxs)), /* * ... * */ size_t(1)); + return MDSPAN_IMPL_FOLD_TIMES_RIGHT((__self.__mapping_ref().extents().extent(Idxs)), /* * ... * */ size_t(1)); } MDSPAN_FORCE_INLINE_FUNCTION static constexpr bool __empty(mdspan const& __self) noexcept { - return (__self.rank()>0) && _MDSPAN_FOLD_OR((__self.__mapping_ref().extents().extent(Idxs)==index_type(0))); + return (__self.rank()>0) && MDSPAN_IMPL_FOLD_OR((__self.__mapping_ref().extents().extent(Idxs)==index_type(0))); } template MDSPAN_FORCE_INLINE_FUNCTION static constexpr @@ -107,9 +107,9 @@ class mdspan requires( // nvhpc has a bug where using just rank_dynamic() here doesn't work ... (extents_type::rank_dynamic() > 0) && - _MDSPAN_TRAIT(std::is_default_constructible, data_handle_type) && - _MDSPAN_TRAIT(std::is_default_constructible, mapping_type) && - _MDSPAN_TRAIT(std::is_default_constructible, accessor_type) + MDSPAN_IMPL_TRAIT(std::is_default_constructible, data_handle_type) && + MDSPAN_IMPL_TRAIT(std::is_default_constructible, mapping_type) && + MDSPAN_IMPL_TRAIT(std::is_default_constructible, accessor_type) ) = default; #endif MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdspan(const mdspan&) = default; @@ -120,8 +120,8 @@ class mdspan /* requires */ ( ((sizeof...(SizeTypes) == rank()) || (sizeof...(SizeTypes) == rank_dynamic())) && (detail::are_valid_indices()) && - _MDSPAN_TRAIT(std::is_constructible, mapping_type, extents_type) && - _MDSPAN_TRAIT(std::is_default_constructible, accessor_type) + MDSPAN_IMPL_TRAIT(std::is_constructible, mapping_type, extents_type) && + MDSPAN_IMPL_TRAIT(std::is_default_constructible, accessor_type) ) ) MDSPAN_INLINE_FUNCTION @@ -133,11 +133,11 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, size_t N, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) && + MDSPAN_IMPL_TRAIT(std::is_convertible, const SizeType&, index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) && ((N == rank()) || (N == rank_dynamic())) && - _MDSPAN_TRAIT(std::is_constructible, mapping_type, extents_type) && - _MDSPAN_TRAIT(std::is_default_constructible, accessor_type) + MDSPAN_IMPL_TRAIT(std::is_constructible, mapping_type, extents_type) && + MDSPAN_IMPL_TRAIT(std::is_default_constructible, accessor_type) ) ) MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic()) @@ -150,11 +150,11 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, size_t N, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) && + MDSPAN_IMPL_TRAIT(std::is_convertible, const SizeType&, index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) && ((N == rank()) || (N == rank_dynamic())) && - _MDSPAN_TRAIT(std::is_constructible, mapping_type, extents_type) && - _MDSPAN_TRAIT(std::is_default_constructible, accessor_type) + MDSPAN_IMPL_TRAIT(std::is_constructible, mapping_type, extents_type) && + MDSPAN_IMPL_TRAIT(std::is_default_constructible, accessor_type) ) ) MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic()) @@ -167,15 +167,15 @@ class mdspan MDSPAN_FUNCTION_REQUIRES( (MDSPAN_INLINE_FUNCTION constexpr), mdspan, (data_handle_type p, const extents_type& exts), , - /* requires */ (_MDSPAN_TRAIT(std::is_default_constructible, accessor_type) && - _MDSPAN_TRAIT(std::is_constructible, mapping_type, const extents_type&)) + /* requires */ (MDSPAN_IMPL_TRAIT(std::is_default_constructible, accessor_type) && + MDSPAN_IMPL_TRAIT(std::is_constructible, mapping_type, const extents_type&)) ) : __members(std::move(p), __map_acc_pair_t(mapping_type(exts), accessor_type())) { } MDSPAN_FUNCTION_REQUIRES( (MDSPAN_INLINE_FUNCTION constexpr), mdspan, (data_handle_type p, const mapping_type& m), , - /* requires */ (_MDSPAN_TRAIT(std::is_default_constructible, accessor_type)) + /* requires */ (MDSPAN_IMPL_TRAIT(std::is_default_constructible, accessor_type)) ) : __members(std::move(p), __map_acc_pair_t(m, accessor_type())) { } @@ -187,20 +187,20 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherAccessor, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, mapping_type, const typename OtherLayoutPolicy::template mapping&) && - _MDSPAN_TRAIT(std::is_constructible, accessor_type, const OtherAccessor&) + MDSPAN_IMPL_TRAIT(std::is_constructible, mapping_type, const typename OtherLayoutPolicy::template mapping&) && + MDSPAN_IMPL_TRAIT(std::is_constructible, accessor_type, const OtherAccessor&) ) ) MDSPAN_CONDITIONAL_EXPLICIT( - !_MDSPAN_TRAIT(std::is_convertible, const typename OtherLayoutPolicy::template mapping&, mapping_type) || - !_MDSPAN_TRAIT(std::is_convertible, const OtherAccessor&, accessor_type) + !MDSPAN_IMPL_TRAIT(std::is_convertible, const typename OtherLayoutPolicy::template mapping&, mapping_type) || + !MDSPAN_IMPL_TRAIT(std::is_convertible, const OtherAccessor&, accessor_type) ) MDSPAN_INLINE_FUNCTION constexpr mdspan(const mdspan& other) : __members(other.__ptr_ref(), __map_acc_pair_t(other.__mapping_ref(), other.__accessor_ref())) { - static_assert(_MDSPAN_TRAIT(std::is_constructible, data_handle_type, typename OtherAccessor::data_handle_type),"Incompatible data_handle_type for mdspan construction"); - static_assert(_MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents),"Incompatible extents for mdspan construction"); + static_assert(MDSPAN_IMPL_TRAIT(std::is_constructible, data_handle_type, typename OtherAccessor::data_handle_type),"Incompatible data_handle_type for mdspan construction"); + static_assert(MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents),"Incompatible extents for mdspan construction"); /* * TODO: Check precondition * For each rank index r of extents_type, static_extent(r) == dynamic_extent || static_extent(r) == other.extent(r) is true. @@ -212,8 +212,8 @@ class mdspan ~mdspan() = default; */ - MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mdspan& operator=(const mdspan&) = default; - MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mdspan& operator=(mdspan&&) = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED mdspan& operator=(const mdspan&) = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED mdspan& operator=(mdspan&&) = default; //-------------------------------------------------------------------------------- @@ -223,8 +223,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class... SizeTypes, /* requires */ ( - _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_convertible, SizeTypes, index_type) /* && ... */) && - _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, SizeTypes) /* && ... */) && + MDSPAN_IMPL_FOLD_AND(MDSPAN_IMPL_TRAIT(std::is_convertible, SizeTypes, index_type) /* && ... */) && + MDSPAN_IMPL_FOLD_AND(MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, SizeTypes) /* && ... */) && (rank() == sizeof...(SizeTypes)) ) ) @@ -238,8 +238,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) + MDSPAN_IMPL_TRAIT(std::is_convertible, const SizeType&, index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) ) ) MDSPAN_FORCE_INLINE_FUNCTION @@ -252,8 +252,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) + MDSPAN_IMPL_TRAIT(std::is_convertible, const SizeType&, index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) ) ) MDSPAN_FORCE_INLINE_FUNCTION @@ -267,8 +267,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class Index, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, Index, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, Index) && + MDSPAN_IMPL_TRAIT(std::is_convertible, Index, index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, Index) && extents_type::rank() == 1 ) ) @@ -296,8 +296,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) + MDSPAN_IMPL_TRAIT(std::is_convertible, const SizeType&, index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) ) ) MDSPAN_FORCE_INLINE_FUNCTION @@ -310,8 +310,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) + MDSPAN_IMPL_TRAIT(std::is_convertible, const SizeType&, index_type) && + MDSPAN_IMPL_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) ) ) MDSPAN_FORCE_INLINE_FUNCTION @@ -370,11 +370,11 @@ class mdspan detail::__compressed_pair __members{}; - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 data_handle_type& __ptr_ref() noexcept { return __members.__first(); } + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 data_handle_type& __ptr_ref() noexcept { return __members.__first(); } MDSPAN_FORCE_INLINE_FUNCTION constexpr data_handle_type const& __ptr_ref() const noexcept { return __members.__first(); } - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 mapping_type& __mapping_ref() noexcept { return __members.__second().__first(); } + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping_type& __mapping_ref() noexcept { return __members.__second().__first(); } MDSPAN_FORCE_INLINE_FUNCTION constexpr mapping_type const& __mapping_ref() const noexcept { return __members.__second().__first(); } - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 accessor_type& __accessor_ref() noexcept { return __members.__second().__second(); } + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 accessor_type& __accessor_ref() noexcept { return __members.__second().__second(); } MDSPAN_FORCE_INLINE_FUNCTION constexpr accessor_type const& __accessor_ref() const noexcept { return __members.__second().__second(); } template @@ -385,7 +385,7 @@ class mdspan #if defined(MDSPAN_IMPL_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION) MDSPAN_TEMPLATE_REQUIRES( class ElementType, class... SizeTypes, - /* requires */ _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_convertible, SizeTypes, size_t) /* && ... */) && + /* requires */ MDSPAN_IMPL_FOLD_AND(MDSPAN_IMPL_TRAIT(std::is_convertible, SizeTypes, size_t) /* && ... */) && (sizeof...(SizeTypes) > 0) ) MDSPAN_DEDUCTION_GUIDE explicit mdspan(ElementType*, SizeTypes...) @@ -393,13 +393,13 @@ MDSPAN_DEDUCTION_GUIDE explicit mdspan(ElementType*, SizeTypes...) MDSPAN_TEMPLATE_REQUIRES( class Pointer, - (_MDSPAN_TRAIT(std::is_pointer, std::remove_reference_t)) + (MDSPAN_IMPL_TRAIT(std::is_pointer, std::remove_reference_t)) ) MDSPAN_DEDUCTION_GUIDE mdspan(Pointer&&) -> mdspan>, extents>; MDSPAN_TEMPLATE_REQUIRES( class CArray, - (_MDSPAN_TRAIT(std::is_array, CArray) && (std::rank_v == 1)) + (MDSPAN_IMPL_TRAIT(std::is_array, CArray) && (std::rank_v == 1)) ) MDSPAN_DEDUCTION_GUIDE mdspan(CArray&) -> mdspan, extents>>; diff --git a/include/experimental/__p0009_bits/no_unique_address.hpp b/include/experimental/__p0009_bits/no_unique_address.hpp index 18bdbaaf..4ffdabaf 100644 --- a/include/experimental/__p0009_bits/no_unique_address.hpp +++ b/include/experimental/__p0009_bits/no_unique_address.hpp @@ -30,7 +30,7 @@ struct __no_unique_address_emulation { MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__ref() const noexcept { return __v; } - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__ref() noexcept { + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T &__ref() noexcept { return __v; } }; @@ -41,11 +41,11 @@ struct __no_unique_address_emulation { template struct __no_unique_address_emulation< _T, _Disambiguator, - std::enable_if_t<_MDSPAN_TRAIT(std::is_empty, _T) && + std::enable_if_t> : + MDSPAN_IMPL_TRAIT(std::is_trivially_destructible, _T)>> : #ifdef MDSPAN_IMPL_COMPILER_MSVC // MSVC doesn't allow you to access public static member functions of a type // when you *happen* to privately inherit from that type. @@ -62,7 +62,7 @@ struct __no_unique_address_emulation< MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__ref() const noexcept { return *static_cast<_T const *>(this); } - MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__ref() noexcept { + MDSPAN_FORCE_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 _T &__ref() noexcept { return *static_cast<_T *>(this); } @@ -75,10 +75,10 @@ struct __no_unique_address_emulation< constexpr __no_unique_address_emulation( __no_unique_address_emulation &&) noexcept = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation & operator=(__no_unique_address_emulation const &) noexcept = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - _MDSPAN_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation & + MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation & operator=(__no_unique_address_emulation &&) noexcept = default; MDSPAN_INLINE_FUNCTION_DEFAULTED ~__no_unique_address_emulation() noexcept = default; diff --git a/include/experimental/__p0009_bits/trait_backports.hpp b/include/experimental/__p0009_bits/trait_backports.hpp index 0eeb999a..e1d6f8a3 100644 --- a/include/experimental/__p0009_bits/trait_backports.hpp +++ b/include/experimental/__p0009_bits/trait_backports.hpp @@ -31,7 +31,7 @@ namespace MDSPAN_IMPL_STANDARD_NAMESPACE { #define _MDSPAN_BACKPORT_TRAIT(TRAIT) \ - template _MDSPAN_INLINE_VARIABLE constexpr auto TRAIT##_v = TRAIT::value; + template MDSPAN_IMPL_INLINE_VARIABLE constexpr auto TRAIT##_v = TRAIT::value; _MDSPAN_BACKPORT_TRAIT(is_assignable) _MDSPAN_BACKPORT_TRAIT(is_constructible) diff --git a/include/experimental/__p0009_bits/type_list.hpp b/include/experimental/__p0009_bits/type_list.hpp index deca7c15..bbe0ede3 100644 --- a/include/experimental/__p0009_bits/type_list.hpp +++ b/include/experimental/__p0009_bits/type_list.hpp @@ -49,7 +49,7 @@ struct __type_at_assign_op_impl { template struct __type_at_large_impl<_I, __type_list<_Ts...>, std::integer_sequence> : decltype( - _MDSPAN_FOLD_ASSIGN_LEFT(__type_at_assign_op_impl{}, /* = ... = */ __type_at_entry<_I, _Idxs, _Ts>{}) + MDSPAN_IMPL_FOLD_ASSIGN_LEFT(__type_at_assign_op_impl{}, /* = ... = */ __type_at_entry<_I, _Idxs, _Ts>{}) ) { }; @@ -84,4 +84,3 @@ struct __type_at<3, __type_list<_T0, _T1, _T2, _T3, _Ts...>> { //============================================================================== } // end namespace MDSPAN_IMPL_STANDARD_NAMESPACE - diff --git a/include/experimental/__p1684_bits/mdarray.hpp b/include/experimental/__p1684_bits/mdarray.hpp index bdc5925f..7bb1085a 100644 --- a/include/experimental/__p1684_bits/mdarray.hpp +++ b/include/experimental/__p1684_bits/mdarray.hpp @@ -104,9 +104,9 @@ class mdarray { class... SizeTypes, /* requires */ ( (::MDSPAN_IMPL_STANDARD_NAMESPACE::detail::are_valid_indices()) && - _MDSPAN_TRAIT( std::is_constructible, extents_type, SizeTypes...) && - _MDSPAN_TRAIT( std::is_constructible, mapping_type, extents_type) && - (_MDSPAN_TRAIT( std::is_constructible, container_type, size_t) || + MDSPAN_IMPL_TRAIT( std::is_constructible, extents_type, SizeTypes...) && + MDSPAN_IMPL_TRAIT( std::is_constructible, mapping_type, extents_type) && + (MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, size_t) || container_is_array::value) && (extents_type::rank()>0 || extents_type::rank_dynamic()==0) ) @@ -119,16 +119,16 @@ class mdarray { MDSPAN_FUNCTION_REQUIRES( (MDSPAN_INLINE_FUNCTION constexpr), mdarray, (const extents_type& exts), , - /* requires */ ((_MDSPAN_TRAIT( std::is_constructible, container_type, size_t) || + /* requires */ ((MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, size_t) || container_is_array::value) && - _MDSPAN_TRAIT( std::is_constructible, mapping_type, extents_type)) + MDSPAN_IMPL_TRAIT( std::is_constructible, mapping_type, extents_type)) ) : map_(exts), ctr_(container_is_array::construct(map_)) { } MDSPAN_FUNCTION_REQUIRES( (MDSPAN_INLINE_FUNCTION constexpr), mdarray, (const mapping_type& m), , - /* requires */ (_MDSPAN_TRAIT( std::is_constructible, container_type, size_t) || + /* requires */ (MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, size_t) || container_is_array::value) ) : map_(m), ctr_(container_is_array::construct(map_)) { } @@ -136,7 +136,7 @@ class mdarray { MDSPAN_FUNCTION_REQUIRES( (MDSPAN_INLINE_FUNCTION constexpr), mdarray, (const extents_type& exts, const container_type& ctr), , - /* requires */ (_MDSPAN_TRAIT( std::is_constructible, mapping_type, extents_type)) + /* requires */ (MDSPAN_IMPL_TRAIT( std::is_constructible, mapping_type, extents_type)) ) : map_(exts), ctr_(ctr) { assert(ctr.size() >= static_cast(map_.required_span_size())); } @@ -147,7 +147,7 @@ class mdarray { MDSPAN_FUNCTION_REQUIRES( (MDSPAN_INLINE_FUNCTION constexpr), mdarray, (const extents_type& exts, container_type&& ctr), , - /* requires */ (_MDSPAN_TRAIT( std::is_constructible, mapping_type, extents_type)) + /* requires */ (MDSPAN_IMPL_TRAIT( std::is_constructible, mapping_type, extents_type)) ) : map_(exts), ctr_(std::move(ctr)) { assert(ctr_.size() >= static_cast(map_.required_span_size())); } @@ -159,8 +159,8 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherContainer, /* requires */ ( - _MDSPAN_TRAIT( std::is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping) && - _MDSPAN_TRAIT( std::is_constructible, container_type, OtherContainer) + MDSPAN_IMPL_TRAIT( std::is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping) && + MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, OtherContainer) ) ) MDSPAN_INLINE_FUNCTION @@ -173,8 +173,8 @@ class mdarray { // Constructors for container types constructible from a size and allocator MDSPAN_TEMPLATE_REQUIRES( class Alloc, - /* requires */ (_MDSPAN_TRAIT( std::is_constructible, container_type, size_t, Alloc) && - _MDSPAN_TRAIT( std::is_constructible, mapping_type, extents_type)) + /* requires */ (MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, size_t, Alloc) && + MDSPAN_IMPL_TRAIT( std::is_constructible, mapping_type, extents_type)) ) MDSPAN_INLINE_FUNCTION constexpr mdarray(const extents_type& exts, const Alloc& a) @@ -183,7 +183,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class Alloc, - /* requires */ (_MDSPAN_TRAIT( std::is_constructible, container_type, size_t, Alloc)) + /* requires */ (MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, size_t, Alloc)) ) MDSPAN_INLINE_FUNCTION constexpr mdarray(const mapping_type& map, const Alloc& a) @@ -193,8 +193,8 @@ class mdarray { // Constructors for container types constructible from a container and allocator MDSPAN_TEMPLATE_REQUIRES( class Alloc, - /* requires */ (_MDSPAN_TRAIT( std::is_constructible, container_type, container_type, Alloc) && - _MDSPAN_TRAIT( std::is_constructible, mapping_type, extents_type)) + /* requires */ (MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, container_type, Alloc) && + MDSPAN_IMPL_TRAIT( std::is_constructible, mapping_type, extents_type)) ) MDSPAN_INLINE_FUNCTION constexpr mdarray(const extents_type& exts, const container_type& ctr, const Alloc& a) @@ -203,7 +203,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class Alloc, - /* requires */ (_MDSPAN_TRAIT( std::is_constructible, container_type, size_t, Alloc)) + /* requires */ (MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, size_t, Alloc)) ) MDSPAN_INLINE_FUNCTION constexpr mdarray(const mapping_type& map, const container_type& ctr, const Alloc& a) @@ -212,8 +212,8 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class Alloc, - /* requires */ (_MDSPAN_TRAIT( std::is_constructible, container_type, container_type, Alloc) && - _MDSPAN_TRAIT( std::is_constructible, mapping_type, extents_type)) + /* requires */ (MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, container_type, Alloc) && + MDSPAN_IMPL_TRAIT( std::is_constructible, mapping_type, extents_type)) ) MDSPAN_INLINE_FUNCTION constexpr mdarray(const extents_type& exts, container_type&& ctr, const Alloc& a) @@ -222,7 +222,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class Alloc, - /* requires */ (_MDSPAN_TRAIT( std::is_constructible, container_type, size_t, Alloc)) + /* requires */ (MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, size_t, Alloc)) ) MDSPAN_INLINE_FUNCTION constexpr mdarray(const mapping_type& map, container_type&& ctr, const Alloc& a) @@ -232,8 +232,8 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherContainer, class Alloc, /* requires */ ( - _MDSPAN_TRAIT( std::is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping) && - _MDSPAN_TRAIT( std::is_constructible, container_type, OtherContainer, Alloc) + MDSPAN_IMPL_TRAIT( std::is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping) && + MDSPAN_IMPL_TRAIT( std::is_constructible, container_type, OtherContainer, Alloc) ) ) MDSPAN_INLINE_FUNCTION @@ -255,7 +255,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class... SizeTypes, /* requires */ ( - _MDSPAN_FOLD_AND(_MDSPAN_TRAIT( std::is_convertible, SizeTypes, index_type) /* && ... */) && + MDSPAN_IMPL_FOLD_AND(MDSPAN_IMPL_TRAIT( std::is_convertible, SizeTypes, index_type) /* && ... */) && extents_type::rank() == sizeof...(SizeTypes) ) ) @@ -268,7 +268,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class... SizeTypes, /* requires */ ( - _MDSPAN_FOLD_AND(_MDSPAN_TRAIT( std::is_convertible, SizeTypes, index_type) /* && ... */) && + MDSPAN_IMPL_FOLD_AND(MDSPAN_IMPL_TRAIT( std::is_convertible, SizeTypes, index_type) /* && ... */) && extents_type::rank() == sizeof...(SizeTypes) ) ) @@ -283,7 +283,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class SizeType, size_t N, /* requires */ ( - _MDSPAN_TRAIT( std::is_convertible, SizeType, index_type) && + MDSPAN_IMPL_TRAIT( std::is_convertible, SizeType, index_type) && N == extents_type::rank() ) ) @@ -296,7 +296,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class SizeType, size_t N, /* requires */ ( - _MDSPAN_TRAIT( std::is_convertible, SizeType, index_type) && + MDSPAN_IMPL_TRAIT( std::is_convertible, SizeType, index_type) && N == extents_type::rank() ) ) @@ -338,7 +338,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class SizeType, size_t N, /* requires */ ( - _MDSPAN_TRAIT( std::is_convertible, SizeType, index_type) && + MDSPAN_IMPL_TRAIT( std::is_convertible, SizeType, index_type) && N == extents_type::rank() ) ) @@ -351,7 +351,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class SizeType, size_t N, /* requires */ ( - _MDSPAN_TRAIT( std::is_convertible, SizeType, index_type) && + MDSPAN_IMPL_TRAIT( std::is_convertible, SizeType, index_type) && N == extents_type::rank() ) ) @@ -401,7 +401,7 @@ class mdarray { class OtherElementType, class OtherExtents, class OtherLayoutType, class OtherAccessorType, /* requires */ ( - _MDSPAN_TRAIT(std::is_assignable, + MDSPAN_IMPL_TRAIT(std::is_assignable, mdspan, mdspan_type) ) @@ -414,7 +414,7 @@ class mdarray { class OtherElementType, class OtherExtents, class OtherLayoutType, class OtherAccessorType, /* requires */ ( - _MDSPAN_TRAIT(std::is_assignable, + MDSPAN_IMPL_TRAIT(std::is_assignable, mdspan, const_mdspan_type) ) @@ -426,7 +426,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class OtherAccessorType = default_accessor, /* requires */ ( - _MDSPAN_TRAIT(std::is_assignable, mdspan_type, + MDSPAN_IMPL_TRAIT(std::is_assignable, mdspan_type, mdspan) ) ) @@ -438,7 +438,7 @@ class mdarray { MDSPAN_TEMPLATE_REQUIRES( class OtherAccessorType = default_accessor, /* requires */ ( - _MDSPAN_TRAIT(std::is_assignable, const_mdspan_type, + MDSPAN_IMPL_TRAIT(std::is_assignable, const_mdspan_type, mdspan) ) ) diff --git a/include/experimental/__p2630_bits/submdspan_mapping.hpp b/include/experimental/__p2630_bits/submdspan_mapping.hpp index cb9a2085..82f9193a 100644 --- a/include/experimental/__p2630_bits/submdspan_mapping.hpp +++ b/include/experimental/__p2630_bits/submdspan_mapping.hpp @@ -72,7 +72,7 @@ MDSPAN_INLINE_FUNCTION constexpr bool any_slice_out_of_bounds_helper(std::index_sequence, const extents &exts, const Slices &... slices) { - return _MDSPAN_FOLD_OR( + return MDSPAN_IMPL_FOLD_OR( (one_slice_out_of_bounds(exts.extent(RankIndices), slices))); } diff --git a/tests/foo_customizations.hpp b/tests/foo_customizations.hpp index 48ab4a88..cfd8e994 100644 --- a/tests/foo_customizations.hpp +++ b/tests/foo_customizations.hpp @@ -101,11 +101,11 @@ class layout_foo::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) ) ) MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible::value)) // needs two () due to comma - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(mapping const& other) noexcept // NOLINT(google-explicit-constructor) :__extents(other.extents()) { @@ -118,11 +118,11 @@ class layout_foo::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) ) ) MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible::value)) // needs two () due to comma - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(Kokkos::layout_right::mapping const& other) noexcept // NOLINT(google-explicit-constructor) :__extents(other.extents()) {} @@ -130,12 +130,12 @@ class layout_foo::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) && + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) && (extents_type::rank() <= 1) ) ) MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible::value)) // needs two () due to comma - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(Kokkos::layout_left::mapping const& other) noexcept // NOLINT(google-explicit-constructor) :__extents(other.extents()) {} @@ -143,11 +143,11 @@ class layout_foo::mapping { MDSPAN_TEMPLATE_REQUIRES( class OtherExtents, /* requires */ ( - _MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) + MDSPAN_IMPL_TRAIT(std::is_constructible, extents_type, OtherExtents) ) ) MDSPAN_CONDITIONAL_EXPLICIT((extents_type::rank() > 0)) - MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14 mapping(Kokkos::layout_stride::mapping const& other) // NOLINT(google-explicit-constructor) :__extents(other.extents()) { @@ -165,7 +165,7 @@ class layout_foo::mapping { #endif } - MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED MDSPAN_IMPL_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default; MDSPAN_INLINE_FUNCTION constexpr const extents_type& extents() const noexcept { diff --git a/tests/test_exhaustive_layouts.cpp b/tests/test_exhaustive_layouts.cpp index 7e8a3296..f6481087 100644 --- a/tests/test_exhaustive_layouts.cpp +++ b/tests/test_exhaustive_layouts.cpp @@ -20,7 +20,7 @@ #include #include -_MDSPAN_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; template size_t get_expected_mapping( diff --git a/tests/test_extents.cpp b/tests/test_extents.cpp index 9d57cb30..0438196f 100644 --- a/tests/test_extents.cpp +++ b/tests/test_extents.cpp @@ -45,7 +45,7 @@ struct TestExtents< void test_rank() { size_t* result = allocate_array(2); - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { extents_type _exts(DynamicSizes...); // Silencing an unused warning in nvc++ the condition will never be true size_t dyn_val = _exts.rank()>0?static_cast(_exts.extent(0)):1; @@ -63,7 +63,7 @@ struct TestExtents< void test_static_extent() { size_t* result = allocate_array(extents_type::rank()); - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { extents_type _exts(DynamicSizes...); for(size_t r=0; r<_exts.rank(); r++) { // Silencing an unused warning in nvc++ the condition will never be true @@ -83,7 +83,7 @@ struct TestExtents< void test_extent() { size_t* result = allocate_array(extents_type::rank()); - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { extents_type _exts(DynamicSizes...); for(size_t r=0; r<_exts.rank(); r++ ) result[r] = _exts.extent(r); diff --git a/tests/test_layout_ctors.cpp b/tests/test_layout_ctors.cpp index 78c6f896..15296fe3 100644 --- a/tests/test_layout_ctors.cpp +++ b/tests/test_layout_ctors.cpp @@ -17,7 +17,7 @@ #include -_MDSPAN_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; template struct TestLayoutCtors; template diff --git a/tests/test_layout_stride.cpp b/tests/test_layout_stride.cpp index a9605f11..8ae78339 100644 --- a/tests/test_layout_stride.cpp +++ b/tests/test_layout_stride.cpp @@ -17,7 +17,7 @@ #include -_MDSPAN_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; template struct TestLayoutStride; template diff --git a/tests/test_mdarray_ctors.cpp b/tests/test_mdarray_ctors.cpp index a224a546..9d478df7 100644 --- a/tests/test_mdarray_ctors.cpp +++ b/tests/test_mdarray_ctors.cpp @@ -54,7 +54,7 @@ struct ChatterResource : std::pmr::memory_resource{ namespace KokkosEx = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE; -_MDSPAN_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; template struct mdarray_values; @@ -172,7 +172,7 @@ void test_mdarray_ctor_data_carray() { size_t* errors = allocate_array(1); errors[0] = 0; - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { KokkosEx::mdarray, Kokkos::layout_right, std::array> m(Kokkos::extents{}); __MDSPAN_DEVICE_ASSERT_EQ(m.rank(), 1); __MDSPAN_DEVICE_ASSERT_EQ(m.rank_dynamic(), 0); diff --git a/tests/test_mdarray_to_mdspan.cpp b/tests/test_mdarray_to_mdspan.cpp index 71c22c3d..11482005 100644 --- a/tests/test_mdarray_to_mdspan.cpp +++ b/tests/test_mdarray_to_mdspan.cpp @@ -21,7 +21,7 @@ namespace KokkosEx = MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE; -_MDSPAN_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; template struct MDArrayToMDSpanOperatorTest { @@ -60,5 +60,3 @@ TEST(TestMDArray,mdarray_to_mdspan) { 100 ); } - - diff --git a/tests/test_mdspan_ctors.cpp b/tests/test_mdspan_ctors.cpp index 728f7d1d..261c506d 100644 --- a/tests/test_mdspan_ctors.cpp +++ b/tests/test_mdspan_ctors.cpp @@ -19,14 +19,14 @@ #include #include "offload_utils.hpp" -_MDSPAN_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; void test_mdspan_ctor_default() { size_t* errors = allocate_array(1); errors[0] = 0; - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { Kokkos::mdspan> m; __MDSPAN_DEVICE_ASSERT_EQ(m.data_handle(), nullptr); __MDSPAN_DEVICE_ASSERT_EQ(m.rank(), 1); @@ -50,7 +50,7 @@ void test_mdspan_ctor_data_carray() { size_t* errors = allocate_array(1); errors[0] = 0; - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { int data[1] = {42}; Kokkos::mdspan> m(data); __MDSPAN_DEVICE_ASSERT_EQ(m.data_handle(), data); diff --git a/tests/test_mdspan_swap.cpp b/tests/test_mdspan_swap.cpp index 7b074ccd..ba55119c 100644 --- a/tests/test_mdspan_swap.cpp +++ b/tests/test_mdspan_swap.cpp @@ -26,7 +26,7 @@ void test_mdspan_std_swap_static_extents() { size_t* errors = allocate_array(1); errors[0] = 0; - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { int data1[12] = {1,2,3,4,5,6,7,8,9,10,11,12}; int data2[12] = {21,22,23,24,25,26,27,28,29,30,31,32}; Kokkos::mdspan> m1(data1); @@ -66,7 +66,7 @@ void test_mdspan_std_swap_dynamic_extents() { size_t* errors = allocate_array(1); errors[0] = 0; - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { int data1[12] = {1,2,3,4,5,6,7,8,9,10,11,12}; int data2[12] = {21,22,23,24,25,26,27,28,29,30,31,32}; Kokkos::mdspan> m1(data1,3,4); @@ -108,7 +108,7 @@ void test_mdspan_foo_swap_dynamic_extents() { size_t* errors = allocate_array(1); errors[0] = 0; - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { using map_t = Foo::layout_foo::template mapping>; using acc_t = Foo::foo_accessor; diff --git a/tests/test_submdspan.cpp b/tests/test_submdspan.cpp index 701d5328..655eda67 100644 --- a/tests/test_submdspan.cpp +++ b/tests/test_submdspan.cpp @@ -23,7 +23,7 @@ #include "offload_utils.hpp" #include "foo_customizations.hpp" -_MDSPAN_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; +MDSPAN_IMPL_INLINE_VARIABLE constexpr auto dyn = Kokkos::dynamic_extent; TEST(TestSubmdspanLayoutRightStaticSizedRankReducing3Dto1D, test_submdspan_layout_right_static_sized_rank_reducing_3d_to_1d) { std::vector d(2 * 3 * 4, 0); @@ -357,7 +357,7 @@ struct TestSubMDSpan< map_t map{ typename mds_org_t::extents_type(ConstrArgs...) }; mds_org_t src(data, map); - dispatch([=] _MDSPAN_HOST_DEVICE () { + dispatch([=] MDSPAN_IMPL_HOST_DEVICE () { auto sub = Kokkos::submdspan(src, create_slice_arg(SubArgs())...); bool match = check_submdspan_match(0, 0, src, sub, std::index_sequence<>(), std::index_sequence<>(), create_slice_arg(SubArgs())...); result[0] = match?1:0;