template<typename T = uint32_t, typename NamespaceType = DefaultNamespaceType>
struct AZ::RHI::Handle< T, NamespaceType >
Handle a simple wrapper around an integral type, which adds the formal concept of a 'Null' value. It is designed to accommodate a zero-based 'index' where a value of 0 is considered valid. As such, the null value is equal to -1 casted to the type.
- Template Parameters
-
T | An integral type held by the Handle container. A value of -1 (or max value for unsigned types) is reserved for the null index. |
NamespaceType | An optional typename used to create a compile-time unique variant of Handle. This disallows trivial copying of unrelated 'types'. Useful to make a handle variant typed to a client class. |
Sample Usage:
class Foo;
using FooHandle = Handle<uint16_t, Foo>;
FooHandle fooHandle;
class Bar;
using BarHandle = Handle<uint16_t, Bar>;
BarHandle barHandle;
fooHandle = barHandle;
fooHandle.IsNull();
fooHandle.GetIndex();
fooHandle = 15;
fooHandle.GetIndex();
fooHandle.IsNull();