Last active
October 8, 2020 12:05
-
-
Save ampulhetadosaber/b4d3207b3bbed3cf76b1accb59890607 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
priority_queue<int> fila; | |
if(!fila.empty()) // Aqui a fila está vazia, já que nada foi inserido ainda | |
{ | |
cout << "Não está vazia\n"; | |
} | |
// Note que o código não irá entrar na checagem anterior | |
fila.push(3); // A partir deste momento a fila não está mais vazia | |
// Então, !fila.empty() retornará Verdadeiro | |
if(fila.empty()) // Como a fila não está vazia o código entrar nessa checagem | |
{ | |
cout << "Não está vazia\n"; | |
} | |
// Logo, o código so irá imprimir "Não está vazia" uma unica vez. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment