StrKey

Files CCore/inc/StrKey.h CCore/src/StrKey.cpp

StrKey is a simple class. It is a combination of the StrLen class and the 32-bit hash code. This class can be used as the key type to build maps. It speeds-up string comparison. The constructor calculates and stores the hash code of the string. The comparison method compares hash codes first and strings after.


struct StrKey : CmpComparable<StrKey>
 {
  uint32 hash;
  StrLen str;
  
  StrKey() noexcept;
  
  explicit StrKey(StrLen str);
  
  CmpResult objCmp(const StrKey &obj) const;
 };