| | |
unordered pair?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2008
Posts: 634
Reputation:
Solved Threads: 46
Is there a built in type to store UNordered pairs?
ie. I want these
to be equal. Do I have to make a wrapper and override == ?
Thanks,
Dave
ie. I want these
C++ Syntax (Toggle Plain Text)
pair<double, double> a(4.0, 5.0); pair<double, double> a(5.0, 4.0);
to be equal. Do I have to make a wrapper and override == ?
Thanks,
Dave
•
•
Join Date: Apr 2008
Posts: 185
Reputation:
Solved Threads: 10
I don't believe there is a built in type to do such a thing (I've never come across anything like that anyway), but you should be able to write your own function to make sure they are equal anyway.
I think that would handle each case, but you'd have to test it to make sure.
c++ Syntax (Toggle Plain Text)
bool equal ( /* pair p1 and p2 */) { /*check if p1 first and p2 first are equal if so, check if p1 second and p2 second are equal if so, return true if 1st check not, check if p1 first and p2 second are equal if so, check if p1 second and p2 first are equal if so, return true return false otherwise */ }
I think that would handle each case, but you'd have to test it to make sure.
![]() |
Other Threads in the C++ Forum
- Previous Thread: How can i loop char?
- Next Thread: Gaussian Elimination in C++
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap bmp c++ c/c++ calculator char class classes code compile compiler console conversion count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelper iamthwee ifstream input int integer java lib library linkedlist linker linux loop looping loops map math matrix memory newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive return string strings struct studio temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





