C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::basic_cow_string< class > Class Template Reference

A copy-on-write string implementation that wraps a std::basic_string. More...

#include <cow_string.hpp>

Inheritance diagram for caf::basic_cow_string< class >:
caf::detail::comparable< basic_cow_string< CharT > > caf::detail::comparable< basic_cow_string< CharT >, std::basic_string< CharT > > caf::detail::comparable< basic_cow_string< CharT >, const CharT * >

Public Types

using std_type = std::basic_string<CharT>
 
using view_type = std::basic_string_view<CharT>
 
using size_type = typename std_type::size_type
 
using const_iterator = typename std_type::const_iterator
 
using const_reverse_iterator = typename std_type::const_reverse_iterator
 

Public Member Functions

 basic_cow_string (std_type str)
 
 basic_cow_string (view_type str)
 
 basic_cow_string (basic_cow_string &&) noexcept=default
 
 basic_cow_string (const basic_cow_string &) noexcept=default
 
basic_cow_stringoperator= (basic_cow_string &&) noexcept=default
 
basic_cow_stringoperator= (const basic_cow_string &) noexcept=default
 
std_type & unshared ()
 Returns a mutable reference to the managed string.
 
const std_type & str () const noexcept
 Returns the managed string.
 
bool unique () const noexcept
 Returns whether the reference count of the managed object is 1.
 
size_t get_reference_count () const noexcept
 Queries the current reference count for this object.
 
bool empty () const noexcept
 
size_type size () const noexcept
 
size_type length () const noexcept
 
size_type max_size () const noexcept
 
CharT at (size_type pos) const
 
CharT operator[] (size_type pos) const
 
CharT front () const
 
CharT back () const
 
const CharT * data () const noexcept
 
const CharT * c_str () const noexcept
 
 operator view_type () const noexcept
 
basic_cow_string substr (size_type pos=0, size_type count=npos) const
 
size_type copy (CharT *dest, size_type count, size_type pos=0) const
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
const_reverse_iterator rbegin () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
const_reverse_iterator rend () const noexcept
 
const_reverse_iterator crend () const noexcept
 
bool starts_with (view_type x) const noexcept
 
bool starts_with (CharT x) const noexcept
 
bool starts_with (const CharT *x) const
 
bool ends_with (view_type x) const noexcept
 
bool ends_with (CharT x) const noexcept
 
bool ends_with (const CharT *x) const
 
bool contains (std::string_view x) const noexcept
 
bool contains (char x) const noexcept
 
bool contains (const CharT *x) const
 
size_type find (const std::string &str, size_type pos=0) const noexcept
 
size_type find (const basic_cow_string &str, size_type pos=0) const noexcept
 
size_type find (const CharT *str, size_type pos, size_type count) const
 
size_type find (const CharT *str, size_type pos=0) const
 
size_type find (char x, size_type pos=0) const noexcept
 
template<class T >
std::enable_if_t< std::is_convertible_v< const T &, view_type > &&!std::is_convertible_v< const T &, const CharT * >, size_type > find (const T &x, size_type pos=0) const noexcept
 
int compare (const CharT *x) const noexcept
 
int compare (const std_type &x) const noexcept
 
int compare (const cow_string &x) const noexcept
 

Static Public Attributes

static const size_type npos = std_type::npos
 

Friends

template<class Inspector >
bool inspect (Inspector &f, basic_cow_string &x)
 

Related Symbols

(Note that these are not member symbols.)

using cow_string = basic_cow_string<char>
 A copy-on-write wrapper for a std::string;.
 
using cow_u16string = basic_cow_string<char16_t>
 A copy-on-write wrapper for a std::string;.
 
using cow_u32string = basic_cow_string<char32_t>
 A copy-on-write wrapper for a std::string;.
 

Detailed Description

template<class>
class caf::basic_cow_string< class >

A copy-on-write string implementation that wraps a std::basic_string.

Member Function Documentation

◆ unshared()

template<class >
std_type & caf::basic_cow_string< class >::unshared ( )

Returns a mutable reference to the managed string.

Copies the string if more than one reference to it exists to make sure the reference count is exactly 1 when returning from this function.


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