native 0.0.1
Vectors, masks and wide register packs for C++26
Loading...
Searching...
No Matches
native::static_c_string Class Referenceexport

A pointer-sized view of a complete interned char string. Length is recovered from the first NUL. Use static_string when embedded NULs matter or repeated end/length scans are undesirable. Default construction selects the canonical empty string; equality compares addresses. More...

Public Member Functions

constructors
constexpr static_c_string () noexcept=default
 Select the canonical empty C string.
constexpr static_c_string (static_c_string const &) noexcept=default
 Copy the interned view without copying characters.
constexpr static_c_string (static_c_string &&) noexcept=default
 Copy the interned view; the source remains valid and unchanged.
constexpr static_c_string (static_string x) noexcept
assignment
constexpr static_c_string & operator= (static_c_string const &) noexcept=default
 Replace this view with the source view without allocation; the source is unchanged.
constexpr static_c_string & operator= (static_c_string &&) noexcept=default
 Replace this view with the source view without allocation; the source is unchanged.
conversion
constexpr operator const char * () const noexcept
 Borrow the interned null-terminated character pointer.
constexpr operator static_string () const noexcept
 Recover a static_string by scanning to the first NUL; O(length).
constexpr const char * data () const noexcept
 Return the borrowed interned pointer.
iterators
constexpr auto begin () const noexcept
constexpr auto end () const noexcept
 Return the one-past-last character iterator; C-string form scans to its NUL.
constexpr auto cbegin () const noexcept
constexpr auto cend () const noexcept
constexpr auto rbegin () const noexcept
constexpr auto rend () const noexcept
constexpr auto crbegin () const noexcept
constexpr auto crend () const noexcept

Friends

void swap (static_c_string &x, static_c_string &y) noexcept
 Exchange the interned pointers without touching characters.
comparison
constexpr friend bool operator== (static_c_string x, static_c_string y) noexcept
 Return whether both views refer to the same interned address.
constexpr friend bool operator!= (static_c_string x, static_c_string y) noexcept
 Return whether the interned addresses differ.

Detailed Description

A pointer-sized view of a complete interned char string. Length is recovered from the first NUL. Use static_string when embedded NULs matter or repeated end/length scans are undesirable. Default construction selects the canonical empty string; equality compares addresses.

Definition at line 306 of file native.static_string.ccm.

Constructor & Destructor Documentation

◆ static_c_string()

native::static_c_string::static_c_string ( static_string x)
inlineconstexprnoexcept

Borrow the interned storage, dropping the separately stored length.

Precondition
x has no embedded NUL before x.size().

Definition at line 341 of file native.static_string.ccm.

Member Function Documentation

◆ begin()

auto native::static_c_string::begin ( ) const
inlineconstexprnoexcept

O(1) Return the first character iterator.

Definition at line 390 of file native.static_string.ccm.

Here is the caller graph for this function:

◆ cbegin()

auto native::static_c_string::cbegin ( ) const
inlineconstexprnoexcept

O(1) Return the first const character iterator.

Definition at line 399 of file native.static_string.ccm.

◆ cend()

auto native::static_c_string::cend ( ) const
inlineconstexprnoexcept

O(n) Return the const end iterator; C-string form scans to its NUL.

Definition at line 404 of file native.static_string.ccm.

◆ crbegin()

auto native::static_c_string::crbegin ( ) const
inlineconstexprnoexcept

O(n) Return the first const reverse iterator.

Definition at line 419 of file native.static_string.ccm.

◆ crend()

auto native::static_c_string::crend ( ) const
inlineconstexprnoexcept

O(1) Return the const reverse end iterator.

Definition at line 424 of file native.static_string.ccm.

◆ rbegin()

auto native::static_c_string::rbegin ( ) const
inlineconstexprnoexcept

O(n) Return the first reverse iterator; C-string form first finds its end.

Definition at line 409 of file native.static_string.ccm.

◆ rend()

auto native::static_c_string::rend ( ) const
inlineconstexprnoexcept

O(1) Return the reverse end iterator.

Definition at line 414 of file native.static_string.ccm.


The documentation for this class was generated from the following file: