Fix possible ambiguity of utils::bless

This commit is contained in:
Elad 2025-11-26 18:05:31 +02:00
parent 41aaa912e7
commit c9d57e8e80

View file

@ -3,8 +3,8 @@
namespace utils namespace utils
{ {
// Hack. Pointer cast util to workaround UB. Use with extreme care. // Hack. Pointer cast util to workaround UB. Use with extreme care.
template <typename T, typename U> template <typename T, typename U> requires requires () { +reinterpret_cast<T*>(static_cast<const U&>(nullptr)); }
[[nodiscard]] T* bless(U* ptr) [[nodiscard]] inline T* bless(const U& ptr)
{ {
#ifdef _MSC_VER #ifdef _MSC_VER
return (T*)ptr; return (T*)ptr;