class StringID

A string identifier that provides very fast comparisons to other string identifiers.

Significantly faster than comparing raw strings.

Public

Constructors

StringID

StringID() noexcept = default

StringID

StringID(const char *name)

StringID

StringID(const String &name)

Methods

Empty

bool Empty() const

Returns true if the string id has no value assigned.

CStr

const char *CStr() const

Returns the null-terminated name of the string id.

Id

u32 Id() const

Returns the unique identifier of the string.

Operators

operator==

bool operator==(const StringID &rhs) const

Compare to string ids for equality.

Uses fast integer comparison.

operator!=

bool operator!=(const StringID &rhs) const

Compare to string ids for inequality.

Uses fast integer comparison.

operator basic_string

operator String() const

Implicitly converts to a normal string.

operator basic_string_view

operator StringView() const

Implicitly converts to a string view.

Private

Methods

AllocEntry

InternalData *AllocEntry()

Allocates a new string entry and assigns it a unique ID.

Optionally expands the chunks buffer if the new entry doesn't fit.

Fields

mData

InternalData * mData