sigh, include type_traits

This commit is contained in:
Elad 2025-11-26 20:11:30 +02:00 committed by GitHub
parent c9d57e8e80
commit 8f8315bccc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,9 +1,11 @@
#pragma once
#include <type_traits>
namespace utils
{
// Hack. Pointer cast util to workaround UB. Use with extreme care.
template <typename T, typename U> requires requires () { +reinterpret_cast<T*>(static_cast<const U&>(nullptr)); }
template <typename T, typename U> requires (std::is_pointer_v<std::remove_reference_t<U>>)
[[nodiscard]] inline T* bless(const U& ptr)
{
#ifdef _MSC_VER
@ -21,3 +23,4 @@ namespace utils
#endif
}
}