我將如何找到一個向量元素從它的參數與emplace_back 試圖分離線程然後從向量中刪除它設置一個一個找到的矢量的元素。從它的參數
std::vector<std::thread> vTimerThreads;
void SetTimer(UINT ID, DWORD dwMilliseconds)
{
// timerThreadProc is my thread that handles my timers
vTimerThreads.emplace_back(timerThreadProc, ID, dwMilliseconds);
}
void DeleteTimer(UINT ID)
{
//Find thread by ID?
// thread.detach();
// then delete
}
SetTimer(TIMER1, 5000);
您尚未在任何地方存儲「ID」,至少可以從矢量訪問的任何位置。 – chris