alpaka
Abstraction Library for Parallel Kernel Acceleration
Traits.hpp
Go to the documentation of this file.
1 /* Copyright 2022 Benjamin Worpitz, Bernhard Manfred Gruber
2  * SPDX-License-Identifier: MPL-2.0
3  */
4 
5 #pragma once
6 
7 #include <type_traits>
8 
9 namespace alpaka
10 {
11  //! The element trait.
12  namespace trait
13  {
14  //! The element type trait.
15  template<typename TView, typename TSfinae = void>
16  struct ElemType;
17  } // namespace trait
18 
19  //! The element type trait alias template to remove the ::type.
20  template<typename TView>
21  using Elem = std::remove_volatile_t<typename trait::ElemType<TView>::type>;
22 
23  // Trait specializations for unsigned integral types.
24  namespace trait
25  {
26  //! The fundamental type elem type trait specialization.
27  template<typename T>
28  struct ElemType<T, std::enable_if_t<std::is_fundamental_v<T>>>
29  {
30  using type = T;
31  };
32  } // namespace trait
33 } // namespace alpaka
The alpaka accelerator library.
std::remove_volatile_t< typename trait::ElemType< TView >::type > Elem
The element type trait alias template to remove the ::type.
Definition: Traits.hpp:21
The element type trait.
Definition: Traits.hpp:16