Sets relations

V

Victor Nazarov

Sorry for a dumb question, but it's hard to find an answer.
How can I check in C++ if one set supersedes another? operator < ?
Actually I want to check if two sets are not equal and none of them
supersedes the other.
 
T

Thomas Matthews

Victor said:
Sorry for a dumb question, but it's hard to find an answer.
How can I check in C++ if one set supersedes another? operator < ?
Actually I want to check if two sets are not equal and none of them
supersedes the other.

I would think that you would need to do a "for each" on
the set using a "supercedes" function. So how are you
defining "supercede"?


--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 
V

Victor Bazarov

Thomas said:
I would think that you would need to do a "for each" on
the set using a "supercedes" function. So how are you
defining "supercede"?

I believe the OP by "supercede" means the one is a superset of
the other. The only verification I can think of is that the
one includes the other. IOW

std::set<sometype> A, B;
... // fill A and B

if (std::includes(B.begin(), B.end(), A.begin(), A.end()))
std::cout << "B is a superset of A";

Victor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top