Click here to Skip to main content
15,900,384 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Linker error when adding Ole to my application, what am I missing? Pin
Randor 6-Jan-23 10:40
professional Randor 6-Jan-23 10:40 
Questionhow to interact with access control and open the door from My c++ desktop application Pin
Zouaoui Billel31-Dec-22 4:58
Zouaoui Billel31-Dec-22 4:58 
AnswerRe: how to interact with access control and open the door from My c++ desktop application Pin
Richard MacCutchan31-Dec-22 5:11
mveRichard MacCutchan31-Dec-22 5:11 
QuestionMessage Closed Pin
27-Dec-22 9:31
Member 1496877127-Dec-22 9:31 
AnswerRe: How to link C code to which Bluetooth library ? ( Linux) Pin
k505427-Dec-22 10:30
mvek505427-Dec-22 10:30 
AnswerRe: How to link C code to which Bluetooth library ? ( Linux) Pin
Richard MacCutchan27-Dec-22 22:03
mveRichard MacCutchan27-Dec-22 22:03 
QuestionInsert a Container App Pin
Glenn Meadows 202227-Dec-22 5:07
Glenn Meadows 202227-Dec-22 5:07 
AnswerRe: Insert a Container App Pin
Richard MacCutchan27-Dec-22 22:06
mveRichard MacCutchan27-Dec-22 22:06 
SuggestionRe: Insert a Container App Pin
David Crow28-Dec-22 4:49
David Crow28-Dec-22 4:49 
QuestionHaving trouble with a function in C Pin
BuilderboiYT26-Dec-22 15:38
BuilderboiYT26-Dec-22 15:38 
AnswerRe: Having trouble with a function in C Pin
Victor Nijegorodov26-Dec-22 20:12
Victor Nijegorodov26-Dec-22 20:12 
AnswerRe: Having trouble with a function in C Pin
Richard MacCutchan26-Dec-22 22:10
mveRichard MacCutchan26-Dec-22 22:10 
AnswerRe: Having trouble with a function in C Pin
Mircea Neacsu26-Dec-22 22:34
Mircea Neacsu26-Dec-22 22:34 
GeneralRe: Having trouble with a function in C Pin
Richard MacCutchan26-Dec-22 23:39
mveRichard MacCutchan26-Dec-22 23:39 
QuestionInvalid comparator for STL map Pin
ForNow25-Dec-22 18:08
ForNow25-Dec-22 18:08 
AnswerRe: Invalid comparator for STL map Pin
Daniel Pfeffer25-Dec-22 19:36
professionalDaniel Pfeffer25-Dec-22 19:36 
GeneralRe: Invalid comparator for STL map Pin
ForNow25-Dec-22 21:33
ForNow25-Dec-22 21:33 
GeneralRe: Invalid comparator for STL map Pin
ForNow26-Dec-22 5:14
ForNow26-Dec-22 5:14 
GeneralRe: Invalid comparator for STL map Pin
Graham Breach26-Dec-22 6:15
Graham Breach26-Dec-22 6:15 
JokeRe: Invalid comparator for STL map Pin
ForNow26-Dec-22 6:51
ForNow26-Dec-22 6:51 
GeneralRe: Invalid comparator for STL map Pin
ForNow26-Dec-22 7:39
ForNow26-Dec-22 7:39 
GeneralRe: Invalid comparator for STL map solution Pin
ForNow26-Dec-22 8:31
ForNow26-Dec-22 8:31 
GeneralRe: Invalid comparator for STL map solution Pin
k505426-Dec-22 15:49
mvek505426-Dec-22 15:49 
GeneralRe: Invalid comparator for STL map solution Pin
ForNow26-Dec-22 21:06
ForNow26-Dec-22 21:06 
GeneralRe: Invalid comparator for STL map solution Pin
Graham Breach26-Dec-22 21:42
Graham Breach26-Dec-22 21:42 
I think you're making it too complicated:

C++
struct ESDID
{
  char c[4];

  bool operator<(const ESDID& other) const
  {
    return c[0] < other.c[0] && c[1] < other.c[1] &&
      c[2] < other.c[2] && c[3] < other.c[3];
  }
}

struct usingrange
{
  ESDID esdid;
  int start;
  int end;

  bool operator<(const usingrange& other) const
  {
    return esdid < other.esdid && start < other.start &&
      end < other.end;
  }
}


I've used && and < because you do not want operator<() to return true for two different objects when you swap them around.

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.