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

Copyright (c) Theophilus Eriata. All Rights Reserved. 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.
xiiHashableStruct & operator= (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 >

Copyright (c) Theophilus Eriata. All Rights Reserved.

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.

Constructor & Destructor Documentation

◆ xiiHashableStruct()

template<typename DERIVED>
XII_ALWAYS_INLINE constexpr xiiHashableStruct< DERIVED >::xiiHashableStruct ( )
constexprnoexcept

Default constructor. Initializes all bytes to zero.

Copyright (c) Theophilus Eriata. All Rights Reserved.


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