Macro Subspace :: sus_class_trivially_relocatable_unchecked
Mark a class as unconditionally trivially relocatable, without any additional assertion to help verify correctness.
Generally, prefer to use sus_class_trivially_relocatable() with
all field types passed to the macro.
To additionally allow the class to be passed in registers, the class can be
marked with the [[clang::trivial_abi]]
attribute.
Use the TriviallyRelocatable
concept to
determine if a type is trivially relocatable, and to test with static_assert
that types are matching what you are expecting. This allows containers to
optimize their implementations when relocating the type in memory.
Macro | Style |
---|---|
sus_class_trivially_relocatable |
asserts all param types are trivially relocatable |
sus_class_trivially_relocatable_if_types |
is conditionally trivially relocatable if all param types are |
sus_class_trivially_relocatable_if |
is conditionally trivially relocatable if the condition is true |
sus_class_trivially_relocatable_unchecked |
is trivially relocatable without any condition or assertion |
Example
struct S {
Thing<i32> thing;
i32 more;
sus_class_trivially_relocatable_unchecked(unsafe_fn);
};