This repository was archived by the owner on Mar 21, 2024. It is now read-only.
Commit 9ca1210 1 parent 64ab693 commit 9ca1210 Copy full SHA for 9ca1210
File tree 4 files changed +39
-3
lines changed
4 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 17
17
#pragma once
18
18
19
19
#include < thrust/detail/config.h>
20
+ #include < thrust/detail/type_traits.h>
20
21
21
22
THRUST_NAMESPACE_BEGIN
22
23
@@ -66,6 +67,11 @@ const DerivedPolicy &derived_cast(const execution_policy_base<DerivedPolicy> &x)
66
67
return static_cast <const DerivedPolicy&>(x);
67
68
}
68
69
70
+ template <class >
71
+ struct is_system_tag
72
+ : false_type
73
+ {};
74
+
69
75
} // end detail
70
76
71
77
template <typename DerivedPolicy>
Original file line number Diff line number Diff line change 18
18
19
19
#include < thrust/detail/config.h>
20
20
#include < thrust/detail/execution_policy.h>
21
+ #include < thrust/detail/type_traits.h>
21
22
22
23
THRUST_NAMESPACE_BEGIN
23
24
24
25
struct any_system_tag
25
26
: thrust::execution_policy<any_system_tag>
26
27
{
27
- // allow any_system_tag to convert to any type at all
28
- // XXX make this safer using enable_if<is_tag<T>> upon c++11
29
- template <typename T> operator T () const {return T ();}
28
+ // allow any_system_tag to convert to any system tag type
29
+ template <typename T,
30
+ typename detail::enable_if<detail::is_system_tag<T>::value, int >::type = 0 >
31
+ operator T () const {return T ();}
30
32
};
31
33
34
+ namespace detail {
35
+
36
+ template <>
37
+ struct is_system_tag <any_system_tag>
38
+ : true_type
39
+ {};
40
+
41
+ }
42
+
43
+
32
44
THRUST_NAMESPACE_END
33
45
Original file line number Diff line number Diff line change @@ -27,4 +27,13 @@ THRUST_NAMESPACE_BEGIN
27
27
28
28
typedef thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::tag device_system_tag;
29
29
30
+ namespace detail {
31
+
32
+ template <>
33
+ struct is_system_tag <device_system_tag>
34
+ : true_type
35
+ {};
36
+
37
+ }
38
+
30
39
THRUST_NAMESPACE_END
Original file line number Diff line number Diff line change @@ -27,4 +27,13 @@ THRUST_NAMESPACE_BEGIN
27
27
28
28
typedef thrust::system::__THRUST_HOST_SYSTEM_NAMESPACE::tag host_system_tag;
29
29
30
+ namespace detail {
31
+
32
+ template <>
33
+ struct is_system_tag <host_system_tag>
34
+ : true_type
35
+ {};
36
+
37
+ }
38
+
30
39
THRUST_NAMESPACE_END
You can’t perform that action at this time.
0 commit comments