Skip to content

Commit

Permalink
Use the right define for internal traits
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Nov 6, 2024
1 parent 1643f61 commit 558f642
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions libcudacxx/include/cuda/std/__memory/allocator_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,21 @@ _CCCL_NV_DIAG_SUPPRESS(1215)

_LIBCUDACXX_BEGIN_NAMESPACE_STD

#if _CCCL_STD_VER <= 2014
#if defined(_CCCL_NO_VARIABLE_TEMPLATES)
# define _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
template <class _Tp, class = void> \
struct NAME : false_type \
{}; \
template <class _Tp> \
struct NAME<_Tp, void_t<typename _Tp::PROPERTY>> : true_type \
{}

#else // ^^^ _CCCL_STD_VER <= 2014 ^^^ / vvv _CCCL_STD_VER >= 2017 vvv
#else // ^^^ _CCCL_NO_VARIABLE_TEMPLATES ^^^ / vvv !_CCCL_NO_VARIABLE_TEMPLATES vvv
# define _LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(NAME, PROPERTY) \
template <class _Tp, class = void> \
inline constexpr bool NAME##_v = false; \
_CCCL_INLINE_VAR constexpr bool NAME##_v = false; \
template <class _Tp> \
inline constexpr bool NAME##_v<_Tp, void_t<typename _Tp::PROPERTY>> = true;
#endif // _CCCL_STD_VER >= 2017
_CCCL_INLINE_VAR constexpr bool NAME##_v<_Tp, void_t<typename _Tp::PROPERTY>> = true;
#endif // !_CCCL_NO_VARIABLE_TEMPLATES

// __pointer
_LIBCUDACXX_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer);
Expand Down
6 changes: 3 additions & 3 deletions libcudacxx/include/cuda/std/__memory/uses_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

_LIBCUDACXX_BEGIN_NAMESPACE_STD

#if _CCCL_STD_VER <= 2014
#if defined(_CCCL_NO_VARIABLE_TEMPLATES)
template <class _Tp, class = void>
struct __has_allocator_type : false_type
{};
Expand All @@ -42,7 +42,7 @@ struct __uses_allocator : false_type
template <class _Tp, class _Alloc>
struct __uses_allocator<_Tp, _Alloc, true> : is_convertible<_Alloc, typename _Tp::allocator_type>
{};
#else // ^^^ _CCCL_STD_VER <= 2014 ^^^ / vvv _CCCL_STD_VER >= 2017 vvv
#else // ^^^ _CCCL_NO_VARIABLE_TEMPLATES ^^^ / vvv !_CCCL_NO_VARIABLE_TEMPLATES vvv
template <class _Tp, class = void>
_CCCL_INLINE_VAR constexpr bool __has_allocator_type_v = false;
template <class _Tp>
Expand All @@ -53,7 +53,7 @@ _CCCL_INLINE_VAR constexpr bool __uses_allocator_v = false;
template <class _Tp, class _Alloc>
_CCCL_INLINE_VAR constexpr bool __uses_allocator_v<_Tp, _Alloc, true> =
is_convertible_v<_Alloc, typename _Tp::allocator_type>;
#endif // _CCCL_STD_VER >= 2017
#endif // !_CCCL_NO_VARIABLE_TEMPLATES

template <class _Tp, class _Alloc>
struct _CCCL_TYPE_VISIBILITY_DEFAULT uses_allocator
Expand Down

0 comments on commit 558f642

Please sign in to comment.