◐ Shell
clean mode source ↗

std::basic_string - cppreference.com

<tbody> </tbody>

Definido no cabeçalho

<string>

template< class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT> > class basic_string;

O modelo de classe basic_string lojas e manipula seqüências de char-como objetos (ou seja, objetos para que uma especialização de std::char_traits ou classe traços compatível é fornecido).

Original:

The class template basic_string stores and manipulates sequences of char-like objects (that is, objects for which a specialization of std::char_traits or compatible traits class is provided).

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Os elementos de um basic_string são armazenados de forma contígua, ou seja, para um basic_string s, &*(s.begin() + n) == &*s.begin() + n para qualquer n em [0, s.size()), ou, de modo equivalente, um ponteiro para s[0] podem ser passados ​​para funções que esperam um ponteiro para o primeiro elemento de uma matriz charT[]. (desde C++11)

Original:

The elements of a basic_string are stored contiguously, that is, for a basic_string s, &*(s.begin() + n) == &*s.begin() + n for any n in [0, s.size()), or, equivalently, a pointer to s[0] can be passed to functions that expect a pointer to the first element of a charT[] array. (desde C++11)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Várias especializações para tipos de caracteres comuns são fornecidos:

Original:

Several specializations for common character types are provided:

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Defined in header <string>

Tipo

Original:

Type

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Definition
std::string std::basic_string<char>
std::wstring std::basic_string<wchar_t>
std::u16string std::basic_string<char16_t>
std::u32string std::basic_string<char32_t>

Tipos de membro

Tipo de membro

Original:

Member type

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Definition
traits_type Traits
value_type Traits::char_type
allocator_type Allocator [edit]
size_type

Tipo integral sem sinal (geralmente size_t)

Original:

Unsigned integral type (usually size_t)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[edit]
difference_type

tipo inteiro com sinal (geralmente

Original:

Signed integer type (usually

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

ptrdiff_t) [edit]
reference Allocator::reference (até C++11)
value_type& (desde C++11) [edit]
const_reference Allocator::const_reference (até C++11)
const value_type& (desde C++11) [edit]
pointer Allocator::pointer (até C++11)
std::allocator_traits<Allocator>::pointer (desde C++11) [edit]
const_pointer Allocator::const_pointer (até C++11)
std::allocator_traits<Allocator>::const_pointer (desde C++11) [edit]
iterator RandomAccessIterator [edit]
const_iterator

Iterador constante acesso aleatório

Original:

Constant random access iterator

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[edit]
reverse_iterator std::reverse_iterator<iterator> [edit]
const_reverse_iterator std::reverse_iterator<const_iterator> [edit]

Funções de membro

constrói um basic_string

Original:

constructs a basic_string

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

atribui valores para a cadeia

Original:

assigns values to the string

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

atribuir caracteres para uma string

Original:

assign characters to a string

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

retorna o alocador de associado

Original:

returns the associated allocator

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

acesso. Elemento

Original:

Element access

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

acesso de caracteres especificada com verificação de limites

Original:

access specified character with bounds checking

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

acesso de caracteres especificada

Original:

access specified character

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

(C++11)

acessa o primeiro caractere

Original:

accesses the first character

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

(C++11)

acessa o último caractere

Original:

accesses the last character

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

retorna um ponteiro para o primeiro caractere de uma string

Original:

returns a pointer to the first character of a string

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

retorna um não-modificáveis ​​padrão C versão matriz de caracteres da cadeia

Original:

returns a non-modifiable standard C character array version of the string

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

Iteradores

Original:

Iterators

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

retorna um iterador para o começo

Original:

returns an iterator to the beginning

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

(C++11)

retorna um iterador para o fim

Original:

returns an iterator to the end

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

retorna um iterador inverso ao início

Original:

returns a reverse iterator to the beginning

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

retorna um iterador inverso até ao fim

Original:

returns a reverse iterator to the end

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

Capacidade

Original:

Capacity

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

verifica se a string está vazia

Original:

checks whether the string is empty

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]
returns the number of characters
(função pública membro) [edit]

devolve o número máximo de caracteres

Original:

returns the maximum number of characters

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

As reservas de armazenagem

Original:

reserves storage

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

retorna o número de caracteres que podem ser mantidos em armazenamento atualmente alocado

Original:

returns the number of characters that can be held in currently allocated storage

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

reduz o uso de memória, liberando memória não utilizada

Original:

reduces memory usage by freeing unused memory

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

Operações

Original:

Operations

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

apaga o conteúdo

Original:

clears the contents

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

insere personagens

Original:

inserts characters

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]
removes characters
(função pública membro) [edit]

acrescenta um caráter até o fim

Original:

appends a character to the end

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

(C++11)

remove o último caractere

Original:

removes the last character

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

Acrescenta caracteres até o fim

Original:

appends characters to the end

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

Acrescenta caracteres até o fim

Original:

appends characters to the end

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

compara duas strings

Original:

compares two strings

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

substitui todas as ocorrências de caracteres especificados

Original:

replaces every occurrence of specified characters

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

retorna uma substring

Original:

returns a substring

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

cópias personagens

Original:

copies characters

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

altera o número de caracteres armazenados

Original:

changes the number of characters stored

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

Trocar o conteúdo

Original:

swaps the contents

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

Pesquisar

Original:

Search

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

encontrar caracteres na string

Original:

find characters in the string

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

encontrar a última ocorrência de uma substring

Original:

find the last occurrence of a substring

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

encontrar a primeira ocorrência de caracteres

Original:

find first occurrence of characters

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

encontrar primeira ausência de caracteres

Original:

find first absence of characters

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

encontrar última ocorrência de caracteres

Original:

find last occurrence of characters

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

encontrar ausência de última caracteres

Original:

find last absence of characters

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

Constantes

Original:

Constants

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[estática]

valor especial. O significado exato depende do contexto

Original:

special value. The exact meaning depends on the context

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(membro estático público constante) [edit]

Não-membros funções

concatena duas strings ou uma String e um char

Original:

concatenates two strings or a string and a char

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(modelo de função) [edit]

lexicographically compara duas strings

Original:

lexicographically compares two strings

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(modelo de função) [edit]

o algoritmo especializado std::swap

Original:

specializes the std::swap algorithm

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(modelo de função) [edit]

Entrada / saída

Original:

Input/output

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

executa fluxo de I / O em cordas

Original:

performs stream I/O on strings

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(modelo de função) [edit]

ler dados de um fluxo de I / O em uma string

Original:

read data from an I/O stream into a string

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função) [edit]

Conversões numéricas

Original:

Numeric conversions

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(C++11)
(C++11)
(C++11)

converte uma string para um inteiro assinado

Original:

converts a string to an signed integer

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função) [edit]

(C++11)
(C++11)

converte uma string para um inteiro sem sinal

Original:

converts a string to an unsigned integer

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função) [edit]

(C++11)
(C++11)
(C++11)

converte uma string para um valor de ponto flutuante

Original:

converts a string to an floating point value

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função) [edit]

(C++11)

converte um valor de ponto flutuante para integral ou string

Original:

converts an integral or floating point value to string

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função) [edit]

converte um valor de ponto flutuante para integral ou wstring

Original:

converts an integral or floating point value to wstring

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função) [edit]

Classes auxiliares