core.stdcpp.string

D header file for interaction with C++ std::string.

Constructors 8

this(const(T)[] str, ref const(allocator_type) al)
this(const(T)[] str)
this(const ref basic_string str)
this(const(T)[] str, ref const(allocator_type) al)
this(const(T)[] str)
this(const(T)[] str, ref const(allocator_type) al)
this(const(T)[] str)

Destructors 3

~this()
~this()
~this()

Types 16

structchar_traits(CharT)

Character traits classes specify character properties and provide specific semantics for certain operations on characters and sequences of characters.

Methods
size_t length(const(char_type) * s) @trusted pure nothrow @nogc
char_type * move(char_type * s1, const char_type * s2, size_t n) @trusted pure nothrow @nogc
structbasic_string(T, Traits = char_traits!T, Alloc = allocator!T)

D language counterpart to C++ std::basic_string.

C++ reference: https://en.cppreference.com/w/cpp/string/basic_string

Fields
size_type npos
Methods
bool empty() const nothrow @trusted
size_t[2] opSlice(size_t dim : 0)(size_t start, size_t end) const pure nothrow @safe @nogc
inout(T) opIndex(size_t index) ref inout pure nothrow @safe @nogc
inout(T)[] opIndex(size_t[2] slice) inout pure nothrow @safe @nogc
inout(T)[] opIndex() inout pure nothrow @safe @nogc
bool opEquals(scope const ref basic_string s) const pure nothrow @safeTwo `basic_string`s are equal if they represent the same sequence of code units.
bool opEquals(scope const T[] s) const pure nothrow @safeditto
int opCmp(scope const ref basic_string rhs) const pure nothrow @safePerforms lexicographical comparison.
int opCmp(scope const T[] rhs) const pure nothrow @safeditto
size_t toHash() const @nogc nothrow pure @safeHash to allow `basicstring`s to be used as keys for built-in associative arrays. *The result will generally not be the same as C++ `std::hash<std::basicstring<T>>`.*
void clear()
void resize(size_type n, T c = T(0)) @trusted
inout(T) front() ref inout nothrow @safe
inout(T) back() ref inout nothrow @safe
const(T) * c_str() const nothrow @safe
basic_string opAssign()(auto ref basic_string str) ref
basic_string opAssign(const(T)[] str) ref
basic_string opAssign(T c) ref
basic_string opIndexAssign(T c, size_t index) ref
basic_string opIndexAssign(T c, size_t[2] slice) ref
basic_string opIndexAssign(const(T)[] str, size_t[2] slice) ref
basic_string opIndexAssign(T c) ref
basic_string opIndexAssign(const(T)[] str) ref
basic_string opIndexOpAssign(string op)(T c, size_t index) ref
basic_string opIndexOpAssign(string op)(T c, size_t[2] slice) ref
basic_string opIndexOpAssign(string op)(const(T)[] str, size_t[2] slice) ref
basic_string opIndexOpAssign(string op)(T c) ref
basic_string opIndexOpAssign(string op)(const(T)[] str) ref
basic_string append(T c) ref
basic_string opOpAssign(string op : "~")(const(T)[] str) ref
basic_string opOpAssign(string op : "~")(T c) ref
basic_string insert(size_type pos, ref const(basic_string) str) ref
basic_string insert(size_type pos, ref const(basic_string) str, size_type subpos, size_type sublen) ref @trusted
basic_string insert(S : size_type)(S pos, const(T) * s) ref
basic_string insert(size_type pos, const(T)[] s) ref
basic_string erase(size_type pos = 0) ref
basic_string erase(size_type pos, size_type len) ref
basic_string replace()(size_type pos, size_type len, auto ref basic_string str) ref
basic_string replace()(size_type pos, size_type len, auto ref basic_string str, size_type subpos, size_type sublen = npos) ref
basic_string replace(size_type pos, size_type len, const(value_type)[] s) ref
basic_string replace(S : size_type)(S pos, size_type len, const(value_type) * s) ref
void push_back(T c) @trusted
void pop_back()
Constructors
this()MSVC allocates on default initialisation in debug, which can't be modelled by D `struct`
alias_Traits = traits_type
alias_Scary_val = _String_val!T
struct_Rep_base
Fields
size_type _M_length
size_type _M_capacity
_Atomic_word _M_refcount
struct_Rep
Fields
_Rep_base base
size_type _S_max_size
T _S_terminal
size_type[(_Rep_base.sizeof + T.sizeof + size_type.sizeof - 1) / size_type.sizeof] _S_empty_rep_storage
Methods
_Rep _S_empty_rep() ref nothrow @trusted
void _M_set_sharable() nothrow
void _M_set_length_and_sharable(size_type __n) nothrow
bool _M_is_leaked() const nothrow
bool _M_is_shared() const nothrow
T * _M_refdata() nothrow @trusted
T * _M_grab(ref allocator_type __alloc1, const ref allocator_type __alloc2)
_Rep * _S_create(size_type __capacity, size_type __old_capacity, ref Alloc __alloc)
void _M_dispose(ref Alloc __a)
void _M_destroy(ref Alloc __a)
T * _M_refcopy() nothrow @trusted
T * _M_clone(ref Alloc __alloc, size_type __res = 0)
alias_M_data = _M_p
union
Fields
T[_S_local_capacity + 1] _M_local_buf
size_type _M_allocated_capacity
alias_M_length = _M_string_length
alias_M_capacity = _M_allocated_capacity
alias_M_data = _M_p
alias__alloc_traits = allocator_traits!allocator_type
union__ulx
Fields
__long __lx
__short __lxx
struct__raw
Fields
size_type[__n_words] __words
struct__rep

