一呼百應, "one call, a hundred responses"
Loading...
Searching...
No Matches
ein::static_c_string Class Reference

#include <static_string.hpp>

Public Types

using traits_type = std::char_traits<char>
 
using value_type = char
 
using pointer = char *
 
using const_pointer = char const *
 
using reference = char &
 
using const_reference = char const &
 
using const_iterator = char const *
 
using iterator = const_iterator
 
using const_reverse_iterator = std::reverse_iterator<const_iterator>
 
using reverse_iterator = const_reverse_iterator
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

constructors
constexpr static_c_string () noexcept=default
 
constexpr static_c_string (static_c_string const &) noexcept=default
 
constexpr static_c_string (static_c_string &&) noexcept=default
 
constexpr static_c_string (static_string x) noexcept
 
assignment
ein_reinitializes constexpr static_c_stringoperator= (static_c_string const &) noexcept=default
 
ein_reinitializes constexpr static_c_stringoperator= (static_c_string &&) noexcept=default
 
conversion
constexpr operator const char * () const noexcept
 
constexpr operator static_string () const noexcept
 
constexpr const char * data () const noexcept
 
iterators
constexpr auto begin () const noexcept
 O(1)
 
constexpr auto end () const noexcept
 
constexpr auto cbegin () const noexcept
 O(1)
 
constexpr auto cend () const noexcept
 O(1)
 
constexpr auto rbegin () const noexcept
 O(n)
 
constexpr auto rend () const noexcept
 O(1)
 
constexpr auto crbegin () const noexcept
 O(n)
 
constexpr auto crend () const noexcept
 O(1)
 

Private Attributes

const char * p
 

Friends

void swap (static_c_string &x, static_c_string &y) noexcept
 
comparison
constexpr friend bool operator== (static_c_string x, static_c_string y) noexcept
 
constexpr friend bool operator!= (static_c_string x, static_c_string y) noexcept
 

Detailed Description

Definition at line 253 of file static_string.hpp.

Member Typedef Documentation

◆ const_iterator

Definition at line 263 of file static_string.hpp.

◆ const_pointer

Definition at line 260 of file static_string.hpp.

◆ const_reference

Definition at line 262 of file static_string.hpp.

◆ const_reverse_iterator

Definition at line 265 of file static_string.hpp.

◆ difference_type

using ein::static_c_string::difference_type = std::ptrdiff_t

Definition at line 268 of file static_string.hpp.

◆ iterator

◆ pointer

Definition at line 259 of file static_string.hpp.

◆ reference

Definition at line 261 of file static_string.hpp.

◆ reverse_iterator

◆ size_type

using ein::static_c_string::size_type = std::size_t

Definition at line 267 of file static_string.hpp.

◆ traits_type

using ein::static_c_string::traits_type = std::char_traits<char>

Definition at line 257 of file static_string.hpp.

◆ value_type

Definition at line 258 of file static_string.hpp.

Constructor & Destructor Documentation

◆ static_c_string() [1/4]

ein::static_c_string::static_c_string ( )
constexprdefaultnoexcept[[always_inline]]

◆ static_c_string() [2/4]

ein::static_c_string::static_c_string ( static_c_string const & )
constexprdefaultnoexcept[[always_inline]]

◆ static_c_string() [3/4]

ein::static_c_string::static_c_string ( static_c_string && )
constexprdefaultnoexcept[[always_inline]]

◆ static_c_string() [4/4]

ein::static_c_string::static_c_string ( static_string x)
inlineconstexprnoexcept[[always_inline]]

Definition at line 283 of file static_string.hpp.

283: p(x.data()) {}

Member Function Documentation

◆ begin()

auto ein::static_c_string::begin ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[const]][[artificial]]

O(1)

Definition at line 324 of file static_string.hpp.

324{ return p; }

References p.

Referenced by crend(), and rend().

Here is the caller graph for this function:

◆ cbegin()

auto ein::static_c_string::cbegin ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[const]][[artificial]]

O(1)

Definition at line 331 of file static_string.hpp.

331{ return p; }

References p.

◆ cend()

auto ein::static_c_string::cend ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[pure]]

O(1)

Definition at line 335 of file static_string.hpp.

335{ return p + strlen(p); }

References p.

◆ crbegin()

auto ein::static_c_string::crbegin ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[pure]]

O(n)

Definition at line 347 of file static_string.hpp.

347{ return std::reverse_iterator<const char *>(end()); }
constexpr auto end() const noexcept

References end().

◆ crend()

auto ein::static_c_string::crend ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[pure]]

O(1)

Definition at line 351 of file static_string.hpp.

351{ return std::reverse_iterator<const char *>(begin()); }
constexpr auto begin() const noexcept
O(1)

References begin().

◆ data()

const char * ein::static_c_string::data ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[pure]][[artificial]]

Definition at line 306 of file static_string.hpp.

306{ return p; }

References p.

◆ end()

auto ein::static_c_string::end ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[pure]]

Definition at line 327 of file static_string.hpp.

327{ return p + strlen(p); }

References p.

Referenced by crbegin(), and rbegin().

Here is the caller graph for this function:

◆ operator const char *()

ein::static_c_string::operator const char * ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[pure]][[artificial]]

Definition at line 300 of file static_string.hpp.

300{ return p; }

References p.

◆ operator static_string()

ein::static_c_string::operator static_string ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[pure]][[artificial]]

Definition at line 303 of file static_string.hpp.

303{ return string_view(p); }

References p.

◆ operator=() [1/2]

ein_reinitializes constexpr static_c_string & ein::static_c_string::operator= ( static_c_string && )
constexprdefaultnoexcept[[always_inline]]

◆ operator=() [2/2]

ein_reinitializes constexpr static_c_string & ein::static_c_string::operator= ( static_c_string const & )
constexprdefaultnoexcept[[always_inline]]

◆ rbegin()

auto ein::static_c_string::rbegin ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[pure]]

O(n)

Definition at line 339 of file static_string.hpp.

339{ return std::reverse_iterator<const char *>(end()); }

References end().

◆ rend()

auto ein::static_c_string::rend ( ) const
inlineconstexprnoexcept[[nodiscard]][[always_inline]][[pure]]

O(1)

Definition at line 343 of file static_string.hpp.

343{ return std::reverse_iterator<const char *>(begin()); }

References begin().

Friends And Related Symbol Documentation

◆ operator!=

friend bool operator!= ( static_c_string x,
static_c_string y )
friend[[nodiscard]][[always_inline]][[pure]][[artificial]]

Definition at line 316 of file static_string.hpp.

316{ return x.p != y.p; }

◆ operator==

friend bool operator== ( static_c_string x,
static_c_string y )
friend[[nodiscard]][[always_inline]][[pure]][[artificial]]

Definition at line 313 of file static_string.hpp.

313{ return x.p == y.p; }

◆ swap

void swap ( static_c_string & x,
static_c_string & y )
friend[[always_inline]]

Definition at line 356 of file static_string.hpp.

356 {
357 using std::swap;
358 swap(x.p,y.p);
359 }
friend void swap(static_c_string &x, static_c_string &y) noexcept

Member Data Documentation

◆ p

const char* ein::static_c_string::p
private

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