diff --git a/include/yorel/yomm2/core.hpp b/include/yorel/yomm2/core.hpp index 9e58597a..9092e5d9 100644 --- a/include/yorel/yomm2/core.hpp +++ b/include/yorel/yomm2/core.hpp @@ -143,8 +143,6 @@ struct requires_dynamic_cast_ref_aux< B, D, std::void_t(std::declval()))>> : std::false_type {}; -} // namespace detail - template constexpr bool requires_dynamic_cast = detail::requires_dynamic_cast_ref_aux::value; @@ -158,6 +156,8 @@ auto optimal_cast(B&& obj) -> decltype(auto) { } } +} // namespace detail + // ============================================================================= // virtual_traits @@ -174,7 +174,7 @@ struct virtual_traits { template static auto cast(T& obj) -> D& { - return optimal_cast(obj); + return detail::optimal_cast(obj); } }; @@ -188,7 +188,7 @@ struct virtual_traits { template static auto cast(T&& obj) -> D&& { - return optimal_cast(obj); + return detail::optimal_cast(obj); } }; @@ -463,7 +463,7 @@ class virtual_ptr { virtual_ptr_traits::template cast(obj); } else { result.obj = - &optimal_cast(*obj); + &detail::optimal_cast(*obj); } return result; @@ -528,11 +528,11 @@ template using select_spec_polymorphic_type = typename select_spec_polymorphic_type_aux::type; -template +template using spec_polymorphic_types = boost::mp11::mp_remove< boost::mp11::mp_transform_q< boost::mp11::mp_bind_front, - MethodArgList, SpecArgList>, + MethodParameters, OverriderParameters>, void>; template diff --git a/include/yorel/yomm2/virtual_shared_ptr.hpp b/include/yorel/yomm2/virtual_shared_ptr.hpp index 7082cbb5..1cdbeeea 100644 --- a/include/yorel/yomm2/virtual_shared_ptr.hpp +++ b/include/yorel/yomm2/virtual_shared_ptr.hpp @@ -50,7 +50,7 @@ struct virtual_traits&> { static auto cast(const std::shared_ptr& obj) { check_cast(); - if constexpr (requires_dynamic_cast) { + if constexpr (detail::requires_dynamic_cast) { return std::dynamic_pointer_cast< typename shared_ptr_traits::polymorphic_type>(obj); } else { @@ -82,7 +82,7 @@ struct virtual_traits> { static auto cast(const std::shared_ptr& obj) { check_cast(); - if constexpr (requires_dynamic_cast) { + if constexpr (detail::requires_dynamic_cast) { return std::dynamic_pointer_cast< typename shared_ptr_traits::polymorphic_type>(obj); } else { @@ -102,7 +102,7 @@ struct virtual_ptr_traits, Policy> { using OtherPtr = typename std::remove_reference_t; using OtherClass = typename OtherPtr::box_type::element_type; - if constexpr (requires_dynamic_cast) { + if constexpr (detail::requires_dynamic_cast) { return std::dynamic_pointer_cast(ptr); } else { return std::static_pointer_cast(ptr);