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__)
21#ifndef GPUCA_GPUCODE_COMPILEKERNELS
22#include <type_traits>
23#endif
24#else
25// We just reimplement some type traits in std for the GPU
26namespace std
27{
28template <bool B, class T, class F>
29struct conditional {
30 typedef T type;
31};
32template <class T, class F>
33struct conditional<false, T, F> {
34 typedef F type;
35};
36template <bool B, class T, class F>
37using contitional_t = typename conditional<B, T, F>::type;
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;
48template <bool B, class T = void>
49struct enable_if {
50};
51template <class T>
52struct enable_if<true, T> {
53 typedef T type;
54};
55template <class T>
56struct remove_cv {
57 typedef T type;
58};
59template <class T>
60struct remove_cv<const T> {
61 typedef T type;
62};
63template <class T>
64struct remove_cv<volatile T> {
65 typedef T type;
66};
67template <class T>
68struct remove_cv<const volatile T> {
69 typedef T type;
70};
71template <class T>
72struct remove_const {
73 typedef T type;
74};
75template <class T>
76struct remove_const<const T> {
77 typedef T type;
78};
79template <class T>
80struct remove_volatile {
81 typedef T type;
82};
83template <class T>
84struct remove_volatile<volatile T> {
85 typedef T type;
86};
87template <class T>
88struct is_pointer_t {
89 static constexpr bool value = false;
90};
91template <class T>
92struct is_pointer_t<T*> {
93 static constexpr bool value = true;
94};
95template <class T>
96struct is_pointer : is_pointer_t<typename std::remove_cv<T>::type> {
97};
98} // namespace std
99#endif
100
101#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.