Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
std::stdexcept_detail::simple_string Class Reference

A simple string class that manages a static storage size C-style string. More...

Public Member Functions

 simple_string (arene::base::detail::raw_c_string const str) noexcept
 Construct a new simple string object.
 
 simple_string (simple_string &&other) noexcept=default
 move ctor
 
 simple_string (simple_string const &other) noexcept=default
 copy ctor
 
 ~simple_string () noexcept=default
 dtor
 
auto c_str () const noexcept -> arene::base::detail::raw_c_string
 Returns a pointer to the internal C-style string.
 
auto operator= (simple_string &&other) noexcept -> simple_string &=default
 move assignment
 
auto operator= (simple_string const &other) noexcept -> simple_string &=default
 copy assignment
 

Detailed Description

A simple string class that manages a static storage size C-style string.

Warning
This class is intended only for the narrow usecase of being used inside an exception type, where it is guaranteed there will always be some message to store. It does not handle construction from nullptr.

Constructor & Destructor Documentation

◆ simple_string() [1/3]

std::stdexcept_detail::simple_string::simple_string ( arene::base::detail::raw_c_string const str)
inlineexplicitnoexcept

Construct a new simple string object.

Parameters
strThe data to initialize the string with. It will be copied into this string.
Postcondition
c_str() will return a cstring for which strcmp(c_str(),str)==0 .

◆ ~simple_string()

std::stdexcept_detail::simple_string::~simple_string ( )
defaultnoexcept

dtor

◆ simple_string() [2/3]

std::stdexcept_detail::simple_string::simple_string ( simple_string const & other)
defaultnoexcept

copy ctor

Parameters
otherThe other string to copy from
Postcondition
c_str() will return a cstring for which strcmp(c_str(),other.c_str())==0 .

◆ simple_string() [3/3]

std::stdexcept_detail::simple_string::simple_string ( simple_string && other)
defaultnoexcept

move ctor

Parameters
otherThe other string to move from
Postcondition
c_str() will return a cstring for which strcmp(c_str(),other.c_str())==0 with other 's state before move. other 's state post-move is unspecified.

Member Function Documentation

◆ c_str()

auto std::stdexcept_detail::simple_string::c_str ( ) const -> arene::base::detail::raw_c_string
inlinenoexcept

Returns a pointer to the internal C-style string.

Returns
arene::base::detail::raw_c_string A pointer to the internal C-style string.

◆ operator=() [1/2]

auto std::stdexcept_detail::simple_string::operator= ( simple_string && other) -> simple_string &=default
defaultnoexcept

move assignment

Parameters
otherThe other string to move from
Returns
simple_string& *this post assignment
Postcondition
c_str() will return a cstring for which strcmp(c_str(),other.c_str())==0 with other 's state before move. other 's state post-move is unspecified.

◆ operator=() [2/2]

auto std::stdexcept_detail::simple_string::operator= ( simple_string const & other) -> simple_string &=default
defaultnoexcept

copy assignment

Parameters
otherThe other string to copy from
Returns
simple_string& *this post assignment
Postcondition
c_str() will return a cstring for which strcmp(c_str(),other.c_str())==0 .

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