XII Release 0.1.0
Loading...
Searching...
No Matches
xiiHashableStruct< DERIVED > Class Template Reference

Curiously Recurring Template Pattern (CRTP) base for making trivially copyable structs hashable and comparable. More...

#include <HashableStruct.h>

Public Member Functions

constexpr xiiHashableStruct () noexcept
 Default constructor. Initializes all bytes to zero.
 
 xiiHashableStruct (const xiiHashableStruct &other) noexcept
 Bitwise copy constructor.
 
xiiHashableStructoperator= (const xiiHashableStruct &other) noexcept
 Bitwise assignment operator.
 
bool operator== (const xiiHashableStruct &other) const noexcept
 Compares equality via raw byte comparison.
 
std::strong_ordering operator<=> (const xiiHashableStruct &other) const noexcept
 Compares ordering via raw byte comparison.
 
xiiUInt32 CalculateHash () const noexcept
 Calculates a 32-bit hash from raw bytes of the struct.
 
void Clear () noexcept
 Fills all bytes with zero.
 
bool IsZero () const noexcept
 Returns true if all bytes are zero.
 

Detailed Description

template<typename DERIVED>
class xiiHashableStruct< DERIVED >

Curiously Recurring Template Pattern (CRTP) base for making trivially copyable structs hashable and comparable.

This class provides automatic zero-initialization, bitwise equality, ordering, hashing, and a set of utility functions. It is designed for descriptor-style types that contain raw data (including pointers) and no dynamic allocation or polymorphic behavior.

Note
Requires derived types to be trivially copyable and standard-layout.
Template Parameters
DERIVEDThe derived struct type using CRTP.

The documentation for this class was generated from the following files: