ORIGINAL
Loading...
Searching...
No Matches
original::hashable< DERIVED > Class Template Referenceabstract

Forward declaration of hashable interface template. More...

#include <hash.h>

Collaboration diagram for original::hashable< DERIVED >:
Collaboration graph

Public Member Functions

virtual u_integer toHash () const noexcept
 Computes the hash of the object.
 
virtual bool equals (const DERIVED &other) const noexcept
 Compares two objects for equality.
 
virtual ~hashable ()=0
 Virtual destructor.
 

Detailed Description

template<typename DERIVED>
class original::hashable< DERIVED >

Forward declaration of hashable interface template.

Interface for user-defined hashable types.

Template Parameters
DERIVEDThe derived class that inherits from hashable.
DERIVEDThe derived type

Provides default implementations for:

  • toHash(): Uses byte-wise hashing of object representation
  • equals(): Uses operator== comparison

Usage:

class MyType : public hashable<MyType> {
// Optionally override toHash() and equals()
};
Forward declaration of hashable interface template.
Definition hash.h:216

Member Function Documentation

◆ equals()

template<typename DERIVED>
bool original::hashable< DERIVED >::equals ( const DERIVED & other) const
virtualnoexcept

Compares two objects for equality.

Parameters
otherThe object to compare with
Returns
True if equal

Default implementation uses operator==

◆ toHash()

template<typename DERIVED>
original::u_integer original::hashable< DERIVED >::toHash ( ) const
nodiscardvirtualnoexcept

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