shared_ptr.hpp: minor fixup

This commit is contained in:
Nekotekina 2021-03-01 00:28:28 +03:00
parent b7c579adf9
commit 71e16bfac3

View File

@ -30,13 +30,13 @@ namespace stx
} }
else if constexpr (std::is_convertible_v<U*, T*>) else if constexpr (std::is_convertible_v<U*, T*>)
{ {
const auto u = &sample<U>; const auto u = std::addressof(sample<U>);
const volatile void* x = u; const volatile void* x = u;
return static_cast<T*>(u) == x; return static_cast<T*>(u) == x;
} }
else if constexpr (std::is_convertible_v<T*, U*>) else if constexpr (std::is_convertible_v<T*, U*>)
{ {
const auto t = &sample<T>; const auto t = std::addressof(sample<T>);
const volatile void* x = t; const volatile void* x = t;
return static_cast<U*>(t) == x; return static_cast<U*>(t) == x;
} }