@@ -21,7 +21,7 @@ class queue;
21
21
template <int dimentions> class range ;
22
22
23
23
template <typename T, int dimensions = 1 ,
24
- typename AllocatorT = cl::sycl::buffer_allocator< char > >
24
+ typename AllocatorT = cl::sycl::buffer_allocator>
25
25
class buffer {
26
26
public:
27
27
using value_type = T;
@@ -36,11 +36,11 @@ class buffer {
36
36
get_count () * sizeof (T), propList);
37
37
}
38
38
39
- // buffer(const range<dimensions> &bufferRange, AllocatorT allocator,
40
- // const property_list &propList = {}) {
41
- // impl = std::make_shared<detail::buffer_impl>(bufferRange, allocator,
42
- // propList);
43
- // }
39
+ buffer (const range<dimensions> &bufferRange, AllocatorT allocator,
40
+ const property_list &propList = {}) {
41
+ impl = std::make_shared<detail::buffer_impl<AllocatorT>>(
42
+ get_count () * sizeof (T), propList, allocator );
43
+ }
44
44
45
45
buffer (T *hostData, const range<dimensions> &bufferRange,
46
46
const property_list &propList = {})
@@ -49,11 +49,11 @@ class buffer {
49
49
hostData, get_count () * sizeof (T), propList);
50
50
}
51
51
52
- // buffer(T *hostData, const range<dimensions> &bufferRange,
53
- // AllocatorT allocator, const property_list &propList = {}) {
54
- // impl = std::make_shared<detail::buffer_impl>(hostData, bufferRange,
55
- // allocator, propList);
56
- // }
52
+ buffer (T *hostData, const range<dimensions> &bufferRange,
53
+ AllocatorT allocator, const property_list &propList = {}) {
54
+ impl = std::make_shared<detail::buffer_impl<AllocatorT>>(
55
+ hostData, get_count () * sizeof (T), propList, allocator );
56
+ }
57
57
58
58
buffer (const T *hostData, const range<dimensions> &bufferRange,
59
59
const property_list &propList = {})
@@ -62,18 +62,18 @@ class buffer {
62
62
hostData, get_count () * sizeof (T), propList);
63
63
}
64
64
65
- // buffer(const T *hostData, const range<dimensions> &bufferRange,
66
- // AllocatorT allocator, const property_list &propList = {}) {
67
- // impl = std::make_shared<detail::buffer_impl>(hostData, bufferRange,
68
- // allocator, propList);
69
- // }
65
+ buffer (const T *hostData, const range<dimensions> &bufferRange,
66
+ AllocatorT allocator, const property_list &propList = {}) {
67
+ impl = std::make_shared<detail::buffer_impl<AllocatorT>>(
68
+ hostData, get_count () * sizeof (T), propList, allocator );
69
+ }
70
70
71
- // buffer(const shared_ptr_class<T> &hostData,
72
- // const range<dimensions> &bufferRange, AllocatorT allocator,
73
- // const property_list &propList = {}) {
74
- // impl = std::make_shared<detail::buffer_impl>(hostData, bufferRange,
75
- // allocator, propList);
76
- // }
71
+ buffer (const shared_ptr_class<T> &hostData,
72
+ const range<dimensions> &bufferRange, AllocatorT allocator,
73
+ const property_list &propList = {}) {
74
+ impl = std::make_shared<detail::buffer_impl<AllocatorT>>(
75
+ hostData, get_count () * sizeof (T), propList, allocator );
76
+ }
77
77
78
78
buffer (const shared_ptr_class<T> &hostData,
79
79
const range<dimensions> &bufferRange,
@@ -83,12 +83,13 @@ class buffer {
83
83
hostData, get_count () * sizeof (T), propList);
84
84
}
85
85
86
- // template <class InputIterator>
87
- // buffer<T, 1>(InputIterator first, InputIterator last, AllocatorT allocator,
88
- // const property_list &propList = {}) {
89
- // impl = std::make_shared<detail::buffer_impl>(first, last, allocator,
90
- // propList);
91
- // }
86
+ template <class InputIterator >
87
+ buffer (InputIterator first, InputIterator last, AllocatorT allocator,
88
+ const property_list &propList = {})
89
+ : Range(range<1 >(std::distance(first, last))) {
90
+ impl = std::make_shared<detail::buffer_impl<AllocatorT>>(
91
+ first, last, get_count () * sizeof (T), propList, allocator);
92
+ }
92
93
93
94
template <class InputIterator , int N = dimensions,
94
95
typename = std::enable_if<N == 1 >>
@@ -135,7 +136,7 @@ class buffer {
135
136
136
137
size_t get_size () const { return impl->get_size (); }
137
138
138
- // AllocatorT get_allocator() const { return impl->get_allocator(); }
139
+ AllocatorT get_allocator () const { return impl->get_allocator (); }
139
140
140
141
template <access::mode mode,
141
142
access::target target = access::target::global_buffer>
0 commit comments