473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Comparing 2 structs

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)

Sep 6 '06 #1
1 1922
Jing Yong wrote:
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 &) { ... }
}
}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.
>
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.
Sep 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paminu | last post by:
Why make an array of pointers to structs, when it is possible to just make an array of structs? I have this struct: struct test { int a; int b;
5
by: Bob Gregory | last post by:
Hi all, I'm utter C# newbie, do be gentle. VS2005 Express refuses point blank to install on my box, so I'm stuck with C# 1.0 unless someone can point me to a C#2.0 compiler elsewhere. I have...
5
by: ma740988 | last post by:
There's a need for me to move around at specified offsets within memory. As as a result - long story short - unsigned char* is the type of choice. At issue: Consider the case ( test code ) where...
12
by: barcaroller | last post by:
Is it legal to compare the contents of two multi-field variables (of the same struct) using "==" and "!="? struct { int a; int b; } x,y; ...
19
by: Ole Nielsby | last post by:
How does the GetHashCode() of an array object behave? Does it combine the GetHashCode() of its elements, or does it create a sync block for the object? I want to use readonly arrays as...
61
by: Marty | last post by:
I am new to C# and to structs so this could be easy or just not possible. I have a struct defined called Branch If I use Branch myBranch = new Branch(i); // everything works If I use Branch...
20
by: subramanian100in | last post by:
Suppose there are five DISTINCT types TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, of data. Consider the structures: struct struct_one { TYPE1 data1; TYPE2 data2; TYPE3 data3;
2
by: Zytan | last post by:
I wanted to do something simple like checking my own Color variable against Color.Black, and == returned false, even though their RGB values were all 0! Of course, there's the A (alpha) value, but...
29
by: Dom | last post by:
I'm really confused by the difference between a Struct and a Class? Sometimes, I want just a group of fields to go together. A Class without methods seems wrong, in that it carries too much...
17
by: junky_fellow | last post by:
Guys, Is it a good way to compare two structures for equality by using "memcmp" ? If not, what could be the problems associated with this ? And what is the correct method of doing this ? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.