Skip to content

Commit c78d609

Browse files
committed
Tables and descriptions
1 parent 772fcf2 commit c78d609

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

multi_ptr-cast/sycl-2.2/index.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ class multi_ptr {
9999
The conversion operator to `multi_ptr<ElementTypeU, Space>` replaces
100100
the existing explicit conversion to `multi_ptr<void, Space>`.
101101
102-
TODO(Peter): Table
103-
104-
TODO(Peter): Handle multi_ptr<const void, Space>
102+
| Member function | Description |
103+
|-----------------|-------------|
104+
| *`template <typename ElementTypeU> explicit operator multi_ptr<ElementTypeU, Space>() const`* | Performs a static cast of the underlying pointer `ElementType*` 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 static cast from `ElementType*` to `ElementTypeU*` is valid. |
105+
| *`explicit operator multi_ptr<const ElementType, Space>() const`* | Performs a static cast of the underlying pointer `ElementType*` to `const ElementType*` and returns a new `multi_ptr` instance containing the cast pointer. The address space stays the same. |
105106
106107
## Conversion functions
107108
@@ -112,18 +113,22 @@ we propose adding the following free functions to the `cl::sycl` namespace:
112113
namespace cl {
113114
namespace sycl {
114115
116+
// Performs a static_cast of the contained pointer
115117
template <typename ElementTypeU, typename ElementTypeT, access::address_space Space>
116118
multi_ptr<ElementTypeU, Space>
117119
static_pointer_cast(const multi_ptr<ElementTypeT, Space>& multiPtr);
118120
121+
// Performs a dynamic_cast of the contained pointer
119122
template <typename ElementTypeU, typename ElementTypeT, access::address_space Space>
120123
multi_ptr<ElementTypeU, Space>
121124
dynamic_pointer_cast(const multi_ptr<ElementTypeT, Space>& multiPtr);
122125
126+
// Performs a const_cast of the contained pointer
123127
template <typename ElementTypeU, typename ElementTypeT, access::address_space Space>
124128
multi_ptr<ElementTypeU, Space>
125129
const_pointer_cast(const multi_ptr<ElementTypeT, Space>& multiPtr);
126130
131+
// Performs a reinterpret_cast of the contained pointer
127132
template <typename ElementTypeU, typename ElementTypeT, access::address_space Space>
128133
multi_ptr<ElementTypeU, Space>
129134
reinterpret_pointer_cast(const multi_ptr<ElementTypeT, Space>& multiPtr);
@@ -132,6 +137,15 @@ multi_ptr<ElementTypeU, Space>
132137
} // namespace cl
133138
```
134139

135-
TODO(Peter): Description
140+
In the table below, each function has the following template parameters:
141+
```cpp
142+
template <typename ElementTypeU, typename ElementTypeT, access::address_space Space>
143+
```
144+
145+
| Member function | Description |
146+
|-----------------|-------------|
147+
| *`multi_ptr<ElementTypeU, Space> static_pointer_cast(const multi_ptr<ElementTypeT, Space>& multiPtr)`* | Performs a `static_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 `static_cast` from `ElementType*` to `ElementTypeU*` is valid. |
148+
| *`multi_ptr<ElementTypeU, Space> dynamic_pointer_cast(const multi_ptr<ElementTypeT, Space>& multiPtr)`* | Performs a `dynamic_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 `dynamic_cast` from `ElementType*` to `ElementTypeU*` is valid. |
149+
| *`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. |
150+
| *`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. |
136151

137-
TODO(Peter): Table

0 commit comments

Comments
 (0)