Skip to content

Commit 4d854be

Browse files
committed
More examples
1 parent dfe6969 commit 4d854be

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

multi_ptr-cast/sycl-2.2/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ template <typename ElementTypeU, typename ElementTypeT, access::address_space Sp
149149
| *`multi_ptr<ElementTypeU, Space> const_pointer_cast(const multi_ptr<ElementTypeT, Space>& multiPtr)`* | Performs a `const_cast` of the underlying pointer `ElementTypeT*` contained within `multiPtr` to `ElementTypeU*` and returns a new `multi_ptr` instance containing the cast pointer. The address space stays the same. This conversion is only valid if the `const_cast` from `ElementType*` to `ElementTypeU*` is valid. |
150150
| *`multi_ptr<ElementTypeU, Space> reinterpret_pointer_cast(const multi_ptr<ElementTypeT, Space>& multiPtr)`* | Performs a `reinterpret_cast` of the underlying pointer `ElementTypeT*` contained within `multiPtr` to `ElementTypeU*` and returns a new `multi_ptr` instance containing the cast pointer. The address space stays the same. This conversion is only valid if the `reinterpret_cast` from `ElementType*` to `ElementTypeU*` is valid. |
151151

152+
## Add `const` to existing functions taking a `multi_ptr`
153+
154+
TODO(Peter)
155+
152156
## Examples
153157

154158
### Simple casts
@@ -188,3 +192,19 @@ TODO(Peter)
188192
### Passing `multi_ptr` to functions
189193
190194
TODO(Peter)
195+
196+
Implicit conversion to `multi_ptr<const ElementType, Space>`:
197+
198+
```cpp
199+
200+
using namespace cl::sycl;
201+
202+
template <typename ElementType, access::address_space Space>
203+
void function_taking_const_ptr(const multi_ptr<const ElementType, Space>& ptr);
204+
205+
const global_ptr<int> ptrInt = get_some_global_ptr();
206+
207+
// function_taking_const_ptr(static_cast<const int>(static_cast<void>(ptrInt)));
208+
function_taking_const_ptr(ptrInt);
209+
210+
```

0 commit comments

Comments
 (0)