I am trying to use an unordered_set to keep track of the uniqueness of some char* elements but in this scope the unordered_set modifies and elements even dissapear from it for no reason. I am displaying the elements at the beginning and before modifying it and it does display different elements and I cant get why.
for (unordered_set <char*> ::iterator it = unique_states.begin(); it != unique_states.end(); it++)
cout << *it << " ";
cout << endl;
set <int> state;
for (int i = 0; i < strlen(states_names[it_states]); i++)
{
int index = states_names[it_states][i] - '0';
for (set <int> ::iterator it = concatenations[index][j].begin(); it != concatenations[index][j].end(); it++)
state.insert(*it);
}
strcpy_s(temp, "");
for (set <int> ::iterator it = state.begin(); it != state.end(); it++)
{
char aux[2];
aux[0] = *it + '0';
aux[1] = '\0';
strcat_s(temp, aux);
}
int position = 0;
for (unordered_set <char*> ::iterator it = unique_states.begin(); it != unique_states.end(); it++)
cout << *it << " ";
cout << endl;
for (unordered_set <char*> ::iterator it = unique_states.begin(); it != unique_states.end(); it++)
{
cout << *it << " ";
/*if (strcmp(*it, temp) == 0)
break;*/
position++;
}
if (unique_states.count(temp) == 0)
position = it_states + 1;
cout << "Position : " << position << endl;
dfa_transitions[it_states].push_back(make_pair(j + 'a', position));
unique_states.insert(temp);