Skip to content

Commit 1e514c8

Browse files
Fznamznonvladimirlaz
authored andcommitted
[SYCL] Use std::enable_if properly in buffer contructors
std::enable_if was used without "type" member type. Signed-off-by: Mariya Podchishchaeva <[email protected]>
1 parent edb3d6d commit 1e514c8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

sycl/include/CL/sycl/buffer.hpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace cl {
1818
namespace sycl {
1919
class handler;
2020
class queue;
21-
template <int dimentions> class range;
21+
template <int dimensions> class range;
2222

2323
template <typename T, int dimensions = 1,
2424
typename AllocatorT = cl::sycl::buffer_allocator>
@@ -28,6 +28,8 @@ class buffer {
2828
using reference = value_type &;
2929
using const_reference = const value_type &;
3030
using allocator_type = AllocatorT;
31+
template <int dims>
32+
using EnableIfOneDimension = typename std::enable_if<1 == dims>::type;
3133

3234
buffer(const range<dimensions> &bufferRange,
3335
const property_list &propList = {})
@@ -83,7 +85,8 @@ class buffer {
8385
hostData, get_count() * sizeof(T), propList);
8486
}
8587

86-
template <class InputIterator>
88+
template <class InputIterator, int N = dimensions,
89+
typename = EnableIfOneDimension<N>>
8790
buffer(InputIterator first, InputIterator last, AllocatorT allocator,
8891
const property_list &propList = {})
8992
: Range(range<1>(std::distance(first, last))) {
@@ -92,7 +95,7 @@ class buffer {
9295
}
9396

9497
template <class InputIterator, int N = dimensions,
95-
typename = std::enable_if<N == 1>>
98+
typename = EnableIfOneDimension<N>>
9699
buffer(InputIterator first, InputIterator last,
97100
const property_list &propList = {})
98101
: Range(range<1>(std::distance(first, last))) {
@@ -105,7 +108,7 @@ class buffer {
105108
// impl = std::make_shared<detail::buffer_impl>(b, baseIndex, subRange);
106109
// }
107110

108-
template <int N = dimensions, typename = std::enable_if<N == 1>>
111+
template <int N = dimensions, typename = EnableIfOneDimension<N>>
109112
buffer(cl_mem MemObject, const context &SyclContext,
110113
event AvailableEvent = {}) {
111114
impl = std::make_shared<detail::buffer_impl<AllocatorT>>(

0 commit comments

Comments
 (0)