meta: allow checking meta_any for nullptr (#591)
This commit is contained in:
committed by
Michele Caini
parent
bc987ed03f
commit
7c0db3203b
@@ -171,9 +171,11 @@ class meta_any {
|
||||
using pointed_type = std::remove_reference_t<decltype(*std::declval<Type>())>;
|
||||
|
||||
if constexpr(std::is_const_v<pointed_type> && std::is_copy_constructible_v<pointed_type>) {
|
||||
return std::as_const(*any.cast<Type>());
|
||||
auto ptr = any.cast<Type>();
|
||||
return ptr ? std::as_const(*ptr) : meta_any{};
|
||||
} else if constexpr(!std::is_const_v<pointed_type>) {
|
||||
return std::ref(*any.cast<Type>());
|
||||
auto ptr = any.cast<Type>();
|
||||
return ptr ? std::ref(*ptr) : meta_any{};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user