18 #include <type_traits>
24 namespace experimental {
29 template <
typename PropT,
typename PropertiesT>
31 template <
typename PropT,
typename T,
typename... Ts>
34 template <
typename PropT,
typename... Rest>
36 template <
typename PropT,
typename... PropValuesTs,
typename... Rest>
38 PropT,
std::
tuple<property_value<PropT, PropValuesTs...>, Rest...>>
43 template <
typename CTPropertyT,
typename PropertiesT =
void>
47 template <
typename CTPropertyT,
typename OtherProperty,
typename... Rest>
49 std::
tuple<OtherProperty, Rest...>> {
54 template <
typename CTPropertyT,
typename... CTPropertyValueTs,
typename... Rest>
57 std::
tuple<property_value<CTPropertyT, CTPropertyValueTs...>, Rest...>> {
61 template <
typename CTPropertyT,
bool HasProperty,
typename PropertiesT =
void>
69 template <
typename CTPropertyT,
bool HasProperty,
typename PropertiesT =
void>
70 static constexpr std::enable_if_t<!HasProperty, void>
get_property() {
80 template <
typename T,
typename... Ts>
83 IsRuntimeProperty<T>::value,
85 T, typename RuntimePropertyStorage<std::tuple<Ts...>>::type>,
86 RuntimePropertyStorage<std::tuple<Ts...>>> {};
92 template <
typename... PropertiesTs>
94 template <
typename... PropertyValueTs>
97 template <
typename... PropertyValueTs>
103 template <
typename PropertyT,
typename... PropertiesTs>
105 template <
typename... PropertyValueTs>
109 template <
typename... PropertyValueTs>
114 template <
typename... PropertyValueTs>
116 Extract(std::tuple<PropertyValueTs...> PropertyValues) {
117 PropertyT ThisExtractedProperty = std::get<PropertyT>(PropertyValues);
120 PropertyValueTs...>(PropertyValues);
121 return std::tuple_cat(std::tuple<PropertyT>{ThisExtractedProperty},
122 NextExtractedProperties);
130 "Properties must be in a tuple.");
132 "Unrecognized property in property list.");
134 "Properties in property list are not sorted.");
135 static_assert(detail::SortedAllUnique<PropertiesT>::value,
136 "Duplicate properties in property list.");
139 template <
typename... PropertyValueTs>
141 : Storage(detail::ExtractProperties<StorageT>::Extract(
142 std::
tuple<PropertyValueTs...>{props...})) {}
144 template <
typename PropertyT>
145 static constexpr std::enable_if_t<detail::IsProperty<PropertyT>::value,
bool>
150 template <
typename PropertyT>
151 typename std::enable_if_t<detail::IsRuntimeProperty<PropertyT>::value &&
152 has_property<PropertyT>(),
155 return std::get<PropertyT>(Storage);
158 template <
typename PropertyT>
159 typename std::enable_if_t<detail::IsRuntimeProperty<PropertyT>::value &&
160 !has_property<PropertyT>(),
163 static_assert(has_property<PropertyT>(),
164 "Property list does not contain the requested property.");
168 template <
typename PropertyT>
172 static_assert(has_property<PropertyT>(),
173 "Property list does not contain the requested property.");
174 return detail::get_property<PropertyT, has_property<PropertyT>(),
184 #ifdef __cpp_deduction_guides
186 template <
typename... PropertyValueTs>
187 properties(PropertyValueTs... props)
188 -> properties<
typename detail::Sorted<PropertyValueTs...>::type>;
193 template <
typename... PropertyValueTs>
196 properties<std::tuple<PropertyValueTs...>>,
197 properties<typename detail::Sorted<PropertyValueTs...>::type>> {};
199 #if __cplusplus > 201402L
200 template <
typename propertiesT>
210 template <
typename PropertiesT>
212 ext::oneapi::experimental::properties<PropertiesT>,
214 ext::oneapi::experimental::properties<PropertiesT>>::value>>
216 template <
typename PropertiesT>
218 const ext::oneapi::experimental::properties<PropertiesT>,
220 const ext::oneapi::experimental::properties<PropertiesT>>::value>>