Velocity Reviews > C++ > Sets relations

# Sets relations

Victor Nazarov
Guest
Posts: n/a

 07-26-2004
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.

--
vir

Thomas Matthews
Guest
Posts: n/a

 07-26-2004
Victor Nazarov wrote:

> 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.
>
> --
> vir

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

Victor Bazarov
Guest
Posts: n/a

 07-26-2004
Thomas Matthews wrote:
> Victor Nazarov wrote:
>
>> 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.
>>
>> --
>> vir

>
>
> 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