|
|
@@ -172,7 +172,7 @@ class meta_any {
|
|
|
if constexpr(std::is_function_v<element_type>) {
|
|
|
*static_cast<meta_any *>(to) = any_cast<const Type>(from);
|
|
|
} else if constexpr(!std::is_same_v<element_type, void>) {
|
|
|
- if constexpr(std::is_reference_v<decltype(adl_meta_pointer_like<Type>::dereference(std::declval<const Type &>()))>) {
|
|
|
+ if constexpr(std::is_lvalue_reference_v<decltype(adl_meta_pointer_like<Type>::dereference(std::declval<const Type &>()))>) {
|
|
|
auto &&obj = adl_meta_pointer_like<Type>::dereference(any_cast<const Type &>(from));
|
|
|
*static_cast<meta_any *>(to) = (op == operation::DEREF ? meta_any{std::ref(obj)} : meta_any{std::cref(obj)});
|
|
|
} else {
|
|
|
@@ -603,7 +603,7 @@ struct meta_handle {
|
|
|
if constexpr(std::is_same_v<std::remove_cv_t<std::remove_reference_t<Type>>, meta_any>) {
|
|
|
any = value.as_ref();
|
|
|
} else {
|
|
|
- any = std::ref(value);
|
|
|
+ any.emplace<Type &>(value);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1641,11 +1641,7 @@ class meta_sequence_container::meta_iterator {
|
|
|
++any_cast<It &>(const_cast<any &>(from));
|
|
|
break;
|
|
|
case operation::DEREF:
|
|
|
- if constexpr(std::is_lvalue_reference_v<typename std::iterator_traits<It>::reference>) {
|
|
|
- *static_cast<meta_any *>(to) = std::ref(*any_cast<const It &>(from));
|
|
|
- } else {
|
|
|
- *static_cast<meta_any *>(to) = *any_cast<const It &>(from);
|
|
|
- }
|
|
|
+ static_cast<meta_any *>(to)->emplace<typename std::iterator_traits<It>::reference>(*any_cast<const It &>(from));
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -1791,18 +1787,10 @@ struct meta_sequence_container::meta_sequence_container_proxy {
|
|
|
|
|
|
[[nodiscard]] static meta_any get(any &container, size_type pos) {
|
|
|
if(auto * const cont = any_cast<Type>(&container); cont) {
|
|
|
- if constexpr(std::is_lvalue_reference_v<typename Type::reference>) {
|
|
|
- return std::ref(traits_type::get(*cont, pos));
|
|
|
- } else {
|
|
|
- return traits_type::get(*cont, pos);
|
|
|
- }
|
|
|
+ return meta_any{std::in_place_type<typename Type::reference>, traits_type::get(*cont, pos)};
|
|
|
}
|
|
|
|
|
|
- if constexpr(std::is_lvalue_reference_v<typename Type::const_reference>) {
|
|
|
- return std::ref(traits_type::cget(any_cast<const Type &>(container), pos));
|
|
|
- } else {
|
|
|
- return traits_type::cget(any_cast<const Type &>(container), pos);
|
|
|
- }
|
|
|
+ return meta_any{std::in_place_type<typename Type::const_reference>, traits_type::cget(any_cast<const Type &>(container), pos)};
|
|
|
}
|
|
|
};
|
|
|
|