Functions 132

fninout(T) at(size_type i) ref inout nothrow @trusted
fnbasic_string assign(const(T)[] str) ref
fnbasic_string assign(const ref basic_string str) ref
fnbasic_string append(const(T)[] str) ref
fnbasic_string append(size_type n, T c) ref
fnvoid reserve(size_type _Newcap = 0)
fnvoid shrink_to_fit()
fnbasic_string insert(size_type pos, const(T) * s, size_type n) ref
fnbasic_string insert(size_type pos, size_type n, T c) ref
fnbasic_string replace(size_type pos, size_type len, const(T) * s, size_type slen) ref
fnbasic_string replace(size_type _Off, size_type _N0, size_type _Count, T _Ch) ref
fnvoid swap(ref basic_string _Right)
fnvoid eos(size_type offset) nothrow
fninout(_Base.Alloc) _Getal() ref inout nothrow @safe
fninout(_Base.ValTy) _Get_data() ref inout nothrow @safe
fnvoid _Alloc_proxy() nothrow
fnvoid _AssignAllocator(ref const(allocator_type) al) nothrow
fnvoid _Become_small()
fnvoid _Tidy_init() nothrow
fnsize_type _Calculate_growth(size_type _Requested) const nothrow
fnbasic_string _Reallocate_for(_ArgTys...)(size_type _New_size, void function(pointer, size_type, _ArgTys) nothrow @nogc _Fn, _ArgTys _Args) ref
fnbasic_string _Reallocate_grow_by(_ArgTys...)(size_type _Size_increase, void function(pointer, const(T)[], _ArgTys) nothrow @nogc _Fn, _ArgTys _Args) ref
fnvoid _Swap_data(bool _memcpy : true)(ref basic_string _Right)
fnvoid _Swap_data(bool _memcpy : false)(ref basic_string _Right)
fnvoid _Swap_bx_large_with_small(ref _Scary_val _Starts_large, ref _Scary_val _Starts_small)
fninout(Alloc) get_allocator() ref inout
fnsize_type max_size() const nothrow @safe
fnsize_type size() const nothrow @safe
fnsize_type capacity() const nothrow
fninout(T) * data() inout @safe
fninout(T)[] as_array() inout nothrow @trusted
fninout(T) at(size_type i) ref inout nothrow
fnbasic_string assign(const(T)[] str) ref
fnbasic_string assign(const ref basic_string str) ref
fnbasic_string append(const(T)[] str) ref
fnbasic_string append(size_type __n, T __c) ref
fnvoid reserve(size_type __res = 0)
fnvoid shrink_to_fit() nothrow
fnbasic_string insert(size_type __pos, const(T) * __s, size_type __n) ref
fnbasic_string insert(size_type pos, size_type n, T c) ref
fnbasic_string replace(size_type __pos, size_type __n1, const(T) * __s, size_type __n2) ref
fnbasic_string replace(size_type pos, size_type n1, size_type n2, T c) ref
fnvoid swap(ref basic_string __s)
fnvoid eos(size_type offset)
fninout(allocator_type) _M_get_allocator() ref inout
fn_Rep * _M_rep() const nothrow @trusted
fnsize_type _M_limit(size_type __pos, size_type __off) const @safe nothrow @nogc pure
fnsize_type _M_check(size_type __pos, const char * __s) const
fn_Rep _S_empty_rep() ref nothrow
fnT * _S_construct(const(T) * __beg, const(T) * __end, ref Alloc __a)
fnbasic_string _M_replace_safe(size_type __pos1, size_type __n1, const(T) * __s, size_type __n2) ref
fnbasic_string _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, T __c) ref
fnvoid _M_mutate(size_type __pos, size_type __len1, size_type __len2)
fninout(Alloc) get_allocator() ref inout
fnsize_type max_size() const nothrow @safe
fnsize_type size() const nothrow @safe
fnsize_type capacity() const nothrow
fninout(T) * data() inout @safe
fninout(T)[] as_array() inout nothrow @trusted
fninout(T) at(size_type i) ref inout nothrow
fnbasic_string assign(const(T)[] str) ref
fnbasic_string assign(const ref basic_string str) ref
fnbasic_string append(const(T)[] str) ref
fnbasic_string append(size_type n, T c) ref
fnvoid reserve(size_type __res = 0)
fnvoid shrink_to_fit() nothrow
fnbasic_string insert(size_type pos, const(T) * s, size_type n) ref
fnbasic_string insert(size_type pos, size_type n, T c) ref
fnbasic_string replace(size_type pos, size_type n1, const(T) * s, size_type n2) ref
fnbasic_string replace(size_type pos, size_type n1, size_type n2, T c) ref
fnvoid swap(ref basic_string __s)
fnvoid eos(size_type offset) nothrow
fninout(pointer) _M_local_data() inout
fnbool _M_is_local() const
fninout(allocator_type) _M_get_allocator() ref inout
fnvoid _M_set_length(size_type __n)
fnsize_type _M_check(size_type __pos, const char * __s) const
fnsize_type _M_limit(size_type __pos, size_type __off) const nothrow pure @nogc @safe
fnvoid __alloc_on_swap()(ref allocator_type __a) if (!is_empty!allocator_type.value)
fnvoid __alloc_on_swap()(ref allocator_type __a) if (is_empty!allocator_type.value)
fnvoid _M_construct(const(T) * __beg, size_type __dnew)
fnpointer _M_create(ref size_type __capacity, size_type __old_capacity)
fnbasic_string _M_replace(size_type __pos, size_type __len1, const(T) * __s, const size_type __len2) ref
fnbasic_string _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, T __c) ref
fnbasic_string _M_append(const(T) * __s, size_type __n) ref
fnvoid _M_mutate(size_type __pos, size_type __len1, const(T) * __s, size_type __len2)
fnvoid _M_dispose()
fnvoid _M_destroy(size_type __size)
fnvoid _M_check_length(size_type __n1, size_type __n2, const char * __s) const
fnvoid _M_assign_allocator(ref const(allocator_type) al) nothrow
fnbool _M_disjunct(const(T) * __s) const nothrow
fnvoid _S_move(T * __d, const(T) * __s, size_type __n)
fnvoid _S_copy(T * __d, const(T) * __s, size_type __n)
fninout(Alloc) get_allocator() ref inout
fnsize_type max_size() const nothrow @safe
fnsize_type size() const nothrow
fnsize_type capacity() const nothrow
fninout(T) * data() inout @trusted
fninout(T) at(size_type i) ref inout nothrow @trusted
fnbasic_string assign(const(T)[] str) ref
fnbasic_string assign(const ref basic_string str) ref
fnbasic_string append(const(T)[] str) ref
fnbasic_string append(size_type __n, value_type __c) ref
fnvoid reserve(size_type __res_arg = 0)
fnvoid shrink_to_fit()
fnbasic_string insert(size_type __pos, const(value_type) * __s, size_type __n) ref
fnbasic_string insert(size_type pos, size_type n, value_type c) ref
fnbasic_string replace(size_type __pos, size_type __n1, const(T) * __s, size_type __n2) ref
fnbasic_string replace(size_type __pos, size_type __n1, size_type __n2, value_type __c) ref
fnvoid swap(ref basic_string __str)
fnvoid eos(size_type offset) nothrow
fnvoid __set_long_size(size_type __s) nothrow
fnsize_type __get_long_size() const nothrow @trusted
fnvoid __set_size(size_type __s) nothrow
fnvoid __set_long_cap(size_type __s) nothrow
fnsize_type __get_long_cap() const nothrow
fnvoid __set_long_pointer(pointer __p) nothrow
fninout(T) * __get_long_pointer() inout nothrow
fninout(T) * __get_short_pointer() inout nothrow @safe
fninout(T) * __get_pointer() inout nothrow
fnbool __is_long() const nothrow @safe
fnvoid __zero() nothrow @safe
fninout(allocator_type) __alloc() ref inout nothrow @safe
fnvoid __init(const(value_type) * __s, size_type __sz)
fnvoid __assign_allocator(ref const(allocator_type) al) nothrow
fnvoid __init(const(value_type) * __s, size_type __sz, size_type __reserve)
fnsize_type __recommend(size_type __s) nothrow @safe
fnvoid __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz, size_type __n_copy, size_type __n_del, size_type __n_add, const(value_type) * __p_new_stuff)
fnvoid __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz, size_type __n_copy, size_type __n_del, size_type __n_add = 0)
fnT max(T)(auto ref T a, auto ref T b) ref
fnT min(T)(auto ref T a, auto ref T b) ref

Variables 12

enumvarDefault = DefaultConstruct()

Constructor argument for default construction

enumvar_Can_memcpy_val = is(_Traits == char_traits!E, E) && is(pointer == U *, U)
enumvar_Memcpy_val_offset = _Size_after_ebco_v!_Container_base
enumvar_Memcpy_val_size = _Scary_val.sizeof - _Memcpy_val_offset
var_String_alloc!(_String_base_types!(T, Alloc)) _Base
varT * _M_p
varpointer _M_p
varsize_type _M_string_length
enumvar_S_local_capacity = 15 / T.sizeof
enumvar__alignment = 16
enumvar__n_words = __ulx.sizeof / size_type.sizeof
var__compressed_pair!(__rep, allocator_type) __r_