DPC++ Runtime
Runtime libraries for oneAPI DPC++
util.hpp
Go to the documentation of this file.
1 //==----------------- util.hpp - DPC++ Explicit SIMD API ------------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 // Utility functions used for implementing experimental Explicit SIMD APIs.
9 //===----------------------------------------------------------------------===//
10 
11 #pragma once
12 
14 
15 namespace sycl {
16 inline namespace _V1 {
17 namespace ext::intel::experimental::esimd {
19 namespace detail {
21 template <typename...> struct is_one_of {
22  static constexpr bool value = false;
23 };
24 
25 template <typename Checked, typename First, typename... Other>
26 struct is_one_of<Checked, First, Other...> {
27  static constexpr bool value = std::is_same_v<std::remove_const_t<Checked>,
28  std::remove_const_t<First>> ||
29  is_one_of<Checked, Other...>::value;
30 };
31 template <typename Checked, typename... T>
32 inline constexpr bool is_one_of_v = is_one_of<Checked, T...>::value;
33 
36 template <typename enumClass, enumClass... E> struct is_one_of_enum {
37  static constexpr bool value = false;
38 };
39 
40 template <typename enumClass, enumClass Checked, enumClass First,
41  enumClass... Else>
42 struct is_one_of_enum<enumClass, Checked, First, Else...> {
43  static constexpr bool value =
44  (Checked == First) || is_one_of_enum<enumClass, Checked, Else...>::value;
45 };
46 template <typename enumClass, enumClass... T>
47 inline constexpr bool is_one_of_enum_v = is_one_of_enum<enumClass, T...>::value;
48 } // namespace detail
49 } // namespace ext::intel::experimental::esimd
50 } // namespace _V1
51 } // namespace sycl
52 
Definition: access.hpp:18