#pragma once #include #include template inline T* start_lifetime_as(void* p) noexcept { T* q = reinterpret_cast(p); std::memcpy(q, q, sizeof(T)); return q; } template inline const T* start_lifetime_as(const void* p) noexcept { const T* q = reinterpret_cast(p); std::memcpy(const_cast(static_cast(q)), q, sizeof(T)); return q; } template inline volatile T* start_lifetime_as(volatile void* p) noexcept { volatile T* q = reinterpret_cast(p); std::memcpy(const_cast(static_cast(q)), q, sizeof(T)); return q; } template inline const volatile T* start_lifetime_as(const volatile void* p) noexcept { const volatile T* q = reinterpret_cast(p); std::memcpy(const_cast(static_cast(q)), q, sizeof(T)); return q; }