Add constraint to array<> ctor

This commit is contained in:
Po-Yen, Chen
2024-03-13 03:32:05 -04:00
parent 5c433432fd
commit 60221b89f8

View File

@@ -49,12 +49,16 @@ struct array
data[i] = vlast;
}
}
template <typename Y>
template <typename Y,
typename = std::enable_if_t<std::is_convertible_v<Y, value_type> ||
std::is_constructible_v<Y, value_type>>>
CK_TILE_HOST_DEVICE explicit constexpr array(Y c)
{
for(auto i = 0; i < size(); i++)
data[i] = static_cast<value_type>(c);
}
// template <typename Y>
// CK_TILE_HOST_DEVICE constexpr array(const array& o)
// {