MUDA
Loading...
Searching...
No Matches
type_label.h
1#pragma once
2#include <type_traits>
3
4namespace muda
5{
6/*************************************************************************
7*
8* Type Labels
9*
10*************************************************************************/
11
12// force a type to be trivial (only in muda memory-related API)
13template <typename T>
15{
16 constexpr static bool value = false;
17};
18template <typename T>
19constexpr bool force_trivial_v = force_trivial<T>::value;
20template <typename T>
21constexpr bool is_trivial_v = std::is_trivial_v<T> || force_trivial_v<T>;
22
23// force a type to be trivially destructible (only in muda memory-related API)
24template <typename T>
26{
27 constexpr static bool value = false;
28};
29template <typename T>
30constexpr bool force_trivially_destructible_v = force_trivially_destructible<T>::value;
31template <typename T>
32constexpr bool is_trivially_destructible_v =
33 std::is_trivially_destructible_v<T> || force_trivially_destructible_v<T>;
34
35// force a type to be trivially constructible (only in muda memory-related API)
36template <typename T>
38{
39 constexpr static bool value = false;
40};
41template <typename T>
42constexpr bool force_trivially_constructible_v = force_trivially_constructible<T>::value;
43template <typename T>
44constexpr bool is_trivially_constructible_v =
45 std::is_trivially_constructible_v<T> || force_trivially_constructible_v<T>;
46
47// force a type to be trivially copy constructible (only in muda memory-related API)
48template <typename T>
50{
51 constexpr static bool value = false;
52};
53template <typename T>
54constexpr bool force_trivially_copy_constructible_v =
56template <typename T>
57constexpr bool is_trivially_copy_constructible_v =
58 std::is_trivially_copy_constructible_v<T> || force_trivially_copy_constructible_v<T>;
59
60// force a type to be trivially copy assignable (only in muda memory-related API)
61template <typename T>
63{
64 constexpr static bool value = false;
65};
66template <typename T>
67constexpr bool force_trivially_copy_assignable_v =
69template <typename T>
70constexpr bool is_trivially_copy_assignable_v =
71 std::is_trivially_copy_assignable_v<T> || force_trivially_copy_assignable_v<T>;
72} // namespace muda
Definition type_label.h:15
Definition type_label.h:38
Definition type_label.h:63
Definition type_label.h:26