cuda::experimental::mr::basic_any_resource
Defined in include/cuda/experimental/__memory_resource/any_resource.cuh
-
template<cuda::mr::_AllocType _Alloc_type, class ..._Properties>
class basic_any_resource : public cuda::mr::_Resource_base<_Alloc_type, cuda::mr::_WrapperType::_Owning>, private cuda::mr::_Filtered_vtable<_Properties...> Base class for a type erased owning wrapper around a memory resource
basic_any_resource
abstracts the differences between a resource and an async resource away, allowing efficient interoperability between the two.Public Functions
-
template<class _Resource, class __resource_t = cuda::std::remove_cvref_t<_Resource>>
inline basic_any_resource(_Resource &&__res) noexcept Constructs a
basic_any_resource
from a type that satisfies theresource
orasync_resource
concept as well as all properties.- Parameters
__res – The resource to be wrapped within the
basic_any_resource
.
-
template<class _Resource, class ..._Args>
inline basic_any_resource(cuda::std::in_place_type_t<_Resource>, _Args&&... __args) noexcept Constructs a
basic_any_resource
wrapping an object of type_Resource
that is constructed from__args
… ._Resource
must satisfy theresource
orasync_resource
concept, and it must provide all properties in_Properties
… .- Parameters
__args – The arguments used to construct the instance of
_Resource
to be wrapped within thebasic_any_resource
.
-
template<cuda::mr::_AllocType _OtherAllocType, class ..._OtherProperties>
inline basic_any_resource(basic_any_resource<_OtherAllocType, _OtherProperties...> __other) noexcept Conversion from a
basic_any_resource
with the same set of properties but in a different order. This constructor also handles conversion fromany_async_resource
toany_resource
.- Parameters
__other – The other
basic_any_resource
.
-
inline basic_any_resource(basic_any_resource &&__other) noexcept
Move-constructs a
basic_any_resource
from another one, taking ownership of the stored resource.- Parameters
__other – The other
basic_any_resource
.
-
inline basic_any_resource &operator=(basic_any_resource &&__other) noexcept
Move-assigns another
basic_any_resource
, taking ownership of the stored resource.- Parameters
__other – The other
basic_any_resource
.
-
inline basic_any_resource(const basic_any_resource &__other)
Copy-constructs a
basic_any_resource
from another one.- Parameters
__other – The other
basic_any_resource
.
-
inline basic_any_resource &operator=(const basic_any_resource &__other)
Copy-assigns another
basic_any_resource
.- Parameters
__other – The other
basic_any_resource
.
-
inline ~basic_any_resource() noexcept
Destroys the stored resource.
-
inline void swap(basic_any_resource &__other) noexcept
Swaps a
basic_any_resource
with another one.- Parameters
__other – The other
basic_any_resource
.
-
template<class ..._OtherProperties, ::cuda::std::enable_if_t<(sizeof...(_Properties) == sizeof...(_OtherProperties)) && __properties_match<_OtherProperties...>, int> = 0>
inline bool operator==(const basic_any_resource<_Alloc_type, _OtherProperties...> &__rhs) const Equality comparison between two
basic_any_resource
.- Parameters
__rhs – The other
basic_any_resource
- Returns
Checks whether both resources have the same equality function stored in their vtable and if so returns the result of that equality comparison. Otherwise returns false.
-
template<class ..._OtherProperties, ::cuda::std::enable_if_t<(sizeof...(_Properties) == sizeof...(_OtherProperties)) && __properties_match<_OtherProperties...>, int> = 0>
inline bool operator!=(const basic_any_resource<_Alloc_type, _OtherProperties...> &__rhs) const Inequality comparison between two
basic_any_resource
.- Parameters
__rhs – The other
basic_any_resource
- Returns
Checks whether both resources have the same equality function stored in their vtable and if so returns the inverse result of that equality comparison. Otherwise returns true.
-
template<class _Property, ::cuda::std::enable_if_t<property_with_value<_Property>&&(cuda::std::__is_included_in_v<_Property, _Properties...>), int> = 0>
inline __property_value_t<_Property> get_property(const basic_any_resource &__res, _Property) noexcept Forwards the stateful properties.
Friends
-
template<class _Property, ::cuda::std::enable_if_t<(!property_with_value<_Property>) && (cuda::std::__is_included_in_v<_Property, _Properties...>), int> = 0>
inline friend void get_property(const basic_any_resource&, _Property) noexcept Forwards the stateless properties.
-
template<class _Resource, class __resource_t = cuda::std::remove_cvref_t<_Resource>>