Какая причина ошибки "vector subscript out of range" в моём коде?
#include <iostream>
#include <string>
#include <windows.h>
#include <time.h>
#include <thread>
#include <conio.h>
#include <vector>
POINT xypos;
using namespace std;
//а это...оно
vector <string> name_combo_click;
vector <vector<int>> combo_click(0, vector <int>(6));
vector <int> click_lore;//история координат до 240 000 координат,нечетные - x,четные - y,как только число доходит до 240 000,то первые два элемента удаляются
void GetCursor_Pos()
{ //получает постоянно координаты мыши
while (true) {
Sleep(5);
GetCursorPos(&xypos);
click_lore.push_back(xypos.x);
click_lore.push_back(xypos.y);
if (size(click_lore) == 240000)
{
for (int i = 2;i > 0;i--)
{
click_lore.erase(click_lore.begin());
}
}
}
}
int main()
{
thread get_cursor_Pos(GetCursor_Pos);
get_cursor_Pos.detach();
while (true)
{
int x = 0;
cout << "xypos.x:" << click_lore[x];
x++;
cout << "xypos.y:" << click_lore[x] << endl;
x++;
if (size(click_lore) == 240000)
{
x = x - 2;
}
}
}