Espacios de nombres
Variantes
Acciones

std::priority_queue::priority_queue

De cppreference.com

 
 
 
std :: priority_queue
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.
priority_queue::priority_queue
priority_queue::~priority_queue
priority_queue::operator=
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.
priority_queue::top
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.
priority_queue::empty
priority_queue::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.
priority_queue::push
priority_queue::emplace
priority_queue::pop
priority_queue::swap
 
explicit priority_queue( const Compare& compare = Compare(),

                         const Container& cont = Container());

priority_queue( const Compare& compare, const Container& cont);
(1) (hasta C++11)

(desde C++11)
explicit priority_queue( const Compare& compare = Compare(),
                         Container&& cont = Container());
(2) (desde C++11)
priority_queue( const priority_queue& other );
(3)
priority_queue( priority_queue&& other );
(4) (desde C++11)
template< class Alloc >
explicit priority_queue( const Alloc& alloc );
(5) (desde C++11)
template< class Alloc >
priority_queue( const Compare& compare, const Alloc& alloc );
(6) (desde C++11)
template< class Alloc >

priority_queue( const Compare& compare, const Container& cont,

                const Alloc& alloc );
(7) (desde C++11)
template< class Alloc >

priority_queue( const Compare& compare, Container&& cont,

                const Alloc& alloc );
(8) (desde C++11)
template< class Alloc >
priority_queue( const priority_queue& other, const Alloc& alloc );
(9) (desde C++11)
template< class Alloc >
priority_queue( priority_queue&& other, const Alloc& alloc );
(10) (desde C++11)
template< class InputIt >

priority_queue( InputIt first, InputIt last,

                const Compare& compare, const Container& cont );
(11) (desde C++11)
template< class InputIt >

priority_queue(InputIt first, InputIt last,

               const Compare& compare = Compare(), Container&& cont = Container());
