Click here to Skip to main content
15,884,298 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionoverloaded = operator not being invoked Pin
ForNow22-Dec-22 14:36
ForNow22-Dec-22 14:36 
AnswerRe: overloaded = operator not being invoked Pin
Mircea Neacsu22-Dec-22 15:24
Mircea Neacsu22-Dec-22 15:24 
GeneralRe: overloaded = operator not being invoked Pin
ForNow22-Dec-22 15:28
ForNow22-Dec-22 15:28 
GeneralRe: overloaded = operator not being invoked Pin
Mircea Neacsu22-Dec-22 15:37
Mircea Neacsu22-Dec-22 15:37 
GeneralRe: overloaded = operator not being invoked Pin
ForNow22-Dec-22 16:00
ForNow22-Dec-22 16:00 
GeneralRe: overloaded = operator not being invoked Pin
Mircea Neacsu22-Dec-22 16:32
Mircea Neacsu22-Dec-22 16:32 
GeneralRe: overloaded = operator not being invoked Pin
ForNow22-Dec-22 16:41
ForNow22-Dec-22 16:41 
QuestionStill Struggling with map::insert and operator overload Pin
ForNow20-Dec-22 15:57
ForNow20-Dec-22 15:57 
Hi
I am still having problems with map::insert

Here is my data

C++
struct usingx
{
	unsigned char rectype;
#define using 0
#define pop 0x20
#define push 0x40
#define drop 0x80
	unsigned char usingflag
#define oridinaryusing 0
#define labeledusing 0x10
#define depedentusing 0x20
#define labeldependentusing 0x30
		;	ESDID locesdid;
	BYTE statement[4];
	BYTE location[4];
	BYTE usingvalue[4];
	BYTE laststatement[4];
	ESDID usingesdid;
	unsigned char registerx;
	BYTE displacement[2];
	BYTE reservedz;
	BYTE usingrange[4];
	BYTE reservedu[2];
	BYTE labeloffset[4];
	BYTE labelength[4];
	char* labelx;


};


Here is the key that I am using the start and end variable are big endian so I have to convert it and overloaded the = operator;

C++
struct usingrange
{
	ESDID esdid;
	int start;
	int end;
	int operator=(BYTE z[4]) { return _byteswap_ulong((int)z[4]); };

  bool operator<(const usingrange x) const {
	  if (esdid < x.esdid)  return esdid < x.esdid;
	  if (start < x.start) return start < x.start; if (end < x.end) return end < x.end;
  };


here is the code using the map::insert

C++
usingrange using_range{ usingpoint->usingesdid };
using_range.start = *usingpoint->statement;
using_range.end = *usingpoint->laststatement;

procpointer->usingptr->insert({ using_range,*usingpoint });
break;


I made breakpoints on the operator= code and thought when I stepped into it with the vs debugger it would trace it but it didnt

both start and end ended up zeros

dont know why ?
AnswerRe: Still Struggling with map::insert and operator overload Pin
Mircea Neacsu20-Dec-22 17:34
Mircea Neacsu20-Dec-22 17:34 
GeneralRe: Still Struggling with map::insert and operator overload Pin
ForNow21-Dec-22 1:51
ForNow21-Dec-22 1:51 
QuestionMessage Closed Pin
18-Dec-22 5:01
ForNow18-Dec-22 5:01 
AnswerRe: Question about return value of STD MAP::INSERT Pin
Mircea Neacsu18-Dec-22 6:55
Mircea Neacsu18-Dec-22 6:55 
GeneralRe: Question about return value of STD MAP::INSERT Pin
ForNow18-Dec-22 7:08
ForNow18-Dec-22 7:08 
GeneralRe: Question about return value of STD MAP::INSERT Pin
ForNow18-Dec-22 8:05
ForNow18-Dec-22 8:05 
AnswerRe: Question about return value of STD MAP::INSERT Pin
Mircea Neacsu18-Dec-22 8:14
Mircea Neacsu18-Dec-22 8:14 
GeneralRe: Question about return value of STD MAP::INSERT Pin
ForNow18-Dec-22 8:31
ForNow18-Dec-22 8:31 
Questionhow to typedef array of 4 char to be used in map template Pin
ForNow13-Dec-22 14:17
ForNow13-Dec-22 14:17 
AnswerRe: how to typedef array of 4 char to be used in map template Pin
CPallini13-Dec-22 21:05
mveCPallini13-Dec-22 21:05 
GeneralRe: how to typedef array of 4 char to be used in map template Pin
ForNow14-Dec-22 1:47
ForNow14-Dec-22 1:47 
GeneralRe: how to typedef array of 4 char to be used in map template Pin
CPallini14-Dec-22 2:17
mveCPallini14-Dec-22 2:17 
GeneralRe: how to typedef array of 4 char to be used in map template Pin
ForNow14-Dec-22 2:30
ForNow14-Dec-22 2:30 
GeneralRe: how to typedef array of 4 char to be used in map template still getting compile errors Pin
ForNow15-Dec-22 2:24
ForNow15-Dec-22 2:24 
GeneralRe: how to typedef array of 4 char to be used in map template still getting compile errors Pin
CPallini15-Dec-22 3:01
mveCPallini15-Dec-22 3:01 
GeneralRe: how to typedef array of 4 char to be used in map template still getting compile errors Pin
ForNow15-Dec-22 3:12
ForNow15-Dec-22 3:12 
GeneralRe: how to typedef array of 4 char to be used in map template still getting compile errors Pin
CPallini15-Dec-22 3:22
mveCPallini15-Dec-22 3:22 

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.