diff --git a/include/boost/variant2/variant.hpp b/include/boost/variant2/variant.hpp index f7fac51..d005a21 100644 --- a/include/boost/variant2/variant.hpp +++ b/include/boost/variant2/variant.hpp @@ -416,13 +416,13 @@ template constexpr U const&& get(variant const&& v) template constexpr typename std::add_pointer>>::type get_if(variant* v) noexcept { static_assert( I < sizeof...(T), "Index out of bounds" ); - return v && v->index() == I? &v->_get_impl( mp11::mp_size_t() ): 0; + return v && v->index() == I? ::std::addressof(v->_get_impl( mp11::mp_size_t() )): 0; } template constexpr typename std::add_pointer>>::type get_if(variant const * v) noexcept { static_assert( I < sizeof...(T), "Index out of bounds" ); - return v && v->index() == I? &v->_get_impl( mp11::mp_size_t() ): 0; + return v && v->index() == I? ::std::addressof(v->_get_impl( mp11::mp_size_t() )): 0; } template constexpr typename std::add_pointer::type get_if(variant* v) noexcept @@ -431,7 +431,7 @@ template constexpr typename std::add_pointer::type get_i using I = mp11::mp_find, U>; - return v && v->index() == I::value? &v->_get_impl( I() ): 0; + return v && v->index() == I::value? ::std::addressof(v->_get_impl( I() )): 0; } template constexpr typename std::add_pointer::type get_if(variant const * v) noexcept @@ -440,7 +440,7 @@ template constexpr typename std::add_pointer::type using I = mp11::mp_find, U>; - return v && v->index() == I::value? &v->_get_impl( I() ): 0; + return v && v->index() == I::value? ::std::addressof(v->_get_impl( I() )): 0; } //