OpenLexocad
28.0
|
Zero overhead unique identifier. More...
#include <entt.hpp>
Public Types | |
using | value_type = Char |
Character type. More... | |
using | hash_type = ENTT_ID_TYPE |
Unsigned integer type. More... | |
Public Member Functions | |
constexpr | basic_hashed_string () ENTT_NOEXCEPT |
Constructs an empty hashed string. More... | |
template<std::size_t N> | |
constexpr | basic_hashed_string (const value_type(&curr)[N]) ENTT_NOEXCEPT |
Constructs a hashed string from an array of const characters. More... | |
constexpr | basic_hashed_string (const_wrapper wrapper) ENTT_NOEXCEPT |
Explicit constructor on purpose to avoid constructing a hashed string directly from a const value_type * . More... | |
constexpr const value_type * | data () const ENTT_NOEXCEPT |
Returns the human-readable representation of a hashed string. More... | |
constexpr hash_type | value () const ENTT_NOEXCEPT |
Returns the numeric representation of a hashed string. More... | |
constexpr | operator const value_type * () const ENTT_NOEXCEPT |
Returns the human-readable representation of a hashed string. More... | |
constexpr | operator hash_type () const ENTT_NOEXCEPT |
Returns the numeric representation of a hashed string. More... | |
constexpr bool | operator== (const basic_hashed_string &other) const ENTT_NOEXCEPT |
Compares two hashed strings. More... | |
Static Public Member Functions | |
template<std::size_t N> | |
static constexpr hash_type | to_value (const value_type(&str)[N]) ENTT_NOEXCEPT |
Returns directly the numeric representation of a string. More... | |
static hash_type | to_value (const_wrapper wrapper) ENTT_NOEXCEPT |
Returns directly the numeric representation of a string. More... | |
static hash_type | to_value (const value_type *str, std::size_t size) ENTT_NOEXCEPT |
Returns directly the numeric representation of a string view. More... | |
Zero overhead unique identifier.
TURN_OFF_DOXYGEN A hashed string is a compile-time tool that allows users to use human-readable identifers in the codebase while using their numeric counterparts at runtime.
Because of that, a hashed string can also be used in constant expressions if required.
Char | Character type. |
using entt::basic_hashed_string< Char >::hash_type = ENTT_ID_TYPE |
Unsigned integer type.
using entt::basic_hashed_string< Char >::value_type = Char |
Character type.
|
inlineconstexpr |
Constructs an empty hashed string.
|
inlineconstexpr |
Constructs a hashed string from an array of const characters.
Forcing template resolution avoids implicit conversions. An human-readable identifier can be anything but a plain, old bunch of characters.
Example of use:
N | Number of characters of the identifier. |
curr | Human-readable identifer. |
|
inlineexplicitconstexpr |
Explicit constructor on purpose to avoid constructing a hashed string directly from a const value_type *
.
wrapper | Helps achieving the purpose by relying on overloading. |
|
inlineconstexpr |
Returns the human-readable representation of a hashed string.
|
inlineconstexpr |
Returns the human-readable representation of a hashed string.
|
inlineconstexpr |
Returns the numeric representation of a hashed string.
|
inlineconstexpr |
Compares two hashed strings.
other | Hashed string with which to compare. |
|
inlinestatic |
Returns directly the numeric representation of a string view.
str | Human-readable identifer. |
size | Length of the string to hash. |
|
inlinestaticconstexpr |
Returns directly the numeric representation of a string.
Forcing template resolution avoids implicit conversions. An human-readable identifier can be anything but a plain, old bunch of characters.
Example of use:
N | Number of characters of the identifier. |
str | Human-readable identifer. |
|
inlinestatic |
Returns directly the numeric representation of a string.
wrapper | Helps achieving the purpose by relying on overloading. |
|
inlineconstexpr |
Returns the numeric representation of a hashed string.