Click here to Skip to main content
15,905,913 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can handle buttons of Preview window? Pin
pallaka30-Dec-08 1:16
pallaka30-Dec-08 1:16 
GeneralRe: How can handle buttons of Preview window? Pin
Le@rner30-Dec-08 1:26
Le@rner30-Dec-08 1:26 
QuestionRemovable hard disk Pin
MsmVc29-Dec-08 20:55
MsmVc29-Dec-08 20:55 
QuestionHow to create child window in SDI application? Pin
Abhijit D. Babar29-Dec-08 20:24
Abhijit D. Babar29-Dec-08 20:24 
Questionhow to convert binary values into decimal by getting these values from dialog box? Pin
puppya29-Dec-08 20:14
puppya29-Dec-08 20:14 
AnswerRe: how to convert binary values into decimal by getting these values from dialog box? Pin
enhzflep29-Dec-08 20:48
enhzflep29-Dec-08 20:48 
GeneralRe: how to convert binary values into decimal by getting these values from dialog box? Pin
CPallini29-Dec-08 21:04
mveCPallini29-Dec-08 21:04 
Questionstd::map or stdex:hash_map Pin
Swinefeaster29-Dec-08 18:13
Swinefeaster29-Dec-08 18:13 
hi there,

i'm trying to set up a hash map such as:

class ObserversByMessageMap :
  public stdext::hash_map<messagekey,>
{};


and i've got MessageKey defined with these operators:

bool operator==(const MessageKey& other)const;
bool operator!=(const MessageKey& other)const;
bool operator<(const MessageKey& other)const;
bool operator>(const MessageKey& other)const;

// Used for hashing.
operator size_t(void)const;


something doesn't work quite right however. i'm trying to do something like:

MessageObserverSet& observers = (*m_observersByMessageMap)[key];
observers.insert(observer);


but it appears that the map (either hash or map) seems to collide with a *different* key than what i expect, and therefore adds the observer to the wrong pre-existing key.

i figured the operator==() is supposed to prevent that from happening, but it aint being called. instead the size_t hash is called and also the < operator, which i've defined as:

bool 
MessageKey::operator<(const MessageKey& other)const
{
  bool lessThan = false;

  if(m_messageId <= other.m_messageId)
  {
    if(m_objectId < other.m_objectId)
    {
      lessThan = true;
    }
  }

  return lessThan;
}


since m_objectId is a nested object.

any ideas? in mfc this kind of stuff worked no problem...

Frown | :(
QuestionLinking to another project [SOLVED] Pin
Christian Flutcher29-Dec-08 17:17
Christian Flutcher29-Dec-08 17:17 
AnswerRe: Linking to another project [SOLVED] Pin
Cedric Moonen29-Dec-08 21:40
Cedric Moonen29-Dec-08 21:40 
GeneralRe: Linking to another project [SOLVED] Pin
Christian Flutcher30-Dec-08 1:12
Christian Flutcher30-Dec-08 1:12 
GeneralRe: Linking to another project [SOLVED] Pin
Cedric Moonen30-Dec-08 22:15
Cedric Moonen30-Dec-08 22:15 
QuestionNeed help with writing an audio stream in avi Pin
monoceres29-Dec-08 14:41
monoceres29-Dec-08 14:41 
QuestioncapCreateCaptureWindow - source code wanted Pin
Vaclav_29-Dec-08 8:21
Vaclav_29-Dec-08 8:21 
AnswerRe: capCreateCaptureWindow - source code wanted Pin
Randor 29-Dec-08 8:52
professional Randor 29-Dec-08 8:52 
GeneralRe: capCreateCaptureWindow - source code wanted Pin
Vaclav_30-Dec-08 7:09
Vaclav_30-Dec-08 7:09 
QuestionHow to find an Access violation error(involving CStringT) in 3rd Party program Pin
Larry Mills Sr29-Dec-08 6:37
Larry Mills Sr29-Dec-08 6:37 
GeneralRe: How to find an Access violation error(involving CStringT) in 3rd Party program Pin
CPallini29-Dec-08 7:56
mveCPallini29-Dec-08 7:56 
GeneralRe: How to find an Access violation error(involving CStringT) in 3rd Party program Pin
Randor 29-Dec-08 9:02
professional Randor 29-Dec-08 9:02 
GeneralRe: How to find an Access violation error(involving CStringT) in 3rd Party program Pin
Larry Mills Sr29-Dec-08 11:35
Larry Mills Sr29-Dec-08 11:35 
QuestionRandom seeding in C++ different to Java? Pin
c#_keithy29-Dec-08 6:16
c#_keithy29-Dec-08 6:16 
GeneralRe: Random seeding in C++ different to Java? Pin
Luc Pattyn29-Dec-08 6:26
sitebuilderLuc Pattyn29-Dec-08 6:26 
QuestionRe: Random seeding in C++ different to Java? Pin
CPallini29-Dec-08 7:50
mveCPallini29-Dec-08 7:50 
AnswerRe: Random seeding in C++ different to Java? Pin
BobInNJ29-Dec-08 9:44
BobInNJ29-Dec-08 9:44 
GeneralRe: Random seeding in C++ different to Java? Pin
CPallini29-Dec-08 10:07
mveCPallini29-Dec-08 10:07 

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.