(12) (desde C++11)
Constructos de nuevo contenedor subyacente del adaptador del recipiente de una variedad de fuentes de datos .
Original:
Constructs new underlying container of the container adaptor from a variety of data sources.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Copia-construye el c contenedor subyacente con el contenido de cont. Copia-construye el comp funtor comparación con el contenido de compare. Llamadas std::make_heap(c.begin(), c.end(), comp).
Original:
{{{2}}}
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Esta es también la (hasta C++11) constructor predeterminado|Copy-constructs the underlying container c with the contents of cont. Copy-constructs the comparison functor comp with the contents of compare. Calls std::make_heap(c.begin(), c.end(), comp).}} This is also the default constructor (hasta C++11)}}
2)
Mover-construye el contenedor subyacente c con std::move(cont). Mover-construye el funtor comparación con comp std::move(compare). Llamadas std::make_heap(c.begin(), c.end(), comp). Este es también el (desde C++11) constructor predeterminado
Original:
Move-constructs the underlying container c with std::move(cont). Move-constructs the comparison functor comp with std::move(compare). Calls std::make_heap(c.begin(), c.end(), comp). This is also the default constructor (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.
3)
Copiar constructor. El adaptador está construido de copia con el contenido de other.c. El funtor comparación se construye con std::move(other.comp). (implícitamente declarado)
Original:
Copy constructor. The adaptor is copy-constructed with the contents of other.c. The comparison functor is constructed with std::move(other.comp). (implícitamente declarado)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Mueva constructor. El adaptador está construido con funtor comparación std::move(other.c).The se construye con std::move(other.comp). (implícitamente declarado)
Original:
Move constructor. The adaptor is constructed with std::move(other.c).The comparison functor is constructed with std::move(other.comp). (implícitamente declarado)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5-10)
Los constructores siguientes se definen solamente si std::uses_allocator<container_type, Alloc>::value == true, es decir, si el contenedor es un contenedor subyacente asignador-conscientes (verdadero para todos los contenedores de la biblioteca estándar) .
Original:
The following constructors are only defined if std::uses_allocator<container_type, Alloc>::value == true, that is, if the underlying container is an allocator-aware container (true for all standard library containers).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
Construye el contenedor subyacente utilizando alloc como asignador. Efectivamente llama c(alloc). comp is value-initialized.
Original:
Constructs the underlying container using alloc as allocator. Effectively calls c(alloc). comp is value-initialized.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
Construye el contenedor subyacente utilizando alloc como asignador. Efectivamente llama c(alloc). Copy-construcciones comp de compare .
Original:
Constructs the underlying container using alloc as allocator. Effectively calls c(alloc). Copy-constructs comp from compare.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
Construye el contenedor subyacente con el contenido de cont y utilizando alloc como asignador. Efectivamente llama c(cont, alloc). Copy-construcciones comp de compare .
Original:
Constructs the underlying container with the contents of cont and using alloc as allocator. Effectively calls c(cont, alloc). Copy-constructs comp from compare.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
Construye el contenedor subyacente con el contenido de cont utilizando la semántica de movimiento mientras que la utilización alloc como asignador. Efectivamente llama c(std::move(cont), alloc). Copy-construcciones comp de compare .
Original:
Constructs the underlying container with the contents of cont using move semantics while utilising alloc as allocator. Effectively calls c(std::move(cont), alloc). Copy-constructs comp from compare.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
Construye el adaptador con el contenido de other.c y utilizando alloc como asignador. Efectivamente llama c(athor.c, alloc). Copy-construcciones comp de other.comp .
Original:
Constructs the adaptor with the contents of other.c and using alloc as allocator. Effectively calls c(athor.c, alloc). Copy-constructs comp from other.comp.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
10)
Construye el adaptador con el contenido de other utilizando la semántica de movimiento mientras que la utilización alloc como asignador. Efectivamente llama c(std::move(other.c), alloc). Mover-construcciones comp de other.comp .
Original:
Constructs the adaptor with the contents of other using move semantics while utilising alloc as allocator. Effectively calls c(std::move(other.c), alloc). Move-constructs comp from other.comp.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
11)
Copy-construcciones c de cont y comp de compare. Entonces llama a c.insert(c.end(), first, last);, y luego llama std::make_heap(c.begin(), c.end(), comp); .
Original:
Copy-constructs c from cont and comp from compare. Then calls c.insert(c.end(), first, last);, and then calls std::make_heap(c.begin(), c.end(), comp);.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
12)
MUDANZA construcciones c de std::move(cont) y comp de std::move(compare). Entonces llama a c.insert(c.end(), first, last);, y luego llama std::make_heap(c.begin(), c.end(), comp); .
Original:
Move-constructs c from std::move(cont) and comp from std::move(compare). Then calls c.insert(c.end(), first, last);, and then calls std::make_heap(c.begin(), c.end(), comp);.
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

alloc -
asignador de usar para todas las asignaciones de memoria del contenedor subyacente
Original:
allocator to use for all memory allocations of the underlying container
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
other -
otro adaptador del recipiente para ser utilizado como fuente para inicializar el contenedor subyacente
Original:
another container adaptor to be used as source to initialize the underlying container
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cont -
contenedor para ser utilizado como fuente para inicializar el contenedor subyacente
Original:
container to be used as source to initialize the underlying container
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
compare -
el objeto función de comparación para inicializar el funtor comparación subyacente
Original:
the comparison function object to initialize the underlying comparison functor
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
first, last -
serie de elementos a inicializar con
Original:
range of elements to initialize with
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Type requirements
-
Alloc must meet the requirements of Allocator.
-
Container must meet the requirements of Container. The constructors (5-10) are only defined if Container meets the requirements of AllocatorAwareContainer
-
InputIt must meet the requirements of InputIterator.

[editar] Complejidad

1, 3, 5, 6, 8: lineal en cont o other
Original:
1, 3, 5, 6, 8: linear in cont or other
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2, 4, 7, 9: constante
Original:
2, 4, 7, 9: constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Ejemplo

#include <queue>
#include <deque>
#include <iostream>
 
int main()
{
    std::priority_queue<int> c1;
    c1.push(5);
    std::cout << c1.size() << '\n';
 
    std::priority_queue<int> c2(c1);
    std::cout << c2.size() << '\n';
 
    std::deque<int> deq {3, 1, 4, 1, 5};
    std::priority_queue<int> c3(std::less<int>(), deq);
    std::cout << c3.size() << '\n';
}

Output:

1
1
5

[editar] Ver también

asigna valores al adaptador de recipiente
Original:
assigns values to the container adaptor
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]