17 #include <type_traits>
21 inline namespace _V1 {
22 namespace ext::oneapi::experimental {
27 template <
typename PropT,
typename PropertiesT>
29 template <
typename PropT,
typename T,
typename... Ts>
32 template <
typename PropT,
typename... Rest>
34 template <
typename PropT,
typename... PropValuesTs,
typename... Rest>
36 PropT,
std::tuple<property_value<PropT, PropValuesTs...>, Rest...>>
41 template <
typename CTPropertyT,
typename PropertiesT =
void>
45 template <
typename CTPropertyT,
typename OtherProperty,
typename... Rest>
47 std::tuple<OtherProperty, Rest...>> {
50 std::tuple<Rest...>>
::type;
52 template <
typename CTPropertyT,
typename... CTPropertyValueTs,
typename... Rest>
55 std::tuple<property_value<CTPropertyT, CTPropertyValueTs...>, Rest...>> {
59 template <
typename CTPropertyT,
bool HasProperty,
typename PropertiesT =
void>
60 static constexpr std::enable_if_t<
67 template <
typename CTPropertyT,
bool HasProperty,
typename PropertiesT =
void>
68 static constexpr std::enable_if_t<!HasProperty, void>
get_property() {
78 template <
typename T,
typename... Ts>
80 : std::conditional_t<IsRuntimeProperty<T>::value,
81 PrependTuple<T, typename RuntimePropertyStorage<
82 std::tuple<Ts...>>::type>,
83 RuntimePropertyStorage<std::tuple<Ts...>>> {};
89 template <
typename... PropertiesTs>
91 template <
typename... PropertyValueTs>
94 template <
typename... PropertyValueTs>
100 template <
typename PropertyT,
typename... PropertiesTs>
102 template <
typename... PropertyValueTs>
106 template <
typename... PropertyValueTs>
111 template <
typename... PropertyValueTs>
113 Extract(std::tuple<PropertyValueTs...> PropertyValues) {
114 PropertyT ThisExtractedProperty = std::get<PropertyT>(PropertyValues);
117 PropertyValueTs...>(PropertyValues);
118 return std::tuple_cat(std::tuple<PropertyT>{ThisExtractedProperty},
119 NextExtractedProperties);
127 "Properties must be in a tuple.");
129 "Unrecognized property in property list.");
131 "Properties in property list are not sorted.");
132 static_assert(detail::SortedAllUnique<PropertiesT>::value,
133 "Duplicate properties in property list.");
134 static_assert(detail::NoConflictingProperties<PropertiesT>::value,
135 "Conflicting properties in property list.");
138 template <
typename... PropertyValueTs>
140 : Storage(detail::ExtractProperties<StorageT>::Extract(
141 std::tuple<PropertyValueTs...>{props...})) {}
143 template <
typename PropertyT>
144 static constexpr std::enable_if_t<detail::IsProperty<PropertyT>::value,
bool>
149 template <
typename PropertyT>
150 typename std::enable_if_t<detail::IsRuntimeProperty<PropertyT>::value &&
151 has_property<PropertyT>(),
154 return std::get<PropertyT>(Storage);
157 template <
typename PropertyT>
158 typename std::enable_if_t<detail::IsRuntimeProperty<PropertyT>::value &&
159 !has_property<PropertyT>(),
162 static_assert(has_property<PropertyT>(),
163 "Property list does not contain the requested property.");
167 template <
typename PropertyT>
171 static_assert(has_property<PropertyT>(),
172 "Property list does not contain the requested property.");
173 return detail::get_property<PropertyT, has_property<PropertyT>(),
183 #ifdef __cpp_deduction_guides
185 template <
typename... PropertyValueTs>
186 properties(PropertyValueTs... props)
187 -> properties<
typename detail::Sorted<PropertyValueTs...>::type>;
194 template <
typename... PropertyValueTs>
197 properties<std::tuple<PropertyValueTs...>>,
198 properties<typename detail::Sorted<PropertyValueTs...>::type>> {};
200 #if __cplusplus > 201402L
201 template <
typename propertiesT>
211 template <
typename... PropertyValueTs>
215 template <
typename LHSPropertiesT,
typename RHSPropertiesT>
217 template <
typename... LHSPropertiesTs,
typename... RHSPropertiesTs>
221 std::tuple<LHSPropertiesTs...>, std::tuple<RHSPropertiesTs...>>
::type>;
223 template <
typename LHSPropertiesT,
typename RHSPropertiesT>
227 template <
typename Properties,
typename PropertyKey,
typename Cond =
void>
229 template <
typename ValT>
static constexpr ValT
get(ValT Default) {
234 template <
typename Properties,
typename PropertyKey>
236 Properties, PropertyKey,
237 std::enable_if_t<is_property_list_v<Properties> &&
238 Properties::template has_property<PropertyKey>()>> {
239 template <
typename ValT>
static constexpr ValT
get(ValT) {
240 return Properties::template get_property<PropertyKey>().value;
244 template <
typename SyclT,
typename PropertiesT>
struct all_props_are_keys_of;
246 template <
typename SyclT,
typename PropertiesT>
249 template <
typename SyclT>
254 template <
typename SyclT,
typename PropT>
257 : std::bool_constant<
258 ext::oneapi::experimental::is_property_key_of<PropT, SyclT>::value> {
261 template <
typename SyclT,
typename PropT,
typename... PropTs>
264 : std::bool_constant<
265 ext::oneapi::experimental::is_property_key_of<PropT, SyclT>::value &&
266 all_props_are_keys_of<SyclT, PropTs...>()> {};
271 template <
typename PropertiesT>
std::enable_if_t< detail::IsRuntimeProperty< PropertyT >::value &&has_property< PropertyT >), PropertyT > get_property() const
std::enable_if_t< detail::IsRuntimeProperty< PropertyT >::value &&!has_property< PropertyT >), void > get_property() const
constexpr properties(PropertyValueTs... props)
static constexpr auto get_property(typename std::enable_if_t< detail::IsCompileTimeProperty< PropertyT >::value > *=0)
static constexpr std::enable_if_t< detail::IsProperty< PropertyT >::value, bool > has_property()
constexpr bool is_property_list_v
static constexpr std::enable_if_t< HasProperty, typename FindCompileTimePropertyValueType< CTPropertyT, PropertiesT >::type > get_property()
typename merged_properties< LHSPropertiesT, RHSPropertiesT >::type merged_properties_t
decltype(properties{}) empty_properties_t
typename FindCompileTimePropertyValueType< CTPropertyT, std::tuple< Rest... > >::type type
static constexpr ValT get(ValT)
static constexpr ValT get(ValT Default)
is_device_copyable is a user specializable class template to indicate that a type T is device copyabl...