basic_string

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

C++ reference:

extern (C++) @nogc
struct basic_string (
T
Traits = char_traits!T
Alloc = allocator!T
) {}

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, const(allocator_type) al)
this
this(DefaultConstruct )
this
this(const(T)[] str, const(allocator_type) al)
this
this(const(T)[] str)
this
this(basic_string str)
this
this(DefaultConstruct )
this
this(const(T)[] str, const(allocator_type) al)
this
this(const(T)[] str)
this
this(DefaultConstruct )
this
this(const(T)[] str, 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(size_type n, T c)
append
basic_string append(const(T)[] str)
append
basic_string append(size_type __n, T __c)
append
basic_string append(const(T)[] str)
append
basic_string append(size_type n, T c)
append
basic_string append(const(T)[] str)
append
basic_string append(size_type __n, value_type __c)
as_array
inout(T)[] as_array()
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(basic_string str)
assign
basic_string assign(const(T)[] str)
assign
basic_string assign(basic_string str)
assign
basic_string assign(const(T)[] str)
assign
basic_string assign(basic_string str)
assign
basic_string assign(const(T)[] str)
assign
basic_string assign(basic_string str)
at
inout(T) at(size_type i)
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()
capacity
size_type capacity()
clear
void clear()
data
inout(T)* data()
data
inout(T)* data()
data
inout(T)* data()
data
inout(T)* data()
empty
bool empty()
erase
basic_string erase(size_type pos)
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()
get_allocator
inout(Alloc) get_allocator()
insert
basic_string insert(size_type pos, const(basic_string) str)
insert
basic_string insert(size_type pos, const(basic_string) str, size_type subpos, size_type sublen)
insert
basic_string insert(S pos, const(T)* s)
insert
basic_string insert(size_type pos, const(T)[] s)
insert
basic_string insert(size_type pos, const(T)* s, size_type n)
insert
basic_string insert(size_type pos, size_type n, T c)
insert
basic_string insert(size_type __pos, const(T)* __s, size_type __n)
insert
basic_string insert(size_type pos, size_type n, T c)
insert
basic_string insert(size_type pos, const(T)* s, size_type n)
insert
basic_string insert(size_type pos, size_type n, T c)
insert
basic_string insert(size_type __pos, const(value_type)* __s, size_type __n)
insert
basic_string insert(size_type pos, size_type n, value_type c)
max_size
size_type max_size()
max_size
size_type max_size()
max_size
size_type max_size()
max_size
size_type max_size()
opAssign
basic_string opAssign(basic_string str)
opAssign
basic_string opAssign(const(T)[] str)
opAssign
basic_string opAssign(T c)
opCmp
int opCmp(basic_string rhs)
int opCmp(T[] rhs)

Performs lexicographical comparison.

opEquals
bool opEquals(basic_string s)
bool opEquals(T[] s)

Two basic_strings are equal if they represent the same sequence of code units.

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)
replace
basic_string replace(size_type pos, size_type len, basic_string str)
replace
basic_string replace(size_type pos, size_type len, basic_string str, size_type subpos, size_type sublen)
replace
basic_string replace(size_type pos, size_type len, const(value_type)[] s)
replace
basic_string replace(S pos, size_type len, const(value_type)* s)
replace
basic_string replace(size_type pos, size_type len, const(T)* s, size_type slen)
replace
basic_string replace(size_type _Off, size_type _N0, size_type _Count, T _Ch)
replace
basic_string replace(size_type __pos, size_type __n1, const(T)* __s, size_type __n2)
replace
basic_string replace(size_type pos, size_type n1, size_type n2, T c)
replace
basic_string replace(size_type pos, size_type n1, const(T)* s, size_type n2)
replace
basic_string replace(size_type pos, size_type n1, size_type n2, T c)
replace
basic_string replace(size_type __pos, size_type __n1, const(T)* __s, size_type __n2)
replace
basic_string replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
reserve
void reserve(size_type _Newcap)
reserve
void reserve(size_type __res)
reserve
void reserve(size_type __res)
reserve
void reserve(size_type __res_arg)
resize
void resize(size_type n, T c)
shrink_to_fit
void shrink_to_fit()
shrink_to_fit
void shrink_to_fit()
shrink_to_fit
void shrink_to_fit()
shrink_to_fit
void shrink_to_fit()
size
size_type size()
size
size_type size()
size
size_type size()
size
size_type size()
swap
void swap(basic_string _Right)
swap
void swap(basic_string __s)
swap
void swap(basic_string __s)
swap
void swap(basic_string __str)
toHash
size_t toHash()

Hash to allow basic_strings 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>>.**

Variables

npos
enum size_type npos;

Meta