Basic template for limited length, packed string identifiers. More...
#include <eagine/identifier.hpp>
Public Types | |
using | encoding = identifier_encoding< CharSet > |
Alias for the encoding type. | |
using | size_type = span_size_t |
Alias for the length type. | |
using | value_type = char |
Alias for the element type. | |
using | name_type = identifier_name< M > |
Alias for the unpacked identifier_name type. | |
Public Member Functions | |
constexpr | basic_identifier () noexcept=default |
Default constructor. Constructs an empty identifier. | |
template<std::size_t L, typename = std::enable_if_t<(L <= M + 1)>> | |
constexpr | basic_identifier (const char(&init)[L]) noexcept |
Construction from a C-string literal. | |
constexpr | basic_identifier (span< const char > init) noexcept |
Construction from a const span of characters. | |
constexpr auto | is_empty () const noexcept -> bool |
Returns the size of this identifier. More... | |
constexpr auto | size () const noexcept -> size_type |
Returns the size of this identifier. More... | |
constexpr auto | operator[] (size_type idx) const noexcept -> value_type |
Subscript operator. Allows to access individual characters. | |
constexpr auto | name () const noexcept -> name_type |
Returns this identifier as unpacked identifier_name. More... | |
auto | str () const -> std::string |
Returns this identifier as unpacked standard string. More... | |
Static Public Member Functions | |
static constexpr auto | max_size () noexcept -> size_type |
Returns the maximum length of this identifier type. | |
Friends | |
constexpr friend auto | operator== (const basic_identifier &a, const basic_identifier &b) noexcept |
Equality comparison. | |
constexpr friend auto | operator!= (const basic_identifier &a, const basic_identifier &b) noexcept |
Nonequality comparison. | |
constexpr friend auto | operator< (const basic_identifier &a, const basic_identifier &b) noexcept |
Less-than comparison. More... | |
constexpr friend auto | operator<= (const basic_identifier &a, const basic_identifier &b) noexcept |
Less-equal comparison. More... | |
constexpr friend auto | operator> (const basic_identifier &a, const basic_identifier &b) noexcept |
Greater-than comparison. More... | |
constexpr friend auto | operator>= (const basic_identifier &a, const basic_identifier &b) noexcept |
Greater-equal comparison. More... | |
Basic template for limited length, packed string identifiers.
Packed identifier store short constant strings with limited allowed set of characters that are used as object identifiers throughout the project. The strings are constexpr
encoded into unsigned integer values and are stored without dynamic memory allocation. Comparison operations on identifiers are typically more efficient than regular character string comparisons, but note that integer comparisons are used instead lexicographical comparisons.
|
inlineconstexprnoexcept |
Returns the size of this identifier.
Referenced by eagine::basic_identifier< 10, 6, default_identifier_char_set, identifier_t >::size().
|
inlineconstexprnoexcept |
Returns this identifier as unpacked identifier_name.
Referenced by eagine::basic_identifier< 10, 6, default_identifier_char_set, identifier_t >::str().
|
inlineconstexprnoexcept |
Returns the size of this identifier.
|
inline |
Returns this identifier as unpacked standard string.
|
friend |
Less-than comparison.
|
friend |
Less-equal comparison.
|
friend |
Greater-than comparison.
|
friend |
Greater-equal comparison.