Click here to Skip to main content
16,006,493 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: process crash on dual processor Winnt4 server Pin
Tim Smith12-Apr-02 7:56
Tim Smith12-Apr-02 7:56 
GeneralRe: process crash on dual processor Winnt4 server Pin
Jim Crafton12-Apr-02 8:03
Jim Crafton12-Apr-02 8:03 
GeneralRe: process crash on dual processor Winnt4 server Pin
Tim Smith12-Apr-02 8:06
Tim Smith12-Apr-02 8:06 
GeneralRe: process crash on dual processor Winnt4 server Pin
James R. Twine12-Apr-02 9:26
James R. Twine12-Apr-02 9:26 
GeneralRe: process crash on dual processor Winnt4 server Pin
Jim Crafton12-Apr-02 11:01
Jim Crafton12-Apr-02 11:01 
GeneralRe: process crash on dual processor Winnt4 server Pin
James R. Twine12-Apr-02 20:38
James R. Twine12-Apr-02 20:38 
GeneralRe: process crash on dual processor Winnt4 server Pin
Vivek Rajan12-Apr-02 21:35
Vivek Rajan12-Apr-02 21:35 
Generalmultimap problem Pin
Alexandru Savescu12-Apr-02 6:10
Alexandru Savescu12-Apr-02 6:10 
Hello,
I am using a STL multimap object to store keys and values.
The key are of type CPosition and values are of type CBirds*

class CPosition consists of two integers X and Y
class CPosition
{
public:
int X;
int Y;
};

To sort the keys I used something like:

struct lesscpos
{
bool operator () (const CPosition& Pos1, const CPosition& Pos2) const
{
if (Pos1.X < Pos2.X)
return true;
else if (Pos1.X > Pos2.Y)
return false;
else if (Pos1.Y < Pos2.Y)
return true;
else
return false;
}
};

I declare the multimap object like this:

multimap <CPostion, CBirds*, lesscpos> MyMap;

My program complies fine. The problem is when I use the count member function to determine how many values share the same key. It seems to me it is going into an infinite loop.

CPosition pos (i, j);
int x = MyMap.count (pos);

It hangs when it finds more than one value with the same key in the following function:

template<class _BidIt,
class _Diff> inline
void _Distance2(_BidIt _First, _BidIt _Last, _Diff& _Off,
bidirectional_iterator_tag)
{ // add to _Off distance between bidirectional iterators (redundant)
for (; _First != _Last; ++_First)
++_Off;
}

Can anyone help me with this one?
Thanks a lot

Best regards,
Alexandru Savescu
GeneralRe: multimap problem Pin
Jim Crafton12-Apr-02 6:39
Jim Crafton12-Apr-02 6:39 
GeneralRe: multimap problem Pin
Alexandru Savescu12-Apr-02 13:16
Alexandru Savescu12-Apr-02 13:16 
GeneralI would like to know your opinion Pin
Le centriste12-Apr-02 5:41
Le centriste12-Apr-02 5:41 
Generaldird(r)iver function Pin
Kuniva12-Apr-02 5:38
Kuniva12-Apr-02 5:38 
GeneralRe: dird(r)iver function Pin
Mike Nordell13-Apr-02 21:27
Mike Nordell13-Apr-02 21:27 
GeneralSetEvent for thread Pin
meirav12-Apr-02 5:33
meirav12-Apr-02 5:33 
GeneralRe: SetEvent for thread Pin
Tim Smith12-Apr-02 8:01
Tim Smith12-Apr-02 8:01 
GeneralRe: SetEvent for thread Pin
meirav13-Apr-02 2:50
meirav13-Apr-02 2:50 
QuestionON_WM_ERASEBKGND() never gets called? Pin
dazinith12-Apr-02 5:18
dazinith12-Apr-02 5:18 
AnswerRe: ON_WM_ERASEBKGND() never gets called? Pin
lucy12-Apr-02 5:23
lucy12-Apr-02 5:23 
GeneralRe: ON_WM_ERASEBKGND() never gets called? Pin
dazinith12-Apr-02 5:52
dazinith12-Apr-02 5:52 
GeneralRe: ON_WM_ERASEBKGND() never gets called? Pin
lucy12-Apr-02 6:41
lucy12-Apr-02 6:41 
AnswerRe: ON_WM_ERASEBKGND() never gets called? Pin
Shog912-Apr-02 5:58
sitebuilderShog912-Apr-02 5:58 
GeneralRe: ON_WM_ERASEBKGND() never gets called? Pin
dazinith12-Apr-02 5:57
dazinith12-Apr-02 5:57 
QuestionTabs and List Control Box?? Pin
Aoife12-Apr-02 4:54
Aoife12-Apr-02 4:54 
AnswerRe: Tabs and List Control Box?? Pin
wangyiming12-Apr-02 18:10
wangyiming12-Apr-02 18:10 
GeneralAn interesing problem with CDialogBar Pin
User 988512-Apr-02 4:42
User 988512-Apr-02 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.