@@ -1386,10 +1386,25 @@ struct
13861386#pragma clang diagnostic ignored "-Wpadded"
13871387#endif
13881388
1389- template <class T , ::boost::multi::dimensionality_type D, class Alloc >
1390- struct array : dynamic_array<T, D, Alloc> {
1389+ template <typename T, ::boost::multi::dimensionality_type D, class Alloc >
1390+ class unique_array : public dynamic_array <T, D, Alloc> {
1391+ using dynamic_ = dynamic_array<T, D, Alloc>;
1392+
1393+ public:
1394+ using dynamic_::dynamic_;
1395+ // unique_array(unique_array const&) = default;
1396+
1397+ #ifdef __NVCC__
1398+ #pragma nv_exec_check_disable
1399+ #endif
1400+ ~unique_array () noexcept = default ; // pins execution space to match dynamic_array (host-only)
1401+ };
1402+
1403+ template <typename T, ::boost::multi::dimensionality_type D, class Alloc >
1404+ struct array : unique_array<T, D, Alloc> {
13911405 private:
13921406 using dynamic_ = dynamic_array<T, D, Alloc>;
1407+ using unique_ = unique_array<T, D, Alloc>;
13931408
13941409 static_assert (
13951410 std::is_same_v<typename multi::allocator_traits<Alloc>::value_type, T> || std::is_same_v<typename multi::allocator_traits<Alloc>::value_type, void >,
@@ -1447,8 +1462,8 @@ struct array : dynamic_array<T, D, Alloc> {
14471462 constexpr explicit operator CArray&() && { return this ->template to_carray_ <CArray>(); } // cppcheck-suppress duplInheritedMember ; to override
14481463
14491464 // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved) false positive in clang-tidy 17-20 ?
1450- using dynamic_array <T, D, Alloc>::dynamic_array ; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) passing c-arrays to base
1451- using typename dynamic_array <T, D, Alloc>::value_type;
1465+ using unique_array <T, D, Alloc>::unique_array ; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) passing c-arrays to base
1466+ using typename unique_array <T, D, Alloc>::value_type;
14521467
14531468 // / Initializer list constructor from a (nested) list of (subarray) element @p values. (Nested list should not be ragged.) (allocates)
14541469 template <
@@ -1476,20 +1491,12 @@ struct array : dynamic_array<T, D, Alloc> {
14761491 // / Copy constructor from @p other array (generally allocates)
14771492 array (array const &) = default ;
14781493
1479- // Destructor, deallocates memory and destroys elements
1494+ // / Destructor, deallocates memory and destroys elements
14801495#ifdef __NVCC__
14811496#pragma nv_exec_check_disable
14821497#endif
14831498 ~array () noexcept = default ;
14841499
1485- // auto reshape(typename array::extensions_type extensions) & -> array& {
1486- // typename array::layout_t const new_layout{extensions}; // TODO(correaa) implement move-reextent in terms of reshape
1487- // assert(new_layout.num_elements() == this->num_elements());
1488- // this->layout_mutable() = new_layout;
1489- // assert(this->stride() != 0);
1490- // return *this;
1491- // }
1492-
14931500 // / Clear the values of array, making it empty (doesn't throw)
14941501 auto clear () noexcept -> array& { // cppcheck-suppress duplInheritedMember ; to override
14951502 dynamic_::clear ();
@@ -1506,9 +1513,9 @@ struct array : dynamic_array<T, D, Alloc> {
15061513
15071514 // / Move constructor from @p other array that also sets the allocator @p alloc (may allocate)
15081515 BOOST_MULTI_HD constexpr array (array&& other, Alloc const & alloc) noexcept // /< Same as the move constructor, except that alloc is used as the allocator.
1509- : dynamic_array <T, D, Alloc>{std::move (other), alloc} {}
1516+ : unique_array <T, D, Alloc>{std::move (other), alloc} {}
15101517
1511- BOOST_MULTI_HD constexpr array (array&& other) noexcept : dynamic_array <T, D, Alloc>{std::move (other)} {
1518+ BOOST_MULTI_HD constexpr array (array&& other) noexcept : unique_array <T, D, Alloc>{std::move (other)} {
15121519 assert (this ->stride () != 0 );
15131520 }
15141521
0 commit comments