Method to Specify Uniqueness of Objects in an STL set?

A

Andy Yee

I know by using the TRAITS argument in declaring a set, you can tell
C++ how to order your objects. Can I also use TRAITS to tell C++
how an object is unique?

------------------------------------------------------------------------
Andy Yee E-Mail: ayee AT mn dot rr dot com
President Home Page: http://home.mn.rr.com/andyyee
New Directions Engineering, Inc.

Godwin's Law: As a USENET thread grows, the probability of a reference
to Hitler or Nazis approaches 1.00.
Corollary: When such a reference is made, it is generally
recognized that the poster has LOST the argument.
 
K

Kai-Uwe Bux

Andy said:
I know by using the TRAITS argument in declaring a set, you can tell
C++ how to order your objects. Can I also use TRAITS to tell C++
how an object is unique?

No, that is implied:

X and y are considered equal by std::set<> if and only if
neither x is less than y nor y is less than x.


Best

Kai-Uwe Bux
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top