@@ -270,19 +270,15 @@ class ArrayView
270270 { return ArraySlice< T, NDIM, USD, INDEX_TYPE >( data (), m_dims.data , m_strides.data ); }
271271
272272 /* *
273- * @brief Overload for rvalues that raises a compilation error when used .
273+ * @brief Overload for rvalues that is deleted .
274274 * @return A null ArraySlice.
275275 * @note This cannot be called on a rvalue since the @c ArraySlice would
276276 * contain pointers to the dims and strides of the current @c ArrayView that is
277277 * about to be destroyed. This overload prevents that from happening.
278278 */
279279 inline LVARRAY_HOST_DEVICE constexpr
280280 ArraySlice< T, NDIM, USD, INDEX_TYPE >
281- toSlice () const && noexcept
282- {
283- static_assert ( !typeManipulation::always_true< T >, " Cannot call toSlice on a rvalue." );
284- return ArraySlice< T, NDIM, USD, INDEX_TYPE >( nullptr , nullptr , nullptr );
285- }
281+ toSlice () const && noexcept = delete ;
286282
287283 /* *
288284 * @return Return an immutable ArraySlice representing this ArrayView.
@@ -293,19 +289,15 @@ class ArrayView
293289 { return ArraySlice< T const , NDIM, USD, INDEX_TYPE >( data (), m_dims.data , m_strides.data ); }
294290
295291 /* *
296- * @brief Overload for rvalues that raises a compilation error when used .
292+ * @brief Overload for rvalues that is deleted .
297293 * @return A null ArraySlice.
298294 * @brief This cannot be called on a rvalue since the @c ArraySlice would
299295 * contain pointers to the dims and strides of the current @c ArrayView that is
300296 * about to be destroyed. This overload prevents that from happening.
301297 */
302298 inline LVARRAY_HOST_DEVICE constexpr
303299 ArraySlice< T const , NDIM, USD, INDEX_TYPE >
304- toSliceConst () const && noexcept
305- {
306- static_assert ( !typeManipulation::always_true< T >, " Cannot call toSliceConst on a rvalue." );
307- return ArraySlice< T const , NDIM, USD, INDEX_TYPE >( nullptr , nullptr , nullptr );
308- }
300+ toSliceConst () const && noexcept = delete ;
309301
310302 /* *
311303 * @brief A user defined conversion operator (UDC) to an ArrayView< T const, ... >.
@@ -314,26 +306,9 @@ class ArrayView
314306 template < typename _T=T >
315307 inline LVARRAY_HOST_DEVICE constexpr
316308 operator std::enable_if_t < !std::is_const< _T >::value,
317- ArrayView< T const , NDIM, USD, INDEX_TYPE, BUFFER_TYPE > >() const & noexcept
309+ ArrayView< T const , NDIM, USD, INDEX_TYPE, BUFFER_TYPE > >() const noexcept
318310 { return toViewConst (); }
319311
320- /* *
321- * @brief Overload for rvalues that raises a compilation error when used.
322- * @return A null ArrayView.
323- * @brief This is valid when this is an @c ArrayView but invalid when this is an @c Array.
324- * I have been unable to allow the @c ArrayView conversion while not allowing the @c Array.
325- * Therefore the @c ArrayView conversion is not allowed, instead simply call @c toViewConst.
326- */
327- template < typename _T=T >
328- inline LVARRAY_HOST_DEVICE constexpr
329- operator std::enable_if_t < !std::is_const< _T >::value,
330- ArrayView< T const , NDIM, USD, INDEX_TYPE, BUFFER_TYPE > >() const && noexcept
331- {
332- static_assert ( !typeManipulation::always_true< T >,
333- " Cannot call toViewConst on a rvalue. If called from ArrayView please use toViewConst()." );
334- return toViewConst ();
335- }
336-
337312 /* *
338313 * @return Return an ArraySlice representing this ArrayView.
339314 */
@@ -342,18 +317,14 @@ class ArrayView
342317 { return toSlice (); }
343318
344319 /* *
345- * @brief Overload for rvalues that raises a compilation error when used .
320+ * @brief Overload for rvalues that is deleted .
346321 * @return A null ArraySlice.
347322 * @brief This conversion cannot be called on a rvalue since the @c ArraySlice would
348323 * contain pointers to the dims and strides of the current @c ArrayView that is
349324 * about to be destroyed. This overload prevents that from happening.
350325 */
351326 inline LVARRAY_HOST_DEVICE constexpr
352- operator ArraySlice< T, NDIM, USD, INDEX_TYPE >() const && noexcept
353- {
354- static_assert ( !typeManipulation::always_true< T >, " Cannot use conversion to an ArraySlice< T, ... > on a rvalue." );
355- return ArraySlice< T, NDIM, USD, INDEX_TYPE >( nullptr , nullptr , nullptr );
356- }
327+ operator ArraySlice< T, NDIM, USD, INDEX_TYPE >() const && noexcept = delete ;
357328
358329 /* *
359330 * @return Return an immutable ArraySlice representing this ArrayView.
@@ -365,7 +336,7 @@ class ArrayView
365336 { return toSliceConst (); }
366337
367338 /* *
368- * @brief Overload for rvalues that raises a compilation error when used .
339+ * @brief Overload for rvalues that is deleted .
369340 * @return A null ArraySlice.
370341 * @brief This conversion cannot be called on a rvalue since the @c ArraySlice would
371342 * contain pointers to the dims and strides of the current @c ArrayView that is
@@ -374,11 +345,7 @@ class ArrayView
374345 template < typename _T=T >
375346 inline LVARRAY_HOST_DEVICE constexpr
376347 operator std::enable_if_t < !std::is_const< _T >::value,
377- ArraySlice< T const , NDIM, USD, INDEX_TYPE > const >() const && noexcept
378- {
379- static_assert ( !typeManipulation::always_true< T >, " Cannot use conversion to an ArraySlice< T const, ... > on a rvalue." );
380- return ArraySlice< T const , NDIM, USD, INDEX_TYPE >( nullptr , nullptr , nullptr );
381- }
348+ ArraySlice< T const , NDIM, USD, INDEX_TYPE > const >() const && noexcept = delete ;
382349
383350 // /@}
384351
@@ -495,7 +462,7 @@ class ArrayView
495462 }
496463
497464 /* *
498- * @brief Overload for rvalues that raises a compilation error when used .
465+ * @brief Overload for rvalues that is deleted .
499466 * @param index Not used.
500467 * @return A null ArraySlice.
501468 * @brief The multidimensional operator[] cannot be called on a rvalue since the @c ArraySlice
@@ -505,12 +472,7 @@ class ArrayView
505472 template < int _NDIM=NDIM >
506473 LVARRAY_HOST_DEVICE inline CONSTEXPR_WITHOUT_BOUNDS_CHECK
507474 std::enable_if_t < (_NDIM > 1 ), ArraySlice< T, NDIM - 1 , USD - 1 , INDEX_TYPE > >
508- operator []( INDEX_TYPE const index ) const && noexcept
509- {
510- LVARRAY_UNUSED_VARIABLE ( index );
511- static_assert ( !typeManipulation::always_true< T >, " Cannot call multidimensional operator[] on an rvalue." );
512- return ArraySlice< T, NDIM-1 , USD-1 , INDEX_TYPE >( nullptr , nullptr , nullptr );
513- }
475+ operator []( INDEX_TYPE const index ) const && noexcept = delete ;
514476
515477 /* *
516478 * @return Return a reference to the value at the given index.
0 commit comments