Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit a9d907f

Browse files
committed
Fix std::allocator traits
1 parent cf21d24 commit a9d907f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

thrust/detail/allocator/allocator_traits.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include <thrust/detail/type_traits/has_member_function.h>
2727
#include <thrust/detail/type_traits.h>
2828

29+
#include <memory>
30+
2931
THRUST_NAMESPACE_BEGIN
3032
namespace detail
3133
{
@@ -70,6 +72,25 @@ template<typename Alloc, typename U>
7072
typedef thrust::detail::integral_constant<bool, value> type;
7173
};
7274

75+
// The following fields of std::allocator have been deprecated (since C++17).
76+
// There's no way to detect it other than explicit specialization.
77+
#if THRUST_CPP_DIALECT >= 2017
78+
#define THRUST_SPECIALIZE_DEPRECATED(trait_name) \
79+
template <typename T> \
80+
struct trait_name<std::allocator<T>> : false_type {};
81+
82+
THRUST_SPECIALIZE_DEPRECATED(has_is_always_equal)
83+
THRUST_SPECIALIZE_DEPRECATED(has_pointer)
84+
THRUST_SPECIALIZE_DEPRECATED(has_const_pointer)
85+
THRUST_SPECIALIZE_DEPRECATED(has_reference)
86+
THRUST_SPECIALIZE_DEPRECATED(has_const_reference)
87+
88+
#undef THRUST_SPECIALIZE_DEPRECATED
89+
90+
template<typename T, typename U>
91+
struct has_rebind<std::allocator<T>, U> : false_type {};
92+
#endif
93+
7394
template<typename T>
7495
struct nested_pointer
7596
{

0 commit comments

Comments
 (0)