Navigation
API > API/Runtime > API/Runtime/Core
Description
Gets the size of the properties of a type, without any trailing padding. Used to populate PropertiesSize for UStructs for native types. This is important because we use the offset of properties to determine what class they are in (i.e. an offset that falls within a parent class is assumed to be a property of the parent class). Since compilers can reuse the tail padding of a class in derived classes, PropertiesSize must be no more than the offset of the first byte of a derived class for non-final classes. Unfortunately, this implementation does not work for final types, so we fall back to just using sizeof(T) which what was used previously Note that for types that have a virtual destructor, we declare a pure virtual destructor in Derived in order to avoid calling the destructor in T and triggering compile errors related to private destructors or destructors for incomplete types
| Name | DataSizeOf |
| Type | function |
| Header File | /Engine/Source/Runtime/Core/Public/Templates/AlignmentTemplates.h |
| Include Path | #include "Templates/AlignmentTemplates.h" |
template<typename T>
std::size_t DataSizeOf()
sizeof(T) minus the unused tail alignment bytes that subclasses may reuse. Unaligned.