std::stable_sort
De cppreference.com
<tbody>
</tbody>
| Definido en el archivo de encabezado <algorithm>
|
||
template< class RandomIt > void stable_sort( RandomIt first, RandomIt last ); |
(1) | |
template< class RandomIt, class Compare > void stable_sort( RandomIt first, RandomIt last, Compare comp ); |
(2) | |
Ordena los elementos de la
[first, last) rango en orden ascendente. El orden de los elementos iguales se garantiza que se conservan. La primera versión utiliza operator< para comparar los elementos, la segunda versión utiliza la función de comparación dado comp .Original:
Sorts the elements in the range
[first, last) in ascending order. The order of equal elements is guaranteed to be preserved. The first version uses operator< to compare the elements, the second version uses the given comparison function comp.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Parámetros
| first, last | - | la gama de elementos a ordenar
Original: the range of elements to sort The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| comp | - | objeto función de comparación (es decir, un objeto que satisface los requerimientos de Compare) que devuelve true si el primer argumento es menor que el segundo. La signatura de la función de comparación deberá ser equivalente a lo siguiente:
Mientras que la signatura no necesita ser |
| Requisitos de tipo | ||
-RandomIt debe reunir los requerimientos de ValueSwappable y RandomAccessIterator.
| ||
-The type of dereferenced RandomIt must meet the requirements of MoveAssignable and MoveConstructible.
| ||
Valor de retorno
(Ninguno)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Complejidad
O(N·log2(N)), donde las aplicaciones
N = std::distance(first, last) de cmp. Si la memoria adicional está disponible, la complejidad es O(N·log(N) .Original:
O(N·log2(N)), where
N = std::distance(first, last) applications of cmp. If additional memory is available, then the complexity is O(N·log(N).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Notas
Esta función intenta asignar una memoria intermedia temporal igual en tamaño a la secuencia a ser ordenados, normalmente llamando std::get_temporary_buffer. Si la asignación falla, el algoritmo menos eficiente es elegido .
Original:
This function attempts to allocate a temporary buffer equal in size to the sequence to be sorted, typically by calling std::get_temporary_buffer. If the allocation fails, the less efficient algorithm is chosen.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Ejemplo
| Esta sección está incompleta Razón: sin ejemplo |
