basic_string

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

C++ reference:

@nogc extern (C++) extern (C++)
struct basic_string (
T
Traits = char_traits!T
Alloc = allocator!T
) {
allocator_type _M_Alloc;
allocator_type _M_Alloc;
version(BigEndian)
enum size_type __short_mask;
version(BigEndian)
enum size_type __long_mask;
version(!BigEndian)
enum size_type __short_mask;
version(!BigEndian)
enum size_type __long_mask;
version(_LIBCPP_ABI_ALTERNATE_STRING_LAYOUT)
enum size_type __min_cap;
version(BigEndian)
enum size_type __short_mask;
version(BigEndian)
enum size_type __long_mask;
version(!BigEndian)
enum size_type __short_mask;
version(!BigEndian)
enum size_type __long_mask;
version(!_LIBCPP_ABI_ALTERNATE_STRING_LAYOUT)
enum size_type __min_cap;
}

Constructors

this
this()

MSVC allocates on default initialisation in debug, which can't be modelled by D struct

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

Destructor

~this
~this()

Postblit

this(this)
this(this)

Members

Aliases

allocator_type
alias allocator_type = Alloc
const_pointer
alias const_pointer = const(value_type)*
difference_type
alias difference_type = ptrdiff_t
length
alias length = size
opDollar
alias opDollar = length
pointer
alias pointer = value_type*
size_type
alias size_type = size_t
toString
alias toString = as_array
traits_type
alias traits_type = Traits
value_type
alias value_type = T

Functions

append
basic_string append(T c)
append
basic_string append(const(T)[] str)
append
basic_string append(const(T)[] str)
append
basic_string append(const(T)[] str)
as_array
inout(T)[] as_array()
as_array
inout(T)[] as_array()
as_array
inout(T)[] as_array()
assign
basic_string assign(const(T)[] str)
assign
basic_string assign(const(T)[] str)
assign
basic_string assign(const(T)[] str)
at
inout(T) at(size_type i)
at
inout(T) at(size_type i)
at
inout(T) at(size_type i)
back
inout(T) back()
c_str
const(T)* c_str()
capacity
size_type capacity()
capacity
size_type capacity()
capacity
size_type capacity()
clear
void clear()
data
inout(T)* data()
data
inout(T)* data()
data
inout(T)* data()
empty
bool empty()
erase
basic_string erase(size_type pos = 0)
erase
basic_string erase(size_type pos, size_type len)
front
inout(T) front()
get_allocator
inout(Alloc) get_allocator()
get_allocator
inout(Alloc) get_allocator()
get_allocator
inout(Alloc) get_allocator()
max_size
size_type max_size()
max_size
size_type max_size()
max_size
size_type max_size()
opAssign
basic_string opAssign(auto ref basic_string str)
opAssign
basic_string opAssign(const(T)[] str)
opAssign
basic_string opAssign(T c)
opIndex
inout(T) opIndex(size_t index)
opIndex
inout(T)[] opIndex(size_t[2] slice)
opIndex
inout(T)[] opIndex()
opIndexAssign
basic_string opIndexAssign(T c, size_t index)
opIndexAssign
basic_string opIndexAssign(T c, size_t[2] slice)
opIndexAssign
basic_string opIndexAssign(const(T)[] str, size_t[2] slice)
opIndexAssign
basic_string opIndexAssign(T c)
opIndexAssign
basic_string opIndexAssign(const(T)[] str)
opIndexOpAssign
basic_string opIndexOpAssign(T c, size_t index)
opIndexOpAssign
basic_string opIndexOpAssign(T c, size_t[2] slice)
opIndexOpAssign
basic_string opIndexOpAssign(const(T)[] str, size_t[2] slice)
opIndexOpAssign
basic_string opIndexOpAssign(T c)
opIndexOpAssign
basic_string opIndexOpAssign(const(T)[] str)
opOpAssign
basic_string opOpAssign(const(T)[] str)
opOpAssign
basic_string opOpAssign(T c)
opSlice
size_t[2] opSlice(size_t start, size_t end)
pop_back
void pop_back()
push_back
void push_back(T c)
resize
void resize(size_type n, T c = T(0))
size
size_type size()
size
size_type size()
size
size_type size()

Variables

npos
enum size_type npos;
Suggestion Box / Bug Report