stl: std::is_reference_v

This commit is contained in:
skypjack
2026-04-10 16:09:19 +02:00
parent c2db759653
commit e2418206da
3 changed files with 5 additions and 4 deletions

View File

@@ -494,7 +494,7 @@ public:
*/
template<typename Type>
[[nodiscard]] meta_any allow_cast() const {
if constexpr(!std::is_reference_v<Type> || stl::is_const_v<stl::remove_reference_t<Type>>) {
if constexpr(!stl::is_reference_v<Type> || stl::is_const_v<stl::remove_reference_t<Type>>) {
if(storage.has_value<stl::remove_cvref_t<Type>>()) {
return as_ref();
} else if(*this) {
@@ -530,7 +530,7 @@ public:
*/
template<typename Type>
[[nodiscard]] bool allow_cast() {
if constexpr(std::is_reference_v<Type> && !stl::is_const_v<stl::remove_reference_t<Type>>) {
if constexpr(stl::is_reference_v<Type> && !stl::is_const_v<stl::remove_reference_t<Type>>) {
return allow_cast<const stl::remove_reference_t<Type> &>() && (storage.policy() != any_policy::cref);
} else {
if(storage.has_value<stl::remove_cvref_t<Type>>()) {

View File

@@ -33,7 +33,7 @@ struct as_void_t final: private internal::meta_policy {
struct as_ref_t final: private internal::meta_policy {
/*! @cond ENTT_INTERNAL */
template<typename Type>
static constexpr bool value = std::is_reference_v<Type> && !stl::is_const_v<stl::remove_reference_t<Type>>;
static constexpr bool value = stl::is_reference_v<Type> && !stl::is_const_v<stl::remove_reference_t<Type>>;
/*! @endcond */
};
@@ -41,7 +41,7 @@ struct as_ref_t final: private internal::meta_policy {
struct as_cref_t final: private internal::meta_policy {
/*! @cond ENTT_INTERNAL */
template<typename Type>
static constexpr bool value = std::is_reference_v<Type>;
static constexpr bool value = stl::is_reference_v<Type>;
/*! @endcond */
};

View File

@@ -41,6 +41,7 @@ using std::is_nothrow_destructible_v;
using std::is_nothrow_invocable_v;
using std::is_nothrow_move_constructible_v;
using std::is_pointer_v;
using std::is_reference_v;
using std::is_same_v;
using std::is_trivially_destructible_v;
using std::is_void_v;