Hi, ALL,
Since I don't know how to remove SOLVED from the thread and this is actually kind of different issue I decided to make a new thread.
This is a continuation of this thread.
Thank you Paul for the code. It did compile and ran fine.
However when I tried to erase and then insert the element into std::set program crashed.
Here is the code:
The program is crashing on "(*it).second.insert()" call with the message "invalid operator<".
I also had to modify the operator() this way:
Anybody have an idea?
Thank you.
Since I don't know how to remove SOLVED from the thread and this is actually kind of different issue I decided to make a new thread.
This is a continuation of this thread.
Thank you Paul for the code. It did compile and ran fine.
However when I tried to erase and then insert the element into std::set program crashed.
Here is the code:
Code:
for( MapStringToPair::iterator it = m_score.begin(); it != m_score.end(); it++ )
{
std::string score = (*it).first;
bool found = false;
double value;
for( SDSetPair::iterator it1 = (*it).second.begin(); it1 != (*it).second.end() && !found; it1++ )
{
if( (*it1).first == owner )
{
value = (*it1).second;
found = true;
}
(*it).second.erase( SDPair( owner, value ) );
(*it).second.insert( std::make_pair( owner, value + player.GetAmountPaid() ) );
}
}
I also had to modify the operator() this way:
Code:
bool operator()(const SDPair &lhs, const SDPair &rhs) const
{
if( lhs.second < rhs.second )
return true;
else
return lhs.first < rhs.first;
}
Thank you.