Skip to content

Commit

Permalink
basic_any: a utility for defining type-erasing wrappers in terms of…
Browse files Browse the repository at this point in the history
… an interface description (#2633)


---------

Co-authored-by: Michael Schellenberger Costa <[email protected]>
  • Loading branch information
ericniebler and miscco authored Dec 5, 2024
1 parent bca6231 commit e0cf709
Show file tree
Hide file tree
Showing 26 changed files with 4,748 additions and 3 deletions.
1 change: 1 addition & 0 deletions cudax/include/cuda/experimental/__detail/config.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

namespace cuda::experimental
{
namespace __cudax = ::cuda::experimental; // NOLINT: misc-unused-alias-decls
}

#endif // __CUDAX__DETAIL_CONFIG_CUH
24 changes: 21 additions & 3 deletions cudax/include/cuda/experimental/__detail/utility.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef __CUDAX_DETAIL_UTILITY_H
#define __CUDAX_DETAIL_UTILITY_H

#include <cuda/__cccl_config>
#include <cuda/std/detail/__config>

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
Expand All @@ -21,6 +21,8 @@
# pragma system_header
#endif // no system header

#include <cuda/std/__utility/declval.h>

namespace cuda::experimental
{
namespace detail
Expand All @@ -30,8 +32,8 @@ struct [[maybe_unused]] __ignore
{
__ignore() = default;

template <typename _Arg>
_CCCL_HOST_DEVICE constexpr __ignore(_Arg&&) noexcept
template <typename... _Args>
_CCCL_HOST_DEVICE constexpr __ignore(_Args&&...) noexcept
{}
};

Expand All @@ -42,8 +44,24 @@ struct __immovable
__immovable(__immovable&&) = delete;
__immovable& operator=(__immovable&&) = delete;
};

template <class... _Types>
struct _LIBCUDACXX_DECLSPEC_EMPTY_BASES __inherit : _Types...
{};

template <class _Type, template <class...> class _Template>
inline constexpr bool __is_specialization_of = false;

template <template <class...> class _Template, class... _Args>
inline constexpr bool __is_specialization_of<_Template<_Args...>, _Template> = true;

} // namespace detail

template <class _Tp>
using __identity_t _CCCL_NODEBUG_ALIAS = _Tp;

using _CUDA_VSTD::declval;

struct uninit_t
{
explicit uninit_t() = default;
Expand Down
Loading

0 comments on commit e0cf709

Please sign in to comment.