Connecting Tech Pros Worldwide Help | Site Map

Comparing 2 structs

  #1  
Old September 6th, 2006, 01:05 AM
Jing Yong
Guest
 
Posts: n/a
I have a classtruct of over 50 members


class A {
public:
type -- 50 members
A(){initialize all members}
friend operator==(A&,A&){//my operator goes here
}
}B[2];

In the operator I have to compare each member of A , and this looks not
good
Any other ways for the comparison of B[0] and B[1] please?

Also, in that case how are the values evaluated by the VC6 compiler (I
am using)?
Regards,
Yong jin (~.~E)

  #2  
Old September 6th, 2006, 04:45 PM
Davlet Panech
Guest
 
Posts: n/a

re: Comparing 2 structs


Jing Yong wrote:
Quote:
I have a classtruct of over 50 members
>
>
class A {
public:
type -- 50 members
A(){initialize all members}
friend operator==(A&,A&){//my operator goes here
friend bool operator (const A &, const A &) { ... }
Quote:
}
}B[2];
>
In the operator I have to compare each member of A , and this looks not
good
Any other ways for the comparison of B[0] and B[1] please?
No there's no other way.
Quote:
>
Also, in that case how are the values evaluated by the VC6 compiler (I
am using)?
What values? What do you mean by "evaluated"? You mean in the comparison
operator? They are "evaluated" in the order you evaluate them. It's not
clear what you are asking, give us an example.

D.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing structs: System.Drawing.Color Zytan answers 2 April 11th, 2007 07:15 PM
Comparing structs... barcaroller answers 12 March 29th, 2006 10:05 PM
Comparing structs and <null> Bob Gregory answers 5 November 16th, 2005 10:55 AM