Skip to content

Commit aa5d3f1

Browse files
authored
[SYCL][NFC] annotated_arg headers code refactor (#9901)
Move the `DeducedProperties` type-trait utility from ```include/sycl/ext/oneapi/annotated_arg/annotated_arg.hpp``` to the common header ```include/sycl/ext/oneapi/annotated_arg/properties.hpp``` so that it can be used by both `annotated_arg` and `annotated_ptr` classes.
1 parent 21ca00f commit aa5d3f1

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

sycl/include/sycl/ext/oneapi/annotated_arg/annotated_arg.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ struct HasSubscriptOperator
3030
: std::bool_constant<
3131
!std::is_void_v<decltype(std::declval<T>().operator[](0))>> {};
3232

33-
// Deduce a `properties<>` type from given variadic properties
34-
template <typename... Args> struct DeducedProperties {
35-
using type = decltype(properties{std::declval<Args>()...});
36-
};
37-
38-
// Partial specialization for deducing a `properties<>` type by forwarding the
39-
// given `properties<>` type
40-
template <typename... Args>
41-
struct DeducedProperties<detail::properties_t<Args...>> {
42-
using type = detail::properties_t<Args...>;
43-
};
44-
4533
} // namespace detail
4634

4735
// Deduction guide

sycl/include/sycl/ext/oneapi/annotated_arg/properties.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,24 @@ template <int N> struct PropertyMetaInfo<alignment_key::value_t<N>> {
369369

370370
} // namespace detail
371371

372+
//===----------------------------------------------------------------------===//
373+
// Utility type trait for annotated_arg/annotated_ptr deduction guide
374+
//===----------------------------------------------------------------------===//
375+
//
376+
namespace detail {
377+
// Deduce a `properties<>` type from given variadic properties
378+
template <typename... Args> struct DeducedProperties {
379+
using type = decltype(properties{std::declval<Args>()...});
380+
};
381+
382+
// Partial specialization for deducing a `properties<>` type by forwarding the
383+
// given `properties<>` type
384+
template <typename... Args>
385+
struct DeducedProperties<detail::properties_t<Args...>> {
386+
using type = detail::properties_t<Args...>;
387+
};
388+
} // namespace detail
389+
372390
} // namespace experimental
373391
} // namespace oneapi
374392
} // namespace ext

0 commit comments

Comments
 (0)