Skip to content

Commit

Permalink
memory: Drop workaround for to_address
Browse files Browse the repository at this point in the history
  • Loading branch information
stotko committed Aug 27, 2024
1 parent a5ea998 commit 0aec15d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
19 changes: 0 additions & 19 deletions src/stdgpu/impl/memory_detail.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,6 @@ to_address(T* p) noexcept
return p;
}

// Use pre-C++17 SFINAE for dispatching due to wrong missing-return warning caused by NVCC
// (potentially fixed in CUDA 11.5+)
/*
template <typename Ptr>
STDGPU_HOST_DEVICE auto
to_address(const Ptr& p) noexcept
Expand All @@ -693,22 +690,6 @@ to_address(const Ptr& p) noexcept
return static_cast<void*>(nullptr);
}
}
*/

template <typename Ptr, STDGPU_DETAIL_OVERLOAD_DEFINITION_IF(detail::has_arrow_operator_v<Ptr>)>
STDGPU_HOST_DEVICE auto
to_address(const Ptr& p) noexcept
{
return to_address(p.operator->());
}

template <typename Ptr,
STDGPU_DETAIL_OVERLOAD_DEFINITION_IF(!detail::has_arrow_operator_v<Ptr> && detail::has_get_v<Ptr>)>
STDGPU_HOST_DEVICE auto
to_address(const Ptr& p) noexcept
{
return to_address(p.get());
}

template <typename T, typename... Args>
STDGPU_HOST_DEVICE T*
Expand Down
10 changes: 2 additions & 8 deletions src/stdgpu/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -741,18 +741,12 @@ to_address(T* p) noexcept;
* \brief Converts a potential fancy pointer to a raw pointer
* \tparam Ptr The fancy pointer type
* \param[in] p A fancy pointer
* \return The raw pointer held by the fancy pointer obtained via operator->()
* \return The raw pointer held by the fancy pointer obtained via operator->() or get()
*/
template <typename Ptr, STDGPU_DETAIL_OVERLOAD_IF(detail::has_arrow_operator_v<Ptr>)>
template <typename Ptr>
STDGPU_HOST_DEVICE auto
to_address(const Ptr& p) noexcept;

//! @cond Doxygen_Suppress
template <typename Ptr, STDGPU_DETAIL_OVERLOAD_IF(!detail::has_arrow_operator_v<Ptr> && detail::has_get_v<Ptr>)>
STDGPU_HOST_DEVICE auto
to_address(const Ptr& p) noexcept;
//! @endcond

/**
* \ingroup memory
* \brief Destroys the value at the given pointer
Expand Down

0 comments on commit 0aec15d

Please sign in to comment.