diff --git a/include/boost/type_index/runtime_cast/reference_cast.hpp b/include/boost/type_index/runtime_cast/reference_cast.hpp index 10b5dc1..1511f7d 100644 --- a/include/boost/type_index/runtime_cast/reference_cast.hpp +++ b/include/boost/type_index/runtime_cast/reference_cast.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -36,7 +37,7 @@ struct bad_runtime_cast : std::exception /// \return If there exists a valid conversion from U& to T, returns a T that references an address /// suitably offset from u. If no such conversion exists, throws boost::typeindex::bad_runtime_cast. template -T& runtime_cast(U& u) { +typename boost::add_reference::type runtime_cast(U& u) { typedef typename boost::remove_reference::type impl_type; impl_type* value = detail::runtime_cast_impl( boost::addressof(u), boost::is_base_and_derived()); @@ -51,7 +52,7 @@ T& runtime_cast(U& u) { /// \return If there exists a valid conversion from U const& to T const, returns a T const that references an address /// suitably offset from u. If no such conversion exists, throws boost::typeindex::bad_runtime_cast. template -T const& runtime_cast(U const& u) { +typename boost::add_reference::type runtime_cast(U const& u) { typedef typename boost::remove_reference::type impl_type; impl_type* value = detail::runtime_cast_impl( boost::addressof(u), boost::is_base_and_derived());