Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory: Drop workaround for to_address #431

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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