|
native 0.0.1
Vectors, masks and wide register packs for C++26
|
A view of one complete interned string, with its length retained. The five standard character widths are supported by the _ss literal. Embedded NUL characters remain part of its length. Default construction selects the canonical empty string. The view constructor is a compatibility escape hatch, not a runtime interning operation: arbitrary string_view storage violates the lifetime and pointer-equality/hash contract. More...
Public Member Functions | |
| constexpr | basic_static_string (std::basic_string_view< CharT, Traits > value) noexcept |
constructors | |
| template<CharT... xs> | |
| consteval | basic_static_string (std::integer_sequence< CharT, xs... >) noexcept |
| Intern a compile-time character sequence; append one terminator outside its length. | |
| constexpr | basic_static_string () noexcept=default |
| Select the canonical empty interned string. | |
| constexpr | basic_static_string (basic_static_string const &) noexcept=default |
| Copy the interned view without copying characters. | |
| constexpr | basic_static_string (basic_static_string &&) noexcept=default |
| Copy the interned view; the source remains valid and unchanged. | |
assignments | |
| constexpr basic_static_string & | operator= (basic_static_string const &that) noexcept=default |
| Replace this view with the source view without allocation; the source is unchanged. | |
| constexpr basic_static_string & | operator= (basic_static_string &&that) noexcept=default |
| Replace this view with the source view without allocation; the source is unchanged. | |
conversions | |
| constexpr | operator CharT const * () const noexcept |
| Borrow the null-terminated storage; embedded NULs still stop C-string consumers. | |
| constexpr | operator std::basic_string_view< CharT, Traits > () const noexcept |
| Borrow the full view, including any embedded NUL characters. | |
| constexpr | operator std::basic_string< CharT, Traits > () const |
| Allocate an independent standard string containing the full view. | |
element access | |
| constexpr CharT const & | operator[] (size_type i) const noexcept |
| Access character i. Requires i < size(). | |
| constexpr CharT const & | at (size_type i) const |
| access the specified character with bounds checking | |
| constexpr const_reference | front () const noexcept |
| Returns the first character. Requires !empty(). | |
| constexpr const_reference | back () const noexcept |
| constexpr const_pointer | data () const noexcept |
| Borrow the canonical storage; the terminator is at data()[size()]. | |
capacity | |
| constexpr size_type | size () const noexcept |
| Return the stored number of characters, excluding the final terminator. | |
| constexpr size_type | length () const noexcept |
| Synonym for size(). | |
| constexpr size_type | max_size () const noexcept |
| Return the underlying string_view capacity bound, not the current length. | |
| constexpr bool | empty () const noexcept |
| Return whether the stored length is zero. | |
| constexpr | operator bool () const noexcept |
| Return whether the string is nonempty. | |
iterators | |
| constexpr auto | begin () const noexcept |
| Return the first character iterator. | |
| constexpr auto | end () const noexcept |
| Return the one-past-last character iterator; C-string form scans to its NUL. | |
| constexpr auto | cbegin () const noexcept |
| Return the first const character iterator. | |
| constexpr auto | cend () const noexcept |
| Return the const end iterator; C-string form scans to its NUL. | |
| constexpr auto | rbegin () const noexcept |
| Return the first reverse iterator; C-string form first finds its end. | |
| constexpr auto | rend () const noexcept |
| Return the reverse end iterator. | |
| constexpr auto | crbegin () const noexcept |
| Return the first const reverse iterator. | |
| constexpr auto | crend () const noexcept |
| Return the const reverse end iterator. | |
Friends | |
| class | static_c_string |
| Allow the pointer-sized view to share this interned storage. | |
| constexpr friend void | swap (basic_static_string &x, basic_static_string &y) noexcept |
| Exchange views without moving characters. | |
comparisons | |
| constexpr bool | operator== (basic_static_string self, basic_static_string that) noexcept |
| constexpr bool | operator!= (basic_static_string self, basic_static_string that) noexcept |
| constexpr std::basic_ostream< CharT, Traits > & | operator<< (std::basic_ostream< CharT, Traits > &os, basic_static_string< CharT, Traits > v) |
A view of one complete interned string, with its length retained. The five standard character widths are supported by the _ss literal. Embedded NUL characters remain part of its length. Default construction selects the canonical empty string. The view constructor is a compatibility escape hatch, not a runtime interning operation: arbitrary string_view storage violates the lifetime and pointer-equality/hash contract.
Custom Traits can change equality to a character comparison, but the supplied hash remains pointer-based. Do not use it for traits that equate distinct interned byte strings; supply a matching equality/hash pair yourself.
Definition at line 73 of file native.static_string.ccm.
|
inlineconstexprnoexcept |
Adopt an existing interned view without copying or allocating.
Definition at line 81 of file native.static_string.ccm.
|
inlineconstexprnoexcept |
Return the last character.
Definition at line 173 of file native.static_string.ccm.
|
friend |
Negate equality, using the same address or custom-traits comparison.
Definition at line 221 of file native.static_string.ccm.
|
friend |
input/output Write the complete view, including embedded NULs.
| std::ios_base::failure | if an exception is thrown during output. |
Definition at line 235 of file native.static_string.ccm.
|
friend |
Compare interned addresses with standard traits, otherwise compare addresses or character values.
Definition at line 210 of file native.static_string.ccm.