I need all 4 items be equal as per below, to make condition true
it is actually true when any part of below is equal. How can I ammend the code?
if (attempt[0][0] == clean[i][0] && attempt[0][1] == clean[i][1] && attempt[0][2] == clean[i][2] && attempt[0][3] == clean[i][3])
Not as easily as using a std::set container, unique values is a key feature of std::set.
I'd personally find trying to use if/else statements to avoid duplication a lot more complicated than using a std::set (or maybe a std::map). The more elements you deal with the more complicated and prone-to-be-wrong your if/else logic will be.
Oh, I'm still looking for somethings basic, close to C solution, which makes me understand the code better...
Basically, i just need to find proper combination of & and |
if its just 4, wasting time for simple code is fine. \
1) sort it. (C has a sort() function)
2) copy it discarding duplicates into final result. (this is a simple loop). this could also just be a running bool that turns false if you found a duplicate.
yea its inefficient, but it will take a large # of the above to begin to notice that, millions (possibly, 10s of millions) of groups of 4 on a modern desktop.
the statement you show looks fine. it should not be true if any of the equalities is false.
however you can do a memcmp to clean it up if you want a C like answer. this will work because you are comparing across the dimension that is a block of bytes, (assuming that the types being compared can be used with memcmp)
Oh! I finally found slight mistake on function entry, but statement from first message indeed was true..
Having one duplicate to 2000 rows, if will not handle myself will post it here soon :)
Thank you, guys!