has_property_with#

template<class _Resource, class _Property, class _Return>
constexpr bool cuda::has_property_with = _CCCL_FRAGMENT(__has_property_with_, _Resource, _Property, _Return)#

The has_property_with concept verifies that a Resource satisfies a given stateful Property.

For c has_property_with we require the following free function to be callable and its return type to exactly match the value_type of the Property

struct stateless_property {};
constexpr void get_property(const Resource& res, stateless_property) {}

// The resource must be stateful
static_assert(!cuda::has_property_with<Resource, stateless_property, int>);

struct stateful_property { using value_type = int; };
constexpr int get_property(const Resource& res, stateful_property) {}

// The resource is stateful and has the correct return type
static_assert(cuda::has_property_with<Resource, stateful_property, int>);

// The resource is stateful but the return type is incorrect
static_assert(!cuda::has_property_with<Resource, stateful_property, double>);

constexpr double get_property(const OtherResource& res, stateful_property) {}

// The resource is stateful but the value_type does not match the `get_property` return type
static_assert(!cuda::has_property_with<OtherResource, stateful_property, double>);