@@ -22,46 +22,31 @@ template <int dimensions = 1> class array {
22
22
static_assert (dimensions >= 1 , " Array cannot be 0-dimensional." );
23
23
24
24
public:
25
- /* TODO: use common_array initialization via initialization list in
26
- * constructor when memset conversion between SPIR-V and LLVM IR formats
27
- * will be fixed in SPIR-V translator. */
28
- template <int N = dimensions, detail::enable_if_t <(N == 1 ), size_t > = 0 >
29
- array () {
30
- common_array[0 ] = 0 ;
31
- }
32
-
33
- template <int N = dimensions, detail::enable_if_t <(N == 2 ), size_t > = 0 >
34
- array () {
35
- common_array[0 ] = 0 ;
36
- common_array[1 ] = 0 ;
37
- }
38
-
39
- template <int N = dimensions, detail::enable_if_t <(N == 3 ), size_t > = 0 >
40
- array () {
41
- common_array[0 ] = 0 ;
42
- common_array[1 ] = 0 ;
43
- common_array[2 ] = 0 ;
44
- }
45
-
46
25
/* The following constructor is only available in the array struct
47
26
* specialization where: dimensions==1 */
48
27
template <int N = dimensions>
49
- array (typename std::enable_if<(N == 1 ), size_t >::type dim0)
28
+ array (typename std::enable_if<(N == 1 ), size_t >::type dim0 = 0 )
50
29
: common_array{dim0} {}
51
30
52
- /* The following constructor is only available in the array struct
31
+ /* The following constructors are only available in the array struct
53
32
* specialization where: dimensions==2 */
54
33
template <int N = dimensions>
55
34
array (typename std::enable_if<(N == 2 ), size_t >::type dim0, size_t dim1)
56
35
: common_array{dim0, dim1} {}
57
36
58
- /* The following constructor is only available in the array struct
37
+ template <int N = dimensions, detail::enable_if_t <(N == 2 ), size_t > = 0 >
38
+ array () : array(0 , 0 ) {}
39
+
40
+ /* The following constructors are only available in the array struct
59
41
* specialization where: dimensions==3 */
60
42
template <int N = dimensions>
61
43
array (typename std::enable_if<(N == 3 ), size_t >::type dim0, size_t dim1,
62
44
size_t dim2)
63
45
: common_array{dim0, dim1, dim2} {}
64
46
47
+ template <int N = dimensions, detail::enable_if_t <(N == 3 ), size_t > = 0 >
48
+ array () : array(0 , 0 , 0 ) {}
49
+
65
50
// Conversion operators to derived classes
66
51
operator cl::sycl::id<dimensions>() const {
67
52
cl::sycl::id<dimensions> result;
0 commit comments