Navigation
Unreal Engine C++ API Reference > Runtime > MeshDescription
References
Module | MeshDescription |
Header | /Engine/Source/Runtime/MeshDescription/Public/MeshAttributeArray.h |
Include | #include "MeshAttributeArray.h" |
Syntax
template<typename FnType, uint32 Size>
struct TJumpTable
Remarks
We need a mechanism by which we can iterate all items in the attribute map and perform an arbitrary operation on each. We require polymorphic behavior, as attribute arrays are templated on their attribute type, and derived from a generic base class. However, we cannot have a virtual templated method, so we use a different approach.
Effectively, we wish to cast the attribute array depending on the type member of the base class as we iterate through the map. This might look something like this:
template
(The hope is that the compiler would optimize the switch into a jump table so we get O(1) dispatch even as the number of attribute types increases.)
The approach taken here is to generate a jump table at compile time, one entry per possible attribute type. The function Dispatch(...) is the actual function which gets called. MakeJumpTable() is the constexpr function which creates a static jump table at compile time. Class which implements a function jump table to be automatically generated at compile time. This is used by TAttributesSet to provide O(1) dispatch by attribute type at runtime.
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
FnType *[Size] | Fns |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
constexpr | TJumpTable
(
T... Ts |