Skip to content

Commit 772fcf2

Browse files
committed
Specializations for void and const void
1 parent 7129802 commit 772fcf2

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

multi_ptr-cast/sycl-2.2/index.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,33 @@ in order to make the casting safer and easier to use.
4242

4343
## Summary
4444

45-
This proposal adds a few explicit conversion operators
46-
as member functions of the `multi_ptr` class
45+
This proposal folds the `void` specialization of the `multi_ptr` class
46+
into the main definition of `multi_ptr<ElementType, Space>`,
47+
handles the cases where `ElementType` is a `const`-qualified type,
48+
adds a few explicit conversion operators
49+
as member functions of the `multi_ptr` class,
4750
and also adds several free functions to the `cl::sycl` namespace
4851
that follow the naming and semantics of the `std::shared_ptr` pointer cast functions
4952
defined by the C++17 standard: https://en.cppreference.com/w/cpp/memory/shared_ptr/pointer_cast.
5053

54+
## Specializations for void and const void
55+
56+
In SYCL 1.2.1, the `void` specialization of the `multi_ptr` class
57+
is separate from the main definition
58+
because it cannot contain any reference types.
59+
For the purpose of the specification,
60+
we propose folding the two definitions
61+
into a single definition of the `multi_ptr` class,
62+
with comments denoting which types are available
63+
only if `ElementType` is not `void` or `const void`.
64+
The main reason for this simplification
65+
is the introduction of the specialization for `const void`,
66+
which would require the specification to define another specialization
67+
that would be mostly the same as the specialization for `void`.
68+
Simplifying the definiton like this
69+
also covers the case where `ElementType` is not `void` or `const void`,
70+
but some other `const`-qualified type.
71+
5172
## Explicit conversion operators
5273

5374
The new interface of the `multi_ptr` class would look like this:
@@ -71,17 +92,6 @@ class multi_ptr {
7192
explicit operator multi_ptr<const ElementType, Space>() const;
7293
};
7394

74-
template <access::address_space Space>
75-
class multi_ptr<void, Space> {
76-
public:
77-
/// All existing members here
78-
79-
...
80-
81-
// Explicit conversion to `multi_ptr<const void, Space>`
82-
explicit operator multi_ptr<const void, Space>() const;
83-
};
84-
8595
} // namespace sycl
8696
} // namespace cl
8797
```

0 commit comments

Comments
 (0)