473,320 Members | 1,858 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,320 software developers and data experts.

comparing two hashes (maps)

i have two hashes (maps)

map <int, int> FAULTFREENETS;
map <int, int> FAULTNETS;

is there a way i can check if FAULTFREENETS = FAULTNETS with just one
statement instead of writing a for loop with iterators, etc. ?

(just trying to reduce code clutter)

Nov 22 '05 #1
6 2297
mahur...@gmail.com wrote:
i have two hashes (maps)

map <int, int> FAULTFREENETS;
map <int, int> FAULTNETS;

is there a way i can check if FAULTFREENETS = FAULTNETS with just one
Don't use all-caps for variable names. Reserve that for macros.
statement instead of writing a for loop with iterators, etc. ?

(just trying to reduce code clutter)


Lookup std::equal() from <algorithm> or roll-up your own function and
call it.
Jonathan

Nov 22 '05 #2
ma******@gmail.com wrote:
i have two hashes (maps)

map <int, int> FAULTFREENETS;
map <int, int> FAULTNETS;

is there a way i can check if FAULTFREENETS = FAULTNETS with just one
statement instead of writing a for loop with iterators, etc. ?

(just trying to reduce code clutter)


Of course, the obvious works

if (FAULTFREENETS == FAULTNETS)
{
cout << "they're equal\n";
}

john
Nov 22 '05 #3
John Harrison wrote:
ma******@gmail.com wrote:
i have two hashes (maps)

map <int, int> FAULTFREENETS;
map <int, int> FAULTNETS;

is there a way i can check if FAULTFREENETS = FAULTNETS with just one
statement instead of writing a for loop with iterators, etc. ?

(just trying to reduce code clutter)


Of course, the obvious works

if (FAULTFREENETS == FAULTNETS)
{
cout << "they're equal\n";
}


I just hate when this happens.
Jonathan

Nov 22 '05 #4
perfectamundo. "=" works like a charm.

Nov 22 '05 #5
ma******@gmail.com wrote:
i have two hashes (maps)

map <int, int> FAULTFREENETS;
map <int, int> FAULTNETS;


If this is std::map, then just use operator ==. But they are not hash maps.

--

Valentin Samko - http://www.valentinsamko.com
Nov 22 '05 #6
ma******@gmail.com wrote:
perfectamundo. "=" works like a charm.


That should be ==, not =.
Jonathan

Nov 22 '05 #7

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

Similar topics

11
by: Dan Stromberg | last post by:
We will soon have 3 copies, for testing purposes, of what should be about 4.5 terrabytes of data. Rather than cmp'ing twice, to verify data integrity, I was thinking we could speed up the...
1
by: ArunPrakash | last post by:
Hi, I have 2 tables and each has a text column. When i compared the 2 columns with the LIKE operator i found something strange. create table test1( var1 text ) create table test2( var1 text ) ...
2
by: Jeff Thies | last post by:
I need to check if two hashes are identical. My thoughts are something like this: function compareHash(hash1,hash2){ if(hash1.length != hash2.length){return false} for(var key in hash1){...
11
by: Peter | last post by:
Hi how can I compare two byte arrays in VB.NET Thank Peter
1
by: Iain | last post by:
Hi Hopefully I am missing something really simple with this question, but here goes. I have two Bitarrays that I would like to compare. At the moment, I am XORing one with the other and...
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...
2
by: kj7ny | last post by:
I am attempting to incrementally back up files using python. How can I compare a file on a hard drive to a file in a python created zip file to tell if the file has changed? Or should I be using...
7
by: danielle.m.manning | last post by:
Can someone help me figure out what is the best way to perform this task? I have to detect if there were any changes from one recordset to another. My recordset consists of a key (guid), and...
11
by: subodheee | last post by:
i have a problem in implementing script,i have to extract from below data op,offset,and i need to compare the if same offset,same op repeats in other process i need to make it as same,else no .please...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.