core.stdcpp.string

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

Constructors 8

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

Destructors 3

~this() @nogc
~this() @nogc
~this() @nogc

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) static @trusted pure nothrow @nogc
char_type * move(char_type * s1, const char_type * s2, size_t n) static @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() extern(D) @nogc const nothrow @trusted
size_t[2] opSlice(size_t dim : 0)(size_t start, size_t end) extern(D) @nogc const pure nothrow @safe
inout(T) opIndex(size_t index) ref extern(D) @nogc inout pure nothrow @safe
inout(T)[] opIndex(size_t[2] slice) extern(D) @nogc inout pure nothrow @safe
inout(T)[] opIndex() extern(D) @nogc inout pure nothrow @safe
bool opEquals(scope const ref basic_string s) extern(D) @nogc const pure nothrow @safeTwo `basic_string`s are equal if they represent the same sequence of code units.
bool opEquals(scope const T[] s) extern(D) @nogc const pure nothrow @safeditto
int opCmp(scope const ref basic_string rhs) extern(D) @nogc const pure nothrow @safePerforms lexicographical comparison.
int opCmp(scope const T[] rhs) extern(D) @nogc const pure nothrow @safeditto
size_t toHash() extern(D) @nogc const nothrow pure @safeHash to allow `basic_string`s to be used as keys for built-in associative arrays. *The result will generally not be the same as C++ `std::hash<std::basic_string<T>>`.*
void clear() extern(D) @nogc
void resize(size_type n, T c = T(0)) extern(D) @nogc @trusted
inout(T) front() ref extern(D) @nogc inout nothrow @safe
inout(T) back() ref extern(D) @nogc inout nothrow @safe
const(T) * c_str() extern(D) @nogc const nothrow @safe
basic_string opAssign()(auto ref basic_string str) ref extern(D) @nogc
basic_string opAssign(const(T)[] str) ref extern(D) @nogc
basic_string opAssign(T c) ref extern(D) @nogc
basic_string opIndexAssign(T c, size_t index) ref extern(D) @nogc
basic_string opIndexAssign(T c, size_t[2] slice) ref extern(D) @nogc
basic_string opIndexAssign(const(T)[] str, size_t[2] slice) ref extern(D) @nogc
basic_string opIndexAssign(T c) ref extern(D) @nogc
basic_string opIndexAssign(const(T)[] str) ref extern(D) @nogc
basic_string opIndexOpAssign(string op)(T c, size_t index) ref extern(D) @nogc
basic_string opIndexOpAssign(string op)(T c, size_t[2] slice) ref extern(D) @nogc
basic_string opIndexOpAssign(string op)(const(T)[] str, size_t[2] slice) ref extern(D) @nogc
basic_string opIndexOpAssign(string op)(T c) ref extern(D) @nogc
basic_string opIndexOpAssign(string op)(const(T)[] str) ref extern(D) @nogc
basic_string append(T c) ref extern(D) @nogc
basic_string opOpAssign(string op : "~")(const(T)[] str) ref extern(D) @nogc
basic_string opOpAssign(string op : "~")(T c) ref extern(D) @nogc
basic_string insert(size_type pos, ref const(basic_string) str) ref extern(D) @nogc
basic_string insert(size_type pos, ref const(basic_string) str, size_type subpos, size_type sublen) ref extern(D) @nogc @trusted
basic_string insert(S : size_type)(S pos, const(T) * s) ref extern(D) @nogc
basic_string insert(size_type pos, const(T)[] s) ref extern(D) @nogc
basic_string erase(size_type pos = 0) ref extern(D) @nogc
basic_string erase(size_type pos, size_type len) ref extern(D) @nogc
basic_string replace()(size_type pos, size_type len, auto ref basic_string str) ref extern(D) @nogc
basic_string replace()(size_type pos, size_type len, auto ref basic_string str, size_type subpos, size_type sublen = npos) ref extern(D) @nogc
basic_string replace(size_type pos, size_type len, const(value_type)[] s) ref extern(D) @nogc
basic_string replace(S : size_type)(S pos, size_type len, const(value_type) * s) ref extern(D) @nogc
void push_back(T c) extern(D) @nogc @trusted
void pop_back() extern(D) @nogc
Constructors
this()MSVC allocates on default initialisation in debug, which can't be modelled by D `struct`
private alias_Traits = traits_type
private alias_Scary_val = _String_val!T
private struct_Rep_base
Fields
size_type _M_length
size_type _M_capacity
_Atomic_word _M_refcount
private 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() static 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) static
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)
private alias_M_data = _M_p
private union
Fields
T[_S_local_capacity + 1] _M_local_buf
size_type _M_allocated_capacity
private alias_M_length = _M_string_length
private alias_M_capacity = _M_allocated_capacity
private alias_M_data = _M_p
private alias__alloc_traits = allocator_traits!allocator_type
private union__ulx
Fields
__long __lx
__short __lxx
private struct__raw
Fields
size_type[__n_words] __words
private struct__rep

Functions 132

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

Variables 12

enumvarDefault = DefaultConstruct()

Constructor argument for default construction

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