Click here to Skip to main content
15,902,777 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Passing a vector of pointers Pin
Dave Bryant30-Sep-03 16:43
Dave Bryant30-Sep-03 16:43 
GeneralRe: Passing a vector of pointers Pin
mcoloney30-Sep-03 16:51
mcoloney30-Sep-03 16:51 
QuestionWhy do some API calls not work with my windows service? Pin
csurfer7930-Sep-03 15:49
csurfer7930-Sep-03 15:49 
AnswerRe: Why do some API calls not work with my windows service? Pin
Dave Bryant30-Sep-03 16:18
Dave Bryant30-Sep-03 16:18 
AnswerRe: Why do some API calls not work with my windows service? Pin
l a u r e n30-Sep-03 19:46
l a u r e n30-Sep-03 19:46 
QuestionGetting a window's class name? Pin
IGx8930-Sep-03 14:55
IGx8930-Sep-03 14:55 
AnswerRe: Getting a window's class name? Pin
Mike Dimmick1-Oct-03 2:20
Mike Dimmick1-Oct-03 2:20 
Generaloperator != for iterators Pin
mcoloney30-Sep-03 14:49
mcoloney30-Sep-03 14:49 
Friends,

I'm trying to create a function so I can print the conents of a STL list from main(). It looks like:

<br />
void TraverseAndDisplay(list< PhoneRecord>::iterator& itor, const list< PhoneRecord>& l) <br />
{ <br />
   while (itor != l.end()) <br />
   { <br />
     cout << *itor++ << " "; <br />
   } <br />
   cout << endl; <br />
} 


Unfortunately, because PhoneRecord is not a primitive data type (it's my own class), the default operator != won't work.

The exact error I'm getting is:
error C2679: binary '!=' : no operator defined which takes a right-hand operand of type 'class std::list<class PhoneRecord,class std::allocator<class PhoneRecord> >::const_iterator' (or there is no acceptable conversion)

Obviously I need to overload the != to work. I don't know how to overload the != operator to work for iterators in this case?

Thanks in advance for your help!
GeneralRe: operator != for iterators Pin
Dave Bryant30-Sep-03 14:52
Dave Bryant30-Sep-03 14:52 
GeneralRe: operator != for iterators Pin
mcoloney30-Sep-03 14:58
mcoloney30-Sep-03 14:58 
GeneralRe: operator != for iterators Pin
Dave Bryant30-Sep-03 15:02
Dave Bryant30-Sep-03 15:02 
GeneralRe: operator != for iterators Pin
mcoloney30-Sep-03 15:07
mcoloney30-Sep-03 15:07 
GeneralCode to show Sample Unicode Chars Pin
prpub130-Sep-03 14:29
sussprpub130-Sep-03 14:29 
GeneralThe for statement Pin
claytide30-Sep-03 11:50
claytide30-Sep-03 11:50 
GeneralRe: The for statement Pin
Christian Graus30-Sep-03 12:07
protectorChristian Graus30-Sep-03 12:07 
GeneralRe: The for statement Pin
Colin Angus Mackay30-Sep-03 12:36
Colin Angus Mackay30-Sep-03 12:36 
GeneralRe: The for statement Pin
Blake Coverett30-Sep-03 19:16
Blake Coverett30-Sep-03 19:16 
GeneralSimulating clicks.. Pin
Anonymous30-Sep-03 11:28
Anonymous30-Sep-03 11:28 
GeneralRe: Simulating clicks.. Pin
Ravi Bhavnani30-Sep-03 12:19
professionalRavi Bhavnani30-Sep-03 12:19 
GeneralRAPI Pin
Anthony988730-Sep-03 10:09
Anthony988730-Sep-03 10:09 
GeneralRe: RAPI Pin
Jonas Larsson30-Sep-03 23:29
Jonas Larsson30-Sep-03 23:29 
GeneralBitConverter Pin
Arbage30-Sep-03 9:36
Arbage30-Sep-03 9:36 
GeneralRe: BitConverter Pin
Joaquín M López Muñoz30-Sep-03 10:18
Joaquín M López Muñoz30-Sep-03 10:18 
GeneralScrollbar Pin
Anonymous30-Sep-03 8:41
Anonymous30-Sep-03 8:41 
GeneralRe: Scrollbar Pin
Maximilien30-Sep-03 9:22
Maximilien30-Sep-03 9: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.