◐ Shell
clean mode source ↗

std::basic_string::operator= - cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

basic_string& operator=( const basic_string& str );

(1)

basic_string& operator=( basic_string&& str );

(2) (desde C++11)

basic_string& operator=( const CharT* s );

(3)

basic_string& operator=( CharT ch );

(4)

basic_string& operator=( std::initializer_list<CharT> ilist );

(5) (desde C++11)

Substitui o conteúdo da string.

Original:

Replaces the contents 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.

1)

Substitui o conteúdo com uma cópia do str

Original:

Replaces the contents with a copy of str

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

2)

Substitui o conteúdo com os de str usando a semântica de movimento. str está em estado indefinido após a operação.

Original:

Replaces the contents with those of str using move semantics. str is in undefined state after the operation.

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

3)

Substitui o conteúdo com os de terminação nula cadeia de caracteres apontada por s.

Original:

Replaces the contents with those of null-terminated character string pointed to by s.

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

4)

Substitui o conteúdo com ch personagem

Original:

Replaces the contents with character ch

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

8)

Substitui o conteúdo com os da lista de inicializador ilist.

Original:

Replaces the contents with those of the initializer list ilist.

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

Parâmetros

ch -

valor para inicializar caracteres da string com

Original:

value to initialize characters of the string with

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

str -

cadeia a ser utilizado como fonte para iniciar a sequência com

Original:

string to be used as source to initialize the string with

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

s -

ponteiro para um personagem utilização cadeia nula-termanated
to como fonte para inicializar a string com

Original:

pointer to a null-termanated character string
to use as source to initialize the string with

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

init -

inicializador lista para inicializar a string com

Original:

initializer list to initialize the string with

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

Valor de retorno

*this

Complexidade

1)

linear no tamanho de str

Original:

linear in size of str

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

2)

constante. Se alloc é dado e alloc != other.get_allocator(), em seguida, linear.

Original:

constant. If alloc is given and alloc != other.get_allocator(), then linear.

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

3)

linear no tamanho de s

Original:

linear in size of s

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

4)

constante.

Original:

constant.

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

5)

linear no tamanho de init

Original:

linear in size of init

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

Exemplo

Veja também

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]

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]