UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMNeverDestroyed.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if WITH_VERSE_VM || defined(__INTELLISENSE__)
6
7#include "HAL/Platform.h"
8#include "VVMLog.h"
9
10namespace Verse
11{
12
13template <typename T>
14struct alignas(alignof(T)) TNeverDestroyed
15{
17 {
18 UE_LOG(LogVerseVM, Display, TEXT("Running TNeverDestroyed constructor at %p"), this);
19 new (&Get()) T();
20 }
21
22 T& Get()
23 {
24 return *reinterpret_cast<T*>(Data);
25 }
26
27 T& operator*()
28 {
29 return Get();
30 }
31
32 T* operator->()
33 {
34 return &Get();
35 }
36
37 const T& Get() const
38 {
39 return *reinterpret_cast<T*>(Data);
40 }
41
42 const T& operator*() const
43 {
44 return Get();
45 }
46
47 const T* operator->() const
48 {
49 return &Get();
50 }
51
52private:
53 std::byte Data[sizeof(T)];
54};
55
56} // namespace Verse
57#endif // WITH_VERSE_VM
UE_FORCEINLINE_HINT FLinearColor operator*(float Scalar, const FLinearColor &Color)
Definition Color.h:473
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
DIRECTLINK_API Display
Definition DirectLinkLog.h:8
#define UE_LOG(CategoryName, Verbosity, Format,...)
Definition LogMacros.h:270
GeometryCollection::Facades::FMuscleActivationData Data
Definition MuscleActivationConstraints.h:15
FORCEINLINE T * Get(const FObjectPtr &ObjectPtr)
Definition ObjectPtr.h:426
Definition Archive.h:36