@@ -1965,9 +1965,11 @@ NDARRAY_HOST_DEVICE array_ref<T, Shape> make_array_ref(T* base, const Shape& sha
1965
1965
1966
1966
namespace internal {
1967
1967
1968
+ struct no_resolve {};
1969
+
1968
1970
template <class T , class Shape >
1969
1971
NDARRAY_HOST_DEVICE array_ref<T, Shape> make_array_ref_no_resolve (T* base, const Shape& shape) {
1970
- return {base, shape, std::false_type () };
1972
+ return {base, shape, no_resolve{} };
1971
1973
}
1972
1974
1973
1975
template <class T , class Shape , class ... Args>
@@ -2032,7 +2034,7 @@ class array_ref {
2032
2034
shape_.resolve ();
2033
2035
}
2034
2036
2035
- NDARRAY_HOST_DEVICE array_ref (pointer base, const Shape& shape, std::false_type /* resolve */ )
2037
+ NDARRAY_HOST_DEVICE array_ref (pointer base, const Shape& shape, internal::no_resolve )
2036
2038
: base_(base), shape_(shape) {}
2037
2039
2038
2040
/* * Shallow copy or assign an array_ref. */
@@ -2044,7 +2046,7 @@ class array_ref {
2044
2046
/* * Shallow copy or assign an array_ref with a different shape type. */
2045
2047
template <class OtherShape , class = enable_if_shape_compatible<OtherShape>>
2046
2048
NDARRAY_HOST_DEVICE array_ref (const array_ref<T, OtherShape>& other)
2047
- : array_ref(other.base(), other.shape(), std::false_type() ) {}
2049
+ : array_ref(other.base(), other.shape(), internal::no_resolve{} ) {}
2048
2050
template <class OtherShape , class = enable_if_shape_compatible<OtherShape>>
2049
2051
NDARRAY_HOST_DEVICE array_ref& operator =(const array_ref<T, OtherShape>& other) {
2050
2052
base_ = other.base ();
@@ -2165,7 +2167,7 @@ class array_ref {
2165
2167
2166
2168
/* * Allow conversion from array_ref<T> to const_array_ref<T>. */
2167
2169
NDARRAY_HOST_DEVICE const const_array_ref<T, Shape> cref () const {
2168
- return const_array_ref<T, Shape>(base_, shape_);
2170
+ return const_array_ref<T, Shape>(base_, shape_, internal::no_resolve{} );
2169
2171
}
2170
2172
NDARRAY_HOST_DEVICE operator const_array_ref<T, Shape>() const { return cref (); }
2171
2173
@@ -2662,8 +2664,10 @@ class array {
2662
2664
}
2663
2665
2664
2666
/* * Make an array_ref referring to the data in this array. */
2665
- array_ref<T, Shape> ref () { return array_ref<T, Shape>(base_, shape_); }
2666
- const_array_ref<T, Shape> cref () const { return const_array_ref<T, Shape>(base_, shape_); }
2667
+ array_ref<T, Shape> ref () { return array_ref<T, Shape>(base_, shape_, internal::no_resolve{}); }
2668
+ const_array_ref<T, Shape> cref () const {
2669
+ return const_array_ref<T, Shape>(base_, shape_, internal::no_resolve{});
2670
+ }
2667
2671
const_array_ref<T, Shape> ref () const { return cref (); }
2668
2672
operator array_ref<T, Shape>() { return ref (); }
2669
2673
operator const_array_ref<T, Shape>() const { return cref (); }
@@ -2939,7 +2943,7 @@ bool equal(const array<TA, ShapeA, AllocA>& a, const array<TB, ShapeB, AllocB>&
2939
2943
* `NewShape`. The new shape is copy constructed from `a.shape()`. */
2940
2944
template <class NewShape , class T , class OldShape >
2941
2945
NDARRAY_HOST_DEVICE array_ref<T, NewShape> convert_shape (const array_ref<T, OldShape>& a) {
2942
- return array_ref<T, NewShape>(a.base (), convert_shape<NewShape>(a.shape ()));
2946
+ return array_ref<T, NewShape>(a.base (), convert_shape<NewShape>(a.shape ()), internal::no_resolve{} );
2943
2947
}
2944
2948
template <class NewShape , class T , class OldShape , class Allocator >
2945
2949
array_ref<T, NewShape> convert_shape (array<T, OldShape, Allocator>& a) {
@@ -2954,7 +2958,7 @@ const_array_ref<T, NewShape> convert_shape(const array<T, OldShape, Allocator>&
2954
2958
* `U`. `sizeof(T)` must be equal to `sizeof(U)`. */
2955
2959
template <class U , class T , class Shape , class = std::enable_if_t <sizeof (T) == sizeof (U)>>
2956
2960
NDARRAY_HOST_DEVICE array_ref<U, Shape> reinterpret (const array_ref<T, Shape>& a) {
2957
- return array_ref<U, Shape>(reinterpret_cast <U*>(a.base ()), a.shape ());
2961
+ return array_ref<U, Shape>(reinterpret_cast <U*>(a.base ()), a.shape (), internal::no_resolve{} );
2958
2962
}
2959
2963
template <class U , class T , class Shape , class Alloc ,
2960
2964
class = std::enable_if_t <sizeof (T) == sizeof (U)>>
@@ -2971,7 +2975,7 @@ const_array_ref<U, Shape> reinterpret(const array<T, Shape, Alloc>& a) {
2971
2975
* type `U` using `const_cast`. */
2972
2976
template <class U , class T , class Shape >
2973
2977
array_ref<U, Shape> reinterpret_const (const const_array_ref<T, Shape>& a) {
2974
- return array_ref<U, Shape>(const_cast <U*>(a.base ()), a.shape ());
2978
+ return array_ref<U, Shape>(const_cast <U*>(a.base ()), a.shape (), internal::no_resolve{} );
2975
2979
}
2976
2980
2977
2981
/* * Reinterpret the shape of the array or array_ref `a` to be a new shape
0 commit comments