Espacios de nombres
Variantes
Acciones

std::list::assign

De cppreference.com
< cpp‎ | container‎ | list

 
 
 
std::list
Las funciones miembro
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.
list::list
list::~list
list::operator=
list::assign
list::get_allocator
Elemento acceso
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.
list::front
list::back
Los 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.
list::begin
list::cbegin

(C++11)
list::end
list::cend

(C++11)
list::rbegin
list::crbegin

(C++11)
list::rend
list::crend

(C++11)
Capacidad
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::empty
list::size
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.
list::clear
list::insert
list::emplace(C++11)
list::erase
list::push_front
list::emplace_front(C++11)
list::pop_front
list::push_back
list::emplace_back(C++11)
list::pop_back
list::resize
list::swap
Operaciones
Original:
Operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
list::merge
list::splice
list::remove
list::remove_if
list::reverse
list::unique
list::sort
 
void assign( size_type count, const T& value );
(1)
template< class InputIt >
void assign( InputIt first, InputIt last );
(2)
Reemplaza el contenido del 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)
sustituye el contenido con las copias de count 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)
sustituye el contenido con las copias de los de la [first, last) rango
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.

Contenido

[editar] Parámetros

count -
el nuevo tamaño del 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 -
el valor para inicializar elementos del recipiente con
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 -
el rango a copiar los 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] Complejidad

1)
lineal en 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)
lineal en distancia entre first y 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] Ejemplo

El código siguiente utiliza assign añadir varios personajes a un std::list<char>:
Original:
The following code uses assign to add several characters to a std::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 <list>
#include <iostream>
 
int main()
{
    std::list<char> characters;
 
    characters.assign(5, 'a');
 
    for (char c : characters) {
        std::cout << c << '\n';
    } 
 
    return 0;
}

Output:

a
a
a
a
a

[editar] Ver también

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

(miembro público función) [edit]