Project
Loading...
Searching...
No Matches
GPUCommonTypeTraits.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef GPUCOMMONTYPETRAITS_H
16#define GPUCOMMONTYPETRAITS_H
17
18#include "GPUCommonDef.h"
19
20#if !defined(GPUCA_GPUCODE_DEVICE) || defined(__CUDACC__) || defined(__HIPCC__) // TODO: Get rid of GPUCommonTypeTraits once OpenCL supports <type_traits>
21#ifndef GPUCA_GPUCODE_COMPILEKERNELS
22#include <type_traits>
23#endif
24#else
25namespace std
26{
27template <bool B, class T, class F>
28struct conditional {
29 typedef T type;
30};
31template <class T, class F>
32struct conditional<false, T, F> {
33 typedef F type;
34};
35template <bool B, class T, class F>
36using contitional_t = typename conditional<B, T, F>::type;
37
38template <class T, class U>
39struct is_same {
40 static constexpr bool value = false;
41};
42template <class T>
43struct is_same<T, T> {
44 static constexpr bool value = true;
45};
46template <class T, class U>
47static constexpr bool is_same_v = is_same<T, U>::value;
48
49template <bool B, class T = void>
50struct enable_if {
51};
52template <class T>
53struct enable_if<true, T> {
54 typedef T type;
55};
56
57template <class T>
58struct remove_cv {
59 typedef T type;
60};
61template <class T>
62struct remove_cv<const T> {
63 typedef T type;
64};
65template <class T>
66struct remove_cv<volatile T> {
67 typedef T type;
68};
69template <class T>
70struct remove_cv<const volatile T> {
71 typedef T type;
72};
73template <class T>
74using remove_cv_t = typename remove_cv<T>::type;
75
76template <class T>
77struct remove_const {
78 typedef T type;
79};
80template <class T>
81struct remove_const<const T> {
82 typedef T type;
83};
84template <class T>
85using remove_const_t = typename remove_const<T>::type;
86
87template <class T>
88struct remove_volatile {
89 typedef T type;
90};
91template <class T>
92struct remove_volatile<volatile T> {
93 typedef T type;
94};
95template <class T>
96using remove_volatile_t = typename remove_volatile<T>::type;
97
98template <class T>
99struct is_pointer_t {
100 static constexpr bool value = false;
101};
102template <class T>
103struct is_pointer_t<T*> {
104 static constexpr bool value = true;
105};
106template <class T>
107struct is_pointer : is_pointer_t<typename std::remove_cv<T>::type> {
108};
109
110template <class T>
111struct remove_reference {
112 typedef T type;
113};
114template <class T>
115struct remove_reference<T&> {
116 typedef T type;
117};
118template <class T>
119struct remove_reference<T&&> {
120 typedef T type;
121};
122template <class T>
123using remove_reference_t = typename remove_reference<T>::type;
124
125template <class T>
126struct is_member_pointer_helper {
127 static constexpr bool value = false;
128};
129template <class T, class U>
130struct is_member_pointer_helper<T U::*> {
131 static constexpr bool value = true;
132};
133template <class T>
134struct is_member_pointer : is_member_pointer_helper<typename std::remove_cv<T>::type> {
135};
136template <class T>
137static constexpr bool is_member_pointer_v = is_member_pointer<T>::value;
138
139} // namespace std
140#endif
141
142#endif
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
Defining DataPointCompositeObject explicitly as copiable.