공부/MFC_자주쓸거
[MFC] Queue 초기화
청린수아
2023. 3. 22. 14:43
void JobQueue ::clearJobs() { // I want to avoid pop in a loop while (!m_Queue.empty()) { m_Queue.pop(); } } |
int main() { queue <int> q1; // stuff q1 = queue<int>(); } |
#include <algorithm> void clear( std::queue<int> &q ) { std::queue<int> empty; std::swap( q, empty ); } |
출처 : https://stackoverflow.com/questions/709146/how-do-i-clear-the-stdqueue-efficiently