18 #include <type_traits>
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...>> {
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>
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>
81 IsRuntimeProperty<T>::value,
83 T, typename RuntimePropertyStorage<std::tuple<Ts...>>::type>,
84 RuntimePropertyStorage<std::tuple<Ts...>>> {};
90 template <
typename... PropertiesTs>
92 template <
typename... PropertyValueTs>
95 template <
typename... PropertyValueTs>
101 template <
typename PropertyT,
typename... PropertiesTs>
103 template <
typename... PropertyValueTs>
107 template <
typename... PropertyValueTs>
112 template <
typename... PropertyValueTs>
114 Extract(std::tuple<PropertyValueTs...> PropertyValues) {
115 PropertyT ThisExtractedProperty = std::get<PropertyT>(PropertyValues);
118 PropertyValueTs...>(PropertyValues);
119 return std::tuple_cat(std::tuple<PropertyT>{ThisExtractedProperty},
120 NextExtractedProperties);
128 "Properties must be in a tuple.");
130 "Unrecognized property in property list.");
132 "Properties in property list are not sorted.");
133 static_assert(detail::SortedAllUnique<PropertiesT>::value,
134 "Duplicate properties in property list.");
137 template <
typename... PropertyValueTs>
139 : Storage(detail::ExtractProperties<StorageT>::Extract(
140 std::tuple<PropertyValueTs...>{props...})) {}
142 template <
typename PropertyT>
143 static constexpr std::enable_if_t<detail::IsProperty<PropertyT>::value,
bool>
148 template <
typename PropertyT>
149 typename std::enable_if_t<detail::IsRuntimeProperty<PropertyT>::value &&
150 has_property<PropertyT>(),
153 return std::get<PropertyT>(Storage);
156 template <
typename PropertyT>
157 typename std::enable_if_t<detail::IsRuntimeProperty<PropertyT>::value &&
158 !has_property<PropertyT>(),
161 static_assert(has_property<PropertyT>(),
162 "Property list does not contain the requested property.");
166 template <
typename PropertyT>
170 static_assert(has_property<PropertyT>(),
171 "Property list does not contain the requested property.");
172 return detail::get_property<PropertyT, has_property<PropertyT>(),
182 #ifdef __cpp_deduction_guides
184 template <
typename... PropertyValueTs>
185 properties(PropertyValueTs... props)
186 -> properties<
typename detail::Sorted<PropertyValueTs...>::type>;
191 template <
typename... PropertyValueTs>
194 properties<std::tuple<PropertyValueTs...>>,
195 properties<typename detail::Sorted<PropertyValueTs...>::type>> {};
197 #if __cplusplus > 201402L
198 template <
typename propertiesT>
208 template <
typename... PropertyValueTs>
212 template <
typename LHSPropertiesT,
typename RHSPropertiesT>
214 template <
typename... LHSPropertiesTs,
typename... RHSPropertiesTs>
218 std::tuple<LHSPropertiesTs...>, std::tuple<RHSPropertiesTs...>>
::type>;
220 template <
typename LHSPropertiesT,
typename RHSPropertiesT>
229 template <
typename PropertiesT>
231 ext::oneapi::experimental::properties<PropertiesT>,
233 ext::oneapi::experimental::properties<PropertiesT>>::value>>