Espaços nominais
Variantes
Acções

std::forward_list::assign

Da cppreference.com

 
 
 
std::forward_list
Funções de membro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::forward_list
forward_list::~forward_list
forward_list::operator=
forward_list::assign
forward_list::get_allocator
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.
forward_list::front
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.
forward_list::before_begin
forward_list::cbefore_begin
forward_list::begin
forward_list::cbegin
forward_list::end
forward_list::cend
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.
forward_list::empty
forward_list::max_size
Modificadores
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::clear
forward_list::insert_after
forward_list::emplace_after
forward_list::erase_after
forward_list::push_front
forward_list::emplace_front
forward_list::pop_front
forward_list::resize
forward_list::swap
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.
forward_list::merge
forward_list::splice_after
forward_list::remove
forward_list::remove_if
forward_list::reverse
forward_list::unique
forward_list::sort
 
void assign( size_type count, const T& value );
(1) (a partir do C++ 11)
template< class InputIt >
void assign( InputIt first, InputIt last );
(2) (a partir do C++ 11)
Substitui o conteúdo do recipiente.
Original:
Replaces the contents of the container.
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 cópias count de value valor
Original:
replaces the contents with count copies of value value
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 cópias das pessoas na faixa de [first, last)
Original:
replaces the contents with copies of those in the range [first, last)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Parâmetros

count -
o novo tamanho do recipiente
Original:
the new size of the container
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
value -
o valor para inicializar os elementos do recipiente com
Original:
the value to initialize elements of the container with
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
first, last -
o intervalo para copiar os elementos de
Original:
the range to copy the elements from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Type requirements
-
InputIt must meet the requirements of InputIterator.

[editar] Complexidade

1)
linear em count
Original:
linear in count
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
linear da distância entre first e last
Original:
linear in distance between first and last
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exemplo

O código a seguir usa assign para adicionar vários personagens para um std::forward_list<char>:
Original:
The following code uses assign to add several characters to a std::forward_list<char>:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <forward_list>
#include <iostream>
 
int main()
{
    std::forward_list<char> characters;
 
    characters.assign(5, 'a');
 
    for (char c : characters) {
        std::cout << c << '\n';
    } 
 
    return 0;
}

Output:

a
a
a
a
a

[editar] Veja também

constrói o forward_list
Original:
constructs the forward_list
